소스 검색

Merge pull request #333 from John-Hong/John/release-2.20.0/SCRM-5068-2

fix(SCRM-5090): 剩余可用新会员积分小时数 = maxDiscountHours - usedDiscountHours
Tron 1 년 전
부모
커밋
9ffdcee86d
2개의 변경된 파일15개의 추가작업 그리고 3개의 파일을 삭제
  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,