Prechádzať zdrojové kódy

Merge pull request #420 from John-Hong/release-3.2.0

fix(SCRM-5698): 重构无需添加优惠逻辑,加强对小于等于0的case验证
Tron 1 rok pred
rodič
commit
89b2df0a49

+ 14 - 3
src/pages/parkingFee/mixins/parkingFeeCoupon.js

@@ -85,7 +85,7 @@ export default {
         this.remainPrice = this.remainPrice - this.orderDetail.discountInfo.points[0].discountFee
       }   
       // 如果前海开启无积分上限的话,则
-      if ( [5, 10].indexOf(parkMallCode) > -1 && this.unLimitWeekendPoints && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
+      if ( [5, 10].indexOf(parkMallCode) > -1 && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
         this.remainPrice = this.remainPrice - this.orderDetail?.discountInfo?.points[0]?.discountFee
       }
       this.newAvailableDiscountFee = this.availableDiscountFee
@@ -125,7 +125,7 @@ export default {
     checkboxItemChange(name, index) {
       const coupon  = this.couponList[index];
       if ( coupon.disabled ) {
-        if (this.totalFeeInYuan - this.paperDiscountFee - this.remainPrice < 1) {
+        if (this.getAmountToBePaid() <= 0) {
           Toast('当前无需追加优惠')
           return;
         }
@@ -148,7 +148,7 @@ export default {
       }
       // 如果有选中项
       // 还需支付金额 = 总金额 - 优惠金额
-      if (this.totalFeeInYuan - this.paperDiscountFee - this.remainPrice < 1) {
+      if (this.getAmountToBePaid() <= 0) {
         Toast('当前无需追加优惠')
         return;
       }
@@ -416,6 +416,17 @@ export default {
         navigate_time:new Date().getTime()
       }
     },
+    // 获取还需支付金额
+    getAmountToBePaid() {
+      let amountToBePaid = this.totalFeeInYuan - this.paperDiscountFee - this.remainPrice;
+      if([ 5, 10 ].indexOf(this.parkMallCode) > -1 && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
+        amountToBePaid = amountToBePaid - this.orderDetail.discountInfo?.points?.[0]?.discountFee
+      }
+      if([ 4, 6 ].indexOf(this.parkMallCode) > -1 && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
+        amountToBePaid = amountToBePaid - this.orderDetail.discountInfo?.points?.[0]?.discountFee
+      }
+      return amountToBePaid
+    },
     // 跳转小程序
     navigateToMiniProgram() {
       if (this.platform === 'miniprogram') {

+ 13 - 2
src/pages/parkingFeeV2/mixins/parkingFeeCoupon.js

@@ -125,7 +125,7 @@ export default {
     checkboxItemChange(name, index) {
       const coupon  = this.couponList[index];
       if ( coupon.disabled ) {
-        if (this.totalFeeInYuan - this.paperDiscountFee - this.remainPrice < 1) {
+        if (this.getAmountToBePaid() <= 0) {
           Toast('当前无需追加优惠')
           return;
         }
@@ -149,7 +149,7 @@ export default {
       }
       // 如果有选中项
       // 还需支付金额 = 总金额 - 优惠金额
-      if (this.totalFeeInYuan - this.paperDiscountFee - this.remainPrice < 1) {
+      if (this.getAmountToBePaid() <= 0) {
         Toast('当前无需追加优惠')
         return;
       }
@@ -166,6 +166,17 @@ export default {
       })
 
     },
+    // 获取还需支付金额
+    getAmountToBePaid() {
+      let amountToBePaid = this.totalFeeInYuan - this.paperDiscountFee - this.remainPrice;
+      if([ 5, 10 ].indexOf(this.parkMallCode) > -1 && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
+        amountToBePaid = amountToBePaid - this.orderDetail.discountInfo?.points?.[0]?.discountFee
+      }
+      if([ 4, 6 ].indexOf(this.parkMallCode) > -1 && this.orderDetail.discountInfo?.points?.[0]?.discountFee) {
+        amountToBePaid = amountToBePaid - this.orderDetail.discountInfo?.points?.[0]?.discountFee
+      }
+      return amountToBePaid
+    },
     // 针对达到优惠的上限制
     setAllDisabled() {
       const {parkInfo,parkingRule} = this.orderDetail