|
@@ -1,5 +1,9 @@
|
|
|
import request from '@/helpers/request'
|
|
|
-import { postMessage } from '@/helpers/native-message'
|
|
|
+import {
|
|
|
+ listenerMessage,
|
|
|
+ postMessage,
|
|
|
+ removeListenerMessage
|
|
|
+} from '@/helpers/native-message'
|
|
|
import {
|
|
|
Button,
|
|
|
Cell,
|
|
@@ -44,6 +48,9 @@ export default defineComponent({
|
|
|
pay_channel: ''
|
|
|
}
|
|
|
},
|
|
|
+ unmounted() {
|
|
|
+ // removeListenerMessage('paymentOperation', this.onClose)
|
|
|
+ },
|
|
|
methods: {
|
|
|
onClose() {
|
|
|
Dialog.confirm({
|
|
@@ -107,23 +114,35 @@ export default defineComponent({
|
|
|
payInfo: `alipays://platformapi/startapp?saId=10000007&qrcode=${res.data.pay_info}`
|
|
|
}
|
|
|
})
|
|
|
- // pay_info
|
|
|
- Toast.loading({
|
|
|
- message: '支付中...',
|
|
|
- forbidClick: true,
|
|
|
- duration: 3000,
|
|
|
- loadingType: 'spinner',
|
|
|
- onClose: () => {
|
|
|
- this.$emit('update:modelValue', false)
|
|
|
- this.$router.replace({
|
|
|
- path: '/tradeDetail',
|
|
|
- query: {
|
|
|
- orderNo: this.orderInfo.orderNo
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
+ // 唤起支付时状态
|
|
|
+ listenerMessage('paymentOperation', (res: any) => {
|
|
|
+ if (res.status === 'success') {
|
|
|
+ Toast.success('支付成功')
|
|
|
+ } else if (res.status === 'cancel') {
|
|
|
+ Toast.fail('支付取消')
|
|
|
+ } else if (res.status === 'fail') {
|
|
|
+ Toast.fail('支付失败')
|
|
|
}
|
|
|
})
|
|
|
- this.$emit('update:modelValue', false)
|
|
|
+
|
|
|
+ // pay_info
|
|
|
+ // Toast.loading({
|
|
|
+ // message: '支付中...',
|
|
|
+ // forbidClick: true,
|
|
|
+ // duration: 3000,
|
|
|
+ // loadingType: 'spinner',
|
|
|
+ // onClose: () => {
|
|
|
+ // this.$emit('update:modelValue', false)
|
|
|
+ // this.$router.replace({
|
|
|
+ // path: '/tradeDetail',
|
|
|
+ // query: {
|
|
|
+ // orderNo: this.orderInfo.orderNo
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // this.$emit('update:modelValue', false)
|
|
|
} catch {}
|
|
|
}
|
|
|
},
|