Browse Source

fix(SCRM-4959): 北京积分使用限制逻辑补充

john 1 year ago
parent
commit
8b86367173
3 changed files with 148 additions and 2 deletions
  1. 138 0
      src/api/mockData/checkout.bj2.response.json
  2. 1 1
      src/store/order/index.js
  3. 9 1
      src/store/order/points.js

+ 138 - 0
src/api/mockData/checkout.bj2.response.json

@@ -0,0 +1,138 @@
+{
+  "parkingRecord": {
+    "vehicleNo": "浙C35210",
+    "enterTime": "2023-10-17 09:13:52",
+    "serviceMin": 4502,
+    "totalFee": 4503,
+    "actualPayFee": 30.03,
+    "thirdParkOrderNo": "50E19852-2E31-4FFE-B526-662FFF9C5678",
+    "createdByQrCode": false,
+    "totalFeeInYuan": 45.03
+  },
+  "discountInfo": {
+    "usingTotalDiscount": 15,
+    "memberLevelDiscount": false,
+    "points": [
+      {
+        "available": 3800,
+        "maxDiscountFee": 10,
+        "pointsPerUnit": 500,
+        "unitAmount": 5,
+        "totalAvailable": 4800,
+        "unitHour": 1,
+        "newMember": false,
+        "label": "已选择兑换2小时",
+        "discountFee": 10
+      }
+    ],
+    "coupons": [
+      {
+        "code": "gnaza8hxtlg_t",
+        "couponId": "ef20b07b987f4875b1b43006ceb3954c",
+        "status": "available",
+        "name": "停车券",
+        "expirationDate": "2023-10-20 23:59:59",
+        "discountFee": 5,
+        "defaultSelected": true,
+        "superposition": "1",
+        "limitCountPerOrder": 0
+      },
+      {
+        "code": "o7guo6u4evn_t",
+        "couponId": "a9019eafeb8642f7bf3ff22735190ff5",
+        "status": "available",
+        "name": "可叠加电子券-Allison",
+        "expirationDate": "2023-10-22 23:59:59",
+        "discountFee": 5,
+        "defaultSelected": false,
+        "superposition": "2",
+        "limitCountPerOrder": 5
+      },
+      {
+        "code": "y6bhzc3ohu4_t",
+        "couponId": "a9019eafeb8642f7bf3ff22735190ff5",
+        "status": "available",
+        "name": "可叠加电子券-Allison",
+        "expirationDate": "2023-10-22 23:59:59",
+        "discountFee": 5,
+        "defaultSelected": false,
+        "superposition": "2",
+        "limitCountPerOrder": 5
+      },
+      {
+        "code": "n2c6v9lrwxk_t",
+        "couponId": "a9019eafeb8642f7bf3ff22735190ff5",
+        "status": "available",
+        "name": "可叠加电子券-Allison",
+        "expirationDate": "2023-10-22 23:59:59",
+        "discountFee": 5,
+        "defaultSelected": false,
+        "superposition": "2",
+        "limitCountPerOrder": 5
+      },
+      {
+        "code": "qmk5kzf2o5m_t",
+        "couponId": "a9019eafeb8642f7bf3ff22735190ff5",
+        "status": "available",
+        "name": "可叠加电子券-Allison",
+        "expirationDate": "2023-10-22 23:59:59",
+        "discountFee": 5,
+        "defaultSelected": false,
+        "superposition": "2",
+        "limitCountPerOrder": 5
+      },
+      {
+        "code": "s3m3k3j76rh_t",
+        "couponId": "e6bd36c527a447cc9570cbd43974ff85",
+        "status": "available",
+        "name": "不可叠加电子券-Allison",
+        "expirationDate": "2023-10-23 23:59:59",
+        "discountFee": 5,
+        "defaultSelected": false,
+        "superposition": "1",
+        "limitCountPerOrder": 5
+      },
+      {
+        "code": "5uvge6waz89_t",
+        "couponId": "e6bd36c527a447cc9570cbd43974ff85",
+        "status": "available",
+        "name": "不可叠加电子券-Allison",
+        "expirationDate": "2023-10-23 23:59:59",
+        "discountFee": 5,
+        "defaultSelected": false,
+        "superposition": "1",
+        "limitCountPerOrder": 5
+      },
+      {
+        "code": "ky3pp4eslyo_t",
+        "couponId": "e6bd36c527a447cc9570cbd43974ff85",
+        "status": "available",
+        "name": "不可叠加电子券-Allison",
+        "expirationDate": "2023-10-23 23:59:59",
+        "discountFee": 5,
+        "defaultSelected": false,
+        "superposition": "1",
+        "limitCountPerOrder": 5
+      }
+    ]
+  },
+  "parkingRule": {
+    "enableNewMemberPoints": true,
+    "enablePoints": true,
+    "unLimitWeekendPoints": false,
+    "enableCoupon": true,
+    "enablePaperCoupons": false,
+    "enableConsume": false,
+    "enableConsumeNonSplit": true,
+    "availableDiscountFee": 10,
+    "hourPrice": 5,
+    "oneTimeLimitation": false,
+    "oneDayLimitation": false
+  },
+  "parkInfo": {
+    "parkName": "BJ",
+    "description": "10元每小时\n会员停车优惠积分直接抵扣规则:\n嘉友卡800积分抵扣1小时(会员每日限抵扣免费停车2小时)\n嘉享卡、嘉礼卡650积分抵扣1小时(会员每日限抵扣免费停车2小时)\n会员首次停车300积分抵扣1小时(仅限首时)\n会员停车优惠停车券抵扣规则:\n工作日嘉友卡800积分/h,嘉礼卡、嘉享卡650积分/h\n节假日及周末嘉友卡500积分/h,嘉礼卡、嘉享卡350积分/h\n积分抵扣停车时长和停车券可同享,每日上限共4h",
+    "parkMallCode": 3,
+    "buildingId": "BKC-P1"
+  }
+}

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

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

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

