소스 검색

fix(SCRM-4583): [DE][C端]临时停车,浦东,当用户有积分和消费减免的时候,用户手动不勾选消费减免,先添加积分或者电子券优惠,再点击消费减免。是可以选的

john 1 년 전
부모
커밋
14810b20b4
2개의 변경된 파일146개의 추가작업 그리고 10개의 파일을 삭제
  1. 100 0
      src/api/mockData/checkout.pd15.response.json
  2. 46 10
      src/pages/parkingFee/mixins/parkingFeeDiscounts.js

+ 100 - 0
src/api/mockData/checkout.pd15.response.json

@@ -0,0 +1,100 @@
+{
+  "parkingRecord": {
+      "vehicleNo": "沪K10007",
+      "enterTime": "2023-04-27 13:02:00",
+      "serviceMin": 27289,
+      "totalFee": 1100,
+      "actualPayFee": 0.0,
+      "thirdParkOrderNo": "4970710",
+      "createdByQrCode": false,
+      "totalFeeInYuan": 11.00
+  },
+  "discountInfo": {
+      "usingTotalDiscount": 20,
+      "memberLevelDiscount": true,
+      "memberGrade": [
+          {
+              "defaultSelected": false,
+              "selected": false,
+              "memberGradeText": "银卡卡",
+              "discountTime": 1,
+              "discountFee": 10
+          }
+      ],
+      "consume": [
+          {
+              "defaultSelected": true,
+              "selected": true,
+              "defaultDiscountTime": 2,
+              "discountFee": 10,
+              "redeemSalesAmount": 600
+          }
+      ],
+      "points": [
+          {
+              "available": 2052,
+              "selected": true,
+              "pointsPerUnit": 1200,
+              "unitAmount": 10,
+              "totalAvailable": 2052,
+              "unitHour": 1,
+              "newMember": false,
+              "label": "2052积分可减免",
+              "discountFee": 0
+          }
+      ],
+      "coupons": [
+          {
+              "code": "5hj0f0kxnz9_t",
+              "couponId": "fb824bf210f449aab90783187482435e",
+              "selected": false,
+              "status": "available",
+              "name": "Allison测试券",
+              "expirationDate": "2023-05-19 23:59:59",
+              "discountFee": 10,
+              "defaultSelected": false,
+              "superposition": "2",
+              "limitCountPerOrder": 1000
+          },
+          {
+              "code": "o2lz6b9vsb5_t",
+              "couponId": "fb824bf210f449aab90783187482435e",
+              "selected": true,
+              "status": "available",
+              "name": "Allison测试券",
+              "expirationDate": "2023-05-19 23:59:59",
+              "discountFee": 10,
+              "defaultSelected": false,
+              "superposition": "2",
+              "limitCountPerOrder": 1000
+          }
+      ],
+      "paperCoupons": [
+          {
+              "description": "纸质优惠券不限制会员使用。",
+              "selected": false
+          }
+      ]
+  },
+  "parkingRule": {
+      "maxOneTimeDiscountTime": 2,
+      "enableNewMemberPoints": false,
+      "enablePoints": true,
+      "unLimitWeekendPoints": false,
+      "enableCoupon": true,
+      "enablePaperCoupons": true,
+      "paperCouponsDescription": "纸质优惠券不限制会员使用。",
+      "enableConsume": true,
+      "maxConsumeTime": 2,
+      "remainConsumeTime": 2,
+      "hourPrice": 10,
+      "oneTimeLimitation": true,
+      "oneDayLimitation": false
+  },
+  "parkInfo": {
+      "parkName": "浦东嘉里城",
+      "description": "12元/小时。8-24小时封顶96元。纸质优惠券不限制使用数量。每次最多优惠2小时。积分兑换停车费用1200积分=1小时。积分商城售卖停车电子券的使用类型。单日累计消费满300元赠送1张消费600元赠2张1小时的停车券,不重复发券,消费跨天不累计,优惠有效期7天",
+      "parkMallCode": 1,
+      "buildingId": "184-100035"
+  }
+}

+ 46 - 10
src/pages/parkingFee/mixins/parkingFeeDiscounts.js

