From a2f9ee23771946f1063cfed0eb7b546da16939e7 Mon Sep 17 00:00:00 2001 From: LinCyJang Date: Sun, 29 Mar 2026 12:03:19 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A5004=20=E3=80=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91=E5=BE=85=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=A0=B8=E9=94=80=E5=90=8E=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E9=A1=B5=E9=9D=A2=E6=9C=AA=E8=87=AA=E5=8A=A8=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E6=9B=B4=E6=96=B0=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/experienceCouponOrderDetail.vue | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/pkg_product/views/experienceCouponOrderDetail.vue b/pkg_product/views/experienceCouponOrderDetail.vue index 8281508..26cfb34 100644 --- a/pkg_product/views/experienceCouponOrderDetail.vue +++ b/pkg_product/views/experienceCouponOrderDetail.vue @@ -121,7 +121,8 @@ export default { orderInfo: {}, userLatitude: null, userLongitude: null, - distanceText: '' + distanceText: '', + pollTimer: null } }, computed: { @@ -155,6 +156,12 @@ export default { } this.getUserLocation() }, + onUnload() { + this.stopOrderPoll() + }, + onHide() { + this.stopOrderPoll() + }, methods: { fetchDetail() { if (!this.orderId) { @@ -163,8 +170,31 @@ export default { getExperienceCouponOrderDetail(this.orderId).then(({ data }) => { this.orderInfo = data || {} this.updateDistance() + if (!this.isCompleted && !this.isExpired) { + this.startOrderPoll() + } else { + this.stopOrderPoll() + } }).catch(() => {}) }, + startOrderPoll() { + if (this.pollTimer || !this.orderId) { + return + } + this.pollTimer = setInterval(() => { + if (this.isCompleted || this.isExpired) { + this.stopOrderPoll() + return + } + this.fetchDetail() + }, 5000) + }, + stopOrderPoll() { + if (this.pollTimer) { + clearInterval(this.pollTimer) + this.pollTimer = null + } + }, getUserLocation() { uni.getLocation({ type: 'gcj02',