Quellcode durchsuchen

fix(SCRM-5090): 剩余可用新会员积分小时数 = maxDiscountHours - usedDiscountHours

john vor 1 Jahr
Ursprung
Commit
922a307e63
2 geänderte Dateien mit 15 neuen und 3 gelöschten Zeilen
  1. 10 2
      src/components/newMemberPoints/index.vue
  2. 5 1
      src/components/newMemberPoints/item.vue

+ 10 - 2
src/components/newMemberPoints/index.vue

@@ -104,14 +104,13 @@ export default {
       this.popup = true
     },
     pointsMath(type) {
-      const {usedDiscountHours, maxDiscountHours} = this.newMemberPoints
       if ( type === 'minus' && this.pointsTime ) {
         this.pointsTime = this.pointsTime - 1;
         this.newMemberPointsAvailable = this.newMemberPointsAvailable + this.newMemberPoints.pointsPerUnit;
         return
       }
       // 可能还有隐藏上限,就是普通的points的使用,单次不能超过上限
-      if(type === 'add' && this.newMemberPointsAvailable > this.newMemberPoints.pointsPerUnit && (this.pointsTime + usedDiscountHours < maxDiscountHours)) {
+      if(type === 'add' && this.isAdd()) {
         this.pointsTime = this.pointsTime + 1
         this.newMemberPointsAvailable = this.newMemberPointsAvailable - this.newMemberPoints.pointsPerUnit
       } else {
@@ -120,6 +119,15 @@ export default {
       // 调整当前积分
       // 调整points的积分available
     },
+    isAdd() {
+      const {usedDiscountHours, maxDiscountHours} = this.newMemberPoints
+      // const { hourPrice = 0 } = this.orderDetail?.parkingRule
+      const availableDiscountHours = maxDiscountHours - usedDiscountHours
+      if (!availableDiscountHours) {
+        return false
+      }
+      return this.newMemberPointsAvailable > this.newMemberPoints.pointsPerUnit && (this.pointsTime + usedDiscountHours < maxDiscountHours)
+    },
     cancelPointsMathPopup() {
       this.popup = false
     },

+ 5 - 1
src/components/newMemberPoints/item.vue

@@ -2,7 +2,7 @@
   <div class="info-item-box" v-if="enablePoints">
     <div class="label">新会员积分优惠</div>
     <div :class="['value']" @click="showPointsMathPopup('bottom')">
-      <span :class="[integralDesc === '今日已达上限' ? 'text-disable' : 'text-red']">{{ integralDesc }}</span>
+      <span :class="[integralDesc === '今日积分已达上限' ? 'text-disable' : 'text-red']">{{ integralDesc }}</span>
       <van-icon name="arrow"/>
     </div>
     <newMemberPoints :key="newMemberPointsKey" ref="newMemberPoints"></newMemberPoints>
@@ -36,6 +36,10 @@ export default {
       }
       const { maxDiscountHours, usedDiscountHours, discountFee = 0, available = 0,pointsPerUnit = 0 } = this.orderDetail?.discountInfo?.newMemberPoints
       const { hourPrice = 0 } = this.orderDetail?.parkingRule
+      const availableDiscountHours = maxDiscountHours - usedDiscountHours
+      if (!availableDiscountHours) {
+        return '今日积分已达上限'
+      }
       /*
       *       "available": 2400,
       "totalAvailable": 2700,