@@ -295,12 +295,23 @@ export default {
       const remainingLimitToIncrease = Math.abs(this.remainPrice - this.availableDiscountFee || 0) / hourPrice;
       // 如果是浦东的话, 重新计算优惠
       if (this.parkMallCode === 1) {
-        /*if(this.checkedList.indexOf('reduces') < 0) {
-          this.maxReduceDiscount = this.maxReduceDiscount > maxDiscountTime ? maxDiscountTime: this.maxReduceDiscount
+        // 如果超过限制就置灰
+        const maxOneTimeDiscountTimeFee = maxOneTimeDiscountTime * hourPrice
+        const isSelected = this.consume.hasOwnProperty('selected') ? this.consume.selected : this.consume.defaultSelected;
+        const isCheckedListSelected = this.checkedList.indexOf('consume') > -1;
+        if(maxOneTimeDiscountTimeFee > this.remainPrice) {
+          this.maxReduceDiscount = (maxOneTimeDiscountTimeFee - this.remainPrice) / hourPrice + (isSelected ? this.reduceHours : 0)
+          !isSelected && (this.reduceHours = this.maxReduceDiscount)
           return
-        }*/
-        this.maxReduceDiscount = this.remainPrice / hourPrice < remainConsumeTime ? remainConsumeTime : this.maxReduceDiscount
-        return;
+        }
+        if(maxOneTimeDiscountTimeFee == this.remainPrice && !isSelected && isCheckedListSelected) {
+          this.maxReduceDiscount = 0
+          this.reduceHours = this.maxReduceDiscount
+          return
+        } else {
+          this.maxReduceDiscount = this.reduceHours
+        }
+        return
       }
       if (!remainingLimitToIncrease) {
         // if(!this.consume.selected) {
@@ -364,14 +375,31 @@ export default {
       // debugger
       const { maxConsumeTime, remainConsumeTime, availableDiscountFee, hourPrice } = this.orderDetail.parkingRule;
       if (this.checkedList.indexOf('member') > -1) {
+        /* 浦东 */
+        if(this.parkMallCode === 1) {
+          const [isCrossMessage = false, maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage();
+          if (!isCrossMessage) {
+            this.remainPrice = this.memberGrade.discountFee + this.remainPrice;
+          } else {
+            this.checkedList = this.checkedList.filter((elm) => elm !== 'member');
+            // this.remainPrice = this.remainPrice - this.memberGrade.discountFee
+            this.isMember = false;
+          }
+          this.maxReduceDiscountInit();
+          return
+        }
         this.remainPrice = this.memberGrade.discountFee + this.remainPrice;
-        // console.log(331, this.remainPrice);
         // 沈阳
         if (this.parkMallCode === 4 || this.parkMallCode === 6) {
-          // console.log(322);
           this.maxReduceDiscountInit();
         }
       } else if (!this.isMember) {
+        // 浦东单独处理
+        if(this.parkMallCode === 1) {
+          this.remainPrice = this.remainPrice - this.memberGrade.discountFee;
+          this.maxReduceDiscountInit();
+          return
+        }
         this.remainPrice = this.remainPrice - this.memberGrade.discountFee;
         // 如果不是沈阳,重新计算优惠
         if (this.parkMallCode !== 4 && this.parkMallCode !== 6) {
@@ -396,9 +424,17 @@ export default {
       const { maxOneTimeDiscountTime, hourPrice, oneTimeLimitation, maxConsumeTime, remainConsumeTime, oneDayLimitation, maxOneDayDiscountFee, availableDiscountFee } = this.orderDetail.parkingRule;
       const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
       if (this.checkedList.indexOf('reduces') > -1) {
-        // this.remainPrice = hourPrice + this.remainPrice;
-        // 如果不是沈阳,重新计算计算最大上限
-        if (this.parkMallCode !== 4 && this.parkMallCode !== 6) {
+        if(this.parkMallCode === 1) {
+          const [isCrossMessage = false, maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage();
+          if(isCrossMessage) {
+            this.checkedList = this.checkedList.filter((elm) => elm !== 'reduces');
+            // this.remainPrice = this.remainPrice - this.memberGrade.discountFee
+            // this.isReduces = false;
+            return
+          }
+        }
+         if (this.parkMallCode !== 4 && this.parkMallCode !== 6) {
+           // 如果不是沈阳,重新计算计算最大上限
           this.remainPrice = hourPrice + this.remainPrice;
           this.maxReduceDiscount = remainConsumeTime > maxOneTimeDiscountFee / hourPrice ? maxOneTimeDiscountFee / hourPrice : remainConsumeTime;
         }