添加预约时间
This commit is contained in:
@ -102,13 +102,13 @@
|
||||
<view class="bg-white br16 p24 u-m-t-32 nr row-between" @click="appointmentTime">
|
||||
<view>预约时间</view>
|
||||
<view class="row">
|
||||
<view class="u-m-r-10">16:00-16:30</view>
|
||||
<view class="u-m-r-10"> {{day}} , {{ time }}</view>
|
||||
<u-icon name="arrow-right" size="32"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view class="bg-white br16 p24 u-m-t-32 nr">
|
||||
<!-- <view class="bg-white br16 p24 u-m-t-32 nr">
|
||||
<view class="row-between">
|
||||
<view class="row-center">
|
||||
<u-icon name="weixin-circle-fill" color="#28C445" size="80"></u-icon>
|
||||
@ -121,11 +121,11 @@
|
||||
</u-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<view class="bg-white br16 p24 u-m-t-32 nr">
|
||||
<!-- <view class="bg-white br16 p24 u-m-t-32 nr">
|
||||
<view class="row-between">
|
||||
<view class="row-center">
|
||||
<u-icon name="zhifubao-circle-fill" color="#1477FE" size="80"></u-icon>
|
||||
@ -138,7 +138,7 @@
|
||||
</u-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- #endif -->
|
||||
|
||||
<view class="fixed bg-white row-between px48 u-padding-top-20 u-padding-bottom-20">
|
||||
@ -175,7 +175,7 @@
|
||||
</tabs>
|
||||
</view>
|
||||
</u-popup>
|
||||
<appointment-time v-model="timePopup" @close="timePopup = false" @update="handleSubmitMobile" />
|
||||
<appointment-time v-model="timePopup" @close="timePopup = false" @update="handleSubmitTime" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -219,6 +219,9 @@ export default {
|
||||
showCoupon: false, // 显示优惠券Popup
|
||||
userRemark: '', // 用户留言
|
||||
type: '', // 订单类型
|
||||
day: '',
|
||||
timeId: 0,
|
||||
time: ''
|
||||
}
|
||||
},
|
||||
|
||||
@ -236,7 +239,17 @@ export default {
|
||||
this.pay.alipay = 1
|
||||
//#endif
|
||||
|
||||
getDelivery()
|
||||
this.getDeliveryFun()
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
// 取消全局监听
|
||||
uni.$off(['selectaddress', 'store'])
|
||||
},
|
||||
|
||||
methods: {
|
||||
getDeliveryFun() {
|
||||
getDelivery()
|
||||
.then(({ code, data, msg }) => {
|
||||
// 请求结果判断
|
||||
if (code != 1) throw new Error(msg)
|
||||
@ -292,14 +305,8 @@ export default {
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
// 取消全局监听
|
||||
uni.$off(['selectaddress', 'store'])
|
||||
},
|
||||
|
||||
methods: {
|
||||
appointmentTime() {
|
||||
this.timePopup = true
|
||||
},
|
||||
@ -408,12 +415,36 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
// 选择预约时间
|
||||
handleSubmitTime(data) {
|
||||
this.day = data.day
|
||||
this.timeId = data.time_id
|
||||
this.time = data.time
|
||||
this.timePopup = false
|
||||
},
|
||||
|
||||
// 订单提交
|
||||
async handleOrderSubmit(from) {
|
||||
this.showLoading = true
|
||||
|
||||
// 判断预约时间
|
||||
if (this.day === '今天') {
|
||||
const today = new Date();
|
||||
const year = today.getFullYear();
|
||||
const month = String(today.getMonth() + 1).padStart(2, '0');
|
||||
const date = String(today.getDate()).padStart(2, '0');
|
||||
from.date = `${year}-${month}-${date}`;
|
||||
} else if (this.day === '明天') {
|
||||
const tomorrow = new Date();
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
const year = tomorrow.getFullYear();
|
||||
const month = String(tomorrow.getMonth() + 1).padStart(2, '0');
|
||||
const date = String(tomorrow.getDate()).padStart(2, '0');
|
||||
from.date = `${year}-${month}-${date}`;
|
||||
}
|
||||
|
||||
from.remark = this.userRemark
|
||||
from.type = this.type
|
||||
from.time_id = this.timeId
|
||||
|
||||
try {
|
||||
const { code, data, msg } = await orderBuy(from)
|
||||
|
||||
Reference in New Issue
Block a user