|
@@ -34,6 +34,7 @@
|
|
|
import { Component, Vue } from 'vue-property-decorator'
|
|
|
import { Cell, CellGroup, Radio, RadioGroup } from 'vant'
|
|
|
import { mapActions } from 'vuex'
|
|
|
+import { registerPayCallBack } from '@/utils/globalFunctionsForApp.ts'
|
|
|
|
|
|
declare const JyObj: any
|
|
|
|
|
@@ -100,12 +101,6 @@ export default class Pay extends Vue {
|
|
|
|
|
|
beforeRouteLeave (to, from, next) {
|
|
|
clearInterval(this.checkPaySuccessTimer)
|
|
|
-
|
|
|
- // app端(不跳出vue程序) --- 支付返回订单详情
|
|
|
- // (由于微信端使用location.href跳转,故此处监听不到,不会执行)
|
|
|
- if (to.name === 'buy' && from.name === 'pay') {
|
|
|
- next({ path: `/order/detail/${this.orderInfo.ordercode}` })
|
|
|
- }
|
|
|
next()
|
|
|
}
|
|
|
|
|
@@ -120,6 +115,7 @@ export default class Pay extends Vue {
|
|
|
}
|
|
|
|
|
|
mounted () {
|
|
|
+ const from: any = this.$route.query.from
|
|
|
this.getInfo()
|
|
|
|
|
|
// 微信下使用addEventListener监听返回 跳转订单详情
|
|
@@ -132,6 +128,15 @@ export default class Pay extends Vue {
|
|
|
this.$once('hook:beforeDestroy', () => {
|
|
|
window.removeEventListener('popstate', this.onpopstate)
|
|
|
})
|
|
|
+ } else {
|
|
|
+ // 如果是从购买页面进入
|
|
|
+ if (from === 'buy') {
|
|
|
+ registerPayCallBack({
|
|
|
+ cancel: this.appPayCancelCallBack
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ registerPayCallBack()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -239,6 +244,10 @@ export default class Pay extends Vue {
|
|
|
this.checkAppPaySuccess()
|
|
|
}
|
|
|
|
|
|
+ appPayCancelCallBack () {
|
|
|
+ this.$router.replace({ path: `/order/detail/${this.orderInfo.ordercode}` })
|
|
|
+ }
|
|
|
+
|
|
|
// 开启定时任务,3s查询一次是否支付成功
|
|
|
checkAppPaySuccess () {
|
|
|
const ordercode = this.orderInfo.ordercode
|