新增暂停时长
This commit is contained in:
@@ -134,9 +134,19 @@
|
||||
}
|
||||
});
|
||||
|
||||
const hasPauseTime = computed(() => {
|
||||
const pt = props.order.pauseTime
|
||||
return pt !== undefined && pt !== null && String(pt).trim() !== ''
|
||||
})
|
||||
const isBillingPaused = computed(() => normalizedStatus.value === 'in_used' && hasPauseTime.value)
|
||||
|
||||
const statusDef = computed(() => props.orderStatusMap?.[rawStatus.value] || props.orderStatusMap?.[normalizedStatus.value] || {});
|
||||
const statusText = computed(() => statusDef.value.text || '');
|
||||
const statusText = computed(() => {
|
||||
if (isBillingPaused.value) return t('order.orderStatusBillingPaused')
|
||||
return statusDef.value.text || ''
|
||||
});
|
||||
const statusChipClass = computed(() => {
|
||||
if (isBillingPaused.value) return 'chip-paused'
|
||||
const cls = statusDef.value.class || '';
|
||||
if (cls.includes('status-using')) return 'chip-using';
|
||||
if (cls.includes('status-waiting')) return 'chip-waiting';
|
||||
@@ -212,6 +222,7 @@
|
||||
overflow: hidden;
|
||||
.chip-text { display: inline-block; transform: skewX(15deg); }
|
||||
&.chip-using { background: rgba(7,193,96,0.12); color: #07c160; }
|
||||
&.chip-paused { background: rgba(255,152,0,0.16); color: #e65100; }
|
||||
&.chip-waiting { background: rgba(255,152,0,0.12); color: #FF9800; }
|
||||
&.chip-finished { background: rgba(76,175,80,0.12); color: #4CAF50; }
|
||||
&.chip-cancelled { background: rgba(158,158,158,0.12); color: #9E9E9E; }
|
||||
|
||||
+22
-3
@@ -135,11 +135,30 @@ export const createAliPayment = (orderNo) => {
|
||||
})
|
||||
}
|
||||
|
||||
// 获取正在使用中的订单
|
||||
export const getInUseOrder = () => {
|
||||
// 获取正在使用中的订单(可传 hideLoading: true 由业务自行控制 loading)
|
||||
export const getInUseOrder = (opts = {}) => {
|
||||
return request({
|
||||
url: '/app/order/inUse',
|
||||
method: 'get'
|
||||
method: 'get',
|
||||
...opts
|
||||
})
|
||||
}
|
||||
|
||||
// 查询订单是否可申请暂停计费
|
||||
export const getPauseBillingEligible = (orderId) => {
|
||||
return request({
|
||||
url: `/app/order/pauseBilling/eligible/${orderId}`,
|
||||
method: 'get',
|
||||
hideLoading: true
|
||||
})
|
||||
}
|
||||
|
||||
// 对订单执行暂停计费
|
||||
export const requestPauseBilling = (orderId) => {
|
||||
return request({
|
||||
url: `/app/order/pauseBilling/${orderId}`,
|
||||
method: 'post',
|
||||
hideLoading: true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+13
-1
@@ -227,12 +227,21 @@ export default {
|
||||
returnedThankYou: 'Your fan has been returned, thank you for using',
|
||||
used: 'Used',
|
||||
rentInfo: 'Rent Information',
|
||||
rentInfoExpand: 'Expand',
|
||||
rentInfoCollapse: 'Collapse',
|
||||
fanNo: 'Fan No.',
|
||||
rentMethod: 'Rent Method',
|
||||
returnLocation: 'Return Location',
|
||||
paid: 'Paid',
|
||||
canExpressReturn: ' later for express return',
|
||||
pauseBilling: 'Pause Billing',
|
||||
pauseBillingSuccess: 'Billing paused',
|
||||
pauseBillingFailed: 'Could not pause billing. Please try again.',
|
||||
pauseBillingNotEligible: 'This order cannot pause billing right now.',
|
||||
billingPausedBadge: 'Billing paused',
|
||||
orderStatusBillingPaused: 'Billing paused',
|
||||
billingPausedDurationLabel: 'Paused for',
|
||||
pausedExpressAvailable: 'Express return is available',
|
||||
rentAgain: 'Rent Again',
|
||||
backToHome: 'Back to Home',
|
||||
feeAppeal: 'Fee Appeal',
|
||||
@@ -293,6 +302,7 @@ export default {
|
||||
deviceEjectSuccess: 'Device ejection retry initiated',
|
||||
deviceEjectFailed: 'Operation failed',
|
||||
deviceEjectError: 'Operation failed, please try again later',
|
||||
Pause:'Pause'
|
||||
},
|
||||
|
||||
user: {
|
||||
@@ -482,7 +492,9 @@ export default {
|
||||
faq4Question: 'When will deposit be refunded?',
|
||||
faq4Answer: 'Deposit refund is automatically initiated after returning. It takes 0-7 business days.',
|
||||
faq5Question: 'What if device doesn\'t work?',
|
||||
faq5Answer: 'Submit feedback via "My - Feedback", or call customer service directly.'
|
||||
faq5Answer: 'Submit feedback via "My - Feedback", or call customer service directly.',
|
||||
pauseBillingButton: 'Pause billing',
|
||||
pauseBillingHint: 'You may request to pause billing during an active rental (see your order for details).'
|
||||
},
|
||||
|
||||
settings: {
|
||||
|
||||
+12
-1
@@ -227,12 +227,21 @@ export default {
|
||||
returnedThankYou: 'Kipas angin Anda telah dikembalikan, terima kasih telah menggunakan',
|
||||
used: 'Digunakan',
|
||||
rentInfo: 'Informasi Penyewaan',
|
||||
rentInfoExpand: 'Buka',
|
||||
rentInfoCollapse: 'Tutup',
|
||||
fanNo: 'Nomor Kipas Angin',
|
||||
rentMethod: 'Metode Penyewaan',
|
||||
returnLocation: 'Lokasi Pengembalian',
|
||||
paid: 'Dibayar',
|
||||
canExpressReturn: 'Dapat dikembalikan melalui ekspres',
|
||||
pauseBilling: 'Jeda Penagihan',
|
||||
pauseBillingSuccess: 'Penagihan dijeda',
|
||||
pauseBillingFailed: 'Gagal menjeda penagihan, coba lagi.',
|
||||
pauseBillingNotEligible: 'Pesanan ini belum memenuhi syarat jeda penagihan.',
|
||||
billingPausedBadge: 'Penagihan dijeda',
|
||||
orderStatusBillingPaused: 'Penagihan dijeda',
|
||||
billingPausedDurationLabel: 'Dijeda selama',
|
||||
pausedExpressAvailable: 'Pengembalian ekspres dapat diajukan',
|
||||
rentAgain: 'Sewa Lagi',
|
||||
backToHome: 'Kembali ke Beranda',
|
||||
feeAppeal: 'Banding Biaya',
|
||||
@@ -482,7 +491,9 @@ export default {
|
||||
faq4Question: 'Berapa lama deposit akan dikembalikan?',
|
||||
faq4Answer: 'Setelah perangkat dikembalikan, deposit akan secara otomatis memulai pengembalian dana, diperkirakan akan diterima dalam 0-7 hari kerja.',
|
||||
faq5Question: 'Apa yang harus dilakukan jika perangkat tidak dapat digunakan secara normal?',
|
||||
faq5Answer: 'Anda dapat mengirimkan umpan balik kesalahan melalui "Saya-Keluhan dan Saran", atau langsung menghubungi nomor telepon layanan pelanggan untuk menanganinya.'
|
||||
faq5Answer: 'Anda dapat mengirimkan umpan balik kesalahan melalui "Saya-Keluhan dan Saran", atau langsung menghubungi nomor telepon layanan pelanggan untuk menanganinya.',
|
||||
pauseBillingButton: 'Jeda penagihan',
|
||||
pauseBillingHint: 'Anda dapat mengajukan jeda penagihan saat sewa aktif (rincian di halaman pesanan).'
|
||||
},
|
||||
|
||||
settings: {
|
||||
|
||||
+13
-1
@@ -226,12 +226,21 @@ export default {
|
||||
returnedThankYou: '您的风扇已归还,感谢使用',
|
||||
used: '已使用',
|
||||
rentInfo: '租借信息',
|
||||
rentInfoExpand: '展开',
|
||||
rentInfoCollapse: '收起',
|
||||
fanNo: '风扇编号',
|
||||
rentMethod: '租借方式',
|
||||
returnLocation: '归还地点',
|
||||
paid: '已支付',
|
||||
canExpressReturn: '后可快递归还',
|
||||
pauseBilling: '暂停计费',
|
||||
pauseBillingSuccess: '暂停计费已生效',
|
||||
pauseBillingFailed: '暂停计费失败,请稍后重试',
|
||||
pauseBillingNotEligible: '当前订单暂不符合暂停计费条件',
|
||||
billingPausedBadge: '计费已暂停',
|
||||
orderStatusBillingPaused: '已暂停计费',
|
||||
billingPausedDurationLabel: '暂停时长',
|
||||
pausedExpressAvailable: '已可申请快递归还',
|
||||
rentAgain: '再次租借',
|
||||
backToHome: '返回首页',
|
||||
feeAppeal: '费用申诉',
|
||||
@@ -292,6 +301,7 @@ export default {
|
||||
deviceEjectSuccess: '已重新尝试弹出设备',
|
||||
deviceEjectFailed: '操作失败',
|
||||
deviceEjectError: '操作失败,请稍后重试',
|
||||
Pause:'暂停计费'
|
||||
},
|
||||
|
||||
user: {
|
||||
@@ -481,7 +491,9 @@ export default {
|
||||
faq4Question: '押金多久能退还?',
|
||||
faq4Answer: '归还设备后押金将自动发起退款,预计0-7个工作日到账。',
|
||||
faq5Question: '设备无法正常使用怎么办?',
|
||||
faq5Answer: '您可以通过"我的-投诉与建议"提交故障反馈,或直接拨打客服电话处理。'
|
||||
faq5Answer: '您可以通过"我的-投诉与建议"提交故障反馈,或直接拨打客服电话处理。',
|
||||
pauseBillingButton: '暂停计费',
|
||||
pauseBillingHint: '使用中有疑问可申请暂停计费(具体以订单页为准)'
|
||||
},
|
||||
|
||||
settings: {
|
||||
|
||||
@@ -444,7 +444,7 @@
|
||||
const order = inUseRes.data
|
||||
// 如果有正在进行的订单,跳转到归还页面,带上设备ID
|
||||
uni.redirectTo({
|
||||
url: `/subPackages/service/return/index?deviceId=${deviceId.value}`
|
||||
url: `/pages/order/detail?orderId=${order.orderId}`
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
+361
-89
@@ -11,9 +11,17 @@
|
||||
{{ $t('order.canUsePromotion') }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="header-desc">{{ getStatusDesc() }}</view>
|
||||
<!-- 已暂停:副标题展示暂停持续时长 + 快递归还时间限制(倒计时暂停期间不累计) -->
|
||||
<view v-if="orderInfo.orderStatus === 'in_used' && orderInfo.pauseTime" class="header-desc-block">
|
||||
<text class="header-desc">{{ pauseDurationLine }}</text>
|
||||
<text v-if="orderInfo.isSupportExpressReturn !== 'no' && !showExpressAction && countdownRemaining > 0"
|
||||
class="header-desc header-desc-secondary">{{ formatCountdown(countdownRemaining) }}{{ $t('order.canExpressReturn') }}</text>
|
||||
<text v-else-if="orderInfo.isSupportExpressReturn !== 'no' && showExpressAction"
|
||||
class="header-desc header-desc-secondary">{{ $t('order.pausedExpressAvailable') }}</text>
|
||||
</view>
|
||||
<view v-else class="header-desc">{{ getStatusDesc() }}</view>
|
||||
</view>
|
||||
<view class="header-right" v-if="orderInfo.orderStatus === 'in_used'">
|
||||
<view class="header-right" v-if="orderInfo.orderStatus === 'in_used' && !orderInfo.pauseTime">
|
||||
<view class="device-no-eject-btn" @click="handleDeviceNoEject">
|
||||
<image src="/static/power_no_popout.png" class="device-no-eject-icon" mode="aspectFit" lazy-load="true"></image>
|
||||
<text class="device-no-eject-text">{{ $t('order.deviceNoEject') }}</text>
|
||||
@@ -54,64 +62,68 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 租借信息卡片 -->
|
||||
<!-- 租借信息卡片(可折叠) -->
|
||||
<view class="rent-card">
|
||||
<view class="rent-title">{{ $t('order.rentInfo') }}</view>
|
||||
<view class="rent-item">
|
||||
<view class="rent-label">{{ $t('order.orderNo') }}</view>
|
||||
<view class="rent-value">{{ orderInfo.orderNo || '-' }}</view>
|
||||
<view class="rent-header" @click="toggleRentInfo">
|
||||
<text class="rent-title">{{ $t('order.rentInfo') }}</text>
|
||||
<text class="rent-collapse-label">{{ rentInfoExpanded ? $t('order.rentInfoCollapse') : $t('order.rentInfoExpand') }}</text>
|
||||
</view>
|
||||
<view class="rent-item">
|
||||
<view class="rent-label">{{ $t('order.fanNo') }}</view>
|
||||
<view class="rent-value">{{ deviceId || '-' }}</view>
|
||||
</view>
|
||||
<view class="rent-item">
|
||||
<view class="rent-label">{{ $t('order.rentTime') }}</view>
|
||||
<view class="rent-value">{{ orderInfo.startTime || '-' }}</view>
|
||||
</view>
|
||||
<view class="rent-item">
|
||||
<view class="rent-label">{{ $t('order.rentLocation') }}</view>
|
||||
<view class="rent-value">{{ orderInfo.positionName || '-' }}</view>
|
||||
</view>
|
||||
<view class="rent-item" v-if="orderInfo.freeRentTime&&orderInfo.freeRentTime!=='0'">
|
||||
<view class="rent-label">{{ $t('order.freeRentTime') }}</view>
|
||||
<view class="rent-value">{{ getFreeRentTimeDisplay() }}</view>
|
||||
</view>
|
||||
<view class="rent-item" v-if="orderInfo.unitPrice && orderInfo.orderType">
|
||||
<view class="rent-label">{{ $t('order.pricingRule') }}</view>
|
||||
<view class="rent-value">{{ getPricingRuleDisplay() }}</view>
|
||||
</view>
|
||||
<view class="rent-item">
|
||||
<view class="rent-label">{{ $t('order.paymentMethod') }}</view>
|
||||
<view class="rent-value">{{ getPayWayText() }}</view>
|
||||
</view>
|
||||
<!-- 优惠信息显示 - 订单完成且使用了优惠 -->
|
||||
<view class="rent-item" v-if="isOrderCompleted() && orderInfo.discountTypeName">
|
||||
<view class="rent-label">{{ $t('order.usedPromotion') }}</view>
|
||||
<view class="rent-value promotion-value">
|
||||
<image src="/static/promotion-icon.png" class="promotion-icon" mode="aspectFit" lazy-load="true"></image>
|
||||
{{ orderInfo.discountTypeName }}<text
|
||||
v-if="orderInfo.discountAmount">{{'-¥'+orderInfo.discountAmount||''}}</text>
|
||||
<view class="rent-body" :class="{ open: rentInfoExpanded }">
|
||||
<view class="rent-item">
|
||||
<view class="rent-label">{{ $t('order.orderNo') }}</view>
|
||||
<view class="rent-value">{{ orderInfo.orderNo || '-' }}</view>
|
||||
</view>
|
||||
<view class="rent-item">
|
||||
<view class="rent-label">{{ $t('order.fanNo') }}</view>
|
||||
<view class="rent-value">{{ deviceId || '-' }}</view>
|
||||
</view>
|
||||
<view class="rent-item">
|
||||
<view class="rent-label">{{ $t('order.rentTime') }}</view>
|
||||
<view class="rent-value">{{ orderInfo.startTime || '-' }}</view>
|
||||
</view>
|
||||
<view class="rent-item">
|
||||
<view class="rent-label">{{ $t('order.rentLocation') }}</view>
|
||||
<view class="rent-value">{{ orderInfo.positionName || '-' }}</view>
|
||||
</view>
|
||||
<view class="rent-item" v-if="orderInfo.freeRentTime&&orderInfo.freeRentTime!=='0'">
|
||||
<view class="rent-label">{{ $t('order.freeRentTime') }}</view>
|
||||
<view class="rent-value">{{ getFreeRentTimeDisplay() }}</view>
|
||||
</view>
|
||||
<view class="rent-item" v-if="orderInfo.unitPrice && orderInfo.orderType">
|
||||
<view class="rent-label">{{ $t('order.pricingRule') }}</view>
|
||||
<view class="rent-value">{{ getPricingRuleDisplay() }}</view>
|
||||
</view>
|
||||
<view class="rent-item">
|
||||
<view class="rent-label">{{ $t('order.paymentMethod') }}</view>
|
||||
<view class="rent-value">{{ getPayWayText() }}</view>
|
||||
</view>
|
||||
<!-- 优惠信息显示 - 订单完成且使用了优惠 -->
|
||||
<view class="rent-item" v-if="isOrderCompleted() && orderInfo.discountTypeName">
|
||||
<view class="rent-label">{{ $t('order.usedPromotion') }}</view>
|
||||
<view class="rent-value promotion-value">
|
||||
<image src="/static/promotion-icon.png" class="promotion-icon" mode="aspectFit" lazy-load="true"></image>
|
||||
{{ orderInfo.discountTypeName }}<text
|
||||
v-if="orderInfo.discountAmount">{{'-¥'+orderInfo.discountAmount||''}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rent-item" v-if="isOrderCompleted() && orderInfo.endTime">
|
||||
<view class="rent-label">{{ $t('order.returnTime') }}</view>
|
||||
<view class="rent-value">{{ orderInfo.endTime }}</view>
|
||||
</view>
|
||||
<view class="rent-item" v-if="isOrderCompleted() && orderInfo.returnPosition">
|
||||
<view class="rent-label">{{ $t('order.returnLocation') }}</view>
|
||||
<view class="rent-value">{{ orderInfo.returnPosition || '-' }}</view>
|
||||
</view>
|
||||
<view class="rent-paid" v-if="isOrderCompleted()">
|
||||
<text class="paid-label">{{ $t('order.paid') }}</text>
|
||||
<text class="paid-value">{{ orderInfo.currentFee || orderInfo.payAmount || '10' }}</text>
|
||||
<text class="paid-unit">{{ $t('unit.yuan') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rent-item" v-if="isOrderCompleted() && orderInfo.endTime">
|
||||
<view class="rent-label">{{ $t('order.returnTime') }}</view>
|
||||
<view class="rent-value">{{ orderInfo.endTime }}</view>
|
||||
</view>
|
||||
<view class="rent-item" v-if="isOrderCompleted() && orderInfo.returnPosition">
|
||||
<view class="rent-label">{{ $t('order.returnLocation') }}</view>
|
||||
<view class="rent-value">{{ orderInfo.returnPosition || '-' }}</view>
|
||||
</view>
|
||||
<view class="rent-paid" v-if="isOrderCompleted()">
|
||||
<text class="paid-label">{{ $t('order.paid') }}</text>
|
||||
<text class="paid-value">{{ orderInfo.currentFee || orderInfo.payAmount || '10' }}</text>
|
||||
<text class="paid-unit">{{ $t('unit.yuan') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="" style="font-size: 24rpx;text-align: center;">
|
||||
{{ $t('order.returnProblemTip') }}<text @click="contactService"
|
||||
style="color:#07c160 ;">{{ $t('user.customerService') }}</text>{{ $t('order.contactStaff') }}
|
||||
<view class="rent-service-tip">
|
||||
<text>{{ $t('order.returnProblemTip') }}</text>
|
||||
<text class="rent-service-link" @click="contactService">{{ $t('user.customerService') }}</text>
|
||||
<text>{{ $t('order.contactStaff') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -124,43 +136,44 @@
|
||||
<view class="bottom-bar">
|
||||
<!-- 支付成功状态 -->
|
||||
<template v-if="orderInfo.orderStatus === 'payment_successful'">
|
||||
<view class="bottom-icon-btn" @click="contactService">
|
||||
<image src="/static/customer-service.png" class="icon" mode="aspectFit" lazy-load="true"></image>
|
||||
<text>{{ $t('user.customerService') }}</text>
|
||||
</view>
|
||||
<view class="bottom-icon-btn" @click="handleDeviceNoEject">
|
||||
<image src="/static/complaint.png" class="icon" mode="aspectFit" lazy-load="true"></image>
|
||||
<text>{{ $t('order.deviceNoEject') }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 使用中状态 -->
|
||||
<template v-if="orderInfo.orderStatus === 'in_used'">
|
||||
<view class="bottom-icon-btn" @click="contactService">
|
||||
<image src="/static/customer-service.png" class="icon" mode="aspectFit" lazy-load="true"></image>
|
||||
<text>{{ $t('user.customerService') }}</text>
|
||||
</view>
|
||||
<!-- 使用中状态:独立一行 flex 容器,避免 convert-btn 换行后 flex:1 撑满整行 -->
|
||||
<view v-if="orderInfo.orderStatus === 'in_used'" class="bottom-bar-in-use">
|
||||
<!-- 只有支持快递归还时才显示倒计时和快递归还按钮 -->
|
||||
<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') }}
|
||||
{{ $t('express.title') }}
|
||||
</view>
|
||||
<view v-if="showExpressAction" class="action-btn primary" @click="quickReturn">
|
||||
{{ $t('order.quickReturn') }}
|
||||
<view v-if="showExpressAction" class="bottom-icon-btn" @click="quickReturn">
|
||||
<image src="/static/map.png" class="icon" mode="aspectFit" lazy-load="true"></image>
|
||||
<text>{{ $t('order.quickReturn') }}</text>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 不支持快递归还时只显示快速归还按钮 -->
|
||||
<view v-else class="action-btn primary" @click="quickReturn">
|
||||
{{ $t('order.quickReturn') }}
|
||||
<!-- 不支持快递归还时只显示快速归还(图标+小字) -->
|
||||
<view v-else class="bottom-icon-btn" @click="quickReturn">
|
||||
<image src="/static/map.png" class="icon" mode="aspectFit" lazy-load="true"></image>
|
||||
<text>{{ $t('order.quickReturn') }}</text>
|
||||
</view>
|
||||
<view
|
||||
v-if="showPauseBillingButton"
|
||||
class="action-btn secondary pause-billing-btn"
|
||||
:class="{ 'is-disabled': !isPauseBillingClickable }"
|
||||
@click="onPauseBillingTap"
|
||||
>
|
||||
{{ $t('order.pauseBilling') }}
|
||||
</view>
|
||||
<!-- 不想还了转为自用按钮 -->
|
||||
<view class="action-btn convert-btn" @click="handleConvertToOwnedWithMaxFee">
|
||||
{{ $t('order.convertToOwnWithMaxFee') }}
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<!-- 已完成状态 -->
|
||||
<template v-if="isOrderCompleted()">
|
||||
@@ -169,10 +182,6 @@
|
||||
<image src="/static/suggess.png" class="icon" mode="aspectFit" lazy-load="true"></image>
|
||||
<text>{{ $t('order.feeAppeal') }}</text>
|
||||
</view>
|
||||
<view class="bottom-icon-btn" @click="contactService">
|
||||
<image src="/static/customer-service.png" class="icon" mode="aspectFit" lazy-load="true"></image>
|
||||
<text>{{ $t('user.customerService') }}</text>
|
||||
</view>
|
||||
<view class="action-btn primary" @click="rentAgain">
|
||||
{{ $t('order.rentAgain') }}
|
||||
</view>
|
||||
@@ -218,6 +227,7 @@
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
watch,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
getCurrentInstance
|
||||
@@ -235,7 +245,9 @@
|
||||
convertToOwned,
|
||||
closeWithMaxFee,
|
||||
getInUseOrder,
|
||||
deviceRentByOrderNo
|
||||
deviceRentByOrderNo,
|
||||
getPauseBillingEligible,
|
||||
requestPauseBilling
|
||||
} from '@/config/api/order.js'
|
||||
import {
|
||||
withdrawDeposit
|
||||
@@ -292,7 +304,9 @@
|
||||
discountTypeName: '',
|
||||
originalFee:'',
|
||||
discountAmount:'',
|
||||
returnMapImage: ''
|
||||
returnMapImage: '',
|
||||
/** 有值表示当前处于暂停计费中(接口 pauseTime) */
|
||||
pauseTime: ''
|
||||
})
|
||||
const timer = ref(null)
|
||||
const statusCheckTimer = ref(null)
|
||||
@@ -308,6 +322,102 @@
|
||||
const feeRuleText = ref('')
|
||||
const convertToOwnPopup = ref(null)
|
||||
const lastDeviceEjectTime = ref(0) // 上次点击"宝未弹出"的时间戳
|
||||
/** 是否允许点击暂停:null 拉取中,true 可暂停,false 不可暂停(按钮仍展示为禁用) */
|
||||
const pauseBillingEligible = ref(null)
|
||||
const pauseBillingLoading = ref(false)
|
||||
|
||||
const hasOrderPauseTime = computed(() => {
|
||||
const pt = orderInfo.value.pauseTime
|
||||
return pt != null && String(pt).trim() !== ''
|
||||
})
|
||||
|
||||
/** 使用中且未处于暂停计费态时展示「暂停计费」按钮 */
|
||||
const showPauseBillingButton = computed(() => {
|
||||
return orderInfo.value.orderStatus === 'in_used' && !hasOrderPauseTime.value
|
||||
})
|
||||
|
||||
const isPauseBillingClickable = computed(() => {
|
||||
return pauseBillingEligible.value === true && !pauseBillingLoading.value
|
||||
})
|
||||
/** 租借信息区折叠态:默认展开,仅由用户点击标题切换;换订单时重置为展开 */
|
||||
const rentInfoExpanded = ref(true)
|
||||
|
||||
watch(
|
||||
() => orderInfo.value.orderId,
|
||||
(id, prev) => {
|
||||
if (prev !== undefined && prev !== '' && id !== prev) {
|
||||
rentInfoExpanded.value = true
|
||||
pauseBillingEligible.value = null
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const isApiOk = (res) => res && (res.code === 200 || res.code === 0)
|
||||
|
||||
const toggleRentInfo = () => {
|
||||
rentInfoExpanded.value = !rentInfoExpanded.value
|
||||
}
|
||||
|
||||
/** 刷新是否可暂停计费(仅决定按钮是否可点,不决定显隐) */
|
||||
const refreshPauseBillingEligible = async () => {
|
||||
pauseBillingEligible.value = null
|
||||
if (orderInfo.value.orderStatus !== 'in_used' || !orderInfo.value.orderId) {
|
||||
return
|
||||
}
|
||||
if (hasOrderPauseTime.value) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await getPauseBillingEligible(orderInfo.value.orderId)
|
||||
if (!isApiOk(res)) {
|
||||
pauseBillingEligible.value = false
|
||||
return
|
||||
}
|
||||
const payload = res.data || {}
|
||||
pauseBillingEligible.value = payload.eligible === true
|
||||
} catch (e) {
|
||||
console.warn('refreshPauseBillingEligible', e)
|
||||
pauseBillingEligible.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const onPauseBillingTap = () => {
|
||||
if (!isPauseBillingClickable.value) return
|
||||
handlePauseBilling()
|
||||
}
|
||||
|
||||
const handlePauseBilling = async () => {
|
||||
if (!orderInfo.value.orderId || pauseBillingLoading.value) return
|
||||
pauseBillingLoading.value = true
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: t('common.loading'),
|
||||
mask: true
|
||||
})
|
||||
const pauseRes = await requestPauseBilling(orderInfo.value.orderId)
|
||||
if (isApiOk(pauseRes)) {
|
||||
uni.showToast({
|
||||
title: pauseRes.msg || t('order.pauseBillingSuccess'),
|
||||
icon: 'success'
|
||||
})
|
||||
await getOrderDetails()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: pauseRes?.msg || t('order.pauseBillingFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('handlePauseBilling', e)
|
||||
uni.showToast({
|
||||
title: t('order.pauseBillingFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
pauseBillingLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 计算属性:是否显示优惠券/会员卡可用提示
|
||||
const canUsePromotionTag = computed(() => {
|
||||
@@ -334,8 +444,11 @@
|
||||
orderInfo.value.orderStatus === 'used_down'
|
||||
}
|
||||
|
||||
// 获取订单状态文字
|
||||
// 获取订单状态文字(使用中且存在 pauseTime 时优先展示已暂停计费)
|
||||
const getOrderStatusText = () => {
|
||||
if (orderInfo.value.orderStatus === 'in_used' && orderInfo.value.pauseTime) {
|
||||
return t('order.orderStatusBillingPaused')
|
||||
}
|
||||
const statusMap = {
|
||||
'waiting_for_payment': t('order.waitingForPayment'),
|
||||
'payment_in_progress': t('order.paymentInProgress'),
|
||||
@@ -558,6 +671,40 @@
|
||||
return NaN
|
||||
}
|
||||
|
||||
/** 暂停计费已持续时长(与 pauseTime 联动,每秒刷新) */
|
||||
const pauseDurationLine = ref('')
|
||||
let pauseDurationTimer = null
|
||||
|
||||
const syncPauseDurationLine = () => {
|
||||
if (orderInfo.value.orderStatus !== 'in_used' || !orderInfo.value.pauseTime) {
|
||||
pauseDurationLine.value = ''
|
||||
return
|
||||
}
|
||||
const start = parseStartTimeToMs(orderInfo.value.pauseTime)
|
||||
if (isNaN(start)) {
|
||||
pauseDurationLine.value = ''
|
||||
return
|
||||
}
|
||||
const secs = Math.max(0, Math.floor((Date.now() - start) / 1000))
|
||||
const timeStr = formatCountdown(secs)
|
||||
pauseDurationLine.value = `${t('order.billingPausedDurationLabel')} ${timeStr}`
|
||||
}
|
||||
|
||||
const stopPauseDurationTicker = () => {
|
||||
if (pauseDurationTimer != null) {
|
||||
clearInterval(pauseDurationTimer)
|
||||
pauseDurationTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
const startPauseDurationTicker = () => {
|
||||
stopPauseDurationTicker()
|
||||
syncPauseDurationLine()
|
||||
if (orderInfo.value.orderStatus === 'in_used' && orderInfo.value.pauseTime) {
|
||||
pauseDurationTimer = setInterval(syncPauseDurationLine, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
// 清除倒计时
|
||||
const clearExpressCountdown = () => {
|
||||
if (countdownTimer.value) {
|
||||
@@ -587,7 +734,15 @@
|
||||
return
|
||||
}
|
||||
const nowMs = Date.now()
|
||||
const elapsedSeconds = Math.max(0, Math.floor((nowMs - startMs) / 1000))
|
||||
let elapsedSeconds = Math.max(0, Math.floor((nowMs - startMs) / 1000))
|
||||
// 暂停计费期间:墙钟仍在走,但有效租借计时不应包含「当前这一段暂停」,否则快递归还等时间限制会异常变少
|
||||
if (orderInfo.value.pauseTime) {
|
||||
const pauseMs = parseStartTimeToMs(orderInfo.value.pauseTime)
|
||||
if (!isNaN(pauseMs)) {
|
||||
const pauseOngoingSec = Math.max(0, Math.floor((nowMs - pauseMs) / 1000))
|
||||
elapsedSeconds = Math.max(0, elapsedSeconds - pauseOngoingSec)
|
||||
}
|
||||
}
|
||||
const remaining = expressThresholdSeconds.value - elapsedSeconds
|
||||
if (remaining <= 0) {
|
||||
countdownRemaining.value = 0
|
||||
@@ -821,6 +976,9 @@
|
||||
// 保存是否支持快递归还
|
||||
orderInfo.value.isSupportExpressReturn = orderData.isSupportExpressReturn || 'yes'
|
||||
|
||||
const pt = orderData.pauseTime
|
||||
orderInfo.value.pauseTime = (pt !== undefined && pt !== null && String(pt).trim() !== '') ? pt : ''
|
||||
|
||||
// 如果有有效的 expressReturnStart,立即更新倒计时阈值(小时转秒)
|
||||
if (orderInfo.value.expressReturnStart && typeof orderInfo.value.expressReturnStart === 'number' && orderInfo
|
||||
.value.expressReturnStart > 0) {
|
||||
@@ -854,6 +1012,13 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (orderInfo.value.orderStatus === 'in_used' && orderInfo.value.pauseTime) {
|
||||
startPauseDurationTicker()
|
||||
} else {
|
||||
stopPauseDurationTicker()
|
||||
syncPauseDurationLine()
|
||||
}
|
||||
}
|
||||
|
||||
// 获取订单详情
|
||||
@@ -922,6 +1087,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
await refreshPauseBillingEligible()
|
||||
} else {
|
||||
throw new Error(result.msg || t('order.getOrderFailed'))
|
||||
}
|
||||
@@ -1272,6 +1438,12 @@
|
||||
if (orderInfo.value.orderStatus === 'in_used' && orderInfo.value.isSupportExpressReturn !== 'no') {
|
||||
startExpressCountdown()
|
||||
}
|
||||
if (orderInfo.value.orderStatus === 'in_used' && orderInfo.value.orderId) {
|
||||
refreshPauseBillingEligible()
|
||||
}
|
||||
if (orderInfo.value.orderStatus === 'in_used' && orderInfo.value.pauseTime) {
|
||||
startPauseDurationTicker()
|
||||
}
|
||||
})
|
||||
|
||||
onHide(() => {
|
||||
@@ -1280,6 +1452,7 @@
|
||||
clearTimer()
|
||||
clearStatusCheckTimer()
|
||||
clearExpressCountdown()
|
||||
stopPauseDurationTicker()
|
||||
removeFromOrderMonitor()
|
||||
})
|
||||
|
||||
@@ -1289,6 +1462,7 @@
|
||||
clearTimer()
|
||||
clearStatusCheckTimer()
|
||||
clearExpressCountdown()
|
||||
stopPauseDurationTicker()
|
||||
removeFromOrderMonitor()
|
||||
uni.$off('orderCompleted', handleOrderCompleted)
|
||||
})
|
||||
@@ -1323,6 +1497,24 @@
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.header-desc-block {
|
||||
margin-bottom: 4rpx;
|
||||
|
||||
.header-desc {
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.header-desc-secondary {
|
||||
font-size: 26rpx;
|
||||
color: #07c160;
|
||||
}
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
@@ -1511,11 +1703,55 @@
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
|
||||
.rent-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 24rpx;
|
||||
.rent-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 16rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
&:active {
|
||||
opacity: 0.92;
|
||||
}
|
||||
|
||||
.rent-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.rent-collapse-label {
|
||||
font-size: 26rpx;
|
||||
color: #07c160;
|
||||
margin-left: 16rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.rent-body {
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
transition: max-height 0.3s ease-out;
|
||||
|
||||
&.open {
|
||||
max-height: 3200rpx;
|
||||
transition: max-height 0.35s ease-in;
|
||||
padding-top: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.rent-service-tip {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
line-height: 1.6;
|
||||
padding-top: 20rpx;
|
||||
|
||||
.rent-service-link {
|
||||
color: #07c160;
|
||||
}
|
||||
}
|
||||
|
||||
.rent-item {
|
||||
@@ -1596,10 +1832,23 @@
|
||||
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
|
||||
.bottom-bar-in-use {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
// gap: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.bottom-icon-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -1624,7 +1873,8 @@
|
||||
}
|
||||
|
||||
.countdown-btn {
|
||||
flex: 1;
|
||||
flex: 1 1 auto;
|
||||
min-width: 200rpx;
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -1668,13 +1918,35 @@
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
&.is-disabled {
|
||||
opacity: 0.45;
|
||||
color: #999;
|
||||
background: #ebebeb;
|
||||
border-color: #ddd;
|
||||
|
||||
&:active {
|
||||
opacity: 0.45;
|
||||
}
|
||||
}
|
||||
|
||||
&:not(.is-disabled):active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
&.secondary.pause-billing-btn:not(.is-disabled) {
|
||||
border-color: #07c160;
|
||||
color: #07c160;
|
||||
background: rgba(7, 193, 96, 0.08);
|
||||
}
|
||||
|
||||
&.convert-btn {
|
||||
background: #fff;
|
||||
color: #07c160;
|
||||
border: 2rpx solid #07c160;
|
||||
flex: 1;
|
||||
flex: 0 1 auto;
|
||||
max-width: 100%;
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
|
||||
@@ -142,7 +142,9 @@
|
||||
|
||||
// 格式化订单数据
|
||||
const formattedOrder = {
|
||||
orderNo: orderData.orderId,
|
||||
orderNo: orderData.orderNo || orderData.orderId,
|
||||
orderId: orderData.orderId,
|
||||
orderStatus: orderData.orderStatus,
|
||||
status: orderData.orderStatus,
|
||||
deviceId: orderData.deviceNo,
|
||||
payWay: orderData.payWay,
|
||||
@@ -150,7 +152,8 @@
|
||||
endTime: orderData.endTime || '',
|
||||
positionName: orderData.positionName || orderData.positionLocation || '',
|
||||
deviceName: orderData.deviceName || '',
|
||||
amount: orderData.payAmount || orderData.actualDeviceAmount || orderData.currentFee || orderData.residueAmount || '0.00'
|
||||
amount: orderData.payAmount || orderData.actualDeviceAmount || orderData.currentFee || orderData.residueAmount || '0.00',
|
||||
pauseTime: orderData.pauseTime != null ? orderData.pauseTime : orderData.pause_time
|
||||
};
|
||||
|
||||
// 将订单添加到列表开头
|
||||
@@ -207,7 +210,8 @@
|
||||
endTime: item.endTime || '',
|
||||
positionName: item.positionName || item.positionLocation || '',
|
||||
deviceName: item.deviceName || '',
|
||||
amount: item.payAmount || item.actualDeviceAmount || item.currentFee || item.residueAmount || '0.00'
|
||||
amount: item.payAmount || item.actualDeviceAmount || item.currentFee || item.residueAmount || '0.00',
|
||||
pauseTime: item.pauseTime != null ? item.pauseTime : item.pause_time
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
<view class="help-container">
|
||||
<!-- 常见问题 -->
|
||||
<view class="faq-section">
|
||||
<view
|
||||
<view
|
||||
v-for="(item, index) in faqList"
|
||||
:key="index"
|
||||
class="collapse-item"
|
||||
>
|
||||
<view
|
||||
<view
|
||||
class="collapse-header"
|
||||
@click="toggleCollapse(index)"
|
||||
>
|
||||
<text class="collapse-title">{{ $t(item.question) }}</text>
|
||||
<text class="collapse-icon" :class="{ 'active': activeIndex === index }">▼</text>
|
||||
</view>
|
||||
<view
|
||||
<view
|
||||
class="collapse-content"
|
||||
:class="{ 'show': activeIndex === index }"
|
||||
>
|
||||
@@ -87,12 +87,12 @@ const makePhoneCall = () => {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
margin-bottom: 30rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||
overflow: hidden;
|
||||
|
||||
.collapse-item {
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
@@ -143,7 +143,7 @@ const makePhoneCall = () => {
|
||||
.answer-content {
|
||||
padding: 20rpx 30rpx 30rpx;
|
||||
background: #f9f9f9;
|
||||
|
||||
|
||||
.answer-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
@@ -159,7 +159,7 @@ const makePhoneCall = () => {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 30rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||
|
||||
.contact-title {
|
||||
position: relative;
|
||||
@@ -181,7 +181,7 @@ const makePhoneCall = () => {
|
||||
width: 88%;
|
||||
height: 16rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #07C160;
|
||||
background: #07c160;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ const makePhoneCall = () => {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20rpx 0;
|
||||
|
||||
|
||||
.label {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
@@ -210,4 +210,4 @@ const makePhoneCall = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user