Selaa lähdekoodia

无牌车流程优化

john.hong 2 vuotta sitten
vanhempi
sitoutus
b57836de82

+ 1 - 3
src/api/request.js

@@ -21,7 +21,6 @@ const CONTENT_TYPE_ARRAY = {
 };
 
 function getHeaders(config = {}) {
-  console.log(24, '接口返送出去的config', config);
   const { contentType = 'json' } = config;
   const ct = CONTENT_TYPE_ARRAY[contentType];
   let header = {
@@ -52,7 +51,6 @@ function handleConfig(config = {}) {
   if (noToken) {
     delete header.Authorization;
   }
-  console.log(525252, header);
   return { header, ...config };
 }
 
@@ -175,7 +173,7 @@ export const createAxiosByinterceptors = (config) => {
       }
       // 错误信息提示
       const { code, langMessage, message } = error.response.data;
-      const codeList = ['INTERNAL_SERVER_ERROR', 'VALIDATION_FAILED', 'CAR_NOT_FOUND', 'CAR_HAS_PLATE', "NOT_FOUND", "LOCAL_PARK_ERROR", "LOCK_OCCUPIED", "REMOTE_CALL_FAIL"]; // 默认处理的错误code
+      const codeList = ['INTERNAL_SERVER_ERROR', 'VALIDATION_FAILED', 'CAR_NOT_FOUND', 'CAR_HAS_PLATE', "NOT_FOUND", "LOCAL_PARK_ERROR", "LOCK_OCCUPIED", "REMOTE_CALL_FAIL", 'PLEASE_SCAN_QRCODE']; // 默认处理的错误code
       if (codeList.indexOf(code) > -1) {
         uni.showToast({ title: langMessage || message, duration: 3000, icon: 'fail' });
       }

+ 3 - 4
src/pages/parkingFee/mixins/parkingFee.js

@@ -95,7 +95,8 @@ export default {
     },
     unlicensedInfo:{
       handler(){
-        console.log('用户是扫码进来的98', this.unlicensedInfo);
+        const member = uni.getStorageSync('member');
+        if(!member) return // 如果用户走未登录流程的话
         // 不论是否出入场,都使用此函数获取 gateId(闸口机器的ID)
         if (this.unlicensedInfo?.type && /unlicensedOut|unlicensedIn/.test(this.unlicensedInfo.type) && this.endlessLoop.length === 0) {
           // 此处记录扫码流程执行次数。如果超过一次则不再执行
@@ -140,10 +141,10 @@ export default {
                 this.getParkInfo();
                 this.$store.commit('SET_IS_INIT', true);
                 this.$nextTick(() => {
-                  console.log(143, newOptions);
                   // 如果是无牌车的扫码出入场
                   if(options?.options?.type && /unlicensedIn|unlicensedOut/.test(options.options.type)) {
                     this.$store.commit('SET_UNLICENSED_INFO', options.options);
+                    this.qrCodesRule(options.options.code);
                   }  
                 })
               })
@@ -583,9 +584,7 @@ export default {
     // 处理扫码结果: 组装参数,剩余流程,在 缴费支付页面 实现
     async qrCodesRule(code) {
       try {
-
         const qrCodesres = await qrCodes(code); // 无牌车扫码
-        console.log(584, qrCodesres);
         // 记录buildingId,确保 buildingId 是最新的数据
         window.localStorage.setItem('buildingId', qrCodesres.buildingId);
         // 如果是无牌车扫码:出场

+ 2 - 2
src/pages/parkingFee/mixins/parkingFeeDetail.js

@@ -320,7 +320,7 @@ export default {
           gateId: this.$route.query?.gateId,
           endlessLoop: this.endlessLoop,
           callback: (res) => {
-            console.log(323, res);
+            this.$store.dispatch('clearUnlicensed');
             // 如果 无牌车扫码出场扫码 无需缴费,直接展示无需缴费页面
             if(/unlicensedOut/.test(res.code) && res?.unlicensed) {
               this.$router.replace({
@@ -352,7 +352,7 @@ export default {
               });
               return
             }
-            if (/LOCAL_PARK_ERROR|INTERNAL_SERVER_ERROR|VALIDATION_FAILED/g.test(res.code)) {
+            if (/LOCAL_PARK_ERROR|INTERNAL_SERVER_ERROR|VALIDATION_FAILED|PLEASE_SCAN_QRCODE/g.test(res.code)) {
               setTimeout(() => {
                 this.$router.back()
               }, 1000)

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

@@ -37,6 +37,7 @@ export default {
         title: '缴费记录',
       });
     }, 301);
+    this.$store.dispatch('clearUnlicensed');
     this.list = [];
     // 重新获取数据
     canloading = true;

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

@@ -85,6 +85,7 @@ export default {
         title: '停车发票',
       });
     }, 300);
+    this.$store.dispatch('clearUnlicensed');
     if (JSON.stringify(this.member) !== '{}') {
       this.invoice(1);
     } else {

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

@@ -57,6 +57,7 @@ export default {
         title: '车辆管理',
       });
     }, 300);
+    this.$store.dispatch('clearUnlicensed');
     const member = uni.getStorageSync('member');
     if (member && JSON.stringify(this.member) !== '{}') {
       this.getKipMemberVehicles();

+ 2 - 3
src/store/index.js

@@ -159,7 +159,6 @@ const store = new Vuex.Store({
     },
     // 无牌车
     SET_UNLICENSED_INFO(state, payload) {
-      console.log('用户扫码进入的', payload);
       state.unlicensedInfo = payload;
     },
     SET_ENDLESS_LOOP(state, payload) {
@@ -233,10 +232,10 @@ const store = new Vuex.Store({
         commit('SET_GROUP_ID', groupId);
         commit('SET_MALL_ID', mallId);
         commit('SET_BRAND_ID', brandId);
-        console.log('用户扫码进入的', unlicensedInfo, unlicensedInfo?.type);
+        // console.log('用户扫码进入的', unlicensedInfo, unlicensedInfo?.type);
         // 如果是无牌车
         if (unlicensedInfo?.type) {
-          console.log('用户扫码进入的', unlicensedInfo);
+          // console.log('用户扫码进入的', unlicensedInfo);
           commit('SET_UNLICENSED_INFO', unlicensedInfo)
           // commit('SET_ENDLESS_LOOP', true)
         }

+ 2 - 2
src/store/order.js

@@ -144,14 +144,14 @@ const actions = {
   async orderInit({ commit, dispatch, state }, { gateId='124p3LK1', vehicleNo = '浙A616A1', callback, endlessLoop }) {
     try {
       dispatch('clearOrderInfo');
-        const unlicensed = vehicleNo.indexOf('临') > -1 || !vehicleNo; // true: 临时车牌;false:普通车牌
+        const unlicensed = vehicleNo.indexOf('临') > -1; // true: 临时车牌;false:普通车牌
         // const res = await checkOut('浙A616A1');
         // const res = await checkOut('闽AAQ5519', unlicensed);
         // const res = await checkOut('粤A51113');
         // const res = await checkOut('沪DCJ986');
         // console.log('无牌车扫码出场', endlessLoop);
         // 场内缴费,调 check-out 接口,
-        const method = unlicensed && endlessLoop ? unlicensedCarCheckout : checkOut
+        const method = unlicensed && endlessLoop || !vehicleNo ? unlicensedCarCheckout : checkOut
         const res = await method(vehicleNo, false, gateId);
         if ( res?.parkingRecord?.totalFee <= 0) {
           callback && callback({