|
@@ -260,6 +260,7 @@ export default {
|
|
|
// this.maxReduceDiscountInit();
|
|
|
// }
|
|
|
this.maxReduceDiscountInit();
|
|
|
+
|
|
|
}
|
|
|
this.oldCheckedList = [...this.checkedList];
|
|
|
// 如果是杭州、沈阳可以选择
|
|
@@ -268,29 +269,56 @@ export default {
|
|
|
// }
|
|
|
// https://kerryprops.atlassian.net/browse/SCRM-4016?focusedCommentId=117842: 只要存在消费减免情况,都允许用户进行操作
|
|
|
this.isReduces = JSON.stringify(this.consume) === '{}';
|
|
|
+ this.discountInit()
|
|
|
setTimeout(() => {
|
|
|
this.isInit = this.isInit + 1
|
|
|
+
|
|
|
}, 300)
|
|
|
},
|
|
|
+ discountInit() {
|
|
|
+ if(this.parkMallCode === 4 ) {
|
|
|
+ const { maxConsumeTime, remainConsumeTime, hourPrice } = this.orderDetail.parkingRule;
|
|
|
+ const remainingLimitToIncrease = Math.abs(this.remainPrice - this.availableDiscountFee) / hourPrice
|
|
|
+ if(!remainingLimitToIncrease) {
|
|
|
+ this.isMember = this.memberGrade.hasOwnProperty('selected')? !this.memberGrade.selected : !this.memberGrade.defaultSelected
|
|
|
+ this.isReduces = this.consume.hasOwnProperty('selected')? !this.consume.selected : !this.consume.defaultSelected
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
maxReduceDiscountInit() {
|
|
|
if(JSON.stringify(this.consume) === '{}' || !this.consume.hasOwnProperty('redeemSalesAmount')) {
|
|
|
return
|
|
|
}
|
|
|
const { maxConsumeTime, remainConsumeTime, hourPrice } = this.orderDetail.parkingRule;
|
|
|
const remainingLimitToIncrease = Math.abs(this.remainPrice - this.availableDiscountFee) / hourPrice
|
|
|
- if (!remainingLimitToIncrease) return
|
|
|
+ if (!remainingLimitToIncrease) {
|
|
|
+ // if(!this.consume.selected) {
|
|
|
+ // this.isReduces = true
|
|
|
+ // }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.isReduces = false
|
|
|
+ const {maxDiscountTime} = this.consume
|
|
|
if (this.remainPrice >= this.availableDiscountFee) {
|
|
|
// console.log('过大', this.maxReduceDiscount, remainingLimitToIncrease);
|
|
|
- this.maxReduceDiscount = this.maxReduceDiscount - remainingLimitToIncrease
|
|
|
+ this.maxReduceDiscount = this.maxReduceDiscount - remainingLimitToIncrease > maxDiscountTime ? maxDiscountTime : this.maxReduceDiscount - remainingLimitToIncrease
|
|
|
this.consume.discountFee = this.consume.discountFee - (remainingLimitToIncrease * hourPrice)
|
|
|
this.remainPrice = this.remainPrice - (remainingLimitToIncrease * hourPrice);
|
|
|
this.reduceHours = this.maxReduceDiscount
|
|
|
- } else {
|
|
|
- // console.log('过小?', this.consume.discountFee, remainingLimitToIncrease);
|
|
|
+ }
|
|
|
+ if(this.checkedList.indexOf('reduces') < 0) {
|
|
|
+ // 如果没被选中
|
|
|
+ this.maxReduceDiscount = remainingLimitToIncrease > maxDiscountTime ? maxDiscountTime : remainingLimitToIncrease
|
|
|
+ this.reduceHours = this.maxReduceDiscount
|
|
|
+ this.consume.discountFee = remainingLimitToIncrease * hourPrice
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 如果被选中
|
|
|
+ // console.log('过小?', this.consume.discountFee, remainingLimitToIncrease);
|
|
|
const maxReduceDiscount = this.consume.discountFee / hourPrice + remainingLimitToIncrease
|
|
|
// console.log('过小', maxReduceDiscount);
|
|
|
this.maxReduceDiscount = maxReduceDiscount <= remainConsumeTime ? maxReduceDiscount : remainConsumeTime
|
|
|
- }
|
|
|
+ this.maxReduceDiscount = this.maxReduceDiscount > maxDiscountTime ? maxDiscountTime: this.maxReduceDiscount
|
|
|
},
|
|
|
setIsMemberDiscountDisabled() {
|
|
|
this.todayReduceDiscountMessage = '当日';
|
|
@@ -327,8 +355,10 @@ export default {
|
|
|
const { maxConsumeTime, remainConsumeTime, availableDiscountFee, hourPrice } = this.orderDetail.parkingRule;
|
|
|
if (this.checkedList.indexOf('member') > -1) {
|
|
|
this.remainPrice = this.memberGrade.discountFee + this.remainPrice;
|
|
|
+ // console.log(331, this.remainPrice);
|
|
|
// 沈阳
|
|
|
if (this.parkMallCode === 4) {
|
|
|
+ // console.log(322);
|
|
|
this.maxReduceDiscountInit();
|
|
|
}
|
|
|
} else if (!this.isMember) {
|