|
@@ -142,13 +142,11 @@ export default {
|
|
|
// console.log(143, JSON.stringify(this.consume) !== '{}' && this.consume.hasOwnProperty('selected') ? this.consume.selected !== undefined : this.consume.defaultSelected !== undefined);
|
|
|
if (JSON.stringify(this.consume) !== '{}' && this.consume.hasOwnProperty('selected') ? this.consume.selected : this.consume.defaultSelected !== undefined) {
|
|
|
this.checkedList.push('reduces');
|
|
|
- this.isReduces = false;
|
|
|
+ // this.isReduces = false;
|
|
|
// 如果存在拆分逻辑的话
|
|
|
// this.consume.
|
|
|
- } else {
|
|
|
- console.log(150);
|
|
|
- this.isReduces = 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;
|
|
|
if (maxConsumeTime) {
|
|
|
this.maxReduceDiscount = maxConsumeTime;
|
|
@@ -165,14 +163,17 @@ export default {
|
|
|
}
|
|
|
const { maxOneDayCoupons, maxonedaydiscountFee, maxOneTimeDiscountTime, remainConsumeTime, hourPrice, availableDiscountFee, oneTimeLimitation, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
|
// console.log(133,this.reduceHours)
|
|
|
+ console.log(166, this.maxReduceDiscount);
|
|
|
if (type === 'plus' && this.reduceHours < this.maxReduceDiscount) {
|
|
|
- this.remainPrice = this.remainPrice + hourPrice;
|
|
|
- this.reduceHours = this.reduceHours + 1;
|
|
|
+
|
|
|
const [isCrossMessage = false, maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage();
|
|
|
if (isCrossMessage) {
|
|
|
- this.remainPrice = this.remainPrice - hourPrice;
|
|
|
- this.reduceHours = this.reduceHours - 1;
|
|
|
+ // this.remainPrice = this.remainPrice - hourPrice;
|
|
|
+ // this.reduceHours = this.reduceHours - 1;
|
|
|
+ return
|
|
|
}
|
|
|
+ this.remainPrice = this.remainPrice + hourPrice;
|
|
|
+ this.reduceHours = this.reduceHours + 1;
|
|
|
return;
|
|
|
}
|
|
|
if (type === 'minus' && this.reduceHours > 1) {
|
|
@@ -210,10 +211,11 @@ export default {
|
|
|
const reduceHours = (maxOneTimeDiscountFee - this.remainPrice) / hourPrice;
|
|
|
if (this.checkedList.indexOf('reduces') > -1) {
|
|
|
this.remainPrice = hourPrice + this.remainPrice;
|
|
|
- this.maxReduceDiscount = maxConsumeTime;
|
|
|
+ // 计算最大上限
|
|
|
+ this.maxReduceDiscount = maxConsumeTime > maxOneTimeDiscountFee / hourPrice ? maxOneTimeDiscountFee / hourPrice : maxConsumeTime;
|
|
|
} else {
|
|
|
this.remainPrice = this.remainPrice - hourPrice;
|
|
|
- this.maxReduceDiscount = maxConsumeTime;
|
|
|
+ this.maxReduceDiscount = maxConsumeTime > maxOneTimeDiscountFee / hourPrice ? maxOneTimeDiscountFee / hourPrice : maxConsumeTime;
|
|
|
// this.reduceHours = maxConsumeTime;
|
|
|
}
|
|
|
const [isCrossMessage = false, maxReduceDiscount = 0] = this.crossMessage();
|
|
@@ -262,9 +264,9 @@ export default {
|
|
|
const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
|
|
|
const remainConsumeTimeFee = remainConsumeTime * hourPrice;
|
|
|
|
|
|
- // TODO: 统计纸质优惠券的总金额, usingTotalDiscount - 纸质优惠券的总金额,才是用户当前订单使用的优惠总数
|
|
|
- this.isMember = !(this.usingTotalDiscount - this.paperDiscountFee < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.memberLevelDiscount);
|
|
|
- this.isReduces = !(this.usingTotalDiscount - this.paperDiscountFee < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.enableConsume);
|
|
|
+ // TODO: 统计纸质优惠券的总金额, usingTotalDiscount,才是用户当前订单使用的优惠总数
|
|
|
+ this.isMember = !(this.usingTotalDiscount < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.memberLevelDiscount);
|
|
|
+ this.isReduces = !(this.usingTotalDiscount < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.enableConsume);
|
|
|
}
|
|
|
if (callback) callback();
|
|
|
},
|