feat(order): 优化订单备注结构及线下付款状态显示
- 门店订单修改金额时,修改原因从追加 comments 改为保存 merchantRemarks 字段 - ShopOrder 和 OrderCreateRequest 接口新增 buyerRemarks 和 merchantRemarks 字段,实现订单备注字段分离 - 结算页由 comments 注入变更为 buyerRemarks,门店订单列表新增买家备注展示块 - 修复线下付款订单状态显示:统一线下付款(payType=9)与货到付款(payType=8)的待发货状态显示 - 取消按钮逻辑优化,已付款订单不显示取消按钮,文案由"关闭订单"改为"取消订单" - 订单列表和详情页弹窗标题及提示文案更新,确保状态描述准确,提升用户体验
This commit is contained in:
@@ -69,13 +69,13 @@ const getOrderDisplayStatus = (order: ShopOrder): { title: string; bgColor: stri
|
||||
return { bgColor: '#ff7d00', title: '待付款', subtitle: '请尽快完成支付' }
|
||||
}
|
||||
if (isOffline && !payStatus) {
|
||||
return { bgColor: '#ff7d00', title: '线下付款·待确认', subtitle: '请通过微信转账完成付款,商家确认后发货' }
|
||||
return { bgColor: '#4b9cf5', title: '待发货', subtitle: '请通过微信转账完成付款,商家确认后发货' }
|
||||
}
|
||||
if (isCod && !payStatus) {
|
||||
return { bgColor: '#4b9cf5', title: '货到付款·待发货', subtitle: '送达时支付' }
|
||||
return { bgColor: '#4b9cf5', title: '待发货', subtitle: '送达时支付' }
|
||||
}
|
||||
if (deliveryStatus === 10) {
|
||||
return { bgColor: '#4b9cf5', title: isCod ? '货到付款·待发货' : '待发货', subtitle: isCod ? '送达时支付' : '商家正在准备商品' }
|
||||
return { bgColor: '#4b9cf5', title: '待发货', subtitle: '商家正在准备商品' }
|
||||
}
|
||||
if (deliveryStatus === 20 || deliveryStatus === 30) {
|
||||
return { bgColor: '#4b9cf5', title: '待收货', subtitle: '商品运输中,请注意查收' }
|
||||
|
||||
@@ -147,23 +147,23 @@ const OrderListPage: React.FC = () => {
|
||||
}
|
||||
}
|
||||
|
||||
/** 关闭订单(待发货状态下允许客户取消) */
|
||||
/** 取消订单(未付款/待确认收款状态下允许客户取消) */
|
||||
const handleCloseOrder = (order: ShopOrder) => {
|
||||
Taro.showModal({
|
||||
title: '确认关闭订单',
|
||||
content: '关闭后订单将取消,是否确认?',
|
||||
title: '确认取消订单',
|
||||
content: '取消后订单将关闭,是否确认?',
|
||||
confirmColor: '#ee0a24',
|
||||
success: async (res) => {
|
||||
if (res.confirm && order?.orderId) {
|
||||
try {
|
||||
await updateShopOrder({ ...order, orderStatus: OrderStatus.Cancelled })
|
||||
Taro.showToast({ title: '订单已关闭', icon: 'success' })
|
||||
Taro.showToast({ title: '订单已取消', icon: 'success' })
|
||||
// 标记所有 tab 为未初始化,切换时会重新加载(确保「全部」等 tab 能看到最新状态)
|
||||
setTabStates(prev => prev.map(s => ({ ...s, initialized: false })))
|
||||
// 立即刷新当前 tab
|
||||
loadOrders(tabIndex, 1)
|
||||
} catch (err: any) {
|
||||
Taro.showToast({ title: err?.message || '关闭失败', icon: 'none' })
|
||||
Taro.showToast({ title: err?.message || '取消失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ const CheckoutPage: React.FC = () => {
|
||||
addressId: defaultAddress.id,
|
||||
payType,
|
||||
couponId: selectedCoupon?.id ? Number(selectedCoupon.id) : undefined,
|
||||
comments: remarks,
|
||||
buyerRemarks: remarks,
|
||||
deliveryType: 0, // 快递配送
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ export default function StoreOrdersPage() {
|
||||
await updateShopOrder({
|
||||
orderId: currentOrder.orderId,
|
||||
payPrice: newPrice.toFixed(2),
|
||||
comments: (currentOrder.comments || '') + `\n${changeRecord}`,
|
||||
merchantRemarks: (currentOrder.merchantRemarks || '') + `\n${changeRecord}`,
|
||||
} as ShopOrder)
|
||||
|
||||
Taro.showToast({title: '修改成功', icon: 'success'})
|
||||
@@ -450,6 +450,14 @@ export default function StoreOrdersPage() {
|
||||
</View>
|
||||
)}
|
||||
|
||||
{/* 买家备注 */}
|
||||
{order.buyerRemarks && (
|
||||
<View className='bg-orange-50 rounded-lg p-3 mb-3'>
|
||||
<Text className='text-xs text-orange-500 mb-1 block'>买家备注</Text>
|
||||
<Text className='text-sm text-gray-600 block'>{order.buyerRemarks}</Text>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{/* 送达凭证(已完成订单) */}
|
||||
{order.sendEndImg && (() => {
|
||||
const imgs = parseSendEndImg(order.sendEndImg)
|
||||
|
||||
Reference in New Issue
Block a user