调试支付
This commit is contained in:
@@ -92,10 +92,11 @@
|
|||||||
<script>
|
<script>
|
||||||
const jweixin = require('jweixin-module');
|
const jweixin = require('jweixin-module');
|
||||||
import { Apply, Wechat, authFollow } from '@/apis/interfaces/index'
|
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 {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
getState : false,
|
||||||
tradeId : '',
|
tradeId : '',
|
||||||
token : this.$store.getters.getToken,
|
token : this.$store.getters.getToken,
|
||||||
orderNo : '',
|
orderNo : '',
|
||||||
@@ -108,6 +109,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
if(this.getState && this.tradeId != ''){
|
||||||
|
this.onGetOrderPayState()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
let { orderId, orderType } = this.$Route.query
|
let { orderId, orderType } = this.$Route.query
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中...',
|
title: '加载中...',
|
||||||
@@ -131,6 +137,39 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
payType(type) {
|
||||||
if(this.Payment === type) return
|
if(this.Payment === type) return
|
||||||
@@ -202,6 +241,7 @@
|
|||||||
type : payType
|
type : payType
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
let { trade_id } = res;
|
let { trade_id } = res;
|
||||||
|
this.getState = true
|
||||||
this.tradeId = trade_id
|
this.tradeId = trade_id
|
||||||
switch (payType){
|
switch (payType){
|
||||||
case 'mp':
|
case 'mp':
|
||||||
|
|||||||
Reference in New Issue
Block a user