Commit b36dbad3 by zhangzhen

细节优化

parent 21e2f630
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
<view class="part-1"> <view class="part-1">
<button class="cu-btn round" :class="orderType===1?'line-black':'line-gray'" <button class="cu-btn round" :class="orderType===1?'line-black':'line-gray'"
@tap="onSelectDate"> @tap="onSelectDate">
<text>{{startTime}}</text> <text>{{startTime | resetStartTime}}</text>
<text class="cuIcon-edit"></text> <text class="cuIcon-edit"></text>
</button> </button>
</view> </view>
...@@ -422,21 +422,7 @@ ...@@ -422,21 +422,7 @@
], ],
// 套餐 // 套餐
modeIndex: 0, modeIndex: 0,
packageMode: [{ packageMode: [],
id: '',
label: "优惠套餐1",
duration: 4,
originalPrice: 100,
realPrice: 78
},
{
id: '',
label: "优惠套餐2",
duration: 8,
originalPrice: 200,
realPrice: 138
}
],
// 原数据 // 原数据
dateIntervalList: [], dateIntervalList: [],
intervalList: [], intervalList: [],
...@@ -477,6 +463,18 @@ ...@@ -477,6 +463,18 @@
} }
}; };
}, },
filters:{
resetStartTime(val){
let time = null;
let hour = val.split(':')
if(hour>=24){
time = `${hour-24}:00`
}else{
time = val
}
return time;
}
},
onLoad(option) { onLoad(option) {
uni.showLoading({ uni.showLoading({
title: "加载中" title: "加载中"
...@@ -562,6 +560,8 @@ ...@@ -562,6 +560,8 @@
}).then(res => { }).then(res => {
uni.hideLoading() uni.hideLoading()
// orderType 订单类型
if (this.orderType === 1) { if (this.orderType === 1) {
if (this.index == 1){ if (this.index == 1){
this.duration = Number(this.packageMode[this.modeIndex].duration); this.duration = Number(this.packageMode[this.modeIndex].duration);
...@@ -579,7 +579,7 @@ ...@@ -579,7 +579,7 @@
if(item.status==1 && this.setStartTime.duration < this.duration && moment(item.endHoldTime).format("mm")<59 ){ if(item.status==1 && this.setStartTime.duration < this.duration && moment(item.endHoldTime).format("mm")<59 ){
this.setStartTime.startTime = moment(item.endHoldTime).format("HH:mm"); this.setStartTime.startTime = moment(item.endHoldTime).format("HH:mm");
if(index>=24){ if(index>=24){
this.setStartTime.days = 2 this.setStartTime.days = 2;
} }
this.setStartTime.duration = 0; this.setStartTime.duration = 0;
this.setStartTime.status = true; this.setStartTime.status = true;
...@@ -602,9 +602,6 @@ ...@@ -602,9 +602,6 @@
} else if(item.status === 0 && this.setStartTime.duration === 0 && !this.setStartTime.status){ } else if(item.status === 0 && this.setStartTime.duration === 0 && !this.setStartTime.status){
this.setStartTime.duration += 1; this.setStartTime.duration += 1;
this.setStartTime.startTime = `${index}:00`; this.setStartTime.startTime = `${index}:00`;
if(index>=24){
this.setStartTime.days = 2
}
this.setStartTime.status = true; this.setStartTime.status = true;
}else if(item.status === 0 && this.setStartTime.duration >= 0 && this.setStartTime.duration < this.duration && this.setStartTime.status){ }else if(item.status === 0 && this.setStartTime.duration >= 0 && this.setStartTime.duration < this.duration && this.setStartTime.status){
this.setStartTime.duration += 1; this.setStartTime.duration += 1;
...@@ -725,7 +722,6 @@ ...@@ -725,7 +722,6 @@
} }
} }
this.$forceUpdate(); this.$forceUpdate();
setTimeout(() => { setTimeout(() => {
if (!this.useDateStatus) { if (!this.useDateStatus) {
uni.showToast({ uni.showToast({
...@@ -830,8 +826,48 @@ ...@@ -830,8 +826,48 @@
}, },
onChangeMode(i) { onChangeMode(i) {
if (this.modeIndex === i) return; if (this.modeIndex === i) return;
this.modeIndex = i this.modeIndex = i;
this.onSetEndTime() let val = this.intervalList.findIndex(item=>item.status === 2)
let len = this.intervalList.filter(item=> item.status ===2).length;
let duration = Number(this.packageMode[this.modeIndex].duration);
let start = Number(this.startTime.split(":")[0])
let startM = Number(this.startTime.split(":")[1])
let h = val;
if(val+duration>=24){
h = val+duration-24
} else{
h = val+duration
}
this.endTime = `${h>=10?h:'0'+h}:${startM}`;
this.dateObj = this.onSetDateTime(this.startTime, this.endTime);
let showHourUse = false;
this.intervalList = this.intervalList.map((item,index) =>{
let status = item.status;
if(index>=val && index<= val+duration){
status = 2
if(this.dateIntervalList[index].status === 1 && index !== val ){
showHourUse = true
}
}else{
status = this.dateIntervalList[index].status
}
return {
...item,
status
}
})
if (showHourUse) {
uni.showToast({
icon: "none",
title: "选择时段有重复"
})
}
}, },
onDurationChange(i) { onDurationChange(i) {
if (i >= this.distanceMode.length - 1) { if (i >= this.distanceMode.length - 1) {
...@@ -1066,7 +1102,6 @@ ...@@ -1066,7 +1102,6 @@
if (i < 24) { if (i < 24) {
if (val.status == 1) { if (val.status == 1) {
let mTime = moment(val.endHoldTime).format("mm") let mTime = moment(val.endHoldTime).format("mm")
console.log(mTime, "分钟数据")
if (mTime >= '59') { if (mTime >= '59') {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
......
...@@ -64,6 +64,10 @@ ...@@ -64,6 +64,10 @@
<text class="text-gray">支付方式</text> <text class="text-gray">支付方式</text>
<text class="text-title">{{orderInfo.payType==1?'微信支付':'其他支付'}}</text> <text class="text-title">{{orderInfo.payType==1?'微信支付':'其他支付'}}</text>
</view> </view>
<view v-if="orderInfo.couponName && orderInfo.couponId" class="flex-between">
<text class="text-gray">优惠券抵扣</text>
<text class="text-title">{{orderInfo.couponName}}</text>
</view>
<view class="flex-between"> <view class="flex-between">
<text class="text-gray">支付时间</text> <text class="text-gray">支付时间</text>
<text class="text-title">{{orderInfo.payTime||'-'}}</text> <text class="text-title">{{orderInfo.payTime||'-'}}</text>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment