fix:修复订单详情页快递归还按钮展示bug
This commit is contained in:
+50
-12
@@ -75,13 +75,20 @@
|
||||
<image src="/static/customer-service.png" class="icon" mode="aspectFit"></image>
|
||||
<text>{{ $t('user.customerService') }}</text>
|
||||
</view>
|
||||
<view v-if="!showExpressAction" class="countdown-btn">
|
||||
{{ formatCountdown(countdownRemaining) }}{{ $t('order.canExpressReturn') }}
|
||||
</view>
|
||||
<view v-if="showExpressAction" class="action-btn secondary" @click="expressRetrunOrder">
|
||||
{{ $t('order.pauseBilling') }}
|
||||
</view>
|
||||
<view v-if="showExpressAction" class="action-btn primary" @click="quickReturn">
|
||||
<!-- 只有支持快递归还时才显示倒计时和快递归还按钮 -->
|
||||
<template v-if="orderInfo.isSupportExpressReturn !== 'no'">
|
||||
<view v-if="!showExpressAction" class="countdown-btn">
|
||||
{{ formatCountdown(countdownRemaining) }}{{ $t('order.canExpressReturn') }}
|
||||
</view>
|
||||
<view v-if="showExpressAction" class="action-btn secondary" @click="expressRetrunOrder">
|
||||
{{ $t('order.pauseBilling') }}
|
||||
</view>
|
||||
<view v-if="showExpressAction" class="action-btn primary" @click="quickReturn">
|
||||
{{ $t('order.quickReturn') }}
|
||||
</view>
|
||||
</template>
|
||||
<!-- 不支持快递归还时只显示快速归还按钮 -->
|
||||
<view v-else class="action-btn primary" @click="quickReturn">
|
||||
{{ $t('order.quickReturn') }}
|
||||
</view>
|
||||
</template>
|
||||
@@ -150,7 +157,8 @@
|
||||
isWithdrawn: false,
|
||||
positionName: '',
|
||||
returnPosition: '',
|
||||
expressReturnStart: null
|
||||
expressReturnStart: null,
|
||||
isSupportExpressReturn: 'yes'
|
||||
},
|
||||
timer: null,
|
||||
statusCheckTimer: null,
|
||||
@@ -216,7 +224,7 @@
|
||||
},
|
||||
onShow() {
|
||||
this.isPageActive = true
|
||||
if (this.orderInfo.orderStatus === 'in_used') {
|
||||
if (this.orderInfo.orderStatus === 'in_used' && this.orderInfo.isSupportExpressReturn !== 'no') {
|
||||
this.startExpressCountdown()
|
||||
}
|
||||
},
|
||||
@@ -325,8 +333,10 @@
|
||||
|
||||
// 快速归还
|
||||
quickReturn() {
|
||||
// 刷新订单状态,检查是否已归还
|
||||
this.checkReturnStatus()
|
||||
// 跳转到搜索页面查询周围设备
|
||||
uni.navigateTo({
|
||||
url: '/pages/search/index'
|
||||
})
|
||||
},
|
||||
|
||||
// 再次租借
|
||||
@@ -438,6 +448,14 @@
|
||||
|
||||
// 启动快递归还倒计时
|
||||
startExpressCountdown() {
|
||||
// 如果不支持快递归还,直接返回
|
||||
if (this.orderInfo.isSupportExpressReturn === 'no') {
|
||||
console.log('订单不支持快递归还,不启动倒计时')
|
||||
this.showExpressAction = false
|
||||
this.countdownRemaining = 0
|
||||
return
|
||||
}
|
||||
|
||||
this.clearExpressCountdown()
|
||||
this.recomputeExpressCountdownFromStartTime()
|
||||
if (this.showExpressAction) return
|
||||
@@ -450,6 +468,13 @@
|
||||
this.clearExpressCountdown()
|
||||
return
|
||||
}
|
||||
// 再次检查是否支持快递归还
|
||||
if (this.orderInfo.isSupportExpressReturn === 'no') {
|
||||
this.clearExpressCountdown()
|
||||
this.showExpressAction = false
|
||||
this.countdownRemaining = 0
|
||||
return
|
||||
}
|
||||
this.recomputeExpressCountdownFromStartTime()
|
||||
if (this.showExpressAction) {
|
||||
this.clearExpressCountdown()
|
||||
@@ -500,6 +525,13 @@
|
||||
|
||||
// 重新计算倒计时
|
||||
recomputeExpressCountdownFromStartTime() {
|
||||
// 如果不支持快递归还,直接返回
|
||||
if (this.orderInfo.isSupportExpressReturn === 'no') {
|
||||
this.showExpressAction = false
|
||||
this.countdownRemaining = 0
|
||||
return
|
||||
}
|
||||
|
||||
if (this.orderInfo.orderStatus !== 'in_used') {
|
||||
this.showExpressAction = false
|
||||
this.countdownRemaining = 0
|
||||
@@ -578,7 +610,10 @@
|
||||
if (this.orderInfo.orderStatus === 'in_used') {
|
||||
this.startTimer()
|
||||
this.startStatusCheckTimer()
|
||||
this.startExpressCountdown()
|
||||
// 只有支持快递归还时才启动倒计时
|
||||
if (this.orderInfo.isSupportExpressReturn !== 'no') {
|
||||
this.startExpressCountdown()
|
||||
}
|
||||
|
||||
uni.setStorageSync('activeOrderId', this.orderInfo.orderId)
|
||||
|
||||
@@ -640,6 +675,9 @@
|
||||
// 保存快递归还开始时间(小时为单位)
|
||||
this.orderInfo.expressReturnStart = orderData.expressReturnStart || null
|
||||
|
||||
// 保存是否支持快递归还
|
||||
this.orderInfo.isSupportExpressReturn = orderData.isSupportExpressReturn || 'yes'
|
||||
|
||||
// 如果有有效的 expressReturnStart,立即更新倒计时阈值(小时转秒)
|
||||
if (this.orderInfo.expressReturnStart && typeof this.orderInfo.expressReturnStart === 'number' && this.orderInfo.expressReturnStart > 0) {
|
||||
this.expressThresholdSeconds = this.orderInfo.expressReturnStart * 3600
|
||||
|
||||
Reference in New Issue
Block a user