diff --git a/pages/order/MyOrder/index.vue b/pages/order/MyOrder/index.vue
index c39a122..da0faf0 100644
--- a/pages/order/MyOrder/index.vue
+++ b/pages/order/MyOrder/index.vue
@@ -486,7 +486,7 @@
class="v12-font-24 v12-primary-text"
style="background: rgba(246,246,246,0.7); border-radius: 40rpx; padding: 12rpx ;"
>修改地址审核未通过,商家将按原地址发货,
- 预计{{ getTime(order.isFastPost) }}发货,
+ 预计{{ getTime(order.isFastPost) }}发货
(驳回原因:{{ order.addressUpdateReason }})
diff --git a/pages/order/OrderDetails/index.vue b/pages/order/OrderDetails/index.vue
index b48b377..63749dc 100644
--- a/pages/order/OrderDetails/index.vue
+++ b/pages/order/OrderDetails/index.vue
@@ -87,7 +87,7 @@
v-if="Number(orderInfo.addressUpdateStatus) === 2"
class="v12-font-24 v12-primary-text"
style="background: rgba(246,246,246,0.7); border-radius: 40rpx; padding: 12rpx;"
- >修改地址审核未通过,商家将按原地址发货,预计{{ getTime(orderInfo.isFastPost) }}发货,
+ >修改地址审核未通过,商家将按原地址发货,预计{{ getTime(orderInfo.isFastPost) }}发货
(驳回原因:{{ orderInfo.addressUpdateReason }})
diff --git a/pkg_product/views/sojoumOrderDetails.vue b/pkg_product/views/sojoumOrderDetails.vue
index 9519628..6288d7b 100644
--- a/pkg_product/views/sojoumOrderDetails.vue
+++ b/pkg_product/views/sojoumOrderDetails.vue
@@ -241,19 +241,24 @@ export default {
isView: 0,
showExperienceCouponPopup: false,
experienceCouponId: null,
- experienceCouponTimer: null
+ hasCheckedExperienceCoupon: false,
+ orderStatusTimer: null
}
},
onLoad(otps) {
this.key = otps.id;
this.isView = otps.isView || 0;
+ this.hasCheckedExperienceCoupon = false;
},
onShow() {
this.getSojoumOrderDetail();
},
+ onHide() {
+ this.stopOrderStatusPolling();
+ },
onUnload() {
uni.setStorageSync('needRefreshMyOrderList', 1)
- this.stopExperienceCouponPolling();
+ this.stopOrderStatusPolling();
},
methods: {
handleDateRangeChange(dates) {
@@ -325,37 +330,55 @@ export default {
/**
* 获取旅居团购订单详情
*/
- async getSojoumOrderDetail() {
+ async getSojoumOrderDetail(options = {}) {
+ const { showLoading = true } = options;
const params = {
key: this.key
}
- uni.showLoading({
- title: '加载中...',
- mask: true,
- })
- const res = await fetchSojoumOrderDetail(params);
- if (res.status === 200) {
- this.orderInfo = res.data;
- this.orderInfo.minBookingDays = this.getDaysCount();
- this.startExperienceCouponPolling();
- uni.hideLoading();
+ if (showLoading) {
+ uni.showLoading({
+ title: '加载中...',
+ mask: true,
+ })
+ }
+ try {
+ const res = await fetchSojoumOrderDetail(params);
+ if (res.status === 200) {
+ this.orderInfo = res.data;
+ this.orderInfo.minBookingDays = this.getDaysCount();
+ this.startOrderStatusPolling();
+ if (!this.hasCheckedExperienceCoupon) {
+ this.hasCheckedExperienceCoupon = true;
+ this.checkExperienceCouponStatus();
+ }
+ }
+ } finally {
+ if (showLoading) {
+ uni.hideLoading();
+ }
}
},
- startExperienceCouponPolling() {
- this.stopExperienceCouponPolling();
+ shouldPollOrderStatus() {
const statusType = this.orderInfo && this.orderInfo._status && this.orderInfo._status._type;
- // if (![1, 2].includes(Number(statusType))) {
- // return;
- // }
- this.checkExperienceCouponStatus();
- this.experienceCouponTimer = setInterval(() => {
- this.checkExperienceCouponStatus();
+ // 入住/核销成功后不再轮询
+ return !['3', '4'].includes(String(statusType || ''));
+ },
+ startOrderStatusPolling() {
+ if (!this.shouldPollOrderStatus()) {
+ this.stopOrderStatusPolling();
+ return;
+ }
+ if (this.orderStatusTimer) {
+ return;
+ }
+ this.orderStatusTimer = setInterval(() => {
+ this.getSojoumOrderDetail({ showLoading: false });
}, 5000);
},
- stopExperienceCouponPolling() {
- if (this.experienceCouponTimer) {
- clearInterval(this.experienceCouponTimer);
- this.experienceCouponTimer = null;
+ stopOrderStatusPolling() {
+ if (this.orderStatusTimer) {
+ clearInterval(this.orderStatusTimer);
+ this.orderStatusTimer = null;
}
},
async checkExperienceCouponStatus() {
@@ -377,7 +400,6 @@ export default {
if (!showPopup) {
return;
}
- this.stopExperienceCouponPolling();
this.experienceCouponId = data.couponId || null;
this.showExperienceCouponPopup = true;
} catch (e) {