Commit 68f9bf13 by zhangzhen

订单优化

parent 0b62f5e1
...@@ -80,16 +80,17 @@ ...@@ -80,16 +80,17 @@
<view class="item" :class="{active: modeIndex===index}"> <view class="item" :class="{active: modeIndex===index}">
<text>{{item.labelName}}</text> <text>{{item.labelName}}</text>
</view> </view>
<view v-if="item.openPack==1" class="pre-icon">
<image :src="assetsPath+'/pre_icon.png'" mode="widthFix"></image>
</view> </view>
</view> </view>
<view v-if="orderType ==1" class="flex-col package-list"> </view>
<view class="flex-col package-list">
<view v-for="(item,index) in packageMode" :key="index" class="package-list-box" <view v-for="(item,index) in packageMode" :key="index" class="package-list-box"
@tap="onChangePackage2(index)"> @tap="onChangePackage2(index,item)">
<view class="item" :class=" !item.show? 'gray': modeIndex2===index?'active':''">
<view class="item" :class="{active: modeIndex2===index}">
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -135,7 +136,7 @@ ...@@ -135,7 +136,7 @@
</view> </view>
<view class="part-1 part-3"> <view class="part-1">
<text class="text-title">结束时间</text> <text class="text-title">结束时间</text>
</view> </view>
</view> </view>
...@@ -143,7 +144,7 @@ ...@@ -143,7 +144,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>{{formatAllData.startTime}}</text> <text class="text-bold">{{formatAllData.startTime}}</text>
<text class="cuIcon-edit"></text> <text class="cuIcon-edit"></text>
</button> </button>
</view> </view>
...@@ -153,7 +154,7 @@ ...@@ -153,7 +154,7 @@
<view class="part-1 part-3"> <view class="part-1 part-3">
<button class="cu-btn round line-gray"> <button class="cu-btn round line-gray">
<text>{{formatAllData.endTime}}</text> <text class="text-bold">{{formatAllData.endTime}}</text>
</button> </button>
</view> </view>
</view> </view>
...@@ -189,6 +190,9 @@ ...@@ -189,6 +190,9 @@
</view> </view>
<view class="flex-col count-price"> <view class="flex-col count-price">
<view class="logo-box">
<image :src="assetsPath+'/logo_icon_2.png'" mode="widthFix"></image>
</view>
<view class="flex-between original-price"> <view class="flex-between original-price">
<text class="text-black text-left">订单总价</text> <text class="text-black text-left">订单总价</text>
<view class="flex-row"> <view class="flex-row">
...@@ -198,9 +202,9 @@ ...@@ -198,9 +202,9 @@
</view> </view>
<view class="flex-between price"> <view class="flex-between price">
<text class="text-black text-left">预约时长</text> <text class="text-black text-left">预约时长</text>
<text class="text-black">{{(formatAllData.duration/60).toFixed(1)}}小时</text> <text class="text-black text-bold">{{(formatAllData.duration/60).toFixed(1)}}小时</text>
</view> </view>
<view v-show="orderTypeList[index].type==1" class="flex-between price"> <view class="flex-between price">
<text class="text-black text-left">房间单价</text> <text class="text-black text-left">房间单价</text>
<view class="flex-row"> <view class="flex-row">
<text class="text-black text-sm text-bold" style="margin-bottom: 3upx;"></text> <text class="text-black text-sm text-bold" style="margin-bottom: 3upx;"></text>
...@@ -228,10 +232,10 @@ ...@@ -228,10 +232,10 @@
</view> </view>
<view class="pay-content-box"> <view class="pay-content-box">
<view class="flex-row"> <view class="flex-row">
<text class="text-pink">优惠价</text> <text class="text-title">优惠价</text>
<view class="flex-row margin-left"> <view class="flex-row margin-left">
<text class=""></text> <text class=""></text>
<text class="text-xxl text-bold">{{Number(computePriceInfo.payFee).toFixed(2)}}</text> <text class="text-xxl text-bold amount">{{Number(computePriceInfo.payFee).toFixed(2)}}</text>
</view> </view>
</view> </view>
<view class="btn-box"> <view class="btn-box">
...@@ -283,47 +287,49 @@ ...@@ -283,47 +287,49 @@
</view> </view>
</uni-popup> </uni-popup>
<uni-popup ref="confirmPop" type="center"> <uni-popup ref="confirmPop" type="bottom">
<view class="confirm-pop"> <view class="confirm-pop">
<view class="pop-content-box"> <view class="pop-content-box">
<view class="title"> <view class="title">
<text class="text-black text-bold text-xl">{{orderType==1? '预约':'续单'}}信息确认</text> <text>{{orderDateDes}}</text>
<text class="margin-left-sm">{{orderWeeEnum[orderWeekDes]}}</text>
</view> </view>
<view class="info-box"> <view class="info-box">
<view class="info"> <view class="info-store">
<text <text class="text-title">凑角{{roomInfo.storeName|| ''}}</text>
class="text-black text-lg">{{orderType==1? '预约':'续单'}}门店:{{roomInfo.storeName|| ''}}</text>
</view>
<view class="info">
<text class="text-black text-lg">{{orderType==1? '预约':'续单'}}包间:{{roomInfo.name}}</text>
</view>
<view class="info">
<text class="text-black text-lg">开始时间:{{formatAllData.startDateTime}}</text>
</view> </view>
<view class="info">
<text class="text-black text-lg">结束时间:{{formatAllData.endDateTime}}</text> <view class="flex-row time-box">
<view class="part-1">
<image :src="assetsPath+'/time_bg_icon.png'" mode="widthFix"></image>
<view class="absolute">
<text>{{formatAllData.startTime}}</text>
</view> </view>
</view> </view>
<view class="flex-1"> <text></text>
<view class="tip-box"> <view class="part-1">
<view class=""> <image :src="assetsPath+'/time_bg_icon.png'" mode="widthFix"></image>
<text class="text-red text-bold text-xl">客户须知</text> <view class="absolute">
<text>{{formatAllData.endTime}}</text>
</view> </view>
<view class="flex-col text-red">
<text>1.预定的订单将全时段保留,迟到不可顺延和退款。</text>
<text>2.若订单时段前包厢无使用.可提前开始订单.但订单总时长不变。</text>
<!-- <text>3.订单开始前0小时内取消订单需核收xx%退单费请合理规划您的时间。</text> -->
</view> </view>
</view> </view>
<view class="info">
<text class="">房间:{{roomInfo.name}} {{roomTypeEnum[roomInfo.roomType]}}</text>
</view> </view>
<view class="flex-between">
<view class="btn-box"> <view class="info">
<button class="cu-btn round block line-pink lg" @tap="onCancle">返回修改</button> <text class="">金额: {{Number(computePriceInfo.payFee).toFixed(2)}}</text>
</view> </view>
<view class="btn-box">
<button class="cu-btn round block bg-pink lg"
@tap="onOrder">立即{{orderType==1? '预约':'续单'}}</button>
</view> </view>
<view class="footer-btn-box">
<button class="cu-btn block btn-close" @tap="onCancle">关闭</button>
<button class="cu-btn block btn-confirm" @tap="onOrder">确定</button>
</view> </view>
</view> </view>
</view> </view>
...@@ -488,7 +494,20 @@ ...@@ -488,7 +494,20 @@
list:[] list:[]
}, },
orderInfo:{}, orderInfo:{},
tempPackageIndex:0 tempPackageIndex:0,
// 临时存放开始时间 结束时间 时长
tempDateObj:{},
orderDateDes:"",
orderWeekDes:"",
orderWeeEnum:{
1:"星期一",
2:"星期二",
3:"星期三",
4:"星期四",
5:"星期五",
6:"星期六",
0:"星期日",
}
}; };
}, },
filters: { filters: {
...@@ -547,7 +566,7 @@ ...@@ -547,7 +566,7 @@
onChangePackage(index){ onChangePackage(index){
if(this.modeIndex == index) return; if(this.modeIndex == index) return;
let startDateTime = this.orderType ==2? this.orderInfo.startDate: '' let startDateTime = this.orderType ==2? this.orderInfo.endDate: ''
this.modeIndex = index this.modeIndex = index
this.modeIndex2 = -1 this.modeIndex2 = -1
...@@ -562,37 +581,83 @@ ...@@ -562,37 +581,83 @@
this.modeIndex = -1 this.modeIndex = -1
this.modeIndex2 = this.tempPackageIndex this.modeIndex2 = this.tempPackageIndex
let startStr = `${this.dateList[this.dateIndex].readDate} ${this.packageMode[this.modeIndex2].packaStartPeriod}:00:00` this.formatAllData = this.onTransiteForDate({
let startDate = moment(moment().format(startStr)).format("YYYY-MM-DD HH:00:00"); list: JSON.parse(JSON.stringify(this.dateIntervalList)),
startDateTime: this.tempDateObj.startDate,
duration: this.tempDateObj.duration,
durationType:this.tempDateObj.durationType
});
},
// 套餐校验,检查当前套餐是否可用
onCheckPackageUse(valData){
let useStatus = true;
let endStr = `${this.dateList[this.dateIndex].readDate} ${this.packageMode[this.modeIndex2].packaEndPeriod}:00:00` let startStr = `${this.dateList[this.dateIndex].readDate} ${valData.packaStartPeriod}:00:00`
let startDate = moment(moment().format(startStr)).format("YYYY-MM-DD HH:00:00");
let endStr = `${this.dateList[this.dateIndex].readDate} ${valData.packaEndPeriod}:00:00`
let endDate = moment(moment().format(endStr)).format("YYYY-MM-DD HH:00:00"); let endDate = moment(moment().format(endStr)).format("YYYY-MM-DD HH:00:00");
if(this.dateIndex === 0 && (moment().valueOf() > moment(endDate).valueOf())){ // 如果是续单,则订单的结束时间必须在套餐的开始时间和结束时间内,否则无法续对应的套餐
startDate = moment(startDate).add(1,'d').format("YYYY-MM-DD HH:00:00") if(this.orderType == 2){
endDate = moment(endDate).add(1,'d').format("YYYY-MM-DD HH:00:00") if(!(moment(this.orderInfo.endDate).valueOf() >= moment(startDate).valueOf() && moment(this.orderInfo.endDate).valueOf() <= moment(endDate).valueOf())){
useStatus = false;
}
} }
this.dateIntervalList.forEach(item=>{ // 如果此套餐的结束时间在11点前,则为通宵套餐,会在当天及明天进行找合适的时间段,否则则没有合适的套餐时段
let start = moment(moment(item.timeHour).format("YYYY-MM-DD HH::mm:ss")).valueOf() let pointDateForm = moment(this.dateList[this.dateIndex].readDate).format("YYYY-MM-DD 11:00:00");
let orderStartDate = moment(startDate).valueOf() let dateTimeObj = {};
let orderEndDate = moment(endDate).valueOf()
if(start >= orderStartDate && start<=orderEndDate && item.status ==1){ if(moment(endDate).valueOf() < moment(pointDateForm).valueOf()){
startDate = moment(item.endHoldTime).format("YYYY-MM-DD HH:mm:00"); // console.log("通宵套餐")
dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
// 实际时长小于原时长的60%则选择明天的时间
// 原时间
let originTime = moment(endDate).valueOf() - moment(startDate).valueOf()
// 实际时间
let actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf()
if( actualTime < originTime*0.6 || this.onCheckPackUse(startDate,endDate)){
// console.log("实际时长小于原时长的60%则选择明天的时间");
// 加一天时间重新计算
if(this.dateIndex != 0){
useStatus = false;
return
} }
})
let duration = (moment(endDate).valueOf()-moment(startDate).valueOf())/1000/60; startDate = moment(startDate).add(1,"d").format("YYYY-MM-DD HH:00:00");
this.formatAllData = this.onTransiteForDate({ endDate = moment(endDate).add(1,"d").format("YYYY-MM-DD HH:00:00")
list: JSON.parse(JSON.stringify(this.dateIntervalList)),
startDateTime: startDate, dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
duration, // 实际时间
durationType:2 actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf()
}); if( actualTime < originTime*0.6 || this.onCheckPackUse(startDate,endDate)){
useStatus = false;
return
}
}
} else {
// 如果此套餐的结束时间在12点后,则为闲时套餐,仅查看今日日否有合适的套餐
// console.log("闲时套餐")
dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
// 原时间
let originTime = moment(endDate).valueOf() - moment(startDate).valueOf()
// 实际时间
let actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf()
if( actualTime< originTime*0.6 || this.onCheckPackUse(startDate,endDate)){
useStatus = false;
return
}
}
return useStatus
}, },
// 套餐切换 // 套餐切换
onChangePackage2(index){ onChangePackage2(index,val){
if(this.modeIndex2 == index) return;
if(this.modeIndex2 == index || !val.show) return;
this.tempPackageIndex = index; this.tempPackageIndex = index;
let startStr = `${this.dateList[this.dateIndex].readDate} ${this.packageMode[this.tempPackageIndex].packaStartPeriod}:00:00` let startStr = `${this.dateList[this.dateIndex].readDate} ${this.packageMode[this.tempPackageIndex].packaStartPeriod}:00:00`
...@@ -601,16 +666,12 @@ ...@@ -601,16 +666,12 @@
let endStr = `${this.dateList[this.dateIndex].readDate} ${this.packageMode[this.tempPackageIndex].packaEndPeriod}:00:00` let endStr = `${this.dateList[this.dateIndex].readDate} ${this.packageMode[this.tempPackageIndex].packaEndPeriod}:00:00`
let endDate = moment(moment().format(endStr)).format("YYYY-MM-DD HH:00:00"); let endDate = moment(moment().format(endStr)).format("YYYY-MM-DD HH:00:00");
console.log(startDate,endDate,"此套餐的开始时间和结束时间")
// 如果此套餐的结束时间在11点前,则为通宵套餐,会在当天及明天进行找合适的时间段,否则则没有合适的套餐时段 // 如果此套餐的结束时间在11点前,则为通宵套餐,会在当天及明天进行找合适的时间段,否则则没有合适的套餐时段
let pointDateForm = moment(this.dateList[this.dateIndex].readDate).format("YYYY-MM-DD 11:00:00"); let pointDateForm = moment(this.dateList[this.dateIndex].readDate).format("YYYY-MM-DD 11:00:00");
let dateTimeObj = {}; let dateTimeObj = {};
console.log(pointDateForm,9999)
if(moment(endDate).valueOf() < moment(pointDateForm).valueOf()){ if(moment(endDate).valueOf() < moment(pointDateForm).valueOf()){
// console.log("通宵套餐")
dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate); dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
console.log(dateTimeObj,"计算后的时间");
// 实际时长小于原时长的50%则选择明天的时间 // 实际时长小于原时长的50%则选择明天的时间
...@@ -620,10 +681,17 @@ ...@@ -620,10 +681,17 @@
let actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf() let actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf()
if( actualTime< originTime*0.6){ if( actualTime< originTime*0.6){
console.log("实际时长小于原时长的50%则选择明天的时间"); // console.log("实际时长小于原时长的60%则选择明天的时间");
// 加一天时间重新计算 // 加一天时间重新计算
if(this.dateIndex != 0){
uni.showToast({
icon:"none",
title:'可使用时长不足,请选择其他日期'
})
return
}
dateTimeObj = this.onComputeStartDateAndEndDate(moment(startDate).add(1,"d").format("YYYY-MM-DD HH:00:00"),moment(endDate).add(1,"d").format("YYYY-MM-DD HH:00:00")); dateTimeObj = this.onComputeStartDateAndEndDate(moment(startDate).add(1,"d").format("YYYY-MM-DD HH:00:00"),moment(endDate).add(1,"d").format("YYYY-MM-DD HH:00:00"));
console.log(dateTimeObj,"计算后的时间2");
// 实际时间 // 实际时间
actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf() actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf()
...@@ -634,12 +702,41 @@ ...@@ -634,12 +702,41 @@
}) })
return return
}else if(actualTime < originTime*0.8 && actualTime >= originTime*0.6){ }else if(actualTime < originTime*0.8 && actualTime >= originTime*0.6){
this.tempDateObj = {
startDate: dateTimeObj.tempStartDate,
endDate: dateTimeObj.tempEndDate,
duration: actualTime/60000,
durationType:2
}
this.$refs.popupDialog.open(); this.$refs.popupDialog.open();
return return
}else{
this.modeIndex = -1
this.modeIndex2 = index
let duration = (moment(dateTimeObj.tempEndDate).valueOf()-moment(dateTimeObj.tempStartDate).valueOf())/1000/60;
this.formatAllData = this.onTransiteForDate({
list: JSON.parse(JSON.stringify(this.dateIntervalList)),
startDateTime: dateTimeObj.tempStartDate,
endDateTime: dateTimeObj.tempEndDate,
duration,
durationType:2
});
} }
} else if( actualTime < originTime*0.8 && actualTime >= originTime*0.6){ } else if( actualTime < originTime*0.8 && actualTime >= originTime*0.6){
this.tempDateObj = {
startDate: dateTimeObj.tempStartDate,
endDate: dateTimeObj.tempEndDate,
duration: actualTime/60000,
durationType:2
}
this.$refs.popupDialog.open(); this.$refs.popupDialog.open();
return return
}else{ }else{
this.modeIndex = -1 this.modeIndex = -1
...@@ -654,53 +751,91 @@ ...@@ -654,53 +751,91 @@
}); });
} }
} } else {
// 如果此套餐的结束时间在12点后,则为闲时套餐,仅查看今日日否有合适的套餐
// console.log("闲时套餐")
dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
// 原时间
let originTime = moment(endDate).valueOf() - moment(startDate).valueOf()
// 实际时间
let actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf()
if( actualTime< originTime*0.6){
uni.showToast({
icon:"none",
title:'可使用时长不足,请选择其他日期'
})
return
} else if(actualTime < originTime*0.8 && actualTime >= originTime*0.6){
// 如果此套餐的结束时间在12点后,则为闲时套餐,仅查看今日日否有合适的套餐 this.tempDateObj = {
startDate: dateTimeObj.tempStartDate,
endDate: dateTimeObj.tempEndDate,
duration: actualTime/60000,
durationType:2
}
this.$refs.popupDialog.open();
return
}else{
this.modeIndex = -1
this.modeIndex2 = index
let duration = (moment(dateTimeObj.tempEndDate).valueOf()-moment(dateTimeObj.tempStartDate).valueOf())/1000/60;
this.formatAllData = this.onTransiteForDate({
list: JSON.parse(JSON.stringify(this.dateIntervalList)),
startDateTime: dateTimeObj.tempStartDate,
endDateTime: dateTimeObj.tempEndDate,
duration,
durationType:2
});
}
}
}, },
// 通过指定时间在当前时间段内查询合适的时间段 // 通过指定时间在当前时间段内查询合适的时间段
onComputeStartDateAndEndDate(startDate,endDate){ onComputeStartDateAndEndDate(startDate,endDate){
//重新设置开始时间和结束时间 //重新设置开始时间和结束时间
let tempStartDate = startDate; let tempStartDate = '';
let tempEndDate = endDate; let tempEndDate = '';
let startNeedChange = false; let startNeedChange = true;
let endNeedChange = false; let endNeedChange = true;
this.dateIntervalList.forEach(item=>{ this.dateIntervalList.forEach(item=>{
// 检查时段在开始时间和结束时间内 // 检查时段在开始时间和结束时间内
let start = moment(moment(item.timeHour).format("YYYY-MM-DD HH:00:00")).valueOf() let start = moment(moment(item.timeHour).format("YYYY-MM-DD HH:00:00")).valueOf()
let end = moment(moment(item.timeHour).format("YYYY-MM-DD HH:59:59")).valueOf() let end = moment(moment(item.timeHour).format("YYYY-MM-DD HH:59:59")).valueOf()
if( start < moment(endDate).valueOf() && start >= moment(startDate).valueOf()){ if( start < moment(endDate).valueOf() && start >= moment(startDate).valueOf()){
// 当前小时被完全占用
if(item.status ==1 && this.onCheckHourUse(item.startHoldTime,item.endHoldTime)){ if(item.status ==1 && tempStartDate && start > moment(tempStartDate).valueOf() && endNeedChange){
startNeedChange = true; endNeedChange = false;
tempStartDate = moment(item.endHoldTime).format("YYYY-MM-DD HH:mm:00") tempEndDate = moment(item.startHoldTime).format("YYYY-MM-DD HH:mm:00")
} }
if(item.status ==1 && !this.onCheckHourUse(item.startHoldTime,item.endHoldTime)){
tempStartDate = moment(item.endHoldTime).format("YYYY-MM-DD HH:mm:00") if(item.status ==0 && tempStartDate && start > moment(tempStartDate).valueOf() && endNeedChange){
startNeedChange = false; endNeedChange = true;
tempEndDate = moment(item.timeHour+':59:59').add(1,"m").format("YYYY-MM-DD HH:mm:00")
} }
if(item.status == 0 && startNeedChange){
tempStartDate = moment(item.timeHour).format("YYYY-MM-DD HH:00:00")
// 当前小时仅部分占用
if(item.status ==1 && !this.onCheckHourUse(item.startHoldTime,item.endHoldTime) && startNeedChange){
startNeedChange = false; startNeedChange = false;
tempStartDate = moment(moment(item.endHoldTime).format("YYYY-MM-DD HH:mm:00")).add(1,"m").format("YYYY-MM-DD HH:mm:00")
} }
if(start > moment(tempStartDate).valueOf() && endNeedChange){ if(item.status ==1 && this.onCheckHourUse(item.startHoldTime,item.endHoldTime) && startNeedChange){
endNeedChange = true; startNeedChange = true;
tempEndDate = moment(item.startHoldTime).format("YYYY-MM-DD HH:mm:00") tempStartDate = moment(moment(item.endHoldTime).format("YYYY-MM-DD HH:mm:00")).format("YYYY-MM-DD HH:mm:00")
} }
if(start > moment(tempStartDate).valueOf() && !endNeedChange && item.status == 1){ if(item.status == 0 && startNeedChange){
endNeedChange = false; tempStartDate = moment(item.timeHour).format("YYYY-MM-DD HH:00:00")
tempEndDate = moment(item.startHoldTime).format("YYYY-MM-DD HH:mm:00") startNeedChange = false;
} }
} }
}) })
console.log(tempStartDate,tempEndDate,9999);
return { return {
tempStartDate, tempStartDate,
tempEndDate tempEndDate
...@@ -708,7 +843,7 @@ ...@@ -708,7 +843,7 @@
}, },
// 通过指定时长在当前时间段内查询合适的时间段 // 通过指定时长在当前时间段内查询合适的时间段
onComputeByDuration(duration,durationType=1){ onComputeByDuration(duration,durationType=1){
console.log(duration,durationType,8888)
//重新设置开始时间和结束时间 //重新设置开始时间和结束时间
let m = Number(duration)*60; let m = Number(duration)*60;
if (durationType === 2) { if (durationType === 2) {
...@@ -722,19 +857,17 @@ ...@@ -722,19 +857,17 @@
let startNeedChange = true; let startNeedChange = true;
let endNeedChange = true; let endNeedChange = true;
console.log(this.dateIntervalList,9999,"原列表")
this.dateIntervalList.forEach((item,k) => { this.dateIntervalList.forEach((item,k) => {
if(k<24){ if(k<24){
if(item.status == 1 && startNeedChange && this.onCheckHourUse(item.startHoldTime,item.endHoldTime)){ if(item.status == 1 && startNeedChange && this.onCheckHourUse(item.startHoldTime,item.endHoldTime)){
tempStartDate = moment(item.endHoldTime).format("YYYY-MM-DD HH:mm:00") tempStartDate = moment(item.endHoldTime).add(1,'m').format("YYYY-MM-DD HH:mm:00")
startNeedChange = true startNeedChange = true
endNeedChange = true; endNeedChange = true;
} }
if(item.status == 1 && startNeedChange && !this.onCheckHourUse(item.startHoldTime,item.endHoldTime)){ if(item.status == 1 && startNeedChange && !this.onCheckHourUse(item.startHoldTime,item.endHoldTime)){
tempStartDate = moment(item.endHoldTime).format("YYYY-MM-DD HH:mm:00") tempStartDate = moment(item.endHoldTime).add(1,'m').format("YYYY-MM-DD HH:mm:00")
startNeedChange = false startNeedChange = false
endNeedChange = true; endNeedChange = true;
} }
...@@ -756,7 +889,7 @@ ...@@ -756,7 +889,7 @@
endNeedChange = false; endNeedChange = false;
}else{ }else{
if(k <24 ){ if(k <24 ){
tempStartDate = moment(item.endHoldTime).format("YYYY-MM-DD HH:mm:00") tempStartDate = moment(item.endHoldTime).add(1,'m').format("YYYY-MM-DD HH:mm:00")
startNeedChange = true; startNeedChange = true;
}else{ }else{
startNeedChange = false; startNeedChange = false;
...@@ -766,7 +899,6 @@ ...@@ -766,7 +899,6 @@
} }
}else if(item.status == 0 && endNeedChange && tempStartDate){ }else if(item.status == 0 && endNeedChange && tempStartDate){
console.log(k)
let endDate = moment(item.timeHour).format("YYYY-MM-DD HH:59:00") let endDate = moment(item.timeHour).format("YYYY-MM-DD HH:59:00")
if( moment(endDate).valueOf() - moment(tempStartDate).valueOf() >= timeStampLong){ if( moment(endDate).valueOf() - moment(tempStartDate).valueOf() >= timeStampLong){
endNeedChange = false; endNeedChange = false;
...@@ -783,7 +915,6 @@ ...@@ -783,7 +915,6 @@
endDateTime: tempEndDate, endDateTime: tempEndDate,
useStatus: moment(tempEndDate).valueOf() - moment(tempStartDate).valueOf() < timeStampLong useStatus: moment(tempEndDate).valueOf() - moment(tempStartDate).valueOf() < timeStampLong
} }
console.log(params,"通过时长找合适时间段1213")
return params return params
}, },
...@@ -869,7 +1000,9 @@ ...@@ -869,7 +1000,9 @@
}) })
// 判断房间有没有绑定套餐 // 判断房间有没有绑定套餐
if (this.roomInfo.packList && this.roomInfo.packList.length) { if (this.roomInfo.packList && this.roomInfo.packList.length) {
this.packageMode = this.roomInfo.packList this.packageMode = [];
this.packList = this.roomInfo.packList;
// console.log(this.packageMode,"通宵和闲时套餐")
this.modeIndex = 0; this.modeIndex = 0;
} }
if (this.roomInfo.roomLabelList && this.roomInfo.roomLabelList.length) { if (this.roomInfo.roomLabelList && this.roomInfo.roomLabelList.length) {
...@@ -896,6 +1029,14 @@ ...@@ -896,6 +1029,14 @@
hour: index > 0 && index - 24 == 0 ? '次日' : index > 24 ? index - 24 : index hour: index > 0 && index - 24 == 0 ? '次日' : index > 24 ? index - 24 : index
} }
}) })
this.packageMode = this.packList.map(item=>{
return {
...item,
show: this.onCheckPackageUse(item)
}
})
this.formatAllData = this.onTransiteForDate({ this.formatAllData = this.onTransiteForDate({
startDateTime:this.orderType ==2 && this.orderInfo.status == 1? this.orderInfo.endDate : '' , startDateTime:this.orderType ==2 && this.orderInfo.status == 1? this.orderInfo.endDate : '' ,
list: JSON.parse(JSON.stringify(this.dateIntervalList)), list: JSON.parse(JSON.stringify(this.dateIntervalList)),
...@@ -1019,7 +1160,7 @@ ...@@ -1019,7 +1160,7 @@
}, },
// 开始选择时间 // 开始选择时间
onSelectDate() { onSelectDate() {
if(this.orderType==1){ if(this.orderType==1 && this.modeIndex >= 0){
this.hourList = [ this.hourList = [
"00", "00",
"01", "01",
...@@ -1115,7 +1256,6 @@ ...@@ -1115,7 +1256,6 @@
}, },
complete: (res) => { complete: (res) => {
// this.$refs.confirmPop.open();
this.onOrderConfirm(); this.onOrderConfirm();
} }
}) })
...@@ -1135,17 +1275,11 @@ ...@@ -1135,17 +1275,11 @@
// }) // })
// return; // return;
// } // }
let nowDate = moment().valueOf();
let nowDate = moment().format("MMDD") let setDate = moment(this.formatAllData.nowDate).valueOf();
let nowTime = moment().format("HHmm")
let setDate = moment(this.dateObj.startDate).format("MMDD");
let setTime = moment(this.dateObj.startDate).format("HHmm");
// 如果当前时间大于开始时间,则不允许下单 // 如果当前时间大于开始时间,则不允许下单
if (this.orderType == 1 && nowDate == setDate && nowTime > setTime) { if (this.orderType == 1 && nowDate > setDate ) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: "当前时间晚于预约开始时间,请重新选择预约时间" title: "当前时间晚于预约开始时间,请重新选择预约时间"
...@@ -1153,16 +1287,6 @@ ...@@ -1153,16 +1287,6 @@
return return
} }
if (this.orderTypeList[this.index].type === 2) {
if (this.packageMode[this.modeIndex].packaEndPeriod - this.packageMode[this.modeIndex]
.packaStartPeriod < 23 && Number(moment(this.dateObj.endDate).format("HH")) >= this.packageMode[
this.modeIndex].packaEndPeriod) {
this.content =
`所选套餐为限时套餐,订单结束时间为当日${Number(this.packageMode[this.modeIndex].packaEndPeriod)>=10?this.packageMode[this.modeIndex].packaEndPeriod:'0'+this.packageMode[this.modeIndex].packaEndPeriod}:00,请注意下单结束时间!`
this.$refs.popupConfirm.open()
return
}
}
if (!this.useDateStatus) { if (!this.useDateStatus) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
...@@ -1170,6 +1294,9 @@ ...@@ -1170,6 +1294,9 @@
}) })
return return
} }
this.orderDateDes = moment(this.formatAllData.formatAllData).format("YYYY年MM月DD日")
this.orderWeekDes = moment(this.formatAllData.formatAllData).days();
this.$refs.confirmPop.open(); this.$refs.confirmPop.open();
}, },
close() { close() {
...@@ -1324,7 +1451,15 @@ ...@@ -1324,7 +1451,15 @@
}) })
return return
} }
let startDate = val.endHoldTime? moment(val.endHoldTime).add(1,'m').format("YYYY-MM-DD HH:mm:00") : moment(val.timeHour).format("YYYY-MM-DD HH:00:00") let startDate = "";
if(val.endHoldTime && this.onCheckHourUse(val.startHoldTime, val.endHoldTime)){
startDate = moment(val.endHoldTime).format("YYYY-MM-DD HH:mm:00")
}else if(val.endHoldTime && !this.onCheckHourUse(val.startHoldTime, val.endHoldTime)){
startDate = moment(val.endHoldTime).add(1,'m').format("YYYY-MM-DD HH:mm:00")
} else {
startDate = moment(val.timeHour).format("YYYY-MM-DD HH:00:00")
}
this.formatAllData = this.onTransiteForDate({ this.formatAllData = this.onTransiteForDate({
list: JSON.parse(JSON.stringify(this.dateIntervalList)), list: JSON.parse(JSON.stringify(this.dateIntervalList)),
startDateTime: startDate, startDateTime: startDate,
...@@ -1342,25 +1477,35 @@ ...@@ -1342,25 +1477,35 @@
m = Number(duration) m = Number(duration)
} }
let stempLong = m*60000; let stempLong = m*60000;
let startStemp = moment(startDate).valueOf();
let endStemp = startStemp + stempLong;
let nextStatus = false; let nextStatus = false;
this.dateIntervalList.forEach((item,k) =>{ this.dateIntervalList.forEach((item,k) =>{
if(nextStatus) return; if(nextStatus) return;
let start = moment(item.timeHour+':00:00').valueOf(); let start = moment(item.timeHour+':00:00').valueOf();
let end = moment(item.timeHour+':59:59').valueOf(); let end = moment(item.timeHour+':59:59').valueOf();
if( end > moment(startDate).valueOf() && start < moment(startDate).valueOf()+stempLong){ if( end > startStemp && start < endStemp){
if(item.status ==1){ if(item.status ==1){
if(moment(item.endHoldTime).valueOf() > moment(startDate).valueOf() ){ if(this.onCheckHourUse(item.startHoldTime,item.endHoldTime)){
useStatus = true;
nextStatus = true;
}else{
if( moment(item.startHoldTime).valueOf() > startStemp && moment(item.endHoldTime).valueOf() < startStemp){
useStatus = true; useStatus = true;
nextStatus = true; nextStatus = true;
} }
if(moment(item.startHoldTime).valueOf()< moment(startDate).valueOf() + stempLong){
if( moment(item.startHoldTime).valueOf() > endStemp && moment(item.endHoldTime).valueOf() < endStemp){
useStatus = true useStatus = true
nextStatus = true; nextStatus = true;
} }
} }
} }
}
}) })
return useStatus return useStatus
}, },
...@@ -1398,11 +1543,8 @@ ...@@ -1398,11 +1543,8 @@
// 开始和结束时间的毫秒数 // 开始和结束时间的毫秒数
startStamp = moment(params.startDateTime).valueOf(); startStamp = moment(params.startDateTime).valueOf();
endStamp = startStamp + m*60000; endStamp = startStamp + m*60000;
dateObj.useStatus = this.onUseByStartAndDuration(params.startDateTime,m,2) dateObj.useStatus = this.onUseByStartAndDuration(params.startDateTime,m,2)
console.log(dateObj.useStatus,9999334)
} else if(params.duration){ } else if(params.duration){
dateObj = this.onComputeByDuration(m,2); dateObj = this.onComputeByDuration(m,2);
startStamp = moment(dateObj.startDateTime).valueOf(); startStamp = moment(dateObj.startDateTime).valueOf();
...@@ -1419,6 +1561,11 @@ ...@@ -1419,6 +1561,11 @@
item.status = 2 item.status = 2
} }
if(this.orderType == 2 && startStamp>= startH && endStamp <= endH ){
item.status = 2
}
return item return item
}) })
...@@ -1436,10 +1583,8 @@ ...@@ -1436,10 +1583,8 @@
useStatus:dateObj.useStatus, useStatus:dateObj.useStatus,
durationType: 2, durationType: 2,
} }
// 获取用户可用优化券 // 获取用户可用优化券
this.onGetUseCoupon(paramsData) this.onGetUseCoupon(paramsData)
console.log(paramsData,"返回结果")
return paramsData return paramsData
}, },
onCancleTip(){ onCancleTip(){
...@@ -1447,10 +1592,37 @@ ...@@ -1447,10 +1592,37 @@
this.$refs.popupMessage2.close(); this.$refs.popupMessage2.close();
this.$refs.popupDialog.close(); this.$refs.popupDialog.close();
}, },
// 检查当前小时段是否被全部占用 // 检查当前小时段是否被全部占用 true 完全占用 false 部分占用
onCheckHourUse(startDate,endDate) { onCheckHourUse(startDate,endDate) {
let timeStamp = moment(endDate).valueOf()-moment(startDate).valueOf(); let timeStamp = moment(endDate).valueOf()-moment(startDate).valueOf();
return timeStamp >= 3599000 return timeStamp >= 3599000
},
//检查套餐后半段60%的时间内是否有被占用,有被占用,则无法预定
onCheckPackUse(startDate,endDate) {
let useStatus = false;
let startStemp = moment(startDate).valueOf();
let endStemp = moment(endDate).valueOf();
let timeStamp = moment(endDate).valueOf()-moment(startDate).valueOf();
startStemp = startStemp + timeStamp*0.4;
this.dateIntervalList.forEach(item=>{
let start = moment(item.timeHour+':00:00').valueOf();
let end = moment(item.timeHour+':59:59').valueOf();
if(end > startStemp && start < endStemp){
if(item.status == 1){
useStatus = true;
}
}
})
return useStatus
} }
} }
} }
...@@ -1690,6 +1862,7 @@ ...@@ -1690,6 +1862,7 @@
border-radius: 12upx; border-radius: 12upx;
padding: 10upx 6upx; padding: 10upx 6upx;
.room-label-box{ .room-label-box{
position: relative;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
...@@ -1698,6 +1871,18 @@ ...@@ -1698,6 +1871,18 @@
.item { .item {
padding: 8upx 20upx; padding: 8upx 20upx;
} }
.pre-icon{
position: absolute;
top: -8upx;
right: -10upx;
display: flex;
width: 64upx;
z-index: 6;
image{
width: 100%;
max-height: 64upx;
}
}
} }
} }
.package-list{ .package-list{
...@@ -1713,6 +1898,10 @@ ...@@ -1713,6 +1898,10 @@
.item{ .item{
padding: 8rpx 20rpx; padding: 8rpx 20rpx;
} }
.gray{
background: #c3c3c3;
color: #f5f5f5;
}
} }
} }
.item { .item {
...@@ -1779,24 +1968,30 @@ ...@@ -1779,24 +1968,30 @@
.part-3 { .part-3 {
text { text {
color: #8C8C8C; color: #c5c5c5;
} }
} }
.cu-btn { .cu-btn {
width: 80%; width: 92%;
font-size: 32upx; font-size: 34upx;
} }
.line-black { .line-black {
border: 1px solid #e03997; border: 2px solid #e03997;
color: #e03997; color: #e03997;
} }
.line-black::after { .line-black::after {
border-color: transparent; border-color: transparent;
} }
.line-gray{
border: 2px solid #c5c5c5;
color: #c5c5c5;
}
.line-gray::after {
border-color: transparent;
}
.line-pink { .line-pink {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -1894,6 +2089,7 @@ ...@@ -1894,6 +2089,7 @@
} }
.count-price { .count-price {
position: relative;
display: flex; display: flex;
width: 100%; width: 100%;
background-color: #ffffff; background-color: #ffffff;
...@@ -1902,10 +2098,31 @@ ...@@ -1902,10 +2098,31 @@
padding: 0 0 15upx; padding: 0 0 15upx;
overflow: hidden; overflow: hidden;
align-items: center; align-items: center;
.logo-box{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
z-index: 0;
image{
width: 402upx;
height: 322upx;
}
}
.flex-between{
position: relative;
z-index: 3;
}
.text-left { .text-left {
width: 120upx; width: 120upx;
text-align-last: justify; text-align-last: justify;
font-weight: 600;
font-size: 30rpx;
color: #333333;
} }
.original-price { .original-price {
...@@ -1968,9 +2185,12 @@ ...@@ -1968,9 +2185,12 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
color: #000000;
.amount{
color: #e03997; color: #e03997;
} }
} }
}
.btn-box { .btn-box {
.cu-btn-1 { .cu-btn-1 {
...@@ -2029,36 +2249,104 @@ ...@@ -2029,36 +2249,104 @@
} }
.confirm-pop { .confirm-pop {
width: 74vw; width: 100vw;
.pop-content-box { .pop-content-box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
min-height: 50vh; height: 660upx;
background-color: #ffffff; background: #FFFFFF;
border-radius: 20upx; box-shadow: 0 2upx 38upx 0 rgba(0,0,0,0.27);
border-radius: 16upx 16upx 0rpx 0rpx;
.info-box { .info-box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center;
align-items: center;
width: 92%; width: 92%;
margin: 0 auto; padding: 0 0 30upx;
padding-top: 12upx 0; margin: 30upx auto 0;
background: #FFFFFF;
border-radius: 16rpx;
border: 2px solid #8C8C8C;
.info-store{
margin-top: -30upx;
width: 308upx;
height: 60upx;
display: flex;
justify-content: center;
align-items: center;
z-index: 44;
background: #FFFFFF;
.text-title{
font-weight: 600;
font-size: 36rpx;
color: #E03997;
}
}
.time-box{
display: flex;
flex-direction: row;
justify-content: center;
width: 100%;
align-items: center;
margin: 20upx 0;
.part-1{
position: relative;
display: flex;
flex: 1;
margin: 0 20upx;
image{
width: 100%;
height: 104upx;
}
.absolute{
position: absolute;
top:0;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
text{
font-weight: 600;
font-size: 60upx;
color: #333333;
}
}
}
text{
font-weight: 600;
font-size: 30rpx;
color: #333333;
}
}
.info { .info {
padding: 12upx 0; width: 100%;
padding: 12upx 30upx;
font-size: 20upx; font-size: 20upx;
text{
font-weight: 600;
font-size: 32rpx;
color: #333333;
}
} }
} }
.title { .title {
display: flex; display: flex;
justify-content: center; flex-direction: row;
align-items: center; align-items: center;
width: 100%; width: 100%;
padding: 20upx; padding: 32upx 28upx;
border-bottom: 1px solid #ffaaff; text{
font-weight: 600;
font-size: 36upx;
color: #333333;
}
} }
.flex-1 { .flex-1 {
...@@ -2082,15 +2370,40 @@ ...@@ -2082,15 +2370,40 @@
} }
} }
.flex-between { .footer-btn-box {
display: flex; display: flex;
justify-content: center;
align-items: center;
width: 100%; width: 100%;
padding: 0 5%; padding: 0 5%;
margin: 24upx 0; margin: 40upx 0;
.btn-close{
.btn-box { width: 240upx;
width: 45%; height: 64upx;
border: 2upx solid;
background: #F5F5F5;
box-shadow: 0 5upx 9upx 0 rgba(54,4,9,0.42);
border-image: linear-gradient(0deg, #9D9C9C, #DEDCDC) 2 2;
margin: 0 12upx;
font-weight: 600;
font-size: 32upx;
color: #333333;
border-radius: 6upx;
opacity: 0.95;
} }
.btn-confirm{
width: 240upx;
height: 64upx;
background: linear-gradient(97deg, #E5268B, #FD5661);
box-shadow: 0 5upx 9upx 0 rgba(54,4,9,0.42);
border-radius: 6upx;
opacity: 0.95;
margin: 0 12upx;
font-weight: 600;
font-size: 32rpx;
color: #FFFFFF;
}
} }
} }
......
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