|
|
@@ -1,10 +1,8 @@
|
|
|
import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
|
|
|
import DictionariesBehavior from "../../../../core/behavior/dictionaries.behavior";
|
|
|
-import tickleBehavior, {
|
|
|
- getTickleContext,
|
|
|
-} from "../../../../core/behavior/tickle.behavior";
|
|
|
+import tickleBehavior from "../../../../core/behavior/tickle.behavior";
|
|
|
import { patientOfflineTreatmentAppointmentMethod } from "../../request";
|
|
|
-// module/order/pages/confirme-order/confirme-order.ts
|
|
|
+// module/order/pages/appointment/appointment.ts
|
|
|
Page({
|
|
|
behaviors: [PageContainerBehavior, DictionariesBehavior, tickleBehavior],
|
|
|
data: {
|
|
|
@@ -27,7 +25,7 @@ Page({
|
|
|
offlineId: "",
|
|
|
},
|
|
|
onLoad(options: any) {
|
|
|
- // 初始化日期列表(从今天开始5天),内部会调用 initTimeSlots
|
|
|
+ // 初始化日期列表(从今天开始5天)
|
|
|
this.initDateList();
|
|
|
if (options.goodsInfo) {
|
|
|
const goodsInfo = JSON.parse(options.goodsInfo);
|
|
|
@@ -194,9 +192,7 @@ Page({
|
|
|
}
|
|
|
console.log(this.data.selectedDate, "this.data.selectedDate", this.data.selectedTime, "this.data.selectedTime", this.data.offlineId, "this.data.offlineId")
|
|
|
|
|
|
- // const selectedDateItem = this.data.dateList.find(item => item.isSelected);
|
|
|
const appointmentTime = `${this.data.selectedDate} ${this.data.selectedTime}`;
|
|
|
- // console.log(selectedDateItem, "selectedDateItem")
|
|
|
console.log(appointmentTime, "appointmentTime");
|
|
|
console.log(this.data.offlineId, "this.data.offlineId");
|
|
|
this.setData({
|
|
|
@@ -206,18 +202,17 @@ Page({
|
|
|
},
|
|
|
});
|
|
|
try {
|
|
|
- const res = await patientOfflineTreatmentAppointmentMethod(this.data.offlineId, appointmentTime);
|
|
|
- console.log(res, "res========预约结果")
|
|
|
-
|
|
|
+ await patientOfflineTreatmentAppointmentMethod(this.data.offlineId, appointmentTime);
|
|
|
+ wx.showToast({
|
|
|
+ title: '预约成功',
|
|
|
+ icon: 'success',
|
|
|
+ });
|
|
|
setTimeout(() => {
|
|
|
- wx.showToast({
|
|
|
- title: '预约成功',
|
|
|
- icon: 'success',
|
|
|
+ wx.redirectTo({
|
|
|
+ url: `/module/order/pages/appointment-success/appointment-success?goodsInfo=${JSON.stringify(this.data.goodsInfo)}`,
|
|
|
});
|
|
|
}, 1000);
|
|
|
- wx.redirectTo({
|
|
|
- url: `/module/order/pages/appointment-success/appointment-success?goodsInfo=${JSON.stringify(this.data.goodsInfo)}`,
|
|
|
- });
|
|
|
+
|
|
|
} catch (error: any) {
|
|
|
wx.showToast({
|
|
|
title: error.errMsg || "预约失败",
|
|
|
@@ -225,32 +220,6 @@ Page({
|
|
|
});
|
|
|
console.log(error, "error")
|
|
|
}
|
|
|
- // 预约成功后跳转到成功页面,传递预约信息
|
|
|
- // const selectedDateItem = this.data.dateList.find(item => item.isSelected);
|
|
|
- // const serviceTime = selectedDateItem
|
|
|
- // ? `${selectedDateItem.dateStr} ${this.data.selectedTime || '09:00'}`
|
|
|
- // : '12月30日 09:00';
|
|
|
- // console.log('提交预约:', {
|
|
|
- // service: this.data.serviceInfo.name,
|
|
|
- // date: selectedDateItem?.label + ' ' + selectedDateItem?.dateStr,
|
|
|
- // time: this.data.selectedTime,
|
|
|
- // time:appointmentTime,
|
|
|
- // offlineId: this.data.offlineId,
|
|
|
- // });
|
|
|
-
|
|
|
- // // TODO: 调用预约接口
|
|
|
- // wx.showToast({
|
|
|
- // title: '预约成功',
|
|
|
- // icon: 'success',
|
|
|
- // });
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // setTimeout(() => {
|
|
|
- // wx.redirectTo({
|
|
|
- // url: `/module/order/pages/appointment-success/appointment-success?serviceName=${encodeURIComponent(this.data.serviceInfo.name)}&serviceTime=${encodeURIComponent(serviceTime)}&duration=${this.data.serviceInfo.duration}`,
|
|
|
- // });
|
|
|
- // }, 500);
|
|
|
},
|
|
|
|
|
|
// 打开日历弹窗
|