refactor(order): 优化订单商品数据显示逻辑
- 将订单模型中的 orderGoods 类型从 OrderGoods 改为 ShopOrderGoods - 移除 OrderWithGoods 接口定义和 normalizeOrderGoodsList 函数 - 直接使用订单分页接口返回的 orderGoods 字段渲染商品信息 - 添加 utils/orderGoods.ts 工具函数处理订单商品数据标准化 - 在骑手端订单页面实现商品名称汇总显示功能 - 优化再次购买和支付功能中的商品数据获取逻辑
This commit is contained in:
@@ -241,6 +241,14 @@ export default function RiderOrders() {
|
||||
const flow2Done = o.deliveryStatus === 20 || o.deliveryStatus === 30
|
||||
const flow3Done = !!o.sendEndTime
|
||||
const flow4Done = o.orderStatus === 1
|
||||
// 直接使用订单分页接口返回的 orderGoods
|
||||
const goodsList = o.orderGoods || []
|
||||
const goodsNameList = goodsList
|
||||
.map(g => g?.goodsName || (g as any)?.goodsTitle || (g as any)?.title || (g as any)?.name)
|
||||
.filter(Boolean) as string[]
|
||||
const goodsSummary = goodsNameList.length
|
||||
? `${goodsNameList.slice(0, 3).join('、')}${goodsList.length > 3 ? ` 等${goodsList.length}件` : ''}`
|
||||
: (o.title || '-')
|
||||
|
||||
const autoConfirmAt = o.sendEndTime
|
||||
? dayjs(o.sendEndTime).add(AUTO_CONFIRM_RECEIVE_HOURS_FALLBACK, 'hour')
|
||||
@@ -278,6 +286,10 @@ export default function RiderOrders() {
|
||||
<Text className="text-gray-500 ml-3">数量:</Text>
|
||||
<Text>{o.totalNum ?? '-'}</Text>
|
||||
</View>
|
||||
<View className="text-sm text-gray-700 mt-1">
|
||||
<Text className="text-gray-500">商品:</Text>
|
||||
<Text>{goodsSummary}</Text>
|
||||
</View>
|
||||
{o.sendEndTime && (
|
||||
<View className="text-sm text-gray-700 mt-1">
|
||||
<Text className="text-gray-500">送达时间:</Text>
|
||||
|
||||
Reference in New Issue
Block a user