|
|
@@ -1,7 +1,7 @@
|
|
|
import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
|
|
|
import DictionariesBehavior from "../../../../core/behavior/dictionaries.behavior";
|
|
|
import tickleBehavior from "../../../../core/behavior/tickle.behavior";
|
|
|
-import { patientOfflineTreatmentAppointmentMethod } from "../../request";
|
|
|
+import { patientOfflineTreatmentAppointmentMethod ,updateAppointmentMethod} from "../../request";
|
|
|
// module/order/pages/appointment/appointment.ts
|
|
|
Page({
|
|
|
behaviors: [PageContainerBehavior, DictionariesBehavior, tickleBehavior],
|
|
|
@@ -28,15 +28,12 @@ Page({
|
|
|
originalAppointmentTime: "",
|
|
|
},
|
|
|
onLoad(options: any) {
|
|
|
- console.log(options, "options===");
|
|
|
const goodsInfoFromStorage = wx.getStorageSync('goodsInfo');
|
|
|
- console.log(goodsInfoFromStorage, "goodsInfo===from storage");
|
|
|
|
|
|
let parsedGoodsInfo: any = null;
|
|
|
if ( goodsInfoFromStorage) {
|
|
|
try {
|
|
|
parsedGoodsInfo = JSON.parse(goodsInfoFromStorage || '{}');
|
|
|
- console.log(parsedGoodsInfo, "parsedGoodsInfo===");
|
|
|
} catch (e) {
|
|
|
console.error("解析 goodsInfo 失败", e);
|
|
|
}
|
|
|
@@ -264,10 +261,8 @@ Page({
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- console.log(this.data.selectedDate, "this.data.selectedDate", this.data.selectedTime, "this.data.selectedTime", this.data.offlineId, "this.data.offlineId")
|
|
|
|
|
|
const appointmentTime = `${this.data.selectedDate} ${this.data.selectedTime}`;
|
|
|
- console.log(appointmentTime, "appointmentTime");
|
|
|
|
|
|
// 归一化原始预约时间为 "YYYY-MM-DD HH:mm" 用于对比
|
|
|
let normalizedOriginal = "";
|
|
|
@@ -288,7 +283,6 @@ Page({
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- console.log(this.data.offlineId, "this.data.offlineId");
|
|
|
this.setData({
|
|
|
goodsInfo: {
|
|
|
...this.data.goodsInfo,
|
|
|
@@ -296,14 +290,21 @@ Page({
|
|
|
},
|
|
|
});
|
|
|
try {
|
|
|
- await patientOfflineTreatmentAppointmentMethod(this.data.offlineId, appointmentTime);
|
|
|
+ if (this.data.isEditMode) {
|
|
|
+ await updateAppointmentMethod(this.data.offlineId, appointmentTime);
|
|
|
+ } else {
|
|
|
+ await patientOfflineTreatmentAppointmentMethod(
|
|
|
+ this.data.offlineId,
|
|
|
+ appointmentTime
|
|
|
+ );
|
|
|
+ }
|
|
|
wx.showToast({
|
|
|
title: '预约成功',
|
|
|
icon: 'success',
|
|
|
});
|
|
|
setTimeout(() => {
|
|
|
wx.redirectTo({
|
|
|
- url: `/module/order/pages/appointment-success/appointment-success?goodsInfo=${JSON.stringify(this.data.goodsInfo)}`,
|
|
|
+ url: `/module/order/pages/appointment-success/appointment-success?goodsInfo=${encodeURIComponent(JSON.stringify(this.data.goodsInfo))}`,
|
|
|
});
|
|
|
}, 1000);
|
|
|
|
|
|
@@ -312,13 +313,11 @@ Page({
|
|
|
title: error.errMsg || "预约失败",
|
|
|
icon: "none",
|
|
|
});
|
|
|
- console.log(error, "error")
|
|
|
}
|
|
|
},
|
|
|
|
|
|
// 打开日历弹窗
|
|
|
onOpenCalendar() {
|
|
|
- console.log('onOpenCalendar');
|
|
|
this.setData({ show: true });
|
|
|
},
|
|
|
// 关闭日历弹窗
|
|
|
@@ -333,7 +332,6 @@ Page({
|
|
|
// 确认选择日期
|
|
|
onConfirm(event: any) {
|
|
|
const selectedDate = event.detail;
|
|
|
- console.log('选择的日期:', selectedDate);
|
|
|
|
|
|
if (selectedDate) {
|
|
|
// 解析日期
|