@@ -106,9 +106,10 @@ export default {
   },
   },
   // 积分减免
   // 积分减免
   pointsMath( {commit,dispatch,state},{type,callback} ) {
   pointsMath( {commit,dispatch,state},{type,callback} ) {
-    const {parkInfo,parkingRule,parkingRecord} = state.orderDetail
+    const {parkInfo,parkingRule,parkingRecord, discountInfo = {}} = state.orderDetail
     const {maxOneTimeDiscountTime,oneTimeLimitation,oneDayLimitation,hourPrice,remainConsumeTime, maxOneDayDiscountFee} = parkingRule
     const {maxOneTimeDiscountTime,oneTimeLimitation,oneDayLimitation,hourPrice,remainConsumeTime, maxOneDayDiscountFee} = parkingRule
     const {parkMallCode} = parkInfo
     const {parkMallCode} = parkInfo
+    const [points] = discountInfo?.points || [{}]
     console.log(376,maxOneTimeDiscountTime,state.availableDiscountFee)
     console.log(376,maxOneTimeDiscountTime,state.availableDiscountFee)
     /**
     /**
      * maxDiscountFee 单次最大可使用金额
      * maxDiscountFee 单次最大可使用金额
@@ -163,6 +164,13 @@ export default {
         msg = `超出抵扣上限,每次最高可抵扣${ maxOneTimeDiscountTime }小时`
         msg = `超出抵扣上限,每次最高可抵扣${ maxOneTimeDiscountTime }小时`
       }
       }
     }
     }
+    // 北京积分使用限制
+    if(!msg && type === 'add' && parkMallCode === 3) {
+      const{ maxDiscountFee = 0, unitAmount =0 } = points
+      if ( maxDiscountFee && state.pointsTime >= maxDiscountFee/unitAmount) {
+        msg = `超出抵扣上限,每次最高可抵扣${ maxDiscountFee/unitAmount  }小时`
+      }
+    }
     if ( msg ) {
     if ( msg ) {
       callback({
       callback({
         message: msg
         message: msg