mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:23:26 +08:00
【优化】支付成功后跳转到的查询结构,从立即获取后反馈,调整为3秒轮询一次,最多5次,防止微信回调及接口业务处理与支付结果存在时间差导致实际显示不一致。
This commit is contained in:
@@ -68,14 +68,25 @@
|
||||
},
|
||||
methods: {
|
||||
doGetData() {
|
||||
const _this = this;
|
||||
let time = '', i = 0;
|
||||
uni.showLoading({
|
||||
title: '获取支付结果中',
|
||||
mask: true
|
||||
});
|
||||
var _this = this;
|
||||
setTimeout(function () {
|
||||
// 3秒轮询一次,最多5次,防止微信回调及接口业务处理与支付结果实际不一致
|
||||
time = setInterval(function () {
|
||||
i++;
|
||||
if (i == 5 || _this.paymentInfo.status == 2) {
|
||||
clearInterval(time);
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
}, 500);
|
||||
return;
|
||||
}
|
||||
_this.getPaymentInfo();
|
||||
}, 2000);
|
||||
}, 3000);
|
||||
|
||||
},
|
||||
getPaymentInfo() {
|
||||
if (!this.paymentId) {
|
||||
@@ -102,13 +113,7 @@
|
||||
this.orderId = info.sourceId;
|
||||
this.status = true;
|
||||
this.paymentInfo = info;
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
}, 500);
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
}, 500);
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user