|
@@ -18,6 +18,7 @@ export default {
|
|
|
platform: getPlatform(),
|
|
|
maxCouponFee: 0, // 计算优惠券已选的总金额
|
|
|
remainPrice: 0, // 剩余可用优惠额度
|
|
|
+ newAvailableDiscountFee: 0, // 可使用的电子券的优惠金额上限
|
|
|
extraData: {}
|
|
|
};
|
|
|
},
|
|
@@ -69,7 +70,9 @@ export default {
|
|
|
* */
|
|
|
this.couponList = [...this.coupons];
|
|
|
this.remainPrice = this.usingTotalDiscount;
|
|
|
+ this.newAvailableDiscountFee = this.availableDiscountFee
|
|
|
if (this.couponList.length) {
|
|
|
+ if ( this.setAllDisabled() ) return
|
|
|
this.couponList = this.couponList.map((elm, index) => {
|
|
|
elm.disabled = true;
|
|
|
const selected = elm.hasOwnProperty('selected') ? elm.selected : elm.defaultSelected;
|
|
@@ -104,12 +107,12 @@ export default {
|
|
|
}, 100)
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
// 取消勾选时
|
|
|
if (this.checkedCouponList.indexOf(name) > -1) {
|
|
|
this.checkedCouponList = this.checkedCouponList.filter((i) => i !== name);
|
|
|
setTimeout(() => {
|
|
|
this.remainPrice = this.remainPrice - this.couponList[index].discountFee
|
|
|
+ this.newAvailableDiscountFee = this.newAvailableDiscountFee + this.couponList[index].discountFee
|
|
|
this.newGroupedCouponData()
|
|
|
}, 100)
|
|
|
return;
|
|
@@ -117,10 +120,30 @@ export default {
|
|
|
// 如果有选中项
|
|
|
const item = this.couponList[index];
|
|
|
this.remainPrice = this.remainPrice + this.couponList[index].discountFee
|
|
|
+ this.newAvailableDiscountFee = this.newAvailableDiscountFee - this.couponList[index].discountFee
|
|
|
if (!item.disabled) {
|
|
|
this.checkedCouponList.push(`coupon${index}`);
|
|
|
}
|
|
|
- this.newGroupedCouponData()
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if ( this.setAllDisabled() ) return
|
|
|
+ this.newGroupedCouponData()
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ // 针对达到优惠的上限制
|
|
|
+ setAllDisabled() {
|
|
|
+ const { parkMallCode } = this.orderDetail.parkInfo;
|
|
|
+ // 设置深圳的达到优惠金额的上限,置灰剩下未选择的金额
|
|
|
+ if ( parkMallCode === 5 && this.remainPrice - this.paperDiscountFee >= this.newAvailableDiscountFee ) {
|
|
|
+ this.couponList = this.couponList.map((elm,iemi) => {
|
|
|
+ if ( !elm.disabled && this.checkedCouponList.indexOf(`coupon${iemi}`) < 0) {
|
|
|
+ elm.disabled = true
|
|
|
+ }
|
|
|
+ return elm
|
|
|
+ })
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
},
|
|
|
// 对不同类型的优惠券进行汇总统计
|
|
|
/*groupedCouponData() {
|
|
@@ -300,7 +323,7 @@ export default {
|
|
|
// 剩余可使用的优惠金额,支持动态计算; 优惠时长,不可能全部使用,不能超过车费减去优惠的金额;不能超过单次的应付金额
|
|
|
let remainPrice = remainConsumeTime * hourPrice;
|
|
|
if (parkMallCode === 5) {
|
|
|
- if (remainPrice > actualPayFee) {
|
|
|
+ if (remainPrice - this.paperDiscountFee > actualPayFee) {
|
|
|
remainPrice = actualPayFee;
|
|
|
}
|
|
|
}
|
|
@@ -339,14 +362,14 @@ export default {
|
|
|
// });
|
|
|
}*/
|
|
|
// 深圳超限处理
|
|
|
- if (parkMallCode === 5 && this.remainPrice >= this.actualPayFee) {
|
|
|
+ if (parkMallCode === 5 && this.remainPrice >= this.availableDiscountFee) {
|
|
|
return Toast({
|
|
|
- message: `每日最高可抵扣${this.actualPayFee}元`,
|
|
|
+ message: `每日最高可抵扣${this.maxOneDayDiscountFee}元`,
|
|
|
icon: 'none',
|
|
|
});
|
|
|
}
|
|
|
// 浦东,单次上限提示, 后续 usingTotalDiscount 再减去 纸质优惠券的金额
|
|
|
- if (parkMallCode === 1 && usingTotalDiscount- this.paperDiscountFee >= maxOneTimeDiscountTime) {
|
|
|
+ if (parkMallCode === 1 && this.remainPrice - this.paperDiscountFee >= this.availableDiscountFee) {
|
|
|
return Toast({
|
|
|
message: `超出抵扣上限,每次最高可抵扣${maxOneTimeDiscountTime}小时`,
|
|
|
icon: 'none',
|