فهرست منبع

fix(SCRM-4320): [DE][C端]临时停车,扫描纸质优惠券以后,缴费页面会直接刷新

john 2 سال پیش
والد
کامیت
c026283350
1فایلهای تغییر یافته به همراه32 افزوده شده و 4 حذف شده
  1. 32 4
      src/pages/parkingFee/mixins/parkingFeeDetail.js

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

@@ -50,6 +50,11 @@ export default {
         },
       });
     }, 500)
+    setTimeout(() => {
+      this.pageInit();
+    }, 300)
+  },
+  mounted() {
     setTimeout(() => {
       window?.toWXSendMsg({
         type: 'nowRoute',
@@ -60,6 +65,7 @@ export default {
       window.subscribe('reload',(  ) => {
         // 如果是纸质券页面,发起的扫码动作,不做任何刷新动作
         if (window.location.href.indexOf('parkingFeePaperCoupon') > -1) {
+          this.reloadPage()
           return
         }
         // 如果当前路由不是支付页面,则回退到当前页面再刷新页面
@@ -71,11 +77,7 @@ export default {
         }, 100)
       });
     }, 700)
-    setTimeout(() => {
-      this.pageInit();
-    }, 300)
   },
-  
   computed: {
     ...mapState({
       orderDetail: (state) => state.order.orderDetail,
@@ -147,6 +149,32 @@ export default {
     },
   },
   methods: {
+    // 刷新管理
+    reloadPage() {
+      setTimeout(() => {
+        const fullPath = window.location.href.indexOf('parkingFeePaperCoupon') > -1 ? '/parkingFeeDetail/' : this.$route.fullPath
+        window?.toWXSendMsg({
+          type: 'nowRoute',
+          options: {
+            fullPath: fullPath
+          },
+        });
+        window.subscribe('reload',(  ) => {
+          // 如果是纸质券页面,发起的扫码动作,不做任何刷新动作
+          if (window.location.href.indexOf('parkingFeePaperCoupon') > -1) {
+            this.reloadPage()
+            return
+          }
+          // 如果当前路由不是支付页面,则回退到当前页面再刷新页面
+          if(this.$route.name !== 'parkingFeeDetail') {
+            this.$router.back()
+          }
+          setTimeout(() => {
+            window.location.reload();
+          }, 100)
+        });
+      }, 700)
+    },
     // 前往支付
     async toPay() {
       // 判断微信小程序与 h5 是否正常通信