Jelajahi Sumber

Merge pull request #148 from John-Hong/John/release-2.10.0/KIP-10514

feat(SCRM-4004): 临停|UI获取纸质券描述|增加API
Tron 2 tahun lalu
induk
melakukan
bee1b7e44a

+ 14 - 15
src/api/mockData/checkout.pd14.response.json

@@ -1,35 +1,34 @@
 {
   "parkingRecord": {
-    "vehicleNo": "沪D10001",
+    "vehicleNo": "沪D10003",
     "enterTime": "2023-05-17 15:53:00",
-    "serviceMin": 27112,
-    "totalFee": 4000,
-    "actualPayFee": 16,
-    "thirdParkOrderNo": "4970728",
+    "serviceMin": 28745,
+    "totalFee": 2000,
+    "actualPayFee": 0,
+    "thirdParkOrderNo": "4970730",
     "createdByQrCode": false,
-    "totalFeeInYuan": 40
+    "totalFeeInYuan": 20
   },
   "discountInfo": {
     "usingTotalDiscount": 24,
     "memberLevelDiscount": false,
     "consume": [
       {
-        "defaultSelected": true,
-        "defaultDiscountTime": 10,
-        "discountFee": 24,
+        "defaultDiscountTime": 2,
         "redeemSalesAmount": 600,
-        "couponCodes": "0jv2pvambb3_t#8vr1b9wdbli_t#q2q9tqk9fjn_t#b5mkwsc4yag_t#8wl0qimifpi_t#ltvnf11f91l_t#01wn30uhezy_t#ljw41t7natw_t#x2rvzaj44e1_t#p62cmqrlhtk_t"
+        "couponCodes": "jr17wcxh58e_t#8guir7s7ysm_t"
       }
     ],
     "points": [
       {
-        "available": 11798,
+        "available": 4478,
         "pointsPerUnit": 1200,
         "unitAmount": 12,
-        "totalAvailable": 11798,
+        "totalAvailable": 6878,
         "unitHour": 1,
         "newMember": false,
-        "label": "11798积分可减免"
+        "label": "已选择兑换2小时",
+        "discountFee": 24
       }
     ],
     "paperCoupons": [
@@ -47,8 +46,8 @@
     "enablePaperCoupons": true,
     "enableConsume": true,
     "enableConsumeSplit": false,
-    "maxConsumeTime": 10,
-    "remainConsumeTime": 10,
+    "maxConsumeTime": 0,
+    "remainConsumeTime": 2,
     "hourPrice": 12,
     "oneTimeLimitation": true,
     "oneDayLimitation": false

+ 2 - 1
src/components/plate-number/plateNumber.vue

@@ -28,7 +28,8 @@
         </div>
         <div class="close-box">
           <div class="plate_number_box">
-            <button size="small" v-for="(item, index) in English_Number" :key="item.id" :class="[item.id === 99 && 'del', item.id === 66 && 'mini']" :disabled="item.id === 45 || item.id === 46 ? true : false" @click="checkEnglish_num(index)">
+            <!-- :disabled="item.id === 45 || item.id === 46 ? true : false" -->
+            <button size="small" v-for="(item, index) in English_Number" :key="item.id" :class="[item.id === 99 && 'del', item.id === 66 && 'mini']"  @click="checkEnglish_num(index)">
               <span v-if="item.id !== 99">{{ item.name }}</span>
               <img v-else :src="require(`../../static/images/back.png`)" alt="" />
             </button>

+ 4 - 0
src/pages/parkingFee/mixins/parkingFeeDetail.js

@@ -401,6 +401,8 @@ export default {
       // this.$store.commit('order/SET_ORDER_DETAIL', checkOutResponse);
       try {
         console.log('无牌车扫码出场', this.unlicensedInfo, this.endlessLoop);
+        this.btnLoading = false
+        this.isPay = false
         // return
         this.$store.dispatch('order/orderInit', {
           vehicleNo: this.$route.query.vehicleNo,
@@ -535,6 +537,8 @@ export default {
     // 重置倒计时
     resetCountDown() {
       this.$refs?.countDown?.reset();
+      this.btnLoading = false;
+      this.isPay = false
       this.$store.dispatch('order/orderInit', {
         gateId: this.$route.query?.gateId,
         vehicleNo: this.$route.query?.vehicleNo,

+ 1 - 0
src/pages/parkingFee/mixins/parkingFeePaperCoupon.js

@@ -74,6 +74,7 @@ export default {
       paperCoupons: ( state ) => state.order.paperCoupons,
       paperDiscountFee: ( state ) => state.order.paperDiscountFee,
       paperDiscountTime: ( state ) => state.order.paperDiscountTime,
+      paperCouponsDesc: ( state ) => state.order.paperCouponsDesc,
     }),
   },
   methods: {

+ 2 - 1
src/pages/parkingFee/parkingFeePaperCoupon.vue

@@ -4,7 +4,8 @@
       <div class="worp">
         <div class="title">纸质优惠劵减免说明</div>
         <div style="font-size: 28px; color: #808080; padding-top: 12px">
-          {{ (orderDetail && orderDetail.parkingRule && orderDetail.discountInfo.paperCoupons[0].description) || '' }}
+          <!-- {{ (orderDetail && orderDetail.parkingRule && orderDetail.discountInfo.paperCoupons[0].description) || '' }} -->
+          {{ paperCouponsDesc }}
         </div>
       </div>
       <div v-if="paperCouponList.length">

+ 2 - 0
src/store/index.js

@@ -153,6 +153,8 @@ const store = new Vuex.Store({
       state.isInit = payload;
     },
     SET_LBS_ID( state,payload ) {
+      uni.setStorageSync('lbsId',payload);
+      uni.setStorageSync('mallId',payload);
       state.lbsId = payload;
     },
     SET_BRAND_ID( state,payload ) {

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

@@ -1,4 +1,4 @@
-import checkOutQHResponse from "@/api/mockData/checkout.qh15.response.json";
+import checkOutQHResponse from "@/api/mockData/checkout.pd14.response.json";
 import { checkOut,calculateDiscount,ordersAndPrepay,currentUnlicensedPlate,unlicensedCarCheckIn,unlicensedCarCheckout } from '@/api/parking';
 import state from "@/store/order/state";
 import mutations from "@/store/order/mutations";
@@ -69,6 +69,8 @@ export default {
       commit('setParkMallCode', checkOutResponse.parkInfo.parkMallCode)
       commit('setOrderDetail',checkOutResponse);
       const isShowDiscounts = checkOutResponse?.parkingRule?.enableCoupon || false;
+      // 纸质优惠券
+      dispatch('paperCouponRule')
       // 是否展示优惠
       commit('setIsShowDiscounts',isShowDiscounts);
       if ( checkOutResponse.parkingRule ) {
@@ -83,8 +85,6 @@ export default {
         // 电子优惠券:是否启用
         // 处理电子优惠券相关逻辑
         dispatch('couponRule',checkOutResponse);
-        // 纸质优惠券(hold)
-        commit('setEnablePaperCoupons',checkOutResponse?.parkingRule?.enablePaperCoupons || false);
         // 其他数据收集
         commit('setUsingTotalDiscount',checkOutResponse?.discountInfo?.usingTotalDiscount || 0);
         // console.log(191, checkOutResponse?.parkingRecord.hasOwnProperty(actualPayFee));

+ 4 - 0
src/store/order/mutations.js

@@ -44,6 +44,9 @@ export default {
   setEnablePaperCoupons( state,payload ) {
     state.enablePaperCoupons = payload;
   },
+  setPaperCouponsDesc( state,payload ) {
+    state.paperCouponsDesc = payload;
+  },
   setUsingTotalDiscount( state,payload ) {
     state.usingTotalDiscount = payload;
   },
@@ -132,6 +135,7 @@ export default {
     state.couponCount = 0; // 已选择优惠券
     state.couponDesc = ''; // 优惠券说明文案
     state.enablePaperCoupons = false; // 启动纸质优惠券
+    state.paperCouponsDesc = ''; // 纸质优惠券说明
     state.usingTotalDiscount = 0; // 优惠金额
     state.actualPayFee = 0; // 应付金额
     state.availableDiscountFee = 0; // 当日剩余可使用优惠金额

+ 17 - 3
src/store/order/paperCoupon.js

@@ -1,5 +1,7 @@
 import { calculateDiscount } from "@/api/parking";
+import {paperCouponDescription} from '@/utils/api-crm-member'
 import { setSelected } from "@/store/order/utils";
+import uni from '@/utils/uniHooks'; 
 
 export default {
   /*
@@ -14,9 +16,21 @@ export default {
    },
    * 
    * */
-  paperCouponRule( {commit,dispatch,state},checkOutResponse ) {
-    if ( checkOutResponse.parkingRule.enablePaperCoupons ) {
-
+  async paperCouponRule( {commit,dispatch,state},checkOutResponse ) {
+    const groupId = uni.getStorageSync('groupId')
+    const mallId = uni.getStorageSync('mallId')
+    if(!mallId ||!mallId) {
+      commit('setEnablePaperCoupons', false);
+      return
+    }
+    const res = await paperCouponDescription({
+      groupId: groupId,
+      mallId: mallId
+    })
+    console.log(30, res)
+    if (res.msg === 'success' && res.data) {
+      commit('setEnablePaperCoupons', true);
+      commit('setPaperCouponsDesc', res.data)
     }
   },
   async savePaperCoupon( {commit,dispatch,state},{paperCoupons,callback} ) {

+ 4 - 5
src/store/order/points.js

@@ -199,8 +199,8 @@ export default {
       parkInfo: {parkMallCode},
       parkingRule,
     } = state.orderDetail;
-    const [{pointsPerHour,available,discountFee}] = points;
-    const {maxPointsTime,enablePoints,unitAmount} = parkingRule;
+    const [{pointsPerHour,available,discountFee, unitAmount}] = points;
+    const {maxPointsTime,enablePoints} = parkingRule;
     if ( !points ) {
       callback && callback();
       return
@@ -210,11 +210,10 @@ export default {
     if ( parkMallCode === 5 ) {
       pointsTime = discountFee || 0
     } else  {
-      pointsTime = discountFee ?  discountFee / unitAmount: 0
+      pointsTime = discountFee ?  discountFee / unitAmount : 0
     }
-    
     commit('setAvailable',available);
-    commit('setPointsTime',discountFee || 0);
+    commit('setPointsTime',pointsTime || 0);
     callback && callback();
   },
   async savePointsMath( {commit,dispatch,state},callback ) {

+ 1 - 0
src/store/order/state.js

@@ -16,6 +16,7 @@ export default  {
   couponCount: 0, // 已选择优惠券
   couponDesc: '', // 优惠券说明文案
   enablePaperCoupons: false, // 启动纸质优惠券
+  paperCouponsDesc: '', // 纸质优惠券说明文案
   usingTotalDiscount: 0, // 优惠金额
   actualPayFee: 0, // 应付金额
   availableDiscountFee: 0, // 当日剩余可使用优惠金额

+ 8 - 0
src/utils/api-crm-member.js

@@ -105,3 +105,11 @@ export function crmSaveMemberSource(params) {
   const url = `${BASE_URL}api/1.0/login/updateRegister`;
   return request.post(url, params);
 }
+
+
+// https://kerryprops.atlassian.net/browse/SCRM-4004
+// 临停|UI获取纸质券描述|增加API
+export function paperCouponDescription( {groupId, mallId}) {
+  const url = `${window.cmrApi}/1.0/park/paperCouponDescription?groupId=${groupId}&mallId=${mallId}`;
+  return request.post(url);
+}

+ 6 - 0
src/utils/index.js

@@ -175,12 +175,15 @@ export function initEnv() {
   if ( /dev-|8080/.test(href) ) {
     window.env = 'qa';
     window.profileApi = 'https://qa-apim.kerryplus.com/c/api';
+    window.cmrApi = 'https://qa-crm.kerryplus.com/xcrm-api/api';
     window.api = 'qaApi';
     // window.env = 'dev';
     // window.profileApi = 'https://dev-gateway-kip.kerryonvip.com/api';
+    // window.cmrApi = 'https://dev-crm.kerryplus.com/xcrm-api/api';
     // window.api = 'devApi';
     // window.env = 'prod';
     // window.profileApi = 'https://sl-apim.kerryplus.com/c/api';
+    // window.cmrApi = 'https://sl-crm.kerryplus.com/xcrm-api/api';
     // window.api = 'api';
     return;
   }
@@ -188,16 +191,19 @@ export function initEnv() {
     window.env = 'qa';
     window.api = 'qaApi';
     window.profileApi = 'https://qa-apim.kerryplus.com/c/api';
+    window.cmrApi = 'https://qa-crm.kerryplus.com/xcrm-api/api';
     return;
   }
   if ( /sl-/.test(href) ) {
     window.env = 'prod';
     window.profileApi = 'https://sl-apim.kerryplus.com/c/api';
+    window.cmrApi = 'https://sl-crm.kerryplus.com/xcrm-api/api';
     window.api = 'api';
     return;
   }
   window.env = 'prod';
   window.profileApi = 'https://apim.kerryplus.com/c/api';
+  window.cmrApi = 'https://crm.kerryplus.com/xcrm-api/api';
   window.api = 'api';
 }