From eb231d1c4026b23bf0f1fea078a0805e39782078 Mon Sep 17 00:00:00 2001
From: XiaoXinPro 14 IAH5R <568170040@qq.com>
Date: Mon, 26 Jun 2023 18:26:48 +0800
Subject: [PATCH] upload
---
package2/pages/appointment/appointment.js | 73 +++++++++++++++++----
package2/pages/appointment/appointment.ttml | 7 +-
pages/order/detail/index.js | 61 +++++++++++------
pages/order/detail/index.ttml | 3 +-
4 files changed, 108 insertions(+), 36 deletions(-)
diff --git a/package2/pages/appointment/appointment.js b/package2/pages/appointment/appointment.js
index 9a3ab24..bd13e06 100644
--- a/package2/pages/appointment/appointment.js
+++ b/package2/pages/appointment/appointment.js
@@ -9,6 +9,7 @@ Page({
appointmentText: "确认预约",
id: "",
orderId: "",
+ merOrderId: "",
startTime: '',
endTime: "",
mallTenantId: "",
@@ -17,6 +18,7 @@ Page({
pickedDate: "请选择日期",
pickedStartTime: "请选择",
pickedEndTime: "请选择",
+ reservationMerchantName: "",
describeStr: "",
mallList: [],
merchantId: "",
@@ -29,6 +31,13 @@ Page({
onLoad(options) {
console.log(options, 'options')
+ const mallTenantId = tt.getStorageSync('mallTenantId');
+ if (mallTenantId) {
+ this.setData({
+ mallTenantId
+ })
+ }
+
const date = (new Date()).getTime()
const nowDate = util.timestampToTime(date, 'YYYY-MM-DD')
const startTime = util.timestampToTime(options.startTime * 1, 'YYYY-MM-DD')
@@ -62,20 +71,12 @@ Page({
this.setData({
id: options.id || '',
orderId: options.orderId || '',
+ merOrderId: options.merOrderId || '',
startTime: finalStartTime,
endTime: options.endTime || '',
- mallList: JSON.parse(options.mallList)[0].merchantVoList || '',
- // mallList
})
- console.log(this.data.mallList, 'mallList');
-
- const mallTenantId = tt.getStorageSync('mallTenantId');
- if (mallTenantId) {
- this.setData({
- mallTenantId
- })
- }
+ this.getCouponMerchant(options.orderId)
if (this.data.id) {
this.getDetail(this.data.id)
@@ -163,6 +164,52 @@ Page({
})
},
+ getCouponMerchant() { //获取适用门店
+ const that = this
+ Http.get({
+ url: config.api.orderDetail,
+ data: {
+ orderId: that.data.merOrderId,
+ mallTenantId: that.data.mallTenantId || ''
+ }
+ }).then(res => {
+ const couponChannelId = res.data.orders[0].couponChannelId
+
+ Http.get({
+ url: config.api.couponMerchant,
+ data: {
+ couponChannelId,
+ mallTenantId: that.data.mallTenantId || ''
+ }
+ }).then(res => {
+ const keys = Object.keys(res.data)
+ const mallList = []
+ let i = 0
+ keys.forEach(item => {
+ const arr = item.split('|')
+ const obj = {
+ tenantId: arr[0],
+ mallName: arr[1],
+ merchantVoList: res.data[item],
+ expand: false
+ }
+ if (i == 0) {
+ obj.expand = true
+ }
+ mallList.push(obj)
+ i++
+ })
+ that.setData({
+ mallList: mallList[0].merchantVoList
+ })
+ console.log(that.data.mallList, 'mallList');
+ that.getLocation()
+ })
+ }).catch(err => {
+
+ })
+ },
+
chooseAddress() {
if (!this.data.isShowBtns) return
let that = this;
@@ -376,7 +423,9 @@ Page({
pickedEndTime: util.timestampToTime(res.data.endDate, 'hh:mm'),
describeStr: res.data.describeStr,
status,
- appointmentText: res.data.status == 1 ? "重新预约" : "修改预约"
+ appointmentText: res.data.status == 1 ? "重新预约" : "修改预约",
+ merchantId: res.data.reservationMerchantId,
+ reservationMerchantName: res.data.reservationMerchantName
})
if (status == 0 || status == 1 || status == 2 || status == 3) {
that.setData({
@@ -449,6 +498,6 @@ Page({
},
onShow() {
- this.getLocation()
+
}
})
\ No newline at end of file
diff --git a/package2/pages/appointment/appointment.ttml b/package2/pages/appointment/appointment.ttml
index c89ea53..c926bc6 100644
--- a/package2/pages/appointment/appointment.ttml
+++ b/package2/pages/appointment/appointment.ttml
@@ -50,8 +50,11 @@
- 选择可用商户:{{ mallList[currentIndex].merchantName }}
+ 选择可用商户:{{
+ mallList[currentIndex].merchantName }}
+ 选择可用商户:{{ reservationMerchantName
+ }}
diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js
index 990647e..1a2845a 100644
--- a/pages/order/detail/index.js
+++ b/pages/order/detail/index.js
@@ -185,13 +185,13 @@ Page({
const that = this
const orderId = e ? e.currentTarget.dataset.id : orderIdin
const id = this.data.appointmentId
+ const merOrderId = this.data.orderId
const startTime = that.data.order.validStartDATE
const endTime = that.data.order.validEndDate
- const mallList = JSON.stringify(that.data.mallList)
- console.log(startTime, endTime, mallList);
+ console.log(startTime, endTime);
tt.navigateTo({
- url: `/package2/pages/appointment/appointment?id=${id}&orderId=${orderId}&startTime=${startTime}&endTime=${endTime}&mallList=${mallList}`,
+ url: `/package2/pages/appointment/appointment?id=${id}&orderId=${orderId}&merOrderId=${merOrderId}&startTime=${startTime}&endTime=${endTime}`,
});
},
@@ -528,26 +528,45 @@ Page({
}
if (tempData.type == 69 && tempData.couponOrderStatus == 0) {
- const Appointment = tt.getStorageSync('appointment');
- if (Appointment) {
- tt.showModal({
- title: "提示",
- content: "是否立即填写预约信息?",
- showCancel: true,
- confirmText: "现在预约",
- confirmColor: "#deb472",
- cancelText: "稍后预约",
- success(res) {
- if (res.confirm) {
- tt.setStorageSync('appointment', false);
- that.goAppointment(false, tempData.couponOrderId)
- }
- if (res.cancel) {
+ // Http.get({
+ // url: config.api.orderDetail,
+ // data: {
+ // orderId: that.data.orderId,
+ // mallTenantId: that.data.mallTenantId || ''
+ // }
+ // }).then(res => {
+
+ // const cOrderID = res.data.orders[0].couponOrderId
+
+ // that.getUserReservation(cOrderID)
+
+ // }).catch(err => {
+
+ // })
+
+ setTimeout(() => {
+ const isAppointment = that.data.isAppointment
+ const Appointment = tt.getStorageSync('appointment');
+ if (Appointment && !isAppointment) {
+ tt.showModal({
+ title: "提示",
+ content: "是否立即填写预约信息?",
+ showCancel: true,
+ confirmText: "现在预约",
+ confirmColor: "#deb472",
+ cancelText: "稍后预约",
+ success(res) {
+ if (res.confirm) {
+ tt.setStorageSync('appointment', false);
+ that.goAppointment(false, tempData.couponOrderId)
+ }
+ if (res.cancel) {
+ }
}
- }
- });
- }
+ });
+ }
+ }, 2000);
}
that.setData({
diff --git a/pages/order/detail/index.ttml b/pages/order/detail/index.ttml
index ea566e9..cf882cf 100644
--- a/pages/order/detail/index.ttml
+++ b/pages/order/detail/index.ttml
@@ -48,7 +48,8 @@
-
+