|
@@ -47,6 +47,7 @@ export default {
|
|
parkMallCode: (state) => state.order.parkMallCode,
|
|
parkMallCode: (state) => state.order.parkMallCode,
|
|
paperDiscountTime: (state) => state.order.paperDiscountTime,
|
|
paperDiscountTime: (state) => state.order.paperDiscountTime,
|
|
paperDiscountFee: (state) => state.order.paperDiscountTime,
|
|
paperDiscountFee: (state) => state.order.paperDiscountTime,
|
|
|
|
+ availableDiscountFee: (state) => state.order.availableDiscountFee,
|
|
}),
|
|
}),
|
|
enableConsumeNonSplit() {
|
|
enableConsumeNonSplit() {
|
|
return this.orderDetail.parkingRule.enableConsumeNonSplit
|
|
return this.orderDetail.parkingRule.enableConsumeNonSplit
|
|
@@ -57,19 +58,23 @@ export default {
|
|
return this.reduceHours || 0
|
|
return this.reduceHours || 0
|
|
}
|
|
}
|
|
// 如果不存消费减免,默认展示0
|
|
// 如果不存消费减免,默认展示0
|
|
- if(JSON.stringify(this.consume) === '{}') {
|
|
|
|
|
|
+ if (JSON.stringify(this.consume) === '{}') {
|
|
return 0
|
|
return 0
|
|
}
|
|
}
|
|
// 如果存在消费减免并且是可拆分的,则设置最低拆分单位是 1
|
|
// 如果存在消费减免并且是可拆分的,则设置最低拆分单位是 1
|
|
return 1
|
|
return 1
|
|
},
|
|
},
|
|
stepperMax() {
|
|
stepperMax() {
|
|
|
|
+ if (this.parkMallCode === 4) {
|
|
|
|
+ // 如果存在消费减免并且是可拆分的,则设置最低拆分单位是 1
|
|
|
|
+ return this.maxReduceDiscount
|
|
|
|
+ }
|
|
// 如果是合集车场,不存在拆分,默认返回用户可使用的消费抵扣时间
|
|
// 如果是合集车场,不存在拆分,默认返回用户可使用的消费抵扣时间
|
|
if (this.parkMallCode === 7 || this.enableConsumeNonSplit) {
|
|
if (this.parkMallCode === 7 || this.enableConsumeNonSplit) {
|
|
return this.reduceHours || 0
|
|
return this.reduceHours || 0
|
|
}
|
|
}
|
|
// 如果不存消费减免,默认展示0
|
|
// 如果不存消费减免,默认展示0
|
|
- if(JSON.stringify(this.consume) === '{}') {
|
|
|
|
|
|
+ if (JSON.stringify(this.consume) === '{}') {
|
|
return 0
|
|
return 0
|
|
}
|
|
}
|
|
// 如果存在消费减免并且是可拆分的,则设置最低拆分单位是 1
|
|
// 如果存在消费减免并且是可拆分的,则设置最低拆分单位是 1
|
|
@@ -102,17 +107,17 @@ export default {
|
|
// return remainPrice
|
|
// return remainPrice
|
|
// }
|
|
// }
|
|
// 消费减免(拆分部分)提示文本
|
|
// 消费减免(拆分部分)提示文本
|
|
- reduceSplitMessage() {
|
|
|
|
|
|
+ reduceSplitMessage() {
|
|
console.log(106, this.reduceHours);
|
|
console.log(106, this.reduceHours);
|
|
- if (!this.enableConsumeNonSplit) {
|
|
|
|
- return `选择${this.reduceHours}小时,`;
|
|
|
|
- }
|
|
|
|
- return '';
|
|
|
|
- },
|
|
|
|
|
|
+ if (!this.enableConsumeNonSplit) {
|
|
|
|
+ return `选择${this.reduceHours}小时,`;
|
|
|
|
+ }
|
|
|
|
+ return '';
|
|
|
|
+ },
|
|
// 消费减免金额
|
|
// 消费减免金额
|
|
- reducesDiscountFee() {
|
|
|
|
- return this.reduceHours * this.orderDetail.parkingRule.hourPrice;
|
|
|
|
- },
|
|
|
|
|
|
+ reducesDiscountFee() {
|
|
|
|
+ return this.reduceHours * this.orderDetail.parkingRule.hourPrice;
|
|
|
|
+ },
|
|
// 消费减免说明文案
|
|
// 消费减免说明文案
|
|
todayReduceDiscountMessage() {
|
|
todayReduceDiscountMessage() {
|
|
// 静安浦东没有内容
|
|
// 静安浦东没有内容
|
|
@@ -120,22 +125,22 @@ export default {
|
|
return ''
|
|
return ''
|
|
}
|
|
}
|
|
// 消费减免余额为 0 时
|
|
// 消费减免余额为 0 时
|
|
- if(!this.orderDetail.parkingRule.remainConsumeTime) {
|
|
|
|
|
|
+ if (!this.orderDetail.parkingRule.remainConsumeTime) {
|
|
return `您今日消费减免已达${this.orderDetail.parkingRule.maxConsumeTime}小时上限`
|
|
return `您今日消费减免已达${this.orderDetail.parkingRule.maxConsumeTime}小时上限`
|
|
}
|
|
}
|
|
// 消费减免不存在时
|
|
// 消费减免不存在时
|
|
- if(JSON.stringify(this.consume) === '{}') {
|
|
|
|
|
|
+ if (JSON.stringify(this.consume) === '{}') {
|
|
return '消费金额未达到最低优惠要求'
|
|
return '消费金额未达到最低优惠要求'
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// 静安存在消费减免时
|
|
// 静安存在消费减免时
|
|
if (this.parkMallCode === 0) {
|
|
if (this.parkMallCode === 0) {
|
|
return `今日可减免${this.consume.defaultDiscountTime}小时`;
|
|
return `今日可减免${this.consume.defaultDiscountTime}小时`;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// 沈阳提示信息
|
|
// 沈阳提示信息
|
|
if (this.parkMallCode === 4 || this.parkMallCode === 6) {
|
|
if (this.parkMallCode === 4 || this.parkMallCode === 6) {
|
|
- return `未达上限时今日可减免${this.consume.defaultDiscountTime}小时`;
|
|
|
|
|
|
+ return `未达上限时今日可减免${this.stepperMax}小时`;
|
|
}
|
|
}
|
|
if (this.consume.defaultDiscountTime > this.orderDetail.parkingRule.remainConsumeTime) {
|
|
if (this.consume.defaultDiscountTime > this.orderDetail.parkingRule.remainConsumeTime) {
|
|
return `消费已满${this.consume.redeemSalesAmount}元,减免${this.consume.defaultDiscountTime}小时。超出优惠上限,可减免${this.maxReduceDiscount}小时,${this.reduceSplitMessage}可优惠${this.reducesDiscountFee}元`
|
|
return `消费已满${this.consume.redeemSalesAmount}元,减免${this.consume.defaultDiscountTime}小时。超出优惠上限,可减免${this.maxReduceDiscount}小时,${this.reduceSplitMessage}可优惠${this.reducesDiscountFee}元`
|
|
@@ -153,7 +158,7 @@ export default {
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
remainPrice() {
|
|
remainPrice() {
|
|
- const { maxOneDayCoupons, maxonedaydiscountFee, maxOneTimeDiscountTime, remainConsumeTime, hourPrice, availableDiscountFee, oneTimeLimitation, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
|
|
|
|
+ const { maxOneDayCoupons, maxonedaydiscountFee, maxOneTimeDiscountTime, remainConsumeTime, hourPrice, oneTimeLimitation, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
|
|
const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
|
|
// console.log('hourPrice + this.remainPrice',this.remainPrice)
|
|
// console.log('hourPrice + this.remainPrice',this.remainPrice)
|
|
// 单日上限
|
|
// 单日上限
|
|
@@ -191,13 +196,16 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
pageInit() {
|
|
pageInit() {
|
|
- this.remainPrice = this.usingTotalDiscount;
|
|
|
|
if (this.orderDetail?.parkingRule?.enableConsumeSplit) {
|
|
if (this.orderDetail?.parkingRule?.enableConsumeSplit) {
|
|
this.enableConsumeSplit = this.orderDetail.parkingRule.enableConsumeSplit;
|
|
this.enableConsumeSplit = this.orderDetail.parkingRule.enableConsumeSplit;
|
|
}
|
|
}
|
|
this.checkedList = [];
|
|
this.checkedList = [];
|
|
- const { memberGrade = [{}], consume = [], memberLevelDiscount } = this.orderDetail.discountInfo;
|
|
|
|
- const { maxConsumeTime,remainConsumeTime } = this.orderDetail.parkingRule;
|
|
|
|
|
|
+ const { memberGrade = [{}], consume = [], memberLevelDiscount, points=[{}] } = this.orderDetail.discountInfo;
|
|
|
|
+ const { maxConsumeTime, remainConsumeTime, hourPrice } = this.orderDetail.parkingRule;
|
|
|
|
+ // 如果积分存在的话,则移除积分的优惠
|
|
|
|
+ if(JSON.stringify(points) !== {}) {
|
|
|
|
+ this.remainPrice = this.usingTotalDiscount - points[0].discountFee;
|
|
|
|
+ }
|
|
this.memberGrade = { ...memberGrade[0] };
|
|
this.memberGrade = { ...memberGrade[0] };
|
|
this.consume = { ...consume[0] };
|
|
this.consume = { ...consume[0] };
|
|
if (JSON.stringify(this.memberGrade) !== '{}' && this.memberGrade && this.memberGrade.hasOwnProperty('selected') ? this.memberGrade.selected : this.memberGrade.defaultSelected) {
|
|
if (JSON.stringify(this.memberGrade) !== '{}' && this.memberGrade && this.memberGrade.hasOwnProperty('selected') ? this.memberGrade.selected : this.memberGrade.defaultSelected) {
|
|
@@ -214,8 +222,15 @@ export default {
|
|
}
|
|
}
|
|
this.isReduces = this.consume.hasOwnProperty('selected') || this.consume.hasOwnProperty('defaultSelected') ? false : true;
|
|
this.isReduces = this.consume.hasOwnProperty('selected') || this.consume.hasOwnProperty('defaultSelected') ? false : true;
|
|
this.reduceHours = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / this.orderDetail.parkingRule.hourPrice : this.consume.defaultDiscountTime;
|
|
this.reduceHours = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / this.orderDetail.parkingRule.hourPrice : this.consume.defaultDiscountTime;
|
|
- if (this.consume?.defaultDiscountTime) {
|
|
|
|
- this.maxReduceDiscount = this.consume.defaultDiscountTime;
|
|
|
|
|
|
+ if (JSON.stringify(this.consume) !== '{}') {
|
|
|
|
+ const isSelected = this.consume.hasOwnProperty('selected') ? this.consume.selected : this.consume.defaultSelected;
|
|
|
|
+ this.maxReduceDiscount = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / hourPrice : this.consume.defaultDiscountTime;
|
|
|
|
+ const remainingLimitToIncrease = Math.abs(this.remainPrice - this.availableDiscountFee) / hourPrice
|
|
|
|
+ if (remainingLimitToIncrease && isSelected) {
|
|
|
|
+ const remainingLimitToIncrease = Math.abs(this.remainPrice - this.availableDiscountFee) / hourPrice
|
|
|
|
+ const maxReduceDiscount = this.consume.discountFee / hourPrice + remainingLimitToIncrease
|
|
|
|
+ this.maxReduceDiscount = maxReduceDiscount < remainConsumeTime ? maxReduceDiscount : remainConsumeTime
|
|
|
|
+ }
|
|
}
|
|
}
|
|
this.oldCheckedList = [...this.checkedList];
|
|
this.oldCheckedList = [...this.checkedList];
|
|
// 如果是杭州、沈阳可以选择
|
|
// 如果是杭州、沈阳可以选择
|
|
@@ -228,7 +243,7 @@ export default {
|
|
setIsMemberDiscountDisabled() {
|
|
setIsMemberDiscountDisabled() {
|
|
this.todayReduceDiscountMessage = '当日';
|
|
this.todayReduceDiscountMessage = '当日';
|
|
},
|
|
},
|
|
- checkboxChange() {},
|
|
|
|
|
|
+ checkboxChange() { },
|
|
onReduceHoursChange(type) {
|
|
onReduceHoursChange(type) {
|
|
if (this.checkedList.indexOf('reduces') < 0) {
|
|
if (this.checkedList.indexOf('reduces') < 0) {
|
|
return;
|
|
return;
|
|
@@ -236,8 +251,7 @@ export default {
|
|
const { maxOneDayCoupons, maxonedaydiscountFee, maxOneTimeDiscountTime, remainConsumeTime, hourPrice, availableDiscountFee, oneTimeLimitation, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
const { maxOneDayCoupons, maxonedaydiscountFee, maxOneTimeDiscountTime, remainConsumeTime, hourPrice, availableDiscountFee, oneTimeLimitation, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
// console.log(133,this.reduceHours)
|
|
// console.log(133,this.reduceHours)
|
|
console.log(166, this.maxReduceDiscount);
|
|
console.log(166, this.maxReduceDiscount);
|
|
- if (type === 'plus' && this.reduceHours < this.maxReduceDiscount) {
|
|
|
|
-
|
|
|
|
|
|
+ if (type === 'plus' && (this.reduceHours < this.maxReduceDiscount || this.parkMallCode === 4)) {
|
|
const [isCrossMessage = false, maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage();
|
|
const [isCrossMessage = false, maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage();
|
|
if (isCrossMessage) {
|
|
if (isCrossMessage) {
|
|
// this.remainPrice = this.remainPrice - hourPrice;
|
|
// this.remainPrice = this.remainPrice - hourPrice;
|
|
@@ -255,37 +269,64 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
memberClick() {
|
|
memberClick() {
|
|
- const { maxConsumeTime, remainConsumeTime } = this.orderDetail.parkingRule;
|
|
|
|
|
|
+ // debugger
|
|
|
|
+ const { maxConsumeTime, remainConsumeTime, availableDiscountFee, hourPrice } = this.orderDetail.parkingRule;
|
|
if (this.checkedList.indexOf('member') > -1) {
|
|
if (this.checkedList.indexOf('member') > -1) {
|
|
this.remainPrice = this.memberGrade.discountFee + this.remainPrice;
|
|
this.remainPrice = this.memberGrade.discountFee + this.remainPrice;
|
|
|
|
+ if (this.parkMallCode === 4) {
|
|
|
|
+ this.remainPrice = this.remainPrice - this.reduceHours * hourPrice;
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.maxReduceDiscount = Math.abs(availableDiscountFee - this.remainPrice) / hourPrice
|
|
|
|
+ this.reduceHours = this.maxReduceDiscount
|
|
|
|
+ this.consume.discountFee = this.reduceHours * hourPrice
|
|
|
|
+ this.remainPrice = this.remainPrice + this.reduceHours * hourPrice;
|
|
|
|
+ })
|
|
|
|
+ }
|
|
} else if (!this.isMember) {
|
|
} else if (!this.isMember) {
|
|
this.remainPrice = this.remainPrice - this.memberGrade.discountFee;
|
|
this.remainPrice = this.remainPrice - this.memberGrade.discountFee;
|
|
// 如果不是沈阳,重新计算优惠
|
|
// 如果不是沈阳,重新计算优惠
|
|
- if(this.parkMallCode !== 4 ) {
|
|
|
|
|
|
+ if (this.parkMallCode !== 4) {
|
|
this.maxReduceDiscount = remainConsumeTime;
|
|
this.maxReduceDiscount = remainConsumeTime;
|
|
}
|
|
}
|
|
|
|
+ // 如果不是沈阳,重新计算优惠
|
|
|
|
+ if (this.parkMallCode === 4) {
|
|
|
|
+ const remainingLimitToIncrease = Math.abs(this.remainPrice - this.availableDiscountFee) / hourPrice
|
|
|
|
+ const maxReduceDiscount = this.consume.discountFee / hourPrice + remainingLimitToIncrease
|
|
|
|
+ this.maxReduceDiscount = maxReduceDiscount < remainConsumeTime ? maxReduceDiscount : remainConsumeTime
|
|
|
|
+ // 如果 用户选择的金额与消费减免的上限不一致,则不进行计算
|
|
|
|
+ /* if(this.reduceHours === this.maxReduceDiscount) {
|
|
|
|
+ this.reduceHours = this.maxReduceDiscount
|
|
|
|
+ this.consume.discountFee = this.reduceHours * hourPrice
|
|
|
|
+ this.remainPrice = this.remainPrice + remainingLimitToIncrease * hourPrice
|
|
|
|
+ } */
|
|
|
|
+ this.reduceHours = this.maxReduceDiscount
|
|
|
|
+ this.consume.discountFee = this.reduceHours * hourPrice
|
|
|
|
+ this.remainPrice = this.remainPrice + remainingLimitToIncrease * hourPrice
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- const [isCrossMessage = false, maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage();
|
|
|
|
- if (isCrossMessage) {
|
|
|
|
- this.checkedList = this.checkedList.filter((elm) => elm !== 'member');
|
|
|
|
- this.remainPrice = this.remainPrice - this.memberGrade.discountFee;
|
|
|
|
- this.isMember = false;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ /* const [isCrossMessage = false, maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage();
|
|
|
|
+ if (isCrossMessage) {
|
|
|
|
+ this.checkedList = this.checkedList.filter((elm) => elm !== 'member');
|
|
|
|
+ this.remainPrice = this.remainPrice - this.memberGrade.discountFee;
|
|
|
|
+ this.isMember = false;
|
|
|
|
+ } */
|
|
},
|
|
},
|
|
reducesClick() {
|
|
reducesClick() {
|
|
- const { maxOneTimeDiscountTime, hourPrice, oneTimeLimitation, maxConsumeTime,remainConsumeTime, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
|
|
|
|
+ const { maxOneTimeDiscountTime, hourPrice, oneTimeLimitation, maxConsumeTime, remainConsumeTime, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
|
|
const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
|
|
const reduceHours = (maxOneTimeDiscountFee - this.remainPrice) / hourPrice;
|
|
const reduceHours = (maxOneTimeDiscountFee - this.remainPrice) / hourPrice;
|
|
if (this.checkedList.indexOf('reduces') > -1) {
|
|
if (this.checkedList.indexOf('reduces') > -1) {
|
|
this.remainPrice = hourPrice + this.remainPrice;
|
|
this.remainPrice = hourPrice + this.remainPrice;
|
|
// 如果不是沈阳,重新计算计算最大上限
|
|
// 如果不是沈阳,重新计算计算最大上限
|
|
- if(this.parkMallCode !== 4 ) {
|
|
|
|
|
|
+ if (this.parkMallCode !== 4) {
|
|
this.maxReduceDiscount = remainConsumeTime > maxOneTimeDiscountFee / hourPrice ? maxOneTimeDiscountFee / hourPrice : remainConsumeTime;
|
|
this.maxReduceDiscount = remainConsumeTime > maxOneTimeDiscountFee / hourPrice ? maxOneTimeDiscountFee / hourPrice : remainConsumeTime;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
this.remainPrice = this.remainPrice - hourPrice;
|
|
this.remainPrice = this.remainPrice - hourPrice;
|
|
// 如果不是沈阳,重新计算计算最大上限
|
|
// 如果不是沈阳,重新计算计算最大上限
|
|
- if(this.parkMallCode !== 4 ) {
|
|
|
|
|
|
+ if (this.parkMallCode !== 4) {
|
|
this.maxReduceDiscount = remainConsumeTime > maxOneTimeDiscountFee / hourPrice ? maxOneTimeDiscountFee / hourPrice : remainConsumeTime;
|
|
this.maxReduceDiscount = remainConsumeTime > maxOneTimeDiscountFee / hourPrice ? maxOneTimeDiscountFee / hourPrice : remainConsumeTime;
|
|
}
|
|
}
|
|
}
|
|
}
|