调试支付

This commit is contained in:
唐明明
2023-07-12 10:38:55 +08:00
parent 6d1382e2c5
commit a1e1e1d67e

View File

@@ -92,10 +92,11 @@
<script>
const jweixin = require('jweixin-module');
import { Apply, Wechat, authFollow } from '@/apis/interfaces/index'
import { payInfo, payWechat, payUms } from '@/apis/interfaces/pay'
import { payInfo, payWechat, payUms, umsState } from '@/apis/interfaces/pay'
export default {
data() {
return {
getState : false,
tradeId : '',
token : this.$store.getters.getToken,
orderNo : '',
@@ -108,6 +109,11 @@
}
},
onShow() {
if(this.getState && this.tradeId != ''){
this.onGetOrderPayState()
}
},
created() {
let { orderId, orderType } = this.$Route.query
uni.showLoading({
title: '加载中...',
@@ -131,6 +137,39 @@
})
},
methods: {
// 查询订单状态
onGetOrderPayState(){
// 查询支付状态
uni.showLoading({
title: '查询支付结果...',
mask : true
})
let outTime;
let resNumb = 0;
outTime = setInterval(() => {
if(resNumb >= 3){
clearInterval(outTime)
uni.showToast({
title: '暂未查询到你的支付订单',
icon : 'none'
})
return
}
umsState(this.trade_id).then(res => {
resNumb++
if(res.state === 'success'){
clearInterval(outTime)
console.log('支付成功')
}
}).catch(err => {
clearInterval(outTime)
uni.showToast({
title: err.message,
icon : 'none'
})
})
}, 2000)
},
// 选择支付方式
payType(type) {
if(this.Payment === type) return
@@ -202,6 +241,7 @@
type : payType
}).then(res => {
let { trade_id } = res;
this.getState = true
this.tradeId = trade_id
switch (payType){
case 'mp':