ソースを参照

fix(SCRM-3864): 临时停车,用户当天有2个小时得满赠优惠,进入查询页面以后,取消掉消费减免勾选,减免得小时会不显示

john 2 年 前
コミット
6983b45da7

+ 86 - 0
src/api/mockData/checkout.pd12.response.json

@@ -0,0 +1,86 @@
+{
+  "parkingRecord": {
+      "vehicleNo": "沪K10005",
+      "enterTime": "2023-04-27 13:01:00",
+      "serviceMin": 38819,
+      "totalFee": 1294000,
+      "actualPayFee": 12940,
+      "thirdParkOrderNo": "4970708",
+      "createdByQrCode": false,
+      "totalFeeInYuan": 12940
+  },
+  "discountInfo": {
+      "usingTotalDiscount": 0,
+      "memberLevelDiscount": false,
+      "memberGrade": [
+          {
+              "selected": false
+          }
+      ],
+      "consume": [
+          {
+              "defaultSelected": true,
+              "selected": false,
+              "defaultDiscountTime": 3,
+              "discountFee": 24,
+              "redeemSalesAmount": 600,
+              "couponCodes": "due0spj8wc4_t#uel92wo47da_t#nyjr6yd95y9_t"
+          }
+      ],
+      "points": [
+          {
+              "available": 11452,
+              "selected": true,
+              "pointsPerUnit": 1200,
+              "unitAmount": 12,
+              "totalAvailable": 11452,
+              "unitHour": 1,
+              "newMember": false,
+              "label": "11452积分可减免",
+              "discountFee": 0
+          }
+      ],
+      "coupons": [
+          {
+              "code": "kmyhudoo6fo_t",
+              "couponId": "0350f3f6b73c4580810f72b5a61286d1",
+              "selected": false,
+              "status": "available",
+              "name": "1小时停车优惠券",
+              "expirationDate": "2023-06-22 23:59:59",
+              "discountFee": 12,
+              "defaultSelected": false,
+              "superposition": "2",
+              "limitCountPerOrder": 2
+          }
+      ],
+      "paperCoupons": [
+          {
+              "description": "纸质优惠券不限制会员使用。",
+              "selected": false
+          }
+      ]
+  },
+  "parkingRule": {
+      "maxOneTimeDiscountTime": 2,
+      "enableNewMemberPoints": false,
+      "enablePoints": true,
+      "unLimitWeekendPoints": false,
+      "enableCoupon": true,
+      "enablePaperCoupons": true,
+      "paperCouponsDescription": "纸质优惠券不限制会员使用。",
+      "enableConsume": true,
+      "enableConsumeSplit": false,
+      "maxConsumeTime": 3,
+      "remainConsumeTime": 3,
+      "hourPrice": 12,
+      "oneDayLimitation": false,
+      "oneTimeLimitation": true
+  },
+  "parkInfo": {
+      "parkName": "浦东嘉里城",
+      "description": "12元/小时。8-24小时封顶96元。纸质优惠券不限制使用数量。每次最多优惠2小时。积分兑换停车费用1200积分=1小时。积分商城售卖停车电子券的使用类型。单日累计消费满300元赠送1张消费600元赠2张1小时的停车券,不重复发券,消费跨天不累计,优惠有效期7天",
+      "parkMallCode": 1,
+      "buildingId": "184-100035"
+  }
+}

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

