diff --git a/components/OrderItemCard.vue b/components/OrderItemCard.vue index 7278633..0889181 100644 --- a/components/OrderItemCard.vue +++ b/components/OrderItemCard.vue @@ -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; } diff --git a/config/api/order.js b/config/api/order.js index cd9e741..8c29b0f 100644 --- a/config/api/order.js +++ b/config/api/order.js @@ -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 }) } diff --git a/locale/en-US.js b/locale/en-US.js index fd5adec..ba1127f 100644 --- a/locale/en-US.js +++ b/locale/en-US.js @@ -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: { diff --git a/locale/id-ID.js b/locale/id-ID.js index 01be828..075b732 100644 --- a/locale/id-ID.js +++ b/locale/id-ID.js @@ -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: { diff --git a/locale/zh-CN.js b/locale/zh-CN.js index 4752a3b..71d0b58 100644 --- a/locale/zh-CN.js +++ b/locale/zh-CN.js @@ -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: { diff --git a/pages/device/detail.vue b/pages/device/detail.vue index b571fc9..178cc0d 100644 --- a/pages/device/detail.vue +++ b/pages/device/detail.vue @@ -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 } diff --git a/pages/order/detail.vue b/pages/order/detail.vue index df8275c..a34012f 100644 --- a/pages/order/detail.vue +++ b/pages/order/detail.vue @@ -11,9 +11,17 @@ {{ $t('order.canUsePromotion') }} - {{ getStatusDesc() }} + + + {{ pauseDurationLine }} + {{ formatCountdown(countdownRemaining) }}{{ $t('order.canExpressReturn') }} + {{ $t('order.pausedExpressAvailable') }} + + {{ getStatusDesc() }} - + {{ $t('order.deviceNoEject') }} @@ -54,64 +62,68 @@ - + - {{ $t('order.rentInfo') }} - - {{ $t('order.orderNo') }} - {{ orderInfo.orderNo || '-' }} + + {{ $t('order.rentInfo') }} + {{ rentInfoExpanded ? $t('order.rentInfoCollapse') : $t('order.rentInfoExpand') }} - - {{ $t('order.fanNo') }} - {{ deviceId || '-' }} - - - {{ $t('order.rentTime') }} - {{ orderInfo.startTime || '-' }} - - - {{ $t('order.rentLocation') }} - {{ orderInfo.positionName || '-' }} - - - {{ $t('order.freeRentTime') }} - {{ getFreeRentTimeDisplay() }} - - - {{ $t('order.pricingRule') }} - {{ getPricingRuleDisplay() }} - - - {{ $t('order.paymentMethod') }} - {{ getPayWayText() }} - - - - {{ $t('order.usedPromotion') }} - - - {{ orderInfo.discountTypeName }}{{'-¥'+orderInfo.discountAmount||''}} + + + {{ $t('order.orderNo') }} + {{ orderInfo.orderNo || '-' }} + + + {{ $t('order.fanNo') }} + {{ deviceId || '-' }} + + + {{ $t('order.rentTime') }} + {{ orderInfo.startTime || '-' }} + + + {{ $t('order.rentLocation') }} + {{ orderInfo.positionName || '-' }} + + + {{ $t('order.freeRentTime') }} + {{ getFreeRentTimeDisplay() }} + + + {{ $t('order.pricingRule') }} + {{ getPricingRuleDisplay() }} + + + {{ $t('order.paymentMethod') }} + {{ getPayWayText() }} + + + + {{ $t('order.usedPromotion') }} + + + {{ orderInfo.discountTypeName }}{{'-¥'+orderInfo.discountAmount||''}} + + + + {{ $t('order.returnTime') }} + {{ orderInfo.endTime }} + + + {{ $t('order.returnLocation') }} + {{ orderInfo.returnPosition || '-' }} + + + + + - - {{ $t('order.returnTime') }} - {{ orderInfo.endTime }} - - - {{ $t('order.returnLocation') }} - {{ orderInfo.returnPosition || '-' }} - - - - - - - - - - {{ $t('order.returnProblemTip') }}{{ $t('user.customerService') }}{{ $t('order.contactStaff') }} + + {{ $t('order.returnProblemTip') }} + {{ $t('user.customerService') }} + {{ $t('order.contactStaff') }} @@ -124,43 +136,44 @@ - - +