add:新增优化功能
This commit is contained in:
@@ -28,33 +28,23 @@
|
|||||||
// 规范化路径格式进行比较
|
// 规范化路径格式进行比较
|
||||||
const normalizedLaunchPath = launchPath.replace(/\.html$/, '')
|
const normalizedLaunchPath = launchPath.replace(/\.html$/, '')
|
||||||
|
|
||||||
// 只在「单页面栈」时生效,避免影响正常多页面跳转(如下单后跳详情)
|
// 只要当前不在目标页面,就进行一次跳转
|
||||||
if (pages.length === 1 && currentRoute !== normalizedLaunchPath) {
|
// 下单流程不会受影响,因为在下单离开设备详情页时不会写入 launchPath
|
||||||
|
if (currentRoute !== normalizedLaunchPath) {
|
||||||
console.log('当前页面:', currentRoute, '目标页面:', normalizedLaunchPath)
|
console.log('当前页面:', currentRoute, '目标页面:', normalizedLaunchPath)
|
||||||
// 清除启动路径标记(在跳转前清除,避免重复触发)
|
// 清除启动路径标记(在跳转前清除,避免重复触发)
|
||||||
uni.removeStorageSync('launchPath')
|
uni.removeStorageSync('launchPath')
|
||||||
// 跳转到启动路径(首页)
|
// 使用 reLaunch 跳转到启动路径(首页)
|
||||||
// 先尝试 switchTab(如果首页是 tabBar 页面)
|
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: normalizedLaunchPath,
|
url: normalizedLaunchPath,
|
||||||
success: () => {
|
success: () => {
|
||||||
console.log('成功跳转到启动路径(switchTab)')
|
console.log('成功跳转到启动路径(reLaunch)')
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (reLaunchErr) => {
|
||||||
console.log('switchTab 失败,使用 reLaunch:', err)
|
console.error('跳转到启动路径失败:', reLaunchErr)
|
||||||
// 如果 switchTab 失败,使用 reLaunch(适用于非 tabBar 页面)
|
|
||||||
uni.reLaunch({
|
|
||||||
url: normalizedLaunchPath,
|
|
||||||
success: () => {
|
|
||||||
console.log('成功跳转到启动路径(reLaunch)')
|
|
||||||
},
|
|
||||||
fail: (reLaunchErr) => {
|
|
||||||
console.error('跳转到启动路径失败:', reLaunchErr)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if (currentRoute === normalizedLaunchPath) {
|
} else {
|
||||||
// 如果已经在目标页面,清除启动路径标记
|
// 如果已经在目标页面,清除启动路径标记
|
||||||
console.log('当前已在目标页面,清除启动路径标记')
|
console.log('当前已在目标页面,清除启动路径标记')
|
||||||
uni.removeStorageSync('launchPath')
|
uni.removeStorageSync('launchPath')
|
||||||
|
|||||||
@@ -95,6 +95,15 @@ export const convertToOwned = (orderId) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 不想还了转为自用(按最高费用)
|
||||||
|
export const closeWithMaxFee = (orderNo) => {
|
||||||
|
console.log('不想还了转为自用,订单号:', orderNo)
|
||||||
|
return request({
|
||||||
|
url: `/app/order/closeWithMaxFee/${orderNo}`,
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 通过订单号获取支付分订单信息
|
// 通过订单号获取支付分订单信息
|
||||||
export const getOrderByOrderNoScore = (orderNo) => {
|
export const getOrderByOrderNoScore = (orderNo) => {
|
||||||
console.log('通过订单号获取支付分订单信息', orderNo);
|
console.log('通过订单号获取支付分订单信息', orderNo);
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
// export const URL = "https://my.gxfs123.com/api" //正式服务器-弃用
|
// export const URL = "https://my.gxfs123.com/api" //正式服务器-弃用
|
||||||
// export const URL = "https://manager.fdzpower.com/api" //正式服务器
|
export const URL = "https://manager.fdzpower.com/api" //正式服务器
|
||||||
export const URL = "https://fansdev.gxfs123.com/api" //测试服务器
|
// export const URL = "https://fansdev.gxfs123.com/api" //测试服务器
|
||||||
// export const URL = "http://192.168.5.30:8080" //本地调试
|
// export const URL = "http://192.168.5.30:8080" //本地调试
|
||||||
// export const URL = "http://127.0.0.1:8080" //本地调试
|
// export const URL = "http://127.0.0.1:8080" //本地调试
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -242,11 +242,19 @@ export default {
|
|||||||
perMinute: 'per minute',
|
perMinute: 'per minute',
|
||||||
perHalfHour: 'per half hour',
|
perHalfHour: 'per half hour',
|
||||||
deviceNoEject: 'Not Ejected',
|
deviceNoEject: 'Not Ejected',
|
||||||
|
returnReminder: 'Return Reminder',
|
||||||
convertToOwn: 'Don\'t want to return? Convert to own',
|
convertToOwn: 'Don\'t want to return? Convert to own',
|
||||||
convertToOwnTitle: 'Convert to Own',
|
convertToOwnTitle: 'Convert to Own',
|
||||||
convertToOwnConfirm: 'Converting to own costs ¥99. The power bank will be yours. Confirm?',
|
convertToOwnConfirm: 'Only ¥99 to convert to own. The power bank will be yours. Confirm?',
|
||||||
convertToOwnSuccess: 'Successfully converted to own',
|
convertToOwnSuccess: 'Successfully converted to own',
|
||||||
convertToOwnFailed: 'Operation failed, please try again',
|
convertToOwnFailed: 'Operation failed, please try again',
|
||||||
|
convertToOwnConfirmBtn: 'Own It',
|
||||||
|
convertToOwnCancelBtn: 'Keep Rent',
|
||||||
|
convertToOwnWithMaxFee: 'Don\'t want to return? Convert to own',
|
||||||
|
convertToOwnWithMaxFeeTitle: 'Take It Home!',
|
||||||
|
convertToOwnWithMaxFeeConfirm: 'Since you love using it, buy it out and take it home! Only ¥99, the device is yours forever – no return needed~\n✅Type-C charging supported, perfect for home use~\n✅No usage limits after purchase, use it freely!',
|
||||||
|
convertToOwnWithMaxFeeSuccess: 'Purchase successful',
|
||||||
|
convertToOwnWithMaxFeeFailed: 'Purchase failed, please try again',
|
||||||
deviceNoEjectTitle: 'Device Not Ejected',
|
deviceNoEjectTitle: 'Device Not Ejected',
|
||||||
deviceNoEjectConfirm: 'Your power bank didn\'t eject? We will handle it immediately, expected to resolve within 5 minutes.',
|
deviceNoEjectConfirm: 'Your power bank didn\'t eject? We will handle it immediately, expected to resolve within 5 minutes.',
|
||||||
deviceNoEjectSuccess: 'Feedback received, will be handled within 5 minutes',
|
deviceNoEjectSuccess: 'Feedback received, will be handled within 5 minutes',
|
||||||
|
|||||||
+9
-1
@@ -242,11 +242,19 @@ export default {
|
|||||||
perMinute: '每分钟',
|
perMinute: '每分钟',
|
||||||
perHalfHour: '每半小时',
|
perHalfHour: '每半小时',
|
||||||
deviceNoEject: '宝未弹出',
|
deviceNoEject: '宝未弹出',
|
||||||
|
returnReminder: '归还提醒',
|
||||||
convertToOwn: '不想还了?点击转为自用',
|
convertToOwn: '不想还了?点击转为自用',
|
||||||
convertToOwnTitle: '转为自用',
|
convertToOwnTitle: '转为自用',
|
||||||
convertToOwnConfirm: '转为自用需扣除99元,充电宝将归您所有,确认操作吗?',
|
convertToOwnConfirm: '仅需花费99元,即可转为自用,充电宝将归您所有,确认操作吗?',
|
||||||
convertToOwnSuccess: '已成功转为自用',
|
convertToOwnSuccess: '已成功转为自用',
|
||||||
convertToOwnFailed: '操作失败,请稍后重试',
|
convertToOwnFailed: '操作失败,请稍后重试',
|
||||||
|
convertToOwnConfirmBtn: '买断自用',
|
||||||
|
convertToOwnCancelBtn: '继续租借',
|
||||||
|
convertToOwnWithMaxFee: '不想还了?转为自用',
|
||||||
|
convertToOwnWithMaxFeeTitle: '买断带回家!',
|
||||||
|
convertToOwnWithMaxFeeConfirm: '既然用得顺手,直接买断带回家!仅需99元,设备永久归你,无需归还~\n✅支持Type-C充电,居家使用超方便~\n✅买断后无任何使用限制,随心用!',
|
||||||
|
convertToOwnWithMaxFeeSuccess: '买断成功',
|
||||||
|
convertToOwnWithMaxFeeFailed: '买断失败,请稍后重试',
|
||||||
deviceNoEjectTitle: '充电宝未弹出',
|
deviceNoEjectTitle: '充电宝未弹出',
|
||||||
deviceNoEjectConfirm: '您的充电宝未弹出吗?我们将立即为您处理,预计5分钟内解决问题。',
|
deviceNoEjectConfirm: '您的充电宝未弹出吗?我们将立即为您处理,预计5分钟内解决问题。',
|
||||||
deviceNoEjectSuccess: '反馈已受理,将在5分钟内处理',
|
deviceNoEjectSuccess: '反馈已受理,将在5分钟内处理',
|
||||||
|
|||||||
@@ -96,10 +96,13 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad((options) => {
|
||||||
if (uni.getStorageSync("userInfo").phone) {
|
if (uni.getStorageSync("userInfo").phone) {
|
||||||
contact.value = uni.getStorageSync('userInfo').phone;
|
contact.value = uni.getStorageSync('userInfo').phone;
|
||||||
}
|
}
|
||||||
|
if(options.selectedType) {
|
||||||
|
selectedType.value = parseInt(options.selectedType);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
|
|||||||
+385
-145
@@ -2,26 +2,44 @@
|
|||||||
<view class="order-detail-container">
|
<view class="order-detail-container">
|
||||||
<!-- 顶部标题 -->
|
<!-- 顶部标题 -->
|
||||||
<view class="page-header">
|
<view class="page-header">
|
||||||
<view class="header-title">{{ getOrderStatusText() }}</view>
|
<view class="header-top">
|
||||||
<view class="header-desc">{{ getStatusDesc() }}</view>
|
<view class="header-left">
|
||||||
|
<view class="header-title">{{ getOrderStatusText() }}</view>
|
||||||
|
<view class="header-desc">{{ getStatusDesc() }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="header-right" v-if="orderInfo.orderStatus === 'in_used'">
|
||||||
|
<view class="device-no-eject-btn" @click="handleDeviceNoEject">
|
||||||
|
<image src="/static/power_no_popout.png" class="device-no-eject-icon" mode="aspectFit"></image>
|
||||||
|
<text class="device-no-eject-text">{{ $t('order.deviceNoEject') }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 订单信息卡片 -->
|
<!-- 订单信息卡片 -->
|
||||||
<view class="info-card">
|
<view class="info-card">
|
||||||
<view class="info-row">
|
<view class="info-row">
|
||||||
<view class="info-col">
|
<view class="info-left">
|
||||||
<view class="info-value-wrapper">
|
<view class="info-col">
|
||||||
<text class="info-value-large">{{ getUsedTimeDisplay().number }}</text>
|
<view class="info-value-wrapper">
|
||||||
<text class="info-value-unit">{{ getUsedTimeDisplay().unit }}</text>
|
<text class="info-value-large">{{ getUsedTimeDisplay().number }}</text>
|
||||||
|
<text class="info-value-unit">{{ getUsedTimeDisplay().unit }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-label">{{ getUsedTimeLabel() }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-col">
|
||||||
|
<view class="info-value-wrapper">
|
||||||
|
<text class="info-value-large">{{ getOrderFee() }}</text>
|
||||||
|
<text class="info-value-unit">{{ $t('unit.yuan') }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-label">{{ $t('order.totalAmount') }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-label">{{ getUsedTimeLabel() }}</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="info-col">
|
<view class="info-right" v-if="orderInfo.orderStatus === 'in_used'">
|
||||||
<view class="info-value-wrapper">
|
<view class="return-reminder-btn" @click="handleReturnReminderSubscribe">
|
||||||
<text class="info-value-large">{{ getOrderFee() }}</text>
|
<uv-icon name="bell" size="20" color="#FFF"></uv-icon>
|
||||||
<text class="info-value-unit">{{ $t('unit.yuan') }}</text>
|
<text class="return-reminder-text">{{ $t('order.returnReminder') }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-label">{{ $t('order.totalAmount') }}</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="fee-rule">
|
<!-- <view class="fee-rule">
|
||||||
@@ -81,9 +99,9 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 转为自用提示 - 在使用中状态时显示 -->
|
<!-- 转为自用提示 - 在使用中状态时显示 -->
|
||||||
<view v-if="orderInfo.orderStatus === 'in_used'" class="convert-tip" @click="handleConvertToOwned">
|
<!-- <view v-if="orderInfo.orderStatus === 'in_used'" class="convert-tip" @click="handleConvertToOwned">
|
||||||
{{ $t('order.convertToOwn') }}
|
{{ $t('order.convertToOwn') }}
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<!-- 底部操作栏 -->
|
<!-- 底部操作栏 -->
|
||||||
<view class="bottom-bar">
|
<view class="bottom-bar">
|
||||||
@@ -121,10 +139,9 @@
|
|||||||
<view v-else class="action-btn primary" @click="quickReturn">
|
<view v-else class="action-btn primary" @click="quickReturn">
|
||||||
{{ $t('order.quickReturn') }}
|
{{ $t('order.quickReturn') }}
|
||||||
</view>
|
</view>
|
||||||
<!-- 宝未弹出按钮 - 放在最后 -->
|
<!-- 不想还了转为自用按钮 -->
|
||||||
<view class="bottom-icon-btn" @click="handleDeviceNoEject">
|
<view class="action-btn convert-btn" @click="handleConvertToOwnedWithMaxFee">
|
||||||
<image src="/static/complaint.png" class="icon" mode="aspectFit"></image>
|
{{ $t('order.convertToOwnWithMaxFee') }}
|
||||||
<text>{{ $t('order.deviceNoEject') }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -154,6 +171,33 @@
|
|||||||
<view class="action-btn primary full-width" @click="goToHome">{{ $t('order.backToHome') }}</view>
|
<view class="action-btn primary full-width" @click="goToHome">{{ $t('order.backToHome') }}</view>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 转为自用确认弹窗 -->
|
||||||
|
<uv-popup
|
||||||
|
ref="convertToOwnPopup"
|
||||||
|
mode="center"
|
||||||
|
round="20"
|
||||||
|
:overlay="true"
|
||||||
|
:closeOnClickOverlay="false"
|
||||||
|
:safeAreaInsetBottom="false"
|
||||||
|
>
|
||||||
|
<view class="convert-to-own-popup">
|
||||||
|
<view class="popup-header">
|
||||||
|
<text class="popup-title">{{ $t('order.convertToOwnWithMaxFeeTitle') }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="popup-content">
|
||||||
|
<text class="popup-text">{{ $t('order.convertToOwnWithMaxFeeConfirm') }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="popup-actions">
|
||||||
|
<view class="popup-btn cancel-btn" @click="closeConvertToOwnPopup">
|
||||||
|
{{ $t('order.convertToOwnCancelBtn') }}
|
||||||
|
</view>
|
||||||
|
<view class="popup-btn confirm-btn" @click="confirmConvertToOwn">
|
||||||
|
{{ $t('order.convertToOwnConfirmBtn') }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uv-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -164,7 +208,8 @@
|
|||||||
queryById,
|
queryById,
|
||||||
cancelOrder,
|
cancelOrder,
|
||||||
reportDeviceNoEject,
|
reportDeviceNoEject,
|
||||||
convertToOwned
|
convertToOwned,
|
||||||
|
closeWithMaxFee
|
||||||
} from '@/config/api/order.js'
|
} from '@/config/api/order.js'
|
||||||
import {
|
import {
|
||||||
addUserFeedback
|
addUserFeedback
|
||||||
@@ -220,6 +265,7 @@
|
|||||||
const showExpressAction = ref(false)
|
const showExpressAction = ref(false)
|
||||||
const countdownTimer = ref(null)
|
const countdownTimer = ref(null)
|
||||||
const feeRuleText = ref('5.0元/60分钟 前15分钟内归还免费 不足60分钟按60分钟计费 封顶99元 持续计费至99元视为买断')
|
const feeRuleText = ref('5.0元/60分钟 前15分钟内归还免费 不足60分钟按60分钟计费 封顶99元 持续计费至99元视为买断')
|
||||||
|
const convertToOwnPopup = ref(null)
|
||||||
// 判断订单是否已完成
|
// 判断订单是否已完成
|
||||||
const isOrderCompleted = () => {
|
const isOrderCompleted = () => {
|
||||||
return orderInfo.value.orderStatus === 'used_done' ||
|
return orderInfo.value.orderStatus === 'used_done' ||
|
||||||
@@ -524,11 +570,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从订单详情页角度不再主动移除订单监控
|
// 从订单监控中移除订单
|
||||||
// 订单监控的生命周期完全交给全局 orderMonitor,在订单真正完成时自动移除
|
|
||||||
const removeFromOrderMonitor = () => {
|
const removeFromOrderMonitor = () => {
|
||||||
// 保留函数以兼容已有调用,但不再从全局监控中删除订单
|
if (orderInfo.value.orderId && $orderMonitor) {
|
||||||
console.log('removeFromOrderMonitor 调用:已不再从全局监控中移除订单,交由 orderMonitor 在订单完成时处理')
|
try {
|
||||||
|
$orderMonitor.removeOrder({
|
||||||
|
orderId: orderInfo.value.orderId
|
||||||
|
})
|
||||||
|
console.log('订单已从监控队列移除:', orderInfo.value.orderId)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('从监控队列移除订单失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 清除本地缓存的 activeOrderId
|
||||||
|
try {
|
||||||
|
uni.removeStorageSync('activeOrderId')
|
||||||
|
console.log('已清除本地缓存的 activeOrderId')
|
||||||
|
} catch (error) {
|
||||||
|
console.error('清除 activeOrderId 缓存失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理订单完成事件
|
// 处理订单完成事件
|
||||||
@@ -665,13 +725,18 @@
|
|||||||
deviceId.value = orderData.deviceNo
|
deviceId.value = orderData.deviceNo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果订单已完成,从监控中移除
|
||||||
|
if (isOrderCompleted()) {
|
||||||
|
removeFromOrderMonitor()
|
||||||
|
console.log('订单已完成,已从监控队列移除')
|
||||||
|
}
|
||||||
|
|
||||||
// 如果订单状态从 'in_used' 变为其他状态,清理所有定时器
|
// 如果订单状态从 'in_used' 变为其他状态,清理所有定时器
|
||||||
if (oldStatus === 'in_used' && orderInfo.value.orderStatus !== 'in_used') {
|
if (oldStatus === 'in_used' && orderInfo.value.orderStatus !== 'in_used') {
|
||||||
console.log('订单状态已从使用中变为:', orderInfo.value.orderStatus, ',清理所有定时器')
|
console.log('订单状态已从使用中变为:', orderInfo.value.orderStatus, ',清理所有定时器')
|
||||||
clearTimer()
|
clearTimer()
|
||||||
clearStatusCheckTimer()
|
clearStatusCheckTimer()
|
||||||
clearExpressCountdown()
|
clearExpressCountdown()
|
||||||
removeFromOrderMonitor()
|
|
||||||
|
|
||||||
// 显示订单完成提示
|
// 显示订单完成提示
|
||||||
if (orderInfo.value.orderStatus === 'used_done' || orderInfo.value.orderStatus === 'used_down') {
|
if (orderInfo.value.orderStatus === 'used_done' || orderInfo.value.orderStatus === 'used_down') {
|
||||||
@@ -721,25 +786,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 无论当前订单状态如何,只要进入订单详情页,就把当前订单交给全局订单监控
|
// 根据订单状态决定是否添加到监控队列
|
||||||
if (orderInfo.value.orderId) {
|
if (orderInfo.value.orderId) {
|
||||||
uni.setStorageSync('activeOrderId', orderInfo.value.orderId)
|
// 如果订单已完成,从监控中移除
|
||||||
|
if (isOrderCompleted()) {
|
||||||
// 添加/更新到监控队列
|
removeFromOrderMonitor()
|
||||||
try {
|
console.log('订单已完成,已从监控队列移除:', orderInfo.value.orderId, '当前状态:', orderInfo.value.orderStatus)
|
||||||
if ($orderMonitor) {
|
} else {
|
||||||
$orderMonitor.removeOrder({
|
// 订单未完成,添加到监控队列
|
||||||
orderId: orderInfo.value.orderId
|
uni.setStorageSync('activeOrderId', orderInfo.value.orderId)
|
||||||
})
|
try {
|
||||||
$orderMonitor.addOrder({
|
if ($orderMonitor) {
|
||||||
orderId: orderInfo.value.orderId
|
$orderMonitor.removeOrder({
|
||||||
}, 'detail')
|
orderId: orderInfo.value.orderId
|
||||||
console.log('订单已添加到监控队列(无论当前状态):', orderInfo.value.orderId, '当前状态:', orderInfo.value.orderStatus)
|
})
|
||||||
} else {
|
$orderMonitor.addOrder({
|
||||||
console.warn('$orderMonitor 未定义,无法添加订单到监控队列')
|
orderId: orderInfo.value.orderId
|
||||||
|
}, 'detail')
|
||||||
|
console.log('订单已添加到监控队列:', orderInfo.value.orderId, '当前状态:', orderInfo.value.orderStatus)
|
||||||
|
} else {
|
||||||
|
console.warn('$orderMonitor 未定义,无法添加订单到监控队列')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('添加订单到监控队列失败:', error)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error('添加订单到监控队列失败:', error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -905,96 +975,99 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理"宝未弹出"反馈
|
// 处理"宝未弹出" - 跳转到反馈页面
|
||||||
const handleDeviceNoEject = () => {
|
const handleDeviceNoEject = () => {
|
||||||
uni.showModal({
|
uni.navigateTo({
|
||||||
title: $t('order.deviceNoEjectTitle'),
|
url: '/pages/feedback/index?selectedType=0'
|
||||||
content: $t('order.deviceNoEjectConfirm'),
|
|
||||||
confirmText: $t('common.confirm'),
|
|
||||||
cancelText: $t('common.cancel'),
|
|
||||||
success: async (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
try {
|
|
||||||
uni.showLoading({
|
|
||||||
title: $t('common.submitting')
|
|
||||||
})
|
|
||||||
|
|
||||||
// 调用反馈API提交工单
|
|
||||||
const feedbackData = {
|
|
||||||
type: 'device_issue',
|
|
||||||
content: `订单号:${orderInfo.value.orderNo}\n设备号:${deviceId.value}\n问题:充电宝未弹出`,
|
|
||||||
phone: orderInfo.value.phone || '',
|
|
||||||
orderId: orderInfo.value.orderId,
|
|
||||||
orderNo: orderInfo.value.orderNo
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await addUserFeedback(feedbackData)
|
|
||||||
|
|
||||||
if (result.code === 200) {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: $t('order.deviceNoEjectSuccess'),
|
|
||||||
icon: 'success',
|
|
||||||
duration: 3000
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
throw new Error(result.msg || $t('order.deviceNoEjectFailed'))
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: error.message || $t('order.deviceNoEjectFailed'),
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理"转为自用"
|
// 处理"归还提醒" - 授权微信通知
|
||||||
const handleConvertToOwned = () => {
|
const handleReturnReminderSubscribe = async () => {
|
||||||
uni.showModal({
|
try {
|
||||||
title: $t('order.convertToOwnTitle'),
|
// 订阅微信通知
|
||||||
content: $t('order.convertToOwnConfirm'),
|
await new Promise((resolve, reject) => {
|
||||||
confirmText: $t('common.confirm'),
|
uni.requestSubscribeMessage({
|
||||||
cancelText: $t('common.cancel'),
|
tmplIds: ['euJmQA2FjRFPZVSM4Z6U96i2eLRiGTLy3E3qMjIoYYY'],
|
||||||
success: async (res) => {
|
success: (subscribeRes) => {
|
||||||
if (res.confirm) {
|
console.log('订阅消息success回调', subscribeRes)
|
||||||
try {
|
resolve(subscribeRes)
|
||||||
uni.showLoading({
|
},
|
||||||
title: $t('common.processing')
|
fail: (subscribeErr) => {
|
||||||
})
|
console.log('订阅消息fail回调', subscribeErr)
|
||||||
|
// 订阅失败不影响主流程
|
||||||
const result = await convertToOwned(orderInfo.value.orderId)
|
resolve(subscribeErr)
|
||||||
|
|
||||||
if (result.code === 200) {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: $t('order.convertToOwnSuccess'),
|
|
||||||
icon: 'success',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
|
|
||||||
// 刷新订单详情
|
|
||||||
setTimeout(() => {
|
|
||||||
getOrderDetails()
|
|
||||||
}, 2000)
|
|
||||||
} else {
|
|
||||||
throw new Error(result.msg || $t('order.convertToOwnFailed'))
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: error.message || $t('order.convertToOwnFailed'),
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
uni.showToast({
|
||||||
|
title: '订阅成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.log('订阅消息异常', error)
|
||||||
|
uni.showToast({
|
||||||
|
title: '订阅失败,请稍后重试',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 处理"不想还了转为自用"(按最高费用)
|
||||||
|
const handleConvertToOwnedWithMaxFee = () => {
|
||||||
|
try {
|
||||||
|
convertToOwnPopup.value && typeof convertToOwnPopup.value.open === 'function' && convertToOwnPopup.value.open()
|
||||||
|
} catch (e) {
|
||||||
|
console.error('打开弹窗失败', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭转为自用弹窗
|
||||||
|
const closeConvertToOwnPopup = () => {
|
||||||
|
try {
|
||||||
|
convertToOwnPopup.value && typeof convertToOwnPopup.value.close === 'function' && convertToOwnPopup.value.close()
|
||||||
|
} catch (e) {
|
||||||
|
console.error('关闭弹窗失败', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确认转为自用
|
||||||
|
const confirmConvertToOwn = async () => {
|
||||||
|
try {
|
||||||
|
closeConvertToOwnPopup()
|
||||||
|
uni.showLoading({
|
||||||
|
title: $t('common.processing')
|
||||||
|
})
|
||||||
|
|
||||||
|
const result = await closeWithMaxFee(orderInfo.value.orderNo)
|
||||||
|
|
||||||
|
if (result.code === 200) {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: $t('order.convertToOwnWithMaxFeeSuccess'),
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
|
||||||
|
// 刷新订单详情
|
||||||
|
setTimeout(() => {
|
||||||
|
getOrderDetails()
|
||||||
|
}, 2000)
|
||||||
|
} else {
|
||||||
|
throw new Error(result.msg || $t('order.convertToOwnWithMaxFeeFailed'))
|
||||||
}
|
}
|
||||||
})
|
} catch (error) {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: error.message || $t('order.convertToOwnWithMaxFeeFailed'),
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生命周期钩子
|
// 生命周期钩子
|
||||||
@@ -1079,6 +1152,16 @@
|
|||||||
.page-header {
|
.page-header {
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
|
|
||||||
|
.header-top {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-left {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.header-title {
|
.header-title {
|
||||||
font-size: 48rpx;
|
font-size: 48rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@@ -1090,6 +1173,42 @@
|
|||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height:100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-no-eject-btn {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
// padding: 12rpx 20rpx;
|
||||||
|
// background: #E8F5E9;
|
||||||
|
// border-radius: 12rpx;
|
||||||
|
// border: 2rpx solid #07c160;
|
||||||
|
min-width: 120rpx;
|
||||||
|
|
||||||
|
.device-no-eject-icon {
|
||||||
|
width: 68rpx;
|
||||||
|
height: 68rpx;
|
||||||
|
margin-bottom: 4rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-no-eject-text {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #07c160;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 订单信息卡片
|
// 订单信息卡片
|
||||||
@@ -1102,36 +1221,72 @@
|
|||||||
|
|
||||||
.info-row {
|
.info-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
// justify-content: space-between;
|
||||||
// margin-bottom: 20rpx;
|
align-items: center;
|
||||||
|
// gap: 20rpx;
|
||||||
|
|
||||||
.info-col {
|
.info-left {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
text-align: center;
|
display: flex;
|
||||||
|
// justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
.info-value-wrapper {
|
.info-col {
|
||||||
display: flex;
|
width: 200rpx;
|
||||||
align-items: baseline;
|
// flex: 1;
|
||||||
justify-content: center;
|
// text-align: center;
|
||||||
margin-bottom: 8rpx;
|
|
||||||
|
|
||||||
.info-value-large {
|
.info-value-wrapper {
|
||||||
font-size: 48rpx;
|
display: flex;
|
||||||
font-weight: bold;
|
align-items: baseline;
|
||||||
color: #333;
|
// justify-content: center;
|
||||||
line-height: 1;
|
margin-bottom: 8rpx;
|
||||||
|
|
||||||
|
.info-value-large {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-value-unit {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
margin-left: 4rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-value-unit {
|
.info-label {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #666;
|
color: #999;
|
||||||
margin-left: 4rpx;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.info-label {
|
.info-right {
|
||||||
font-size: 24rpx;
|
display: flex;
|
||||||
color: #999;
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
.return-reminder-btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 12rpx 24rpx;
|
||||||
|
background: #3EAB64;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
border: 2rpx solid #3EAB64;
|
||||||
|
|
||||||
|
.return-reminder-text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1316,6 +1471,91 @@
|
|||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.convert-btn {
|
||||||
|
background: #fff;
|
||||||
|
color: #07c160;
|
||||||
|
border: 2rpx solid #07c160;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 转为自用确认弹窗样式 */
|
||||||
|
.convert-to-own-popup {
|
||||||
|
width: 640rpx;
|
||||||
|
max-width: 86vw;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
padding: 40rpx 40rpx 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.popup-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
|
||||||
|
.popup-title {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-content {
|
||||||
|
padding: 0 0 40rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
|
.popup-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
line-height: 1.8;
|
||||||
|
text-align: left;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-actions {
|
||||||
|
display: flex;
|
||||||
|
border-top: 1rpx solid #f0f0f0;
|
||||||
|
margin-left: -40rpx;
|
||||||
|
margin-right: -40rpx;
|
||||||
|
|
||||||
|
.popup-btn {
|
||||||
|
flex: 1;
|
||||||
|
height: 88rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
&.cancel-btn {
|
||||||
|
color: #666;
|
||||||
|
border-right: 1rpx solid #f0f0f0;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.confirm-btn {
|
||||||
|
color: #07c160;
|
||||||
|
font-weight: 600;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background-color: #f0f9f4;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
Reference in New Issue
Block a user