Commit 7448ce9f by zhangzhen

细节优化

parent d4a97ace
...@@ -694,65 +694,68 @@ ...@@ -694,65 +694,68 @@
// 套餐校验,检查当前套餐是否可用 // 套餐校验,检查当前套餐是否可用
onCheckPackageUse(valData){ onCheckPackageUse(valData){
let useStatus = true; let useStatus = true;
let startStr = `${this.dateList[this.dateIndex].readDate} ${Number(valData.packaStartPeriod)>= 10 ?valData.packaStartPeriod: '0'+valData.packaStartPeriod}:00:00` let startStr = `${this.dateList[this.dateIndex].readDate} ${Number(valData.packaStartPeriod)>= 10 ?valData.packaStartPeriod: '0'+valData.packaStartPeriod}:00:00`
let startDate = moment(moment().format(startStr)).format("YYYY-MM-DD HH:00:00"); let startDate = moment(moment().format(startStr)).format("YYYY-MM-DD HH:00:00");
let endStr = `${this.dateList[this.dateIndex].readDate} ${Number(valData.packaEndPeriod)>= 10 ?valData.packaEndPeriod: '0'+valData.packaEndPeriod}:00:00` let endStr = `${this.dateList[this.dateIndex].readDate} ${Number(valData.packaEndPeriod)>= 10 ?valData.packaEndPeriod: '0'+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.orderType == 2){
// if(!(moment(this.orderInfo.endDate).valueOf() >= moment(startDate).valueOf() && moment(this.orderInfo.endDate).valueOf() <= moment(endDate).valueOf())){
// useStatus = false;
// }
// }
// 如果此套餐的结束时间在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 = {};
if(moment(endDate).valueOf() < moment(pointDateForm).valueOf()){ if(moment(endDate).valueOf() < moment(pointDateForm).valueOf()){
if(this.orderType == 2){ if(this.orderType == 2){
let orderEndDate = moment(this.orderInfo.endDate).valueOf() // 1.确定续套餐的结束时间
let b1 = orderEndDate >= moment(startDate).valueOf() && orderEndDate <= moment(endDate).valueOf(); let orderEndDate = ''
let b2 = orderEndDate >= moment(moment(startDate).add(1,'d')).valueOf() && orderEndDate <= moment(moment(endDate).add(1,"d")).valueOf(); if(this.orderInfo.status ==1){
if(!(b1||b2)){ orderEndDate = moment(this.orderInfo.endDate).valueOf()
useStatus = false; } else{
return; orderEndDate = moment().valueOf()
} }
} startDate = moment(orderEndDate).format(`YYYY-MM-DD 0${valData.packaStartPeriod}:00:00`);
//通宵套餐 endDate = moment(orderEndDate).format(`YYYY-MM-DD 0${valData.packaEndPeriod}:00:00`);
dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate); // 续夜宵套餐时的开始时间必须在设定的开始和结束时间内
let b1 = orderEndDate >= moment(startDate).valueOf() && orderEndDate <= moment(endDate).valueOf();
// 实际时长小于原时长的60%则选择明天的时间 // 续夜宵套餐的开始时间必须在设定的开始时间和开始时间四个小时内
// 原时间 let b2 = orderEndDate >= moment(startDate).valueOf() && orderEndDate <= moment(startDate).valueOf()+4*60*60*1000;
let originTime = moment(endDate).valueOf() - moment(startDate).valueOf()
// 实际时间 if(!(b1&&b2) || this.onCheckPackUse(startDate,endDate,4)){
let actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf()
if( actualTime < originTime - 4*60*60*1000 || this.onCheckPackUse(startDate,endDate,4)){
// 实际时长小于原时长的60%则选择明天的时间
// 加一天时间重新计算
if(this.dateIndex != 0){
useStatus = false; useStatus = false;
return
} }
}else{
startDate = moment(startDate).add(1,"d").format("YYYY-MM-DD HH:00:00"); //通宵套餐
endDate = moment(endDate).add(1,"d").format("YYYY-MM-DD HH:00:00")
dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate); dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
// 实际时间 // 实际时长小于原时长的60%则选择明天的时间
actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf() // 原时间
let originTime = moment(endDate).valueOf() - moment(startDate).valueOf()
// 实际时间
let actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf()
if( actualTime < originTime - 4*60*60*1000 || this.onCheckPackUse(startDate,endDate,4)){ if( actualTime < originTime - 4*60*60*1000 || this.onCheckPackUse(startDate,endDate,4)){
useStatus = false; // 实际时长小于原时长的60%则选择明天的时间
return // 加一天时间重新计算
} if(this.dateIndex != 0){
} useStatus = false;
return
}
startDate = moment(startDate).add(1,"d").format("YYYY-MM-DD HH:00:00");
endDate = moment(endDate).add(1,"d").format("YYYY-MM-DD HH:00:00")
dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
// 实际时间
actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf()
if( actualTime < originTime - 4*60*60*1000 || this.onCheckPackUse(startDate,endDate,4)){
useStatus = false;
return
}
}
}
} else { } else {
if(this.orderType == 2){ if(this.orderType == 2){
if(!(moment(this.orderInfo.endDate).valueOf() >= moment(startDate).valueOf() && moment(this.orderInfo.endDate).valueOf() <= moment(endDate).valueOf())){ if(!(moment(this.orderInfo.endDate).valueOf() >= moment(startDate).valueOf() && moment(this.orderInfo.endDate).valueOf() <= moment(endDate).valueOf())){
useStatus = false; useStatus = false;
} }
return
} }
// 如果此套餐的结束时间在12点后,则为闲时套餐,仅查看今日日否有合适的套餐 // 如果此套餐的结束时间在12点后,则为闲时套餐,仅查看今日日否有合适的套餐
// 闲时套餐 // 闲时套餐
...@@ -781,13 +784,58 @@ ...@@ -781,13 +784,58 @@
let hEndtStr = this.packageMode[this.tempPackageIndex].packaEndPeriod let hEndtStr = this.packageMode[this.tempPackageIndex].packaEndPeriod
let endStr = `${this.dateList[this.dateIndex].readDate} ${Number(hEndtStr)>= 10 ?hEndtStr:'0'+hEndtStr}:00:00` let endStr = `${this.dateList[this.dateIndex].readDate} ${Number(hEndtStr)>= 10 ?hEndtStr:'0'+hEndtStr}: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");
// 如果此套餐的结束时间在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 = {};
if(moment(endDate).valueOf() < moment(pointDateForm).valueOf()){ if(moment(endDate).valueOf() < moment(pointDateForm).valueOf()){
// 如果是续单
if(this.orderType ==2){
let orderEndDate = moment().format("YYYY-MM-DD HH:mm:ss")
if(this.orderInfo.status ==1){
orderEndDate = this.orderInfo.endDate
}
startDate = moment(orderEndDate).format(`YYYY-MM-DD 0${this.packageMode[this.tempPackageIndex].packaStartPeriod}:00:00`);
endDate = moment(orderEndDate).format(`YYYY-MM-DD 0${this.packageMode[this.tempPackageIndex].packaEndPeriod}:00:00`);
// 续夜宵套餐时的开始时间必须在设定的开始和结束时间内
let b1 =moment(orderEndDate).valueOf() >= moment(startDate).valueOf() && moment(orderEndDate).valueOf() <= moment(endDate).valueOf();
if(b1){
if( moment(endDate).valueOf() - moment(orderEndDate).valueOf()>=3*60*60*1000 && moment(endDate).valueOf()-moment(orderEndDate).valueOf() < 4*60*60*1000){
this.tempDateObj = {
startDate: orderEndDate,
endDate: endDate,
duration: (moment(endDate).valueOf() - moment(orderEndDate).valueOf())/60000,
durationType:2
}
this.warnTip = '通宵套餐,不足4小时,是否预定?'
this.$refs.popupDialog.open();
return
}else if(moment(endDate).valueOf()- moment(orderEndDate).valueOf() > 4*60*60*1000){
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: orderEndDate,
endDateTime: endDate,
duration: (moment(endDate).valueOf() - moment(orderEndDate).valueOf())/60000,
durationType:2
});
}else{
}
}
}else{
//否则是订单
// 通宵套餐 // 通宵套餐
dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate); dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
// 原时间 // 原时间
let originTime = moment(endDate).valueOf() - moment(startDate).valueOf() let originTime = moment(endDate).valueOf() - moment(startDate).valueOf()
// 实际时间 // 实际时间
...@@ -796,50 +844,48 @@ ...@@ -796,50 +844,48 @@
if( actualTime< originTime - 4*60*60*1000 || this.onCheckPackUse(startDate,endDate,4)){ if( actualTime< originTime - 4*60*60*1000 || this.onCheckPackUse(startDate,endDate,4)){
// 实际时长小于原时长的60%则选择明天的时间 // 实际时长小于原时长的60%则选择明天的时间
// 加一天时间重新计算 // 加一天时间重新计算
if(this.dateIndex != 0 ){
if(this.dateIndex != 0){
uni.showToast({ uni.showToast({
icon:"none", icon:"none",
title:'可使用时长不足,请选择其他日期' title:'可使用时长不足,请选择其他日期'
}) })
return
}
startDate = moment(startDate).add(1,"d").format("YYYY-MM-DD HH:00:00");
endDate = moment(endDate).add(1,"d").format("YYYY-MM-DD HH:00:00");
dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
// 实际时间
actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf()
if( actualTime < originTime - 4*60*60*1000 || this.onCheckPackUse(startDate,endDate,4)){
uni.showToast({
icon:"none",
title:'可使用时长不足,请选择其他日期'
})
return
}else if(actualTime < originTime - 3*60*60*1000 && actualTime >= originTime - 4*60*60*1000){
this.tempDateObj = {
startDate: dateTimeObj.tempStartDate,
endDate: dateTimeObj.tempEndDate,
duration: actualTime/60000,
durationType:2
}
this.warnTip = '通宵套餐,不足4小时,是否预定?'
this.$refs.popupDialog.open();
return
}else{ }else{
this.modeIndex = -1 startDate = moment(startDate).add(1,"d").format("YYYY-MM-DD HH:00:00");
this.modeIndex2 = index endDate = moment(endDate).add(1,"d").format("YYYY-MM-DD HH:00:00");
let duration = (moment(dateTimeObj.tempEndDate).valueOf()-moment(dateTimeObj.tempStartDate).valueOf())/1000/60; dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
this.formatAllData = this.onTransiteForDate({ // 实际时间
list: JSON.parse(JSON.stringify(this.dateIntervalList)), actualTime = moment(dateTimeObj.tempEndDate).valueOf() - moment(dateTimeObj.tempStartDate).valueOf()
startDateTime: dateTimeObj.tempStartDate,
endDateTime: dateTimeObj.tempEndDate,
duration,
durationType:2
});
if( actualTime < originTime - 4*60*60*1000 || this.onCheckPackUse(startDate,endDate,4)){
uni.showToast({
icon:"none",
title:'可使用时长不足,请选择其他日期'
})
return
}else if(actualTime < originTime - 3*60*60*1000 && actualTime >= originTime - 4*60*60*1000){
this.tempDateObj = {
startDate: dateTimeObj.tempStartDate,
endDate: dateTimeObj.tempEndDate,
duration: actualTime/60000,
durationType:2
}
this.warnTip = '通宵套餐,不足4小时,是否预定?'
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
});
}
} }
} else if( actualTime < originTime - 3*60*60*1000 && actualTime >= originTime - 4*60*60*1000){ } else if( actualTime < originTime - 3*60*60*1000 && actualTime >= originTime - 4*60*60*1000){
this.tempDateObj = { this.tempDateObj = {
...@@ -853,7 +899,6 @@ ...@@ -853,7 +899,6 @@
return return
}else{ }else{
this.modeIndex = -1 this.modeIndex = -1
this.modeIndex2 = index this.modeIndex2 = index
let duration = (moment(dateTimeObj.tempEndDate).valueOf()-moment(dateTimeObj.tempStartDate).valueOf())/1000/60; let duration = (moment(dateTimeObj.tempEndDate).valueOf()-moment(dateTimeObj.tempStartDate).valueOf())/1000/60;
...@@ -865,7 +910,7 @@ ...@@ -865,7 +910,7 @@
durationType:2 durationType:2
}); });
} }
}
} else { } else {
// 如果此套餐的结束时间在12点后,则为闲时套餐,仅查看今日日否有合适的套餐 // 如果此套餐的结束时间在12点后,则为闲时套餐,仅查看今日日否有合适的套餐
dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate); dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
...@@ -944,7 +989,7 @@ ...@@ -944,7 +989,7 @@
} }
} }
}) })
return { return {
tempStartDate, tempStartDate,
tempEndDate tempEndDate
...@@ -1214,11 +1259,12 @@ ...@@ -1214,11 +1259,12 @@
}else{ }else{
this.selectCouponIndex = -1; this.selectCouponIndex = -1;
} }
if(this.allDayUseStatus){ // if(this.allDayUseStatus){
this.computePriceInfo ='' // this.computePriceInfo =''
}else{ // }else{
this.onQueryCardUse();
} // }
this.onQueryCardUse();
} else if (res.data.code == 401) { } else if (res.data.code == 401) {
this.$refs.loginPop.open(); this.$refs.loginPop.open();
} }
...@@ -1270,8 +1316,7 @@ ...@@ -1270,8 +1316,7 @@
roomLabelId : this.modeIndex >= 0 ? this.roomLabelList[this.modeIndex].id : '', roomLabelId : this.modeIndex >= 0 ? this.roomLabelList[this.modeIndex].id : '',
} }
queryCardUse(params).then(res => { queryCardUse(params).then(res => {
console.log(res,9999)
if(res.data.code == 200){ if(res.data.code == 200){
if(res.data.data && res.data.data.consumerMonthlyCard && res.data.data.consumerMonthlyCard.length){ if(res.data.data && res.data.data.consumerMonthlyCard && res.data.data.consumerMonthlyCard.length){
...@@ -1293,10 +1338,7 @@ ...@@ -1293,10 +1338,7 @@
}else{ }else{
this.secondaryCardList = []; this.secondaryCardList = [];
} }
console.log(this.radioChecked,"4545455")
console.log(this.monthlyCardList)
console.log(this.secondaryCardList)
this.onComputePrice(); this.onComputePrice();
} }
}) })
......
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
<image :src="assetsPath+'/vip/banner2.png'" mode="widthFix"></image> <image :src="assetsPath+'/vip/banner2.png'" mode="widthFix"></image>
</view> --> </view> -->
<!-- <view v-if="tabIndex ==2" class="bg-box-1 margin-top"> <view v-if="tabIndex ==2" class="bg-box-1 margin-top">
<view class="bg-box-2"> <view class="bg-box-2">
<view class="flex-col list-box-2"> <view class="flex-col list-box-2">
<view class="flex-row-center title-content"> <view class="flex-row-center title-content">
...@@ -278,9 +278,9 @@ ...@@ -278,9 +278,9 @@
</view> </view>
</view> </view>
</view> </view>
</view> --> </view>
<!-- <view v-if="tabIndex ==2" class="bg-box-1 margin-top"> <view v-if="tabIndex ==2" class="bg-box-1 margin-top">
<view class="bg-box-2"> <view class="bg-box-2">
<view class="flex-col list-box-2"> <view class="flex-col list-box-2">
<view class="flex-row-center title-content"> <view class="flex-row-center title-content">
...@@ -342,7 +342,7 @@ ...@@ -342,7 +342,7 @@
</view> </view>
</view> </view>
</view> </view>
</view> --> </view>
</view> </view>
</view> </view>
...@@ -694,8 +694,8 @@ ...@@ -694,8 +694,8 @@
}, },
{ {
iconUrl: config.assetsPath + "/vip/p_10.png", iconUrl: config.assetsPath + "/vip/p_10.png",
title: "卡", title: "权益卡",
slogan: "特惠购", slogan: "次卡月卡特权",
value: 8 value: 8
}, },
{ {
...@@ -712,12 +712,12 @@ ...@@ -712,12 +712,12 @@
}, },
{ {
imgUrl:config.assetsPath+'/banner/2.png', imgUrl:config.assetsPath+'/banner/2.png',
routePath:'' routePath:'/pages/activity/index'
},
{
imgUrl:config.assetsPath+'/banner/3.png',
routePath:'/pages/storeList/storeList'
}, },
// {
// imgUrl:config.assetsPath+'/banner/3.png',
// routePath:'/pages/storeList/storeList'
// },
], ],
monthlyCardConf:'', monthlyCardConf:'',
secondaryCardConf:'', secondaryCardConf:'',
......
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