继续完善购物逻辑闭环,consumer模块完成度80%
This commit is contained in:
@@ -36,7 +36,26 @@ onMounted(() => {
|
||||
if (options.orderId) {
|
||||
orderId.value = options.orderId
|
||||
orderNo.value = options.orderId // 使用订单ID作为订单号
|
||||
amount.value = parseFloat(options.amount || 0)
|
||||
|
||||
// 优先使用传递的 amount
|
||||
if (options.amount) {
|
||||
amount.value = parseFloat(options.amount)
|
||||
} else {
|
||||
// 如果没有传 amount,尝试从本地存储查找订单
|
||||
try {
|
||||
const ordersStr = uni.getStorageSync('orders')
|
||||
if (ordersStr) {
|
||||
const orders = JSON.parse(ordersStr as string) as any[]
|
||||
const order = orders.find((o: any) => o.id === orderId.value)
|
||||
if (order) {
|
||||
amount.value = order.actual_amount || order.total_amount || 0
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('读取本地订单失败', e)
|
||||
}
|
||||
}
|
||||
|
||||
// loadOrderInfo() // 暂时注释掉数据库查询
|
||||
}
|
||||
})
|
||||
@@ -59,10 +78,8 @@ onMounted(() => {
|
||||
// }
|
||||
|
||||
const viewOrder = () => {
|
||||
// 跳转到订单列表或订单详情
|
||||
// 这里跳转到订单列表页,并选中对应tab(如果有)
|
||||
uni.redirectTo({
|
||||
url: '/pages/mall/consumer/orders?status=shipping'
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/consumer/orders'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user