Sfoglia il codice sorgente

feat: 支付返回逻辑修改

cuiyalong 5 anni fa
parent
commit
cb1b54413f
3 ha cambiato i file con 10 aggiunte e 3 eliminazioni
  1. 1 1
      package.json
  2. 1 1
      src/views/buy/Buy.vue
  3. 8 1
      src/views/pay/Pay.vue

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "jianyu-datareport",
-  "version": "1.8.53",
+  "version": "1.8.55",
   "private": true,
   "scripts": {
     "serve": "vue-cli-service serve",

+ 1 - 1
src/views/buy/Buy.vue

@@ -419,7 +419,7 @@ export default class BuyReport extends Vue {
         if (this.$env.isWeiXinBrowser) {
           location.href = `/weixin/pay/datareport?ordercode=${res.data.ordercode}`
         } else {
-          this.$router.push(`/pay?ordercode=${res.data.ordercode}&from=buy`)
+          this.$router.replace(`/pay?ordercode=${res.data.ordercode}&from=buy`)
         }
       }
     })

+ 8 - 1
src/views/pay/Pay.vue

@@ -101,6 +101,13 @@ export default class Pay extends Vue {
 
   beforeRouteLeave (to, from, next) {
     clearInterval(this.checkPaySuccessTimer)
+
+    // app端(不跳出vue程序) --- 支付返回订单详情
+    // (由于微信端使用location.href跳转,故此处监听不到,不会执行)
+    const arr = ['buy', 'detail']
+    if (arr.includes(to.name) && from.name === 'pay') {
+      next({ path: `/order/detail/${this.orderInfo.ordercode}` })
+    }
     next()
   }
 
@@ -245,7 +252,7 @@ export default class Pay extends Vue {
   }
 
   appPayCancelCallBack () {
-    this.$router.replace({ path: `/order/detail/${this.orderInfo.ordercode}` })
+    this.$router.back()
   }
 
   // 开启定时任务,3s查询一次是否支付成功