Commit f9621a9a by zhangzhen

细节优化

parent 3b7daf0c
......@@ -95,7 +95,7 @@
</view>
<view class="flex-row list-point-box">
<view v-for="(val,k) in list" :key="k" class="flex-1 flex-col">
<view class="box" :class="objListDate.length && objListDate[index][k].status==1?'bg-pink':'bg-gray'">
<view class="box" :class="objListDate.length && objListDate[index] && objListDate[index].length && objListDate[index][k].status==1&& objListDate[index][k+1].status==1?'bg-pink':'bg-gray'">
</view>
<text class="text-gray text-sm">{{val>=24? val-24:val}}</text>
......@@ -215,7 +215,6 @@
timer: null,
roomVoList:[],
list,
listDate:[],
objListDate:[]
}
},
......@@ -273,7 +272,6 @@
this.$refs.popup.open()
uni.hideLoading()
}
this.objListDate = [];
this.onGetListStore()
}
})
......@@ -312,6 +310,10 @@
})
},
onGetSortDistance(i = 0){
if(i >= this.roomVoList.length){
this.$forceUpdate();
return
}
listSortDistance({
storeId: this.storeInfo.id,
roomId: this.roomVoList[i].id,
......@@ -319,18 +321,8 @@
orderType:1
}).then(res=>{
if(res.data.code == 200 && i <= this.roomVoList.length-1){
this.listDate[i] = res.data.data;
i+=1
if(i >= this.roomVoList.length){
this.listDate = this.listDate.map(item=>{
return this.list.map(val=>item[val])
})
this.objListDate = this.listDate;
}else{
this.onGetSortDistance(i)
}
this.objListDate[i] = this.list.map(val=>res.data.data[val])
this.onGetSortDistance(++i)
}
})
},
......
......@@ -439,9 +439,11 @@
setStartTime: {
status:false,
startTime:'',
startDate:'',
duration:0,
days:1
}
},
days:1
};
},
filters:{
......@@ -509,7 +511,9 @@
}
// 判断房间有没有绑定套餐
if (this.roomInfo.packList && this.roomInfo.packList.length) {
this.packageMode = this.roomInfo.packList
let packageMode = this.roomInfo.packList
packageMode.sort((a,b)=>Number(a.duration)-Number(b.duration))
this.packageMode = packageMode
this.index = 1;
this.modeIndex = 0;
} else {
......@@ -559,15 +563,19 @@
this.dateIntervalList.forEach((item,index) =>{
if(item.status==1 && this.setStartTime.duration < this.duration && moment(item.endHoldTime).format("mm")<59 ){
this.setStartTime.startTime = moment(item.endHoldTime).format("HH:mm");
if(index>=24){
this.setStartTime.startDate = moment(item.endHoldTime).format("YYYYMMDD");
if(index >= 24){
this.setStartTime.days = 2;
this.days = 2;
}
this.setStartTime.duration = 0;
this.setStartTime.status = true;
}if(item.status==1 && this.setStartTime.duration < this.duration && moment(item.startHoldTime).format("mm") > 0){
this.setStartTime.startTime = moment(item.endHoldTime).format("HH:mm");
this.setStartTime.startDate = moment(item.endHoldTime).format("YYYYMMDD");
if(index>=24){
this.setStartTime.days = 2
this.days = 2;
}
this.setStartTime.duration = 0;
this.setStartTime.status = true;
......@@ -583,6 +591,11 @@
} else if(item.status === 0 && this.setStartTime.duration === 0 && !this.setStartTime.status){
this.setStartTime.duration += 1;
this.setStartTime.startTime = `${index}:00`;
if(index>=24){
this.setStartTime.startTime = `${index-24}:00`;
this.setStartTime.days = 2
this.days = 2;
}
this.setStartTime.status = true;
}else if(item.status === 0 && this.setStartTime.duration >= 0 && this.setStartTime.duration < this.duration && this.setStartTime.status){
this.setStartTime.duration += 1;
......@@ -659,7 +672,6 @@
}
this.onGetUseCoupon()
this.onUpdateIntervalList()
this.dateObj = this.onSetDateTime(this.startTime, this.endTime);
},
// 更新时间的选取状态
onUpdateIntervalList() {
......@@ -672,10 +684,11 @@
let end = Number(this.endTime.split(":")[0])
let endM = Number(this.endTime.split(":")[1])
// if(this.setStartTime.days >=2){
// start +=24
// this.setStartTime.days = 1
// }
// 如果开始时间是第二天
if(this.setStartTime.days >=2 || this.days == 2){
start +=24
}
if (this.orderType ==2 && end < start){
end += 24
......@@ -683,6 +696,8 @@
end += 24
}
this.dateObj = this.onSetDateTime(this.startTime, this.endTime);
// 重新将数据还原到元数据
this.intervalList = [
...this.dateIntervalList
......@@ -1111,15 +1126,25 @@
}
let startArr = startTime.split(":")
let endArr = endTime.split(":")
obj.startDate = `${this.dateList[this.dateIndex].readDate} ${startTime}:00`
if (this.orderType == 1 && Number(endArr[0]) <= Number(startArr[0])) {
if(this.setStartTime.days==2 || this.days ==2){
obj.startDate =`${moment(this.dateList[this.dateIndex].readDate).add(1,"days").format("YYYY-MM-DD")} ${startTime}:00`
this.setStartTime.days = 1;
this.days = 1
}else{
obj.startDate = `${this.dateList[this.dateIndex].readDate} ${startTime}:00`
}
if ((this.orderType == 1 && Number(endArr[0]) <= Number(startArr[0]))) {
obj.endDate =
`${moment(this.dateList[this.dateIndex].readDate).add(1,"days").format("YYYY-MM-DD")} ${endTime}:00`
`${moment(obj.startDate).add(1,"days").format("YYYY-MM-DD")} ${endTime}:00`
}else if(this.orderType == 2 && Number(endArr[0]) < Number(startArr[0])) {
obj.endDate =
`${moment(this.dateList[this.dateIndex].readDate).add(1,"days").format("YYYY-MM-DD")} ${endTime}:00`
`${moment(obj.startDate).add(1,"days").format("YYYY-MM-DD")} ${endTime}:00`
} else {
obj.endDate = `${this.dateList[this.dateIndex].readDate} ${endTime}:00`
obj.endDate = `${moment(obj.startDate).format("YYYY-MM-DD")} ${endTime}:00`
}
return obj;
}
......
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