From 29ae6010b6ba9c2679d7bf22a32106f9d0dc0b03 Mon Sep 17 00:00:00 2001 From: jianweie code Date: Mon, 3 Jul 2023 21:37:34 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E6=88=90=E5=8A=9F=E5=90=8E=E8=B7=B3=E8=BD=AC=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E6=9F=A5=E8=AF=A2=E7=BB=93=E6=9E=84=EF=BC=8C=E4=BB=8E?= =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E8=8E=B7=E5=8F=96=E5=90=8E=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E6=95=B4=E4=B8=BA3=E7=A7=92=E8=BD=AE?= =?UTF-8?q?=E8=AF=A2=E4=B8=80=E6=AC=A1=EF=BC=8C=E6=9C=80=E5=A4=9A5?= =?UTF-8?q?=E6=AC=A1=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=BE=AE=E4=BF=A1=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E5=8F=8A=E6=8E=A5=E5=8F=A3=E4=B8=9A=E5=8A=A1=E5=A4=84?= =?UTF-8?q?=E7=90=86=E4=B8=8E=E6=94=AF=E4=BB=98=E7=BB=93=E6=9E=9C=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E6=97=B6=E9=97=B4=E5=B7=AE=E5=AF=BC=E8=87=B4=E5=AE=9E?= =?UTF-8?q?=E9=99=85=E6=98=BE=E7=A4=BA=E4=B8=8D=E4=B8=80=E8=87=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CoreShop/pages/payment/result/result.vue | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/payment/result/result.vue b/CoreCms.Net.Uni-App/CoreShop/pages/payment/result/result.vue index 0b36311d..fc52f50f 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/payment/result/result.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/payment/result/result.vue @@ -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); } });