Bläddra i källkod

fix(KIP-11937): 【DE】【C端】临时停车。查询缴费后,回到首页,点击其他功能,会显示“参数异常,请重试”,后会自动跳到停车缴费首页

john 1 år sedan
förälder
incheckning
a0d8e7b421

+ 1 - 4
public/index.html

@@ -6,11 +6,8 @@
   <meta http-equiv="X-UA-Compatible" content="IE=edge" viewport-fit="cover" />
   <meta name="viewport"
     content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
-  <!-- <title>
-            <%= htmlWebpackPlugin.options.title %>
-        </title> -->
   <title>
-    <%= webpackConfig.name %>
+      <%= htmlWebpackPlugin.options.title %>
   </title>
   <script>
     // CONFIGURATIONS_PLACEHOLDER

+ 4 - 3
src/App.vue

@@ -106,6 +106,7 @@ export default {
       // return
       // 微信重构改造 第二版本
       if(window.location.href.indexOf('tparking/wxV2') > -1) {
+        localStorageInit();
         window.isWxV2 = true
         
         uni.showLoading({
@@ -130,9 +131,9 @@ export default {
             console.log(108, this.$route);
             this.$store.commit('SET_IS_INIT', true);
             // 缓存
-            this.$store.commit('cachedViews/ADD_CACHED_VIEW', {
-              name: 'wxV2'
-            });
+            // this.$store.commit('cachedViews/ADD_CACHED_VIEW', {
+            //   name: 'wxV2'
+            // });
             // 无感积分逻辑
             // this.wxEasyPointsCommitStatusInit();
           },

+ 9 - 10
src/pages/parkingFeeV2/index.vue

@@ -2,7 +2,7 @@
   <div>
 <!--    <div>cachedViews: {{ cachedViews }}-{{ key }}</div>-->
     <keep-alive v-if="isInit" :include="cachedViews" :max="15">
-      <router-view :key="refreshPageKey" />
+      <router-view :key="key" />
     </keep-alive>
   </div>
 </template>
@@ -11,22 +11,22 @@ export default {
   name: 'wxV2',
   data() {
     return {
-      key: 1
+      // key: 1
     }
   },
   computed: {
     cachedViews() {
       return this.$store.state.cachedViews.cachedViews;
     },
-    refreshPageKey() {
-      return this.$store.state.refreshPageKey;
-    },
+    // refreshPageKey() {
+    //   return this.$store.state.refreshPageKey;
+    // },
     passLogin() {
       return this.$store.state.passLogin;
     },
-    // key() {
-    //   return this.$route.path;
-    // },
+    key() {
+      return this.$route.path;
+    },
     isInit() {
       return this.$store.state.isInit;
     },
@@ -61,8 +61,7 @@ export default {
         // parkingFeeMsg home parkingFeeSuccess parkingFeePayment
         // console.log('5858585858', to.name)
         if(fromNoADD.indexOf(name)  < 0 && toNoADD.indexOf(to.name) > -1 ) {
-          // this.key += 1
-          this.$store.commit('SET_REGRESH_PAGE_KEY')
+          this.key += 1
         }
       },
     },

+ 33 - 7
src/pages/parkingFeeV2/mixins/parkingFee.js

@@ -86,10 +86,12 @@ export default {
   created() {
     // console.log('二次加载this.$route.query.fromPage', this.$route.query.fromPage, this.$store.state.pageHistory);
     // console.log('二次加载', this.$route.query.fromPage && !this.$store.state.pageHistory[this.$route.query.fromPage]);
-    if(this.$route.query?.fromPage !== 'undefined' && !this.$store.state.pageHistory[this.$route.query.fromPage]) {
+    const fromPage = localStorage.getItem(`${this.$route.query.fromPage}`)
+    if(this.$route.query?.fromPage !== 'undefined' && !this.$store.state.pageHistory[this.$route.query.fromPage] && !fromPage) {
       this.$store.commit('setPageHistory', {
         [this.$route.query.fromPage]: 1
       })
+      localStorage.setItem(`${this.$route.query.fromPage}`, this.$route.query.fromPage)
       this.$router.push({ path: this.$route.query.fromPage, query: {
         ...this.$route.query,
         loginCount: 1
@@ -270,7 +272,7 @@ export default {
         ...new Set([this.vehicleNumber, ...this.carList]),
       ].slice(0, 6));
       this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
-        name: 'parkingFeeDetailV2',
+        name: 'parkingFeeDetail',
       });
       this.$store.commit('SET_REGRESH_PAGE_KEY')
       this.$nextTick(() => {
@@ -292,7 +294,7 @@ export default {
     toHandleSearch(vehicleNo) {
       uni.setStorageSync('carList', [...new Set([vehicleNo, ...this.carList])].slice(0, 6));
       this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
-        name: 'parkingFeeDetailV2',
+        name: 'parkingFeeDetail',
       });
       this.$store.commit('SET_REGRESH_PAGE_KEY')
       this.$nextTick(() => {
@@ -443,13 +445,21 @@ export default {
     },
     // 缴费记录
     doRouter: function () {
+      const query = {
+        ...this.$route.query,
+        // vehicleNo: vehicleNo,
+    }
+      // fromPage && format && unlicensed
+      query.fromPage = ''
+      query.format = ''
+      query.loginCount = ''
       // uni.setStorageSync('loadData', '');
       // if (this.$store.state.isLogin === 'loginDenied') {
       //   this.$router.push({ path: 'login' });
       //   return;
       // }
       this.$store.commit('SET_REGRESH_PAGE_KEY')
-      this.$router.push({ path: 'parkingFeeList', query: this.$route.query });
+      this.$router.push({ path: 'parkingFeeList', query });
     },
     // 车牌管理
     doRouter2: function () {
@@ -468,8 +478,16 @@ export default {
       //   this.$router.push({ path: 'login' });
       //   return;
       // }
+      const query = {
+        ...this.$route.query,
+        // vehicleNo: vehicleNo,
+    }
+      // fromPage && format && unlicensed
+      query.fromPage = ''
+      query.format = ''
+      query.loginCount = ''
       uni.removeStorageSync('passLogin');
-      this.$router.push({ path: 'vehicleManagement', query: this.$route.query });
+      this.$router.push({ path: 'vehicleManagement', query });
     },
     async jumpToPreJudgmentOfParkingInvoice() {
       return new Promise(async (resolve) => {
@@ -518,6 +536,14 @@ export default {
       //     value: ''
       //   },
       // });
+      const query = {
+        ...this.$route.query,
+        // vehicleNo: vehicleNo,
+    }
+      // fromPage && format && unlicensed
+      query.fromPage = ''
+      query.format = ''
+      query.loginCount = ''
       uni.setStorageSync('loadData', '');
       // if (this.$store.state.isLogin === 'loginDenied') {
       //   this.$router.push({ path: 'login' });
@@ -534,7 +560,7 @@ export default {
         return
       }
       */
-      this.$router.push({ path: 'parkingReceipt', query: this.$route.query  });
+      this.$router.push({ path: 'parkingReceipt', query });
     },
     //停车券兑换
     doRouter3: function () {
@@ -685,7 +711,7 @@ export default {
         // 如果是无牌车扫码:出场
         // console.log('模拟出场', this.unlicensedInfo.type);
         this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
-          name: 'parkingFeeDetailV2',
+          name: 'parkingFeeDetail',
         });
         // return
         if (this.unlicensedInfo?.type === 'unlicensedOut') {

+ 12 - 13
src/pages/parkingFeeV2/mixins/parkingFeeDetail.js

@@ -443,7 +443,7 @@ export default {
                 this.isPay = false
                 this.clearOrderTimeEvent()
                 this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
-                  name: 'parkingFeeDetailV2',
+                  name: 'parkingFeeDetail',
                 });
                 this.$router.replace({
                   // path: 'parkingFeeSuccess?carno=' + this.parkInfo.carno,
@@ -470,7 +470,6 @@ export default {
                   paySign: prepayJson.paySign,
                 }
               }
-              // debugger
               // console.log(430, options)
               const data = {
                 ...options,
@@ -482,8 +481,9 @@ export default {
               const packageStr = data.package + '$';
               const signType = data.signType + '$';
               const paySign = data.paySign + '$';
-              const vehicleNo = data.vehicleNo + '$';
-              const unlicensed = data.unlicensed ? 'unlicensedVehicle': 'licensedVehicle'  + '$';
+              const vehicleNo = this.orderDetail.parkingRecord.vehicleNo + '$';
+              const unlicensed = vehicleNo.indexOf('临') > -1 ? 'unlicensedVehicle': 'licensedVehicle'  + '$';
+              // return
               wx.miniProgram.redirectTo({
                 url: `/pages/package-parkingFee/payment?timeStamp=${encodeURIComponent(
                   timeStamp
@@ -850,16 +850,15 @@ export default {
         if (/NOT_FOUND|PARKING_RECORD_NOT_FOUND/.test(res.code)) {
           // 当前车辆没有查到账单
           this.clearOrderTimeEvent()
-          this.$router.replace({
-            path: 'parkingFeePayment',
-            query: {
-              ...this.$route.query,
-              msg: res.langMessage,
-              vehicleNo: this.$route.query.vehicleNo,
-            },
-          });
           setTimeout(() => {
-            this.$router.go(-1)
+            this.$router.replace({
+              path: 'parkingFeePayment',
+              query: {
+                ...this.$route.query,
+                msg: res.langMessage,
+                vehicleNo: this.$route.query.vehicleNo,
+              },
+            });
           }, 300)
           return
         }

+ 2 - 2
src/pages/parkingFeeV2/mixins/vehicleManagement.js

@@ -146,11 +146,11 @@ export default {
       console.log(145, this.isNoLogin, this.isLogin);
       if (this.isNoLogin) return
       this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
-        name: 'parkingFeeDetailV2',
+        name: 'parkingFeeDetail',
       });
       uni.setStorageSync('carList', [...new Set([carno, ...JSON.parse(uni.getStorageSync('carList') || '[]')])].slice(0, 6));
       this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
-        name: 'parkingFeeDetailV2',
+        name: 'parkingFeeDetail',
       });
       this.$nextTick(() => {
         this.$router.push({

+ 28 - 15
src/routes/index.js

@@ -8,17 +8,17 @@ import { routes as routesV2 } from './indexV2';
 const routes = [
   { path: '/', name: 'index', component: Home },
   { path: '/home', name: 'home', component: Home },
-  {
-    path: '/wxV2',
-    name: 'wxV2',
-    meta: {
-      keepAlive: true, // 需要被缓存
-    },
-    component: () => import('@/pages/parkingFeeV2/index.vue'),
-    children: [
-      ...routesV2,
-    ],
-  },
+  // {
+  //   path: '/wxV2',
+  //   name: 'wxV2',
+  //   meta: {
+  //     keepAlive: true, // 需要被缓存
+  //   },
+  //   component: () => import('@/pages/parkingFeeV2/index.vue'),
+  //   children: [
+  //     ...routesV2,
+  //   ],
+  // },
   {
     path: '/parkingFeePayment',
     component: () => import('@/pages/parkingFee/parkingFeePayment.vue'),
@@ -157,11 +157,10 @@ const routes = [
   // { path: '/bar', component: 'Bar' }
 ].map((item) => {
   let keepAlive = false;
-  console.log('160 item.name  ',item.name);
-  if (['parkingFeeDetail', 'parkingFeeDetailV2','wxV2'].indexOf(item.name) > -1) {
+  if (['parkingFeeDetail', 'parkingFeeDetailV2', 'wxV2'].indexOf(item.name) > -1) {
     keepAlive = true;
   }
-  if(item?.children?.length) {
+  if (item?.children?.length) {
     item.children = item.children.map(elm => {
       elm.keepAlive = false
       if (['parkingFeeDetail', 'parkingFeeDetailV2'].indexOf(elm.name) > -1) {
@@ -186,6 +185,20 @@ const wxRoutes = routes.map((item) => {
   };
 });
 
+const wx2Routes = routesV2.map((item) => {
+  let keepAlive = false
+  if (['parkingFeeDetail'].indexOf(item.name) > -1) {
+    keepAlive = true;
+  }
+  return {
+    ...item,
+    meta: {
+      keepAlive, // 不需要被缓存
+    },
+    path: `/wxV2${item.path}`,
+  };
+});
+
 // const wxV2Routes = routesV2.map((item) => {
 //   return {
 //     ...item,
@@ -223,7 +236,7 @@ const router = new VueRouter({
   base: '/tparking/',
   routes: [
     ...routes,
-    ...wxRoutes,
+    ...(window.isWxV2 ? wxRoutes : wx2Routes),
     ...otherRoutes,
     ...otherTparkingRoutes,
     // ...wxV2Routes,

+ 40 - 40
src/routes/indexV2.js

@@ -1,90 +1,90 @@
 import HomeV2 from '@/pages/parkingFeeV2/parkingFee.vue';
 
 export const routes = [
-    { path: '', name: 'indexV2', component: HomeV2 },
-    { path: 'home', name: 'homeV2', component: HomeV2 },
+    { path: '/', name: 'index', component: HomeV2 },
+    { path: '/home', name: 'home', component: HomeV2 },
     {
-        path: 'parkingFeeList',
-        name: 'parkingFeeListV2',
+        path: '/parkingFeeList',
+        name: 'parkingFeeList',
         component: () => import('@/pages/parkingFeeV2/parkingFeeList.vue'),
     },{
-        path: 'parkingFeeDetailSuccess',
-        name: 'parkingFeeListV2',
+        path: '/parkingFeeDetailSuccess',
+        name: 'parkingFeeList',
         component: () => import('@/pages/parkingFeeV2/parkingFeeDetailSuccess.vue'),
     },{
-        path: 'vehicleAddOrEdit',
-        name: 'vehicleAddOrEditV2',
+        path: '/vehicleAddOrEdit',
+        name: 'vehicleAddOrEdit',
         component: () => import('@/pages/parkingFeeV2/vehicleAddOrEdit.vue'),
     },{
-        path: 'vehicleManagement',
-        name: 'vehicleManagementV2',
+        path: '/vehicleManagement',
+        name: 'vehicleManagement',
         component: () => import('@/pages/parkingFeeV2/vehicleManagement.vue'),
     },{
-        path: 'parkingReceipt',
-        name: 'parkingReceiptV2',
+        path: '/parkingReceipt',
+        name: 'parkingReceipt',
         component: () => import('@/pages/parkingFeeV2/parkingReceipt/parkingReceipt.vue'),
     },{
-        path: 'parkingOrderDetail',
+        path: '/parkingOrderDetail',
         name: 'parkingOrderDetail',
         component: () => import('@/pages/parkingFeeV2/parkingReceipt/parkingOrderDetail.vue'),
     },{
-        path: 'parkingInvoiceImage',
-        name: 'parkingInvoiceImageV2',
+        path: '/parkingInvoiceImage',
+        name: 'parkingInvoiceImage',
         component: () => import('@/pages/parkingFeeV2/parkingReceipt/parkingInvoiceImage.vue'),
     },{
-        path: 'parkingInvoice',
-        name: 'parkingInvoiceV2',
+        path: '/parkingInvoice',
+        name: 'parkingInvoice',
         component: () => import('@/pages/parkingFeeV2/parkingReceipt/parkingInvoice.vue'),
     },{
-        path: 'parkingHeaderDetail',
-        name: 'parkingHeaderDetailV2',
+        path: '/parkingHeaderDetail',
+        name: 'parkingHeaderDetail',
         component: () => import('@/pages/parkingFeeV2/parkingReceipt/parkingHeaderDetail.vue'),
     },{
-        path: 'parkingChooseHeader',
-        name: 'parkingChooseHeaderV2',
+        path: '/parkingChooseHeader',
+        name: 'parkingChooseHeader',
         component: () => import('@/pages/parkingFeeV2/parkingReceipt/parkingChooseHeader.vue'),
     },{
-        path: 'parkingChangeHeader',
-        name: 'parkingChangeHeaderV2',
+        path: '/parkingChangeHeader',
+        name: 'parkingChangeHeader',
         component: () => import('@/pages/parkingFeeV2/parkingReceipt/parkingChangeHeader.vue'),
     },{
-        path: 'parkingApplication',
-        name: 'parkingApplicationV2',
+        path: '/parkingApplication',
+        name: 'parkingApplication',
         component: () => import('@/pages/parkingFeeV2/parkingReceipt/parkingChangeHeader.vue'),
     },{
-        path: 'parkingFeeDetail',
-        name: 'parkingFeeDetailV2',
+        path: '/parkingFeeDetail',
+        name: 'parkingFeeDetail',
         meta: {
             keepAlive: true, // 需要被缓存
         },
         component: () => import('@/pages/parkingFeeV2/parkingFeeDetail.vue'),
     },{
-        path: 'parkingFeePayment',
-        name: 'parkingFeePaymentV2',
+        path: '/parkingFeePayment',
+        name: 'parkingFeePayment',
         component: () => import('@/pages/parkingFeeV2/parkingFeePayment.vue'),
     },{
-        path: 'parkingFeeDiscounts',
-        name: 'parkingFeeDiscountsV2',
+        path: '/parkingFeeDiscounts',
+        name: 'parkingFeeDiscounts',
         component: () => import('@/pages/parkingFeeV2/parkingFeeDiscounts.vue'),
     },{
-        path: 'parkingFeePaperCoupon',
-        name: 'parkingFeePaperCouponV2',
+        path: '/parkingFeePaperCoupon',
+        name: 'parkingFeePaperCoupon',
         component: () => import('@/pages/parkingFeeV2/parkingFeePaperCoupon.vue'),
     },{
-        path: 'parkingFeeCoupon',
-        name: 'parkingFeeCouponV2',
+        path: '/parkingFeeCoupon',
+        name: 'parkingFeeCoupon',
         component: () => import('@/pages/parkingFeeV2/parkingFeeCoupon.vue'),
     },{
-        path: 'parkingFeeMsg',
-        name: 'parkingFeeMsgV2',
+        path: '/parkingFeeMsg',
+        name: 'parkingFeeMsg',
         component: () => import('@/pages/parkingFeeV2/parkingFeeMsg.vue'),
     },{
-        path: 'parkingFeeSuccess',
-        name: 'parkingFeeSuccessV2',
+        path: '/parkingFeeSuccess',
+        name: 'parkingFeeSuccess',
         component: () => import('@/pages/parkingFeeV2/parkingFeeSuccess.vue'),
     },
       {
-        path: 'about',
+        path: '/about',
         name: 'about',
         component: () => import('@/pages/parkingFeeV2/about.vue'),
     },