| @@ -9,6 +9,7 @@ Page({ | |||||
| appointmentText: "确认预约", | appointmentText: "确认预约", | ||||
| id: "", | id: "", | ||||
| orderId: "", | orderId: "", | ||||
| merOrderId: "", | |||||
| startTime: '', | startTime: '', | ||||
| endTime: "", | endTime: "", | ||||
| mallTenantId: "", | mallTenantId: "", | ||||
| @@ -17,6 +18,7 @@ Page({ | |||||
| pickedDate: "请选择日期", | pickedDate: "请选择日期", | ||||
| pickedStartTime: "请选择", | pickedStartTime: "请选择", | ||||
| pickedEndTime: "请选择", | pickedEndTime: "请选择", | ||||
| reservationMerchantName: "", | |||||
| describeStr: "", | describeStr: "", | ||||
| mallList: [], | mallList: [], | ||||
| merchantId: "", | merchantId: "", | ||||
| @@ -29,6 +31,13 @@ Page({ | |||||
| onLoad(options) { | onLoad(options) { | ||||
| console.log(options, 'options') | console.log(options, 'options') | ||||
| const mallTenantId = tt.getStorageSync('mallTenantId'); | |||||
| if (mallTenantId) { | |||||
| this.setData({ | |||||
| mallTenantId | |||||
| }) | |||||
| } | |||||
| const date = (new Date()).getTime() | const date = (new Date()).getTime() | ||||
| const nowDate = util.timestampToTime(date, 'YYYY-MM-DD') | const nowDate = util.timestampToTime(date, 'YYYY-MM-DD') | ||||
| const startTime = util.timestampToTime(options.startTime * 1, 'YYYY-MM-DD') | const startTime = util.timestampToTime(options.startTime * 1, 'YYYY-MM-DD') | ||||
| @@ -62,20 +71,12 @@ Page({ | |||||
| this.setData({ | this.setData({ | ||||
| id: options.id || '', | id: options.id || '', | ||||
| orderId: options.orderId || '', | orderId: options.orderId || '', | ||||
| merOrderId: options.merOrderId || '', | |||||
| startTime: finalStartTime, | startTime: finalStartTime, | ||||
| endTime: options.endTime || '', | 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) { | if (this.data.id) { | ||||
| this.getDetail(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() { | chooseAddress() { | ||||
| if (!this.data.isShowBtns) return | if (!this.data.isShowBtns) return | ||||
| let that = this; | let that = this; | ||||
| @@ -376,7 +423,9 @@ Page({ | |||||
| pickedEndTime: util.timestampToTime(res.data.endDate, 'hh:mm'), | pickedEndTime: util.timestampToTime(res.data.endDate, 'hh:mm'), | ||||
| describeStr: res.data.describeStr, | describeStr: res.data.describeStr, | ||||
| status, | 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) { | if (status == 0 || status == 1 || status == 2 || status == 3) { | ||||
| that.setData({ | that.setData({ | ||||
| @@ -449,6 +498,6 @@ Page({ | |||||
| }, | }, | ||||
| onShow() { | onShow() { | ||||
| this.getLocation() | |||||
| } | } | ||||
| }) | }) | ||||
| @@ -50,8 +50,11 @@ | |||||
| <view tt:if="{{ merchantId }}" class="addressPicker"> | <view tt:if="{{ merchantId }}" class="addressPicker"> | ||||
| <picker style="display: inline;" mode="selector" value="{{index}}" range="{{mallList}}" range-key="distanceName" | <picker style="display: inline;" mode="selector" value="{{index}}" range="{{mallList}}" range-key="distanceName" | ||||
| disabled="{{false}}" bindchange="setMerchant"> | disabled="{{false}}" bindchange="setMerchant"> | ||||
| <text> 选择可用商户:<text class="pickerInside">{{ mallList[currentIndex].merchantName }} <text | |||||
| class="distanceFoot">{{ mallList[currentIndex].distance_str }}</text></text></text> | |||||
| <text tt:if="{{ !reservationMerchantName }}"> 选择可用商户:<text class="pickerInside">{{ | |||||
| mallList[currentIndex].merchantName }} <text class="distanceFoot">{{ | |||||
| mallList[currentIndex].distance_str }}</text></text></text> | |||||
| <text tt:if="{{ reservationMerchantName }}"> 选择可用商户:<text class="pickerInside">{{ reservationMerchantName | |||||
| }}</text></text> | |||||
| </picker> | </picker> | ||||
| </view> | </view> | ||||
| @@ -185,13 +185,13 @@ Page({ | |||||
| const that = this | const that = this | ||||
| const orderId = e ? e.currentTarget.dataset.id : orderIdin | const orderId = e ? e.currentTarget.dataset.id : orderIdin | ||||
| const id = this.data.appointmentId | const id = this.data.appointmentId | ||||
| const merOrderId = this.data.orderId | |||||
| const startTime = that.data.order.validStartDATE | const startTime = that.data.order.validStartDATE | ||||
| const endTime = that.data.order.validEndDate | const endTime = that.data.order.validEndDate | ||||
| const mallList = JSON.stringify(that.data.mallList) | |||||
| console.log(startTime, endTime, mallList); | |||||
| console.log(startTime, endTime); | |||||
| tt.navigateTo({ | 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) { | 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({ | that.setData({ | ||||
| @@ -48,7 +48,8 @@ | |||||
| <image class="infoArrow" src="{{chevronUrl}}" mode='widthFix'></image> | <image class="infoArrow" src="{{chevronUrl}}" mode='widthFix'></image> | ||||
| <view tt:if="{{orderStatus != 'noRefund' && orderStatus != 'orderCancel' && couponOrderStatus == 0}}"> | |||||
| <view | |||||
| tt:if="{{orderStatus != 'noRefund' && orderStatus != 'orderCancel' && (couponOrderStatus == 0 || couponOrderStatus == 3) }}"> | |||||
| <pay-button tt:if="{{orderStatus}}" id='payBtn' class="goRefundPayBtn" order-status="{{orderStatus}}" | <pay-button tt:if="{{orderStatus}}" id='payBtn' class="goRefundPayBtn" order-status="{{orderStatus}}" | ||||
| order-id="{{outOrderId}}" refund-id="{{outRefundOrderId}}" bind:refund="handleRefund" | order-id="{{outOrderId}}" refund-id="{{outRefundOrderId}}" bind:refund="handleRefund" | ||||
| bind:applyrefund="applyRefund" bind:error="handleError" /> | bind:applyrefund="applyRefund" bind:error="handleError" /> | ||||