Selaa lähdekoodia

Merge pull request #326 from John-Hong/release-2.20.0

fix(SCRM-5059)
Tron 1 vuosi sitten
vanhempi
sitoutus
957d5b1e3d

+ 10 - 2
src/api/parking/index.js

@@ -52,8 +52,16 @@ export function calculateDiscount(params) {
 }
 
 // 1.13 下单并发起支付
-export function ordersAndPrepay(params, unlicensed=false) {
-  return window.requestms.post(`/parking/orders-and-prepay?unlicensed=${unlicensed}`, params, { loading: true });
+export function ordersAndPrepay({params, unlicensed=false, buildingId}) {
+  if(!buildingId) {
+    return Promise.reject(new Error('buildingId 为空'))
+  }
+  return window.requestms.post(`/parking/orders-and-prepay?unlicensed=${unlicensed}`, params, { 
+    loading: true,
+    'Parking-User': {
+      buildingId: buildingId,
+    }, 
+  });
 }
 
 // 1.23 会员查询无牌车临牌

+ 2 - 1
src/api/request.js

@@ -133,9 +133,10 @@ function XUser(config) {
   }
   
   // params = {"userId": "8aaa809d835ba76d018378bc57180006","sourceType": "WECHAT","phoneNumber": "18521563898","projectId": "paroject1","buildingId": "QHKC-P1","brandId":"8a84853b7c91ac5b017c962dab55030e","cid": "oIUfO5XAVleJ88z13i1_08DCKIhQ","vipCode":"KERRY100200040","lbsId":"8aaa81cb7c836c6b017c83e46b110001"}
-  if (/orders-and-prepay|calculate-discount|unlicensed-car-check-in|unlicensed-car-checkout|paper-coupon/g.test(config.url)) {
+  if (/calculate-discount|unlicensed-car-check-in|unlicensed-car-checkout|paper-coupon/g.test(config.url)) {
     params.buildingId = window.localStorage.getItem('buildingId');
   }
+  params = Object.assign(params, config['Parking-User'])
   const newParams = {}
   Object.keys(params).forEach(key => {
     const value = params[key]

+ 6 - 17
src/pages/parkingFeeV2/mixins/parkingFeeDetail.js

@@ -272,7 +272,7 @@ export default {
           this.btnLoading = false
         }
       }, 10000)
-      const { parkingRecord, discountInfo = {}, parkingRule = {}} = this.orderDetail;
+      const { parkingRecord, discountInfo = {}, parkingRule = {}, parkInfo = {}} = this.orderDetail;
       const { coupons, points, memberGrade = [], paperCoupons = [], consume = [], newMemberPoints= {} } = discountInfo
       const { hourPrice } = parkingRule
       try {
@@ -377,23 +377,12 @@ export default {
               }
             })
          }
-        // 新会员积分, 默认带上了,然后不加也不影响
-        // if ( newMemberPoints?.discountFee ) {
-        //   params.discountInfo.paperCoupons = paperCoupons.filter(elm => {
-        //     if ( !elm.discountFee ) {
-        //       return false
-        //     }
-        //     return {
-        //       ...elm,
-        //       "discountFee": elm.discountFee,
-        //       // discountTime: elm.discountFee / hourPrice * 60
-        //     }
-        //   })
-        // }
         console.log('下单时的参数', params);
-        const unlicensed = this.$route.query?.vehicleNo ? this.$route.query?.vehicleNo.indexOf('临') > -1 : false; // true: 临时车牌;false:燃油车牌
-        const res = await ordersAndPrepay(params, unlicensed);
-        // console.log('orderDetail', res);
+        const unlicensed = parkingRecord.vehicleNo.indexOf('临') > -1; // true: 临时车牌;false:燃油车牌
+        const res = await ordersAndPrepay({
+          params, unlicensed,
+          buildingId: parkInfo.buildingId
+        });
         if (res?.paymentType === 'NO_FEE_PAY') {
           this.btnLoading = false;
           this.isPay = false

+ 4 - 4
src/utils/common/localStorage.js

@@ -4,15 +4,15 @@ export function localStorageInit() {
   const carList = uni.getStorageSync('carList');
   const lbs_end_time = uni.getStorageSync('lbs_end_time');
   // 保留 buildingId
-  const buildingId = window.localStorage.getItem('buildingId')
+  // const buildingId = window.localStorage.getItem('buildingId')
   // 每次进入页面清空 缓存数据
   window.localStorage.clear();
   if (carList) {
     uni.setStorageSync('carList', JSON.parse(carList));
   }
-  if (buildingId) {
-    window.localStorage.setItem('buildingId', buildingId)
-  }
+  // if (buildingId) {
+  //   window.localStorage.setItem('buildingId', buildingId)
+  // }
   if(lbs_end_time) {
     uni.setStorageSync('lbs_end_time', lbs_end_time);
   }