Commit 68c98580 by zhangzhen

细节优化

parent 9fdb18d1
...@@ -546,34 +546,35 @@ ...@@ -546,34 +546,35 @@
this.duration = Number(this.distanceMode[this.distanceIndex].duration); this.duration = Number(this.distanceMode[this.distanceIndex].duration);
} }
} }
this.dateIntervalList = res.data.data.map((item, index) => { this.dateIntervalList = res.data.data.map((item, index) => {
return {
// 设置可预定的开始时间 ...item,
if(item.status==1 && moment(item.endHoldTime).format("mm")<59){ hour: index > 0 && index - 24 == 0 ? '次日' : index > 24 ? index - 24 : index
this.setStartTime.startTime = moment(item.endHoldTime).format("HH:mm");
this.setStartTime.status = true;
} }
if(item.status === 0 && !this.setStartTime.status){ })
this.setStartTime.startTime = `${index}:00`; 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");
this.setStartTime.duration = 0;
this.setStartTime.status = true; this.setStartTime.status = true;
} } else if(item.status==1 && this.setStartTime.duration < this.duration && moment(item.endHoldTime).format("mm") >=59 ){
if(item.status === 0 && this.setStartTime.status){
this.setStartTime.duration+=1;
}
if(item.status==1 && this.setStartTime.duration>0 && this.setStartTime.duration < this.duration ){
this.setStartTime.status = false;
this.setStartTime.duration = 0; this.setStartTime.duration = 0;
} else if(item.status==1 && this.setStartTime.duration >= this.duration && moment(this.setStartTime.startTime).format("mm") < moment(item.startHoldTime).format("mm")){ this.setStartTime.status = false;
}else if(item.status==1 && this.setStartTime.status && this.setStartTime.duration === this.duration && moment(this.setStartTime.startTime).format("mm") < moment(item.startHoldTime).format("mm")){
this.startTime = this.setStartTime.startTime; this.startTime = this.setStartTime.startTime;
} else if(item.status === 0 && this.setStartTime.duration >= this.duration){ this.setStartTime.duration+=1;
}else if(item.status==1 && this.setStartTime.status && this.setStartTime.duration === this.duration && moment(this.setStartTime.startTime).format("mm") >= moment(item.startHoldTime).format("mm")){
this.setStartTime.duration = 0;
this.setStartTime.status = false;
} else if(item.status === 0 && this.setStartTime.duration === 0 && !this.setStartTime.status){
this.setStartTime.duration += 1;
this.setStartTime.startTime = `${index}:00`;
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;
} else if(item.status === 0 && this.setStartTime.duration == this.duration && this.setStartTime.status){
this.startTime = this.setStartTime.startTime; this.startTime = this.setStartTime.startTime;
} this.setStartTime.duration+=1;
return {
...item,
hour: index > 0 && index - 24 == 0 ? '次日' : index > 24 ? index - 24 : index
} }
}) })
this.onSetEndTime() this.onSetEndTime()
......
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