|
@@ -36,6 +36,8 @@ Page({
|
|
|
content: '您的退款已成功处理,感谢您的理解和支持'
|
|
|
}
|
|
|
},
|
|
|
+ timerCount: 0,
|
|
|
+ timer: null as any,
|
|
|
goodsInfo: {} as any,
|
|
|
orderNo: "" as string,
|
|
|
showCanvas: false,
|
|
@@ -47,15 +49,14 @@ Page({
|
|
|
*/
|
|
|
onLoad(options: any) {
|
|
|
if (options.orderNo) {
|
|
|
- console.log(options, 'options')
|
|
|
this.setData({
|
|
|
orderNo: options.orderNo
|
|
|
}, () => {
|
|
|
- this.getDetail()
|
|
|
+ this.getDetail(this.onTimeout)
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- async getDetail() {
|
|
|
+ async getDetail(callback?: any) {
|
|
|
try {
|
|
|
const { data } = await api_userPaymentOrderDetail(this.data.orderNo);
|
|
|
if (data.code == 200) {
|
|
@@ -89,8 +90,10 @@ Page({
|
|
|
this.setData({
|
|
|
goodsInfo,
|
|
|
status: result.wechatStatus
|
|
|
+ }, () => {
|
|
|
+ callback && typeof callback === 'function' && callback()
|
|
|
})
|
|
|
- if(result.wechatStatus != 'CLOSED') {
|
|
|
+ if(result.wechatStatus != 'CLOSED' || result.wechatStatus != 'WAIT_PAY') {
|
|
|
const firstGoods = tempGoods[0]
|
|
|
if(firstGoods?.shortUrl) {
|
|
|
this.createQrCode(firstGoods?.shortUrl, 'canvasCode')
|
|
@@ -171,4 +174,23 @@ Page({
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
+ onTimeout() {
|
|
|
+
|
|
|
+ const { goodsInfo, timerCount, timer } = this.data
|
|
|
+ if(goodsInfo.wechatStatus === 'WAIT_PAY' && timerCount <= 10) {
|
|
|
+ let count = timerCount
|
|
|
+ const tempT = setTimeout(async () => {
|
|
|
+ count += 1
|
|
|
+ await this.getDetail()
|
|
|
+ this.setData({
|
|
|
+ timer: tempT,
|
|
|
+ timerCount: count
|
|
|
+ }, () => {
|
|
|
+ this.onTimeout()
|
|
|
+ })
|
|
|
+ }, 3000);
|
|
|
+ } else {
|
|
|
+ clearTimeout(timer)
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|