فهرست منبع

Merge pull request #410 from John-Hong/John/release-3.1.0/SCRM-5548

fix(SCRM-5548): 取消纸质优惠券之后,如果回空,重新触发计算整体优惠接口; fix(SCRM-5547): 在已使用的优惠中移除纸质券的抵扣金额
Tron 1 سال پیش
والد
کامیت
9fc92e5a1e

+ 2 - 1
src/pages/parkingFee/mixins/parkingFeeCoupon.js

@@ -39,6 +39,7 @@ export default {
       remainCoupons: ( state ) => state.order.remainCoupons, // 仅限杭州当前剩余可选电子券上限
       parkMallCode: ( state ) => state.order.parkMallCode, // 当前车场的数据
       maxOneDayCoupons: ( state ) => state.order.maxOneDayCoupons,// 仅限杭州当日电子券可选上限
+      paperDiscountFee: ( state ) => state.order.paperDiscountFee,// 纸质券的优惠金额
     }),
   },
 
@@ -76,7 +77,7 @@ export default {
        * 2、superposition  叠加使用规则 (1不可叠加,2仅同类型可叠加,3可叠加);
        * */
       this.couponList = [...this.coupons];
-      this.remainPrice = this.usingTotalDiscount;
+      this.remainPrice = this.usingTotalDiscount - this.paperDiscountFee;
       if ((this.parkMallCode === 4 || this.parkMallCode === 6) && this.orderDetail?.discountInfo?.points[0]?.discountFee) {
         this.remainPrice = this.remainPrice - this.orderDetail.discountInfo.points[0].discountFee
       }   

+ 7 - 3
src/pages/parkingFee/mixins/parkingFeeDiscounts.js

@@ -47,7 +47,7 @@ export default {
       checkedTotal: (state) => state.order.checkedTotal,
       parkMallCode: (state) => state.order.parkMallCode,
       paperDiscountTime: (state) => state.order.paperDiscountTime,
-      paperDiscountFee: (state) => state.order.paperDiscountTime,
+      paperDiscountFee: (state) => state.order.paperDiscountFee,
       availableDiscountFee: (state) => state.order.availableDiscountFee,
     }),
     enableConsumeNonSplit() {
@@ -236,6 +236,10 @@ export default {
       if (points.length && JSON.stringify(points[0]) !== "{}") {
         this.remainPrice = this.parkMallCode !== 1 ? this.usingTotalDiscount - points[0].discountFee : this.usingTotalDiscount;
       }
+      // 如果有纸质优惠券的话,paperDiscountFee
+      if (this.paperDiscountFee) {
+        this.remainPrice = this.remainPrice - this.paperDiscountFee;
+      }
       this.memberGrade = { ...memberGrade[0] };
       this.consume = { ...consume[0] };
       if (JSON.stringify(this.memberGrade) !== '{}' && this.memberGrade && this.memberGrade.hasOwnProperty('selected') ? this.memberGrade.selected : this.memberGrade.defaultSelected) {
@@ -515,8 +519,8 @@ export default {
         const remainConsumeTimeFee = remainConsumeTime * hourPrice;
 
         // TODO: 统计纸质优惠券的总金额, usingTotalDiscount,才是用户当前订单使用的优惠总数
-        this.isMember = !(this.usingTotalDiscount < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.memberLevelDiscount);
-        this.isReduces = !(this.usingTotalDiscount < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.enableConsume);
+        this.isMember = !(this.usingTotalDiscount - this.paperDiscountFee < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.memberLevelDiscount);
+        this.isReduces = !(this.usingTotalDiscount - this.paperDiscountFee < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.enableConsume);
       }
       if (callback) callback();
     },

+ 7 - 3
src/pages/parkingFeeV2/Discounts/index.js

@@ -50,7 +50,7 @@ export default {
       checkedTotal: (state) => state.order.checkedTotal,
       parkMallCode: (state) => state.order.parkMallCode,
       paperDiscountTime: (state) => state.order.paperDiscountTime,
-      paperDiscountFee: (state) => state.order.paperDiscountTime,
+      paperDiscountFee: (state) => state.order.paperDiscountFee,
       availableDiscountFee: (state) => state.order.availableDiscountFee,
     }),
     enableConsumeNonSplit() {
@@ -239,6 +239,10 @@ export default {
       if (points.length && JSON.stringify(points[0]) !== "{}") {
         this.remainPrice = this.parkMallCode !== 1 ? this.usingTotalDiscount - points[0].discountFee : this.usingTotalDiscount;
       }
+      // 如果有纸质优惠券的话,paperDiscountFee
+      if (this.paperDiscountFee) {
+        this.remainPrice = this.remainPrice - this.paperDiscountFee;
+      }
       this.memberGrade = { ...memberGrade[0] };
       this.consume = { ...consume[0] };
       if (JSON.stringify(this.memberGrade) !== '{}' && this.memberGrade && this.memberGrade.hasOwnProperty('selected') ? this.memberGrade.selected : this.memberGrade.defaultSelected) {
@@ -570,8 +574,8 @@ export default {
         const remainConsumeTimeFee = remainConsumeTime * hourPrice;
 
         // TODO: 统计纸质优惠券的总金额, usingTotalDiscount,才是用户当前订单使用的优惠总数
-        this.isMember = !(this.usingTotalDiscount < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.memberLevelDiscount);
-        this.isReduces = !(this.usingTotalDiscount < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.enableConsume);
+        this.isMember = !(this.usingTotalDiscount - this.paperDiscountFee < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.memberLevelDiscount);
+        this.isReduces = !(this.usingTotalDiscount - this.paperDiscountFee < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.enableConsume);
       }
       if (callback) callback();
     },

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

@@ -39,6 +39,7 @@ export default {
       remainCoupons: ( state ) => state.order.remainCoupons, // 仅限杭州当前剩余可选电子券上限
       parkMallCode: ( state ) => state.order.parkMallCode, // 当前车场的数据
       maxOneDayCoupons: ( state ) => state.order.maxOneDayCoupons,// 仅限杭州当日电子券可选上限
+      paperDiscountFee: ( state ) => state.order.paperDiscountFee,// 纸质券的优惠金额
     }),
   },
 
@@ -76,7 +77,7 @@ export default {
        * 2、superposition  叠加使用规则 (1不可叠加,2仅同类型可叠加,3可叠加);
        * */
       this.couponList = [...this.coupons];
-      this.remainPrice = this.usingTotalDiscount;
+      this.remainPrice = this.usingTotalDiscount - this.paperDiscountFee;
       if ((this.parkMallCode === 4 || this.parkMallCode === 6) && this.orderDetail?.discountInfo?.points[0]?.discountFee) {
         this.remainPrice = this.remainPrice - this.orderDetail.discountInfo.points[0].discountFee
       }   

+ 2 - 2
src/pages/parkingFeeV2/mixins/parkingFeePaperCoupon.js

@@ -83,7 +83,7 @@ export default {
   },
   methods: {
     pageInit() {
-      this.paperCouponList = [...this.paperCoupons]
+            this.paperCouponList = [...this.paperCoupons]
     },
     showToast( text ) {
       let options = {};
@@ -243,7 +243,7 @@ export default {
     // 确认
     confirm() {
       // 如果用户没有选择纸质优惠券,则返回上一级页面
-      if(!this.paperCoupons.length) {
+      if(!this.paperCoupons.length && !this.orderDetail?.discountInfo?.paperCoupons) {
         this.$router.back();
         return
       }

+ 12 - 0
src/store/order/paperCoupon.js

@@ -33,6 +33,18 @@ export default {
       newOldDiscountSwitch = true
       method = getPaperCouponDescription
     }
+    if(checkOutResponse?.discountInfo?.paperCoupons?.length) {
+      const paperCouponsList = []
+      checkOutResponse.discountInfo.paperCoupons.forEach(elm => {
+        if(elm.couponCode && elm.discountFee) {
+          paperCouponsList.push(elm)
+        }
+      })
+      if(paperCouponsList.length) {
+        commit('setPaperCoupons', paperCouponsList)
+        dispatch('setDiscountFee')
+      }
+    }
     const res = await method({
       groupId: groupId,
       mallId: mallId,

+ 3 - 3
src/store/order/points.js

@@ -133,7 +133,7 @@ export default {
     }
     // if ( parkMallCode === 5 && state.unlimitUsePoints === 'LIMIT' ) {
     if ( [ 5, 10 ].indexOf(parkMallCode) > -1 && !state.unLimitWeekendPoints ) {
-      if ( type === 'add' && (state.pointsTime >= maxPointsTime || state.usingTotalDiscount >= state.availableDiscountFee) ) {
+      if ( type === 'add' && (state.pointsTime >= maxPointsTime || state.usingTotalDiscount - state.paperDiscountFee >= state.availableDiscountFee) ) {
         // 以下是深圳积分上限规则
         // 超出抵扣上限,每日最高可抵扣${this.parkFee.parkInfoEntity.maxOneDayHour}元 '优惠金额' >= '每日最高可抵扣'
         // if ( state.usingTotalDiscount >= state.availableDiscountFee && !msg ) {
@@ -153,7 +153,7 @@ export default {
       // 当前使用优惠 state.usingTotalDiscount
       // 判断符合上限
       // 浦东积分上限判断
-      if ( parkMallCode === 1 && state.usingTotalDiscount >= maxOneDayDiscountFee ) {
+      if ( parkMallCode === 1 && state.usingTotalDiscount - state.paperDiscountFee >= maxOneDayDiscountFee ) {
         msg = `超出抵扣上限,每次最高可抵扣${ maxOneDayDiscountFee }元`
       }
     }
@@ -165,7 +165,7 @@ export default {
       // 当前使用优惠 state.usingTotalDiscount
       // 判断符合上限
       // 浦东积分上限判断: 减去纸质优惠券的金额
-      if ( parkMallCode === 1 && state.usingTotalDiscount >= maxOneTimeDiscountFee) {
+      if ( parkMallCode === 1 && state.usingTotalDiscount - state.paperDiscountFee >= maxOneTimeDiscountFee) {
         msg = `超出抵扣上限,每次最高可抵扣${ maxOneTimeDiscountTime }小时`
       }
     }