继续完善购物逻辑闭环,consumer模块完成度80%

This commit is contained in:
2026-01-27 17:33:39 +08:00
parent f2f208f258
commit 4ab722a118
22 changed files with 5290 additions and 515 deletions

View File

@@ -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'
})
}