Răsfoiți Sursa

未登录流程调整

john.hong 2 ani în urmă
părinte
comite
aa7099c19a

+ 5 - 4
src/api/request.js

@@ -83,7 +83,7 @@ const cancelLoading = () => {
 };
 
 function XUser(config) {
-  const params = {
+  let params = {
     userId: store.state?.kipUserId || '', // K+用户ID
     // userId: '2c9d85868652dee50186532bdbbb0001', // K+用户ID
     sourceType: 'WECHAT',
@@ -100,6 +100,7 @@ function XUser(config) {
     // lbsId: '8aaa82ea804d07cd0180516ff03b0008',
     lbsId: store.state?.lbsId || '',
   };
+  // params = {"userId":"8aaa809d835ba76d018377d482ac0004","sourceType":"WECHAT","phoneNumber":"15090631337","projectId":"","brandId":"8aaa81947c6e1ca0017c73c13cc30006","cid":"oudWQ5ccsJLSlUGt0s_RQysoHqgg","vipCode":"KERRY100213432","lbsId":"8aaa82ea804d07cd0180516ff03b0008"}
   if (/orders-and-prepay|calculate-discount|unlicensed-car-check-in/.test(config.url)) {
     params.buildingId = window.localStorage.getItem('buildingId');
   }
@@ -173,10 +174,10 @@ export const createAxiosByinterceptors = (config) => {
         }
       }
       // 错误信息提示
-      const { code, langMessage } = error.response.data;
-      const codeList = ['INTERNAL_SERVER_ERROR', 'VALIDATION_FAILED', 'CAR_NOT_FOUND', 'CAR_HAS_PLATE']; // 默认处理的错误code
+      const { code, langMessage, message } = error.response.data;
+      const codeList = ['INTERNAL_SERVER_ERROR', 'VALIDATION_FAILED', 'CAR_NOT_FOUND', 'CAR_HAS_PLATE', "NOT_FOUND"]; // 默认处理的错误code
       if (codeList.indexOf(code) > -1) {
-        uni.showToast({ title: langMessage, duration: 3000, icon: 'fail' });
+        uni.showToast({ title: langMessage || message, duration: 3000, icon: 'fail' });
       }
       // Message.error(error?.response?.data?.message || '服务端异常');
       return Promise.reject(error.response.data);

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

@@ -4,6 +4,7 @@ import LoginDom from '@/components/Login/Login.vue';
 import { mapState } from 'vuex';
 import { initWxJsSdkConfig } from '@/utils/login';
 import { getPlatform } from '@/utils/index';
+import { wxToLoginCallback } from '@/utils';
 
 const app = {
   globalData: {
@@ -117,6 +118,19 @@ export default {
     if (platform === 'micromessenger') {
       await initWxJsSdkConfig(['checkJsApi', 'scanQRCode']);
     }
+    const member = uni.getStorageSync('member');
+    console.log(4141, member);
+    if (!member && !uni.getStorageSync('isLogin') && window?.toWXSendMsg) {
+      wxToLoginCallback('parkingFee', (options) => {
+        uni.setStorageSync('isLogin', 'isLogin');
+        // console.log(126, options);
+        // if (options?.noLoginParkingFeeWebView === 'fail') {
+        //   this.loadData();
+        // } else {
+        //   this.$router.back(-1);
+        // }
+      });
+    }
 
     if (this.openid) {
       this.getParkInfo();
@@ -377,6 +391,15 @@ export default {
     },
     // 缴费记录
     doRouter: function () {
+      window?.toWXSendMsg({
+        type: 'uni_func',
+        funcName: 'setStorageSync',
+        options: {
+          key: 'noLoginParkingFeeWebViewPath',
+          value: ''
+        },
+      });
+      uni.setStorageSync('loadData', '');
       if (this.$store.state.isLogin === '3') {
         this.$router.push({ path: 'login' });
         return;
@@ -385,6 +408,15 @@ export default {
     },
     // 车牌管理
     doRouter2: function () {
+      window?.toWXSendMsg({
+        type: 'uni_func',
+        funcName: 'setStorageSync',
+        options: {
+          key: 'noLoginParkingFeeWebViewPath',
+          value: ''
+        },
+      });
+      uni.setStorageSync('loadData', '');
       if (this.$store.state.isLogin === '3') {
         this.$router.push({ path: 'login' });
         return;
@@ -394,6 +426,15 @@ export default {
     },
     //停车发票
     doRouter1: function () {
+      window?.toWXSendMsg({
+        type: 'uni_func',
+        funcName: 'setStorageSync',
+        options: {
+          key: 'noLoginParkingFeeWebViewPath',
+          value: ''
+        },
+      });
+      uni.setStorageSync('loadData', '');
       if (this.$store.state.isLogin === '3') {
         this.$router.push({ path: 'login' });
         return;
@@ -413,6 +454,15 @@ export default {
     },
     //停车券兑换
     doRouter3: function () {
+      window?.toWXSendMsg({
+        type: 'uni_func',
+        funcName: 'setStorageSync',
+        options: {
+          key: 'noLoginParkingFeeWebViewPath',
+          value: ''
+        },
+      });
+      uni.setStorageSync('loadData', '');
       window.toWXSendMsg({
         type: 'toPage',
         options: {
@@ -442,8 +492,8 @@ export default {
     // 无牌车闸机扫码
     async scanCarCode() {
       try {
-        this.qrCodesRule('e41d4d9dd5534f4aa3de88326a2e6f85')
-        return
+        // this.qrCodesRule('e41d4d9dd5534f4aa3de88326a2e6f85')
+        // return
         const runScanFn = (res) => {
           if (res.scanType == 'QR_CODE' && res.scanType) {
             console.log(res.result);

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

@@ -320,7 +320,7 @@ export default {
               this.$router.replace({
                 path: 'parkingFeePayment',
                 query: {
-                  msg: res.message,
+                  msg: res.langMessage,
                   vehicleNo: this.$route.query.vehicleNo,
                 },
               });

+ 5 - 37
src/pages/parkingFee/mixins/parkingFeeList.js

@@ -42,53 +42,21 @@ export default {
     canloading = true;
     pageNum = 0;
     const member = uni.getStorageSync('member');
-    console.log(4141, member)
-    this.loadData();
-    return
+    // console.log('用户不走未登录', !uni.getStorageSync('loadData'));
     if (member) {
       this.loadData();
-    } else {
+    } else if(!uni.getStorageSync('loadData')){
       wxToLoginCallback('parkingFeeList', (options) => {
-        console.log(229, options);
+        // console.log(229, options);
+        uni.setStorageSync('loadData', 'loadData')
         if (options?.noLoginParkingFeeWebView === 'fail') {
           this.loadData();
         } else {
           this.$router.back(-1);
         }
       });
-      /* // 前往登录
-       window.toWXSendMsg({
-       type: 'toLogin',
-       options: {
-       path: 'parkingFeeList',
-       },
-       });
-       window.subscribe('callback', (options) => {
-       // resolve(options);
-       console.log(110, options);
-       if (options.isReload) {
-       window.location.reload();
-       } else {
-       this.loadData();
-       }
-       });*/
-      // 登录的回调
-      // this.loadData()
-      /*this.$refs.authorize.login("/pages/parkingFee/parkingFee", () => {
-       this.loadData()
-       });*/
     }
   },
-  // mounted() {
-  //   console.log(123, this.$route)
-  // },
-  // onReachBottom: function() {
-  //   console.log('canloading', canloading)
-  //   if (canloading) {
-  //     pageNum++
-  //     this.loadData()
-  //   }
-  // },
   filters: {
     parkingTime(val) {
       const days = parseInt(val / 60 / 24);
@@ -127,7 +95,7 @@ export default {
       try {
         const res = await orders({
           page: params.page,
-          pageSize: params.pageSize,
+          size: params.pageSize,
         })
         console.log('res2', res);
         // const res = orderMockData

+ 1 - 1
src/utils/index.js

@@ -142,7 +142,7 @@ export function wxToLoginCallback(path, callback) {
       },
     });
     window.subscribe('callback', (options) => {
-      console.log('登录成功之后的回调', JSON.stringify(options));
+      console.log('登录页面的回调', JSON.stringify(options));
       if (options.isReload) {
         window.location.reload();
       } else {