|
@@ -32,6 +32,7 @@ export default {
|
|
maxReduceDiscount: 0,
|
|
maxReduceDiscount: 0,
|
|
reduceHours: 0,
|
|
reduceHours: 0,
|
|
remainPrice: 0,
|
|
remainPrice: 0,
|
|
|
|
+ isInit: 1,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -125,8 +126,9 @@ export default {
|
|
return ''
|
|
return ''
|
|
}
|
|
}
|
|
// 消费减免余额为 0 时
|
|
// 消费减免余额为 0 时
|
|
- if (!this.orderDetail.parkingRule.remainConsumeTime) {
|
|
|
|
- return `您今日消费减免已达${this.orderDetail.parkingRule.maxConsumeTime}小时上限`
|
|
|
|
|
|
+ if (!this.orderDetail.parkingRule.remainConsumeTime || !this.consume.hasOwnProperty('redeemSalesAmount')) {
|
|
|
|
+ return `您暂无可用的消费减免`
|
|
|
|
+ // return `您今日消费减免已达${this.orderDetail.parkingRule.maxConsumeTime}小时上限`
|
|
}
|
|
}
|
|
// 消费减免不存在时
|
|
// 消费减免不存在时
|
|
if (JSON.stringify(this.consume) === '{}') {
|
|
if (JSON.stringify(this.consume) === '{}') {
|
|
@@ -185,7 +187,35 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- checkedList() {
|
|
|
|
|
|
+ checkedList(newVal, oldVal) {
|
|
|
|
+ // console.log(190, { newVal, oldVal });
|
|
|
|
+ if (this.parkMallCode === 4 && this.isInit > 1) {
|
|
|
|
+ const { maxOneDayCoupons, maxonedaydiscountFee, maxOneTimeDiscountTime, remainConsumeTime, hourPrice, oneTimeLimitation, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
|
|
+ // 会员等级选中了
|
|
|
|
+ if (newVal.indexOf('member') > -1 && oldVal.indexOf('member') < 0) {
|
|
|
|
+ // console.log(193, '会员等级选中了');
|
|
|
|
+ // this.remainPrice = this.remainPrice + this.memberGrade.discountFee;
|
|
|
|
+ // this.maxReduceDiscountInit();
|
|
|
|
+ }
|
|
|
|
+ if (oldVal.indexOf('member') > -1 && newVal.indexOf('member') < 0) {
|
|
|
|
+ // 会员等级未选中了
|
|
|
|
+ // console.log(193, '会员等级未选中了');
|
|
|
|
+ // this.remainPrice = this.remainPrice - this.memberGrade.discountFee;
|
|
|
|
+ // this.maxReduceDiscountInit();
|
|
|
|
+ }
|
|
|
|
+ // 消费减免选中了
|
|
|
|
+ if (newVal.indexOf('reduces') > -1 && oldVal.indexOf('reduces') < 0) {
|
|
|
|
+ // console.log(193, '消费减免选中了');
|
|
|
|
+ this.consume.discountFee = this.reduceHours * hourPrice
|
|
|
|
+ this.remainPrice = this.remainPrice + this.consume.discountFee;
|
|
|
|
+ }
|
|
|
|
+ if (oldVal.indexOf('reduces') > -1 && newVal.indexOf('reduces') < 0) {
|
|
|
|
+ // 消费减免未选中了
|
|
|
|
+ // console.log(193, '消费减免未选中了');
|
|
|
|
+ this.consume.discountFee = this.reduceHours * hourPrice
|
|
|
|
+ this.remainPrice = this.remainPrice - this.consume.discountFee;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// const {hourPrice} = this.orderDetail.parkingRule;
|
|
// const {hourPrice} = this.orderDetail.parkingRule;
|
|
// if ( this.checkedList.indexOf('reduces') > -1 ) {
|
|
// if ( this.checkedList.indexOf('reduces') > -1 ) {
|
|
// this.remainPrice = this.reduceHours * hourPrice + this.remainPrice
|
|
// this.remainPrice = this.reduceHours * hourPrice + this.remainPrice
|
|
@@ -200,12 +230,12 @@ export default {
|
|
this.enableConsumeSplit = this.orderDetail.parkingRule.enableConsumeSplit;
|
|
this.enableConsumeSplit = this.orderDetail.parkingRule.enableConsumeSplit;
|
|
}
|
|
}
|
|
this.checkedList = [];
|
|
this.checkedList = [];
|
|
- const { memberGrade = [{}], consume = [], memberLevelDiscount, points=[{}] } = this.orderDetail.discountInfo;
|
|
|
|
|
|
+ const { memberGrade = [{}], consume = [], memberLevelDiscount, points = [{}] } = this.orderDetail.discountInfo;
|
|
const { maxConsumeTime, remainConsumeTime, hourPrice } = this.orderDetail.parkingRule;
|
|
const { maxConsumeTime, remainConsumeTime, hourPrice } = this.orderDetail.parkingRule;
|
|
// 如果积分存在的话,则移除积分的优惠
|
|
// 如果积分存在的话,则移除积分的优惠
|
|
- if(JSON.stringify(points) !== {}) {
|
|
|
|
|
|
+ if (JSON.stringify(points) !== {}) {
|
|
this.remainPrice = this.usingTotalDiscount - points[0].discountFee;
|
|
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) {
|
|
@@ -225,12 +255,11 @@ export default {
|
|
if (JSON.stringify(this.consume) !== '{}') {
|
|
if (JSON.stringify(this.consume) !== '{}') {
|
|
const isSelected = this.consume.hasOwnProperty('selected') ? this.consume.selected : this.consume.defaultSelected;
|
|
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;
|
|
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
|
|
|
|
- }
|
|
|
|
|
|
+ // const remainingLimitToIncrease = Math.abs(this.remainPrice - this.availableDiscountFee) / hourPrice
|
|
|
|
+ // if (remainingLimitToIncrease) {
|
|
|
|
+ // this.maxReduceDiscountInit();
|
|
|
|
+ // }
|
|
|
|
+ this.maxReduceDiscountInit();
|
|
}
|
|
}
|
|
this.oldCheckedList = [...this.checkedList];
|
|
this.oldCheckedList = [...this.checkedList];
|
|
// 如果是杭州、沈阳可以选择
|
|
// 如果是杭州、沈阳可以选择
|
|
@@ -239,6 +268,29 @@ export default {
|
|
// }
|
|
// }
|
|
// https://kerryprops.atlassian.net/browse/SCRM-4016?focusedCommentId=117842: 只要存在消费减免情况,都允许用户进行操作
|
|
// https://kerryprops.atlassian.net/browse/SCRM-4016?focusedCommentId=117842: 只要存在消费减免情况,都允许用户进行操作
|
|
this.isReduces = JSON.stringify(this.consume) === '{}';
|
|
this.isReduces = JSON.stringify(this.consume) === '{}';
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.isInit = this.isInit + 1
|
|
|
|
+ }, 300)
|
|
|
|
+ },
|
|
|
|
+ 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 (this.remainPrice >= this.availableDiscountFee) {
|
|
|
|
+ // console.log('过大', this.maxReduceDiscount, remainingLimitToIncrease);
|
|
|
|
+ this.maxReduceDiscount = 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);
|
|
|
|
+ const maxReduceDiscount = this.consume.discountFee / hourPrice + remainingLimitToIncrease
|
|
|
|
+ // console.log('过小', maxReduceDiscount);
|
|
|
|
+ this.maxReduceDiscount = maxReduceDiscount <= remainConsumeTime ? maxReduceDiscount : remainConsumeTime
|
|
|
|
+ }
|
|
},
|
|
},
|
|
setIsMemberDiscountDisabled() {
|
|
setIsMemberDiscountDisabled() {
|
|
this.todayReduceDiscountMessage = '当日';
|
|
this.todayReduceDiscountMessage = '当日';
|
|
@@ -251,8 +303,8 @@ 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 || this.parkMallCode === 4)) {
|
|
|
|
- const [isCrossMessage = false, maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage();
|
|
|
|
|
|
+ if (type === 'plus') {
|
|
|
|
+ const [isCrossMessage = false, maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage('onReduceHoursChange');
|
|
if (isCrossMessage) {
|
|
if (isCrossMessage) {
|
|
// this.remainPrice = this.remainPrice - hourPrice;
|
|
// this.remainPrice = this.remainPrice - hourPrice;
|
|
// this.reduceHours = this.reduceHours - 1;
|
|
// this.reduceHours = this.reduceHours - 1;
|
|
@@ -260,11 +312,13 @@ export default {
|
|
}
|
|
}
|
|
this.remainPrice = this.remainPrice + hourPrice;
|
|
this.remainPrice = this.remainPrice + hourPrice;
|
|
this.reduceHours = this.reduceHours + 1;
|
|
this.reduceHours = this.reduceHours + 1;
|
|
|
|
+ this.consume.discountFee = this.reduceHours * hourPrice
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (type === 'minus' && this.reduceHours > 1) {
|
|
if (type === 'minus' && this.reduceHours > 1) {
|
|
this.reduceHours = this.reduceHours - 1;
|
|
this.reduceHours = this.reduceHours - 1;
|
|
this.remainPrice = this.remainPrice - hourPrice;
|
|
this.remainPrice = this.remainPrice - hourPrice;
|
|
|
|
+ this.consume.discountFee = this.reduceHours * hourPrice
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -273,14 +327,9 @@ export default {
|
|
const { maxConsumeTime, remainConsumeTime, availableDiscountFee, hourPrice } = this.orderDetail.parkingRule;
|
|
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) {
|
|
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;
|
|
|
|
- })
|
|
|
|
|
|
+ this.maxReduceDiscountInit();
|
|
}
|
|
}
|
|
} else if (!this.isMember) {
|
|
} else if (!this.isMember) {
|
|
this.remainPrice = this.remainPrice - this.memberGrade.discountFee;
|
|
this.remainPrice = this.remainPrice - this.memberGrade.discountFee;
|
|
@@ -290,58 +339,52 @@ export default {
|
|
}
|
|
}
|
|
// 如果不是沈阳,重新计算优惠
|
|
// 如果不是沈阳,重新计算优惠
|
|
if (this.parkMallCode === 4) {
|
|
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
|
|
|
|
-
|
|
|
|
|
|
+ this.maxReduceDiscountInit();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 如果不是沈阳
|
|
|
|
+ if (this.parkMallCode !== 4) {
|
|
|
|
+ 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, availableDiscountFee } = this.orderDetail.parkingRule;
|
|
const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
|
|
const maxOneTimeDiscountFee = maxOneTimeDiscountTime * 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.remainPrice = hourPrice + this.remainPrice;
|
|
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.remainPrice = this.remainPrice - hourPrice;
|
|
this.maxReduceDiscount = remainConsumeTime > maxOneTimeDiscountFee / hourPrice ? maxOneTimeDiscountFee / hourPrice : remainConsumeTime;
|
|
this.maxReduceDiscount = remainConsumeTime > maxOneTimeDiscountFee / hourPrice ? maxOneTimeDiscountFee / hourPrice : remainConsumeTime;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- const [isCrossMessage = false, maxReduceDiscount = 0] = this.crossMessage();
|
|
|
|
- if (isCrossMessage) {
|
|
|
|
- this.remainPrice = this.remainPrice - maxReduceDiscount * hourPrice;
|
|
|
|
|
|
+ if (this.parkMallCode !== 4) {
|
|
|
|
+ const [isCrossMessage = false, maxReduceDiscount = 0] = this.crossMessage();
|
|
|
|
+ if (isCrossMessage) {
|
|
|
|
+ this.remainPrice = this.remainPrice - maxReduceDiscount * hourPrice;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 超限提示
|
|
// 超限提示
|
|
- crossMessage() {
|
|
|
|
|
|
+ crossMessage(type) {
|
|
const { maxOneTimeDiscountTime, hourPrice, oneTimeLimitation, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
const { maxOneTimeDiscountTime, hourPrice, oneTimeLimitation, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
|
|
const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
|
|
const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
|
|
|
|
+ // console.log(373, this.remainPrice, this.availableDiscountFee);
|
|
// 单日上限
|
|
// 单日上限
|
|
- if (oneDayLimitation && this.remainPrice >= maxOneDayDiscountFee) {
|
|
|
|
|
|
+ if (oneDayLimitation && this.remainPrice >= this.availableDiscountFee) {
|
|
|
|
+
|
|
Toast({
|
|
Toast({
|
|
message: `每日最高可抵扣${maxOneDayDiscountFee}元`,
|
|
message: `每日最高可抵扣${maxOneDayDiscountFee}元`,
|
|
icon: 'none',
|
|
icon: 'none',
|