Browse Source

Merge pull request #606 from John-Hong/release-3.19.0

fix(KIP-19428): 优化积分兑换为小时或者金额
John-Hong 9 months ago
parent
commit
5e50fd48e8
2 changed files with 10 additions and 10 deletions
  1. 3 3
      src/components/plate-number/plateNumber.vue
  2. 7 7
      src/store/order/points.js

+ 3 - 3
src/components/plate-number/plateNumber.vue

@@ -134,7 +134,7 @@ export default {
   },
   methods: {
     disabledKeyboard(index) {
-      let dis = this.x !== 2 && index >= 32 && index <= 37;
+      let dis = index >= 32 && index <= 37;
       if(this?.disBtn?.length && this.disBtn.indexOf(index) > -1) {
         dis = true;
       }
@@ -345,7 +345,7 @@ export default {
           color: #000000;
         }
       }
-      button[disabled='disabled'] {
+      button[disabled] {
         color: #9da0a3;
       }
     }
@@ -462,7 +462,7 @@ export default {
         }
       } 
     }
-    button[disabled='disabled'] {
+    button[disabled] {
       color: #9da0a3;
     }
   }

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

@@ -50,7 +50,7 @@ export default {
     commit('setMaxDiscountFee',maxDiscountFee);
     let pointsTime = 0
     // 深圳
-    if ( parkMallCode === 5 || parkMallCode === 8 || parkMallCode === 10) {
+    if ( [5, 8, 10].includes(parkMallCode)) {
       pointsTime = discountFee || 0
     } else  {
       pointsTime = discountFee ?  discountFee / unitAmount: 0
@@ -123,7 +123,6 @@ export default {
     const {parkMallCode} = parkInfo
     const [points] = discountInfo?.points || [{}]
     const newMemberPoints = discountInfo?.newMemberPoints || {}
-    console.log(376,maxOneTimeDiscountTime,state.availableDiscountFee)
     /**
      * maxDiscountFee 单次最大可使用金额
      * availableDiscountFee 当日剩余可使用优惠金额
@@ -174,7 +173,7 @@ export default {
       }
     }
     // 单次上限限制
-    if ( oneTimeLimitation && !msg && [5, 8, 10].indexOf(parkMallCode) < 0 && parkMallCode !== 4 && parkMallCode !== 2 && type === 'add') {
+    if ( oneTimeLimitation && !msg && [2, 4, 5, 8, 10].indexOf(parkMallCode) < 0 && type === 'add') {
       const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice // 计算时间对应的金额
       // const remainConsumeTimeFee = remainConsumeTime * hourPrice
       // 计算单日剩余 remainConsumeTime
@@ -211,6 +210,7 @@ export default {
     // if(parkMallCode === 6 && state?.usingTotalDiscount>= parkingRecord?.totalFeeInYuan) {
     //   return
     // }
+    const isAmount = [5, 8, 10].indexOf(parkMallCode) > -1;  // 积分兑换规则是否以 兑换值(元)为主;
     if ( type === 'add' ) {
       // this.totalFeeInYuan - this.remainPrice <= 0
       if(state.orderDetail.parkingRecord.totalFee - state.usingTotalDiscount <= 0) {
@@ -222,9 +222,9 @@ export default {
       //   return
       // }
       let pointsTime = 0;
-      pointsTime = state.pointsTime + ([5, 8, 10].indexOf(parkMallCode) > -1 ? state.unitAmount : state.unitHour);
+      pointsTime = state.pointsTime + (isAmount ? state.unitAmount : state.unitHour);
       const available = state.available - state.pointsPerUnit;
-      const usingTotalDiscount = state.usingTotalDiscount + (state?.unitHour ? state.unitHour * hourPrice : state.unitAmount); // 重新计算已经使用的优惠逻辑
+      const usingTotalDiscount = state.usingTotalDiscount + (isAmount ? state.unitAmount : state.unitHour * hourPrice ); // 重新计算已经使用的优惠逻辑
       if ( available > -1 ) {
         // 如果是深圳车场
         commit('setAvailable',available);
@@ -233,8 +233,8 @@ export default {
       }
     }
     if ( type === 'minus' && state.pointsTime > 0 ) {
-      const pointsTime = state.pointsTime - ([5, 8, 10].indexOf(parkMallCode) > -1 ? state.unitAmount : state.unitHour);
-      const usingTotalDiscount = state.usingTotalDiscount - (state?.unitHour ? state.unitHour * hourPrice : state.unitAmount); // 重新计算已经使用的优惠逻辑
+      const pointsTime = state.pointsTime - (isAmount ? state.unitAmount : state.unitHour);
+      const usingTotalDiscount = state.usingTotalDiscount - (isAmount ? state.unitAmount : state.unitHour * hourPrice); // 重新计算已经使用的优惠逻辑
       // 如果是深圳车场
       commit('setAvailable',state.available + state.pointsPerUnit);
       commit('setPointsTime',pointsTime);