@@ -147,7 +147,7 @@ export default {
       const { parkMallCode } = parkInfo;
       const {maxOneTimeDiscountTime,oneTimeLimitation,oneDayLimitation,hourPrice,remainConsumeTime} = parkingRule
       // 设置深圳的达到优惠金额的上限,置灰剩下未选择的金额
-      if ( parkMallCode === 5 && this.remainPrice - this.paperDiscountFee >= this.newAvailableDiscountFee) {
+      if ( parkMallCode === 5 && this.remainPrice >= this.newAvailableDiscountFee) {
         this.couponList = this.couponList.map((elm,iemi) => {
           if ( !elm.disabled && this.checkedCouponList.indexOf(`coupon${iemi}`) < 0) {
             elm.disabled = true

+ 15 - 13
src/pages/parkingFee/mixins/parkingFeeDiscounts.js

@@ -142,13 +142,11 @@ export default {
       // console.log(143, JSON.stringify(this.consume) !== '{}' && this.consume.hasOwnProperty('selected') ? this.consume.selected !== undefined : this.consume.defaultSelected !== undefined);
       if (JSON.stringify(this.consume) !== '{}' && this.consume.hasOwnProperty('selected') ? this.consume.selected : this.consume.defaultSelected !== undefined) {
         this.checkedList.push('reduces');
-        this.isReduces = false;
+        // this.isReduces = false;
         // 如果存在拆分逻辑的话
         // this.consume.
-      } else {
-        console.log(150);
-        this.isReduces = true;
       }
+      this.isReduces = this.consume.hasOwnProperty('selected') ? false : true;
       this.reduceHours = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / this.orderDetail.parkingRule.hourPrice : this.consume.defaultDiscountTime;
       if (maxConsumeTime) {
         this.maxReduceDiscount = maxConsumeTime;
@@ -165,14 +163,17 @@ export default {
       }
       const { maxOneDayCoupons, maxonedaydiscountFee, maxOneTimeDiscountTime, remainConsumeTime, hourPrice, availableDiscountFee, oneTimeLimitation, oneDayLimitation, maxOneDayDiscountFee } = this.orderDetail.parkingRule;
       // console.log(133,this.reduceHours)
+      console.log(166, this.maxReduceDiscount);
       if (type === 'plus' && this.reduceHours < this.maxReduceDiscount) {
-        this.remainPrice = this.remainPrice + hourPrice;
-        this.reduceHours = this.reduceHours + 1;
+        
         const [isCrossMessage = false, maxReduceDiscount = this.maxReduceDiscount] = this.crossMessage();
         if (isCrossMessage) {
-          this.remainPrice = this.remainPrice - hourPrice;
-          this.reduceHours = this.reduceHours - 1;
+          // this.remainPrice = this.remainPrice - hourPrice;
+          // this.reduceHours = this.reduceHours - 1;
+          return
         }
+        this.remainPrice = this.remainPrice + hourPrice;
+        this.reduceHours = this.reduceHours + 1;
         return;
       }
       if (type === 'minus' && this.reduceHours > 1) {
@@ -210,10 +211,11 @@ export default {
       const reduceHours = (maxOneTimeDiscountFee - this.remainPrice) / hourPrice;
       if (this.checkedList.indexOf('reduces') > -1) {
         this.remainPrice = hourPrice + this.remainPrice;
-        this.maxReduceDiscount = maxConsumeTime;
+        // 计算最大上限
+        this.maxReduceDiscount = maxConsumeTime > maxOneTimeDiscountFee / hourPrice ? maxOneTimeDiscountFee / hourPrice : maxConsumeTime;
       } else {
         this.remainPrice = this.remainPrice - hourPrice;
-        this.maxReduceDiscount = maxConsumeTime;
+        this.maxReduceDiscount = maxConsumeTime > maxOneTimeDiscountFee / hourPrice ? maxOneTimeDiscountFee / hourPrice : maxConsumeTime;
         // this.reduceHours = maxConsumeTime;
       }
       const [isCrossMessage = false, maxReduceDiscount = 0] = this.crossMessage();
@@ -262,9 +264,9 @@ export default {
         const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
         const remainConsumeTimeFee = remainConsumeTime * hourPrice;
 
-        // TODO: 统计纸质优惠券的总金额, usingTotalDiscount - 纸质优惠券的总金额,才是用户当前订单使用的优惠总数
-        this.isMember = !(this.usingTotalDiscount - this.paperDiscountFee < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.memberLevelDiscount);
-        this.isReduces = !(this.usingTotalDiscount - this.paperDiscountFee < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.enableConsume);
+        // TODO: 统计纸质优惠券的总金额, usingTotalDiscount,才是用户当前订单使用的优惠总数
+        this.isMember = !(this.usingTotalDiscount < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.memberLevelDiscount);
+        this.isReduces = !(this.usingTotalDiscount < (oneTimeLimitation ? maxOneTimeDiscountFee : maxOneDayDiscountFee) && this.enableConsume);
       }
       if (callback) callback();
     },

+ 1 - 1
src/pages/parkingFee/parkingFeeDiscounts.vue

@@ -38,7 +38,7 @@
           <div class="fee-box">
             <div>合计:</div>
             <div class="actualPayFee">{{ actualPayFee | currency }}</div>
-            <div :class="['van-hairline--surround', 'usingTotalDiscount', usingTotalDiscount > 0 && 'usingTotalDiscount-red']">已优惠{{ remainPrice | currency }}元</div>
+            <div :class="['van-hairline--surround', 'usingTotalDiscount', usingTotalDiscount > 0 && 'usingTotalDiscount-red']">已优惠{{ usingTotalDiscount | currency }}元</div>
             <!-- <van-count-down :time="3 * 60 * 1000" /> -->
           </div>
         </div>

+ 1 - 1
src/store/order/index.js

@@ -1,4 +1,4 @@
-import checkOutQHResponse from "@/api/mockData/checkout.qh14.response.json";
+import checkOutQHResponse from "@/api/mockData/checkout.pd12.response.json";
 import { checkOut,calculateDiscount,ordersAndPrepay,currentUnlicensedPlate,unlicensedCarCheckIn,unlicensedCarCheckout } from '@/api/parking';
 import state from "@/store/order/state";
 import mutations from "@/store/order/mutations";

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

@@ -127,7 +127,7 @@ export default {
       if ( type === 'add' && (state.pointsTime >= maxPointsTime || state.usingTotalDiscount >= state.availableDiscountFee) ) {
         // 以下是深圳积分上限规则
         // 超出抵扣上限,每日最高可抵扣${this.parkFee.parkInfoEntity.maxOneDayHour}元 '优惠金额' >= '每日最高可抵扣'
-        if ( state.usingTotalDiscount - state.paperDiscountFee >= state.availableDiscountFee && !msg ) {
+        if ( state.usingTotalDiscount >= state.availableDiscountFee && !msg ) {
           msg = `超出抵扣上限,每日最高可抵扣${ state.maxOneDayDiscountFee }元`
         }
         // 超出抵扣上限,每次最高可抵扣${this.integralMaxMoney}元 '积分兑换时长' >= '深圳前海停车积分上限'q