Commit f9621a9a by zhangzhen

细节优化

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