Commit 7448ce9f by zhangzhen

细节优化

parent d4a97ace
......@@ -694,17 +694,10 @@
// 套餐校验,检查当前套餐是否可用
onCheckPackageUse(valData){
let useStatus = true;
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 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");
// 如果是续单,则订单的结束时间必须在套餐的开始时间和结束时间内,否则无法续对应的套餐
// if(this.orderType == 2){
// if(!(moment(this.orderInfo.endDate).valueOf() >= moment(startDate).valueOf() && moment(this.orderInfo.endDate).valueOf() <= moment(endDate).valueOf())){
// useStatus = false;
// }
// }
// 如果此套餐的结束时间在11点前,则为通宵套餐,会在当天及明天进行找合适的时间段,否则则没有合适的套餐时段
let pointDateForm = moment(this.dateList[this.dateIndex].readDate).format("YYYY-MM-DD 11:00:00");
......@@ -712,17 +705,26 @@
if(moment(endDate).valueOf() < moment(pointDateForm).valueOf()){
if(this.orderType == 2){
let orderEndDate = moment(this.orderInfo.endDate).valueOf()
// 1.确定续套餐的结束时间
let orderEndDate = ''
if(this.orderInfo.status ==1){
orderEndDate = moment(this.orderInfo.endDate).valueOf()
} else{
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`);
// 续夜宵套餐时的开始时间必须在设定的开始和结束时间内
let b1 = orderEndDate >= moment(startDate).valueOf() && orderEndDate <= moment(endDate).valueOf();
let b2 = orderEndDate >= moment(moment(startDate).add(1,'d')).valueOf() && orderEndDate <= moment(moment(endDate).add(1,"d")).valueOf();
if(!(b1||b2)){
// 续夜宵套餐的开始时间必须在设定的开始时间和开始时间四个小时内
let b2 = orderEndDate >= moment(startDate).valueOf() && orderEndDate <= moment(startDate).valueOf()+4*60*60*1000;
if(!(b1&&b2) || this.onCheckPackUse(startDate,endDate,4)){
useStatus = false;
return;
}
}
}else{
//通宵套餐
dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
// 实际时长小于原时长的60%则选择明天的时间
// 原时间
let originTime = moment(endDate).valueOf() - moment(startDate).valueOf()
......@@ -747,12 +749,13 @@
return
}
}
}
} else {
if(this.orderType == 2){
if(!(moment(this.orderInfo.endDate).valueOf() >= moment(startDate).valueOf() && moment(this.orderInfo.endDate).valueOf() <= moment(endDate).valueOf())){
useStatus = false;
}
return
}
// 如果此套餐的结束时间在12点后,则为闲时套餐,仅查看今日日否有合适的套餐
// 闲时套餐
......@@ -786,8 +789,53 @@
let pointDateForm = moment(this.dateList[this.dateIndex].readDate).format("YYYY-MM-DD 11:00:00");
let dateTimeObj = {};
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);
// 原时间
let originTime = moment(endDate).valueOf() - moment(startDate).valueOf()
// 实际时间
......@@ -796,15 +844,12 @@
if( actualTime< originTime - 4*60*60*1000 || this.onCheckPackUse(startDate,endDate,4)){
// 实际时长小于原时长的60%则选择明天的时间
// 加一天时间重新计算
if(this.dateIndex != 0){
if(this.dateIndex != 0 ){
uni.showToast({
icon:"none",
title:'可使用时长不足,请选择其他日期'
})
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);
......@@ -841,6 +886,7 @@
});
}
}
} else if( actualTime < originTime - 3*60*60*1000 && actualTime >= originTime - 4*60*60*1000){
this.tempDateObj = {
startDate: dateTimeObj.tempStartDate,
......@@ -853,7 +899,6 @@
return
}else{
this.modeIndex = -1
this.modeIndex2 = index
let duration = (moment(dateTimeObj.tempEndDate).valueOf()-moment(dateTimeObj.tempStartDate).valueOf())/1000/60;
......@@ -865,7 +910,7 @@
durationType:2
});
}
}
} else {
// 如果此套餐的结束时间在12点后,则为闲时套餐,仅查看今日日否有合适的套餐
dateTimeObj = this.onComputeStartDateAndEndDate(startDate,endDate);
......@@ -1214,11 +1259,12 @@
}else{
this.selectCouponIndex = -1;
}
if(this.allDayUseStatus){
this.computePriceInfo =''
}else{
// if(this.allDayUseStatus){
// this.computePriceInfo =''
// }else{
// }
this.onQueryCardUse();
}
} else if (res.data.code == 401) {
this.$refs.loginPop.open();
}
......@@ -1270,7 +1316,6 @@
roomLabelId : this.modeIndex >= 0 ? this.roomLabelList[this.modeIndex].id : '',
}
queryCardUse(params).then(res => {
console.log(res,9999)
if(res.data.code == 200){
......@@ -1294,9 +1339,6 @@
this.secondaryCardList = [];
}
console.log(this.radioChecked,"4545455")
console.log(this.monthlyCardList)
console.log(this.secondaryCardList)
this.onComputePrice();
}
})
......
......@@ -216,7 +216,7 @@
<image :src="assetsPath+'/vip/banner2.png'" mode="widthFix"></image>
</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="flex-col list-box-2">
<view class="flex-row-center title-content">
......@@ -278,9 +278,9 @@
</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="flex-col list-box-2">
<view class="flex-row-center title-content">
......@@ -342,7 +342,7 @@
</view>
</view>
</view>
</view> -->
</view>
</view>
</view>
......@@ -694,8 +694,8 @@
},
{
iconUrl: config.assetsPath + "/vip/p_10.png",
title: "卡",
slogan: "特惠购",
title: "权益卡",
slogan: "次卡月卡特权",
value: 8
},
{
......@@ -712,12 +712,12 @@
},
{
imgUrl:config.assetsPath+'/banner/2.png',
routePath:''
},
{
imgUrl:config.assetsPath+'/banner/3.png',
routePath:'/pages/storeList/storeList'
routePath:'/pages/activity/index'
},
// {
// imgUrl:config.assetsPath+'/banner/3.png',
// routePath:'/pages/storeList/storeList'
// },
],
monthlyCardConf:'',
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