feat(order): 支持商家送货的配送方式展示
- 新增配送方式映射,支持快递配送、自提和商家送货三种类型 - 修改判断逻辑,将商家送货归类为快递配送类型以便正确渲染 - 根据配送方式不同显示相应图标,商家送货显示摩托车图标 - 商家送货时添加配送门店信息展示 - 订单详情增加配送方式字段的显示项
This commit is contained in:
@@ -41,6 +41,13 @@ const DELIVERY_STATUS_MAP: Record<number, string> = {
|
|||||||
30: '部分发货',
|
30: '部分发货',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 配送方式映射: 0=快递配送, 1=无需发货/自提, 2=商家送货
|
||||||
|
const DELIVERY_TYPE_MAP: Record<number, string> = {
|
||||||
|
0: '快递配送',
|
||||||
|
1: '自提',
|
||||||
|
2: '商家送货',
|
||||||
|
}
|
||||||
|
|
||||||
/** 根据订单状态计算展示用的状态标签 */
|
/** 根据订单状态计算展示用的状态标签 */
|
||||||
const getOrderDisplayStatus = (order: ShopOrder): { title: string; bgColor: string; subtitle: string } => {
|
const getOrderDisplayStatus = (order: ShopOrder): { title: string; bgColor: string; subtitle: string } => {
|
||||||
const { payStatus, deliveryStatus, orderStatus, payType } = order
|
const { payStatus, deliveryStatus, orderStatus, payType } = order
|
||||||
@@ -245,7 +252,8 @@ const OrderDetailPage: React.FC = () => {
|
|||||||
|
|
||||||
const displayStatus = getOrderDisplayStatus(order)
|
const displayStatus = getOrderDisplayStatus(order)
|
||||||
const phase = getOrderPhase(order)
|
const phase = getOrderPhase(order)
|
||||||
const isExpress = order.deliveryType === 0 || order.deliveryType === undefined
|
// deliveryType: 0=快递配送, 1=无需发货/自提, 2=商家送货
|
||||||
|
const isExpress = order.deliveryType === 0 || order.deliveryType === 2 || order.deliveryType === undefined
|
||||||
const goodsCount = order.orderGoods?.reduce((sum, g) => sum + (g.totalNum || 1), 0) || 0
|
const goodsCount = order.orderGoods?.reduce((sum, g) => sum + (g.totalNum || 1), 0) || 0
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -274,13 +282,16 @@ const OrderDetailPage: React.FC = () => {
|
|||||||
{isExpress ? (
|
{isExpress ? (
|
||||||
<View className='bg-white mx-3 mt-3 p-3 rounded-lg'>
|
<View className='bg-white mx-3 mt-3 p-3 rounded-lg'>
|
||||||
<View className='flex items-start gap-2'>
|
<View className='flex items-start gap-2'>
|
||||||
<Text className='text-base'>📦</Text>
|
<Text className='text-base'>{order.deliveryType === 2 ? '🛵' : '📦'}</Text>
|
||||||
<View className='flex-1'>
|
<View className='flex-1'>
|
||||||
<View className='flex gap-2 mb-1'>
|
<View className='flex gap-2 mb-1'>
|
||||||
<Text className='text-sm font-medium text-gray-800'>{order.realName || '未知'}</Text>
|
<Text className='text-sm font-medium text-gray-800'>{order.realName || '未知'}</Text>
|
||||||
<Text className='text-sm text-gray-600'>{order.mobile || order.phone || '-'}</Text>
|
<Text className='text-sm text-gray-600'>{order.mobile || order.phone || '-'}</Text>
|
||||||
</View>
|
</View>
|
||||||
<Text className='text-xs text-gray-500'>{order.address || '未填写收货地址'}</Text>
|
<Text className='text-xs text-gray-500'>{order.address || '未填写收货地址'}</Text>
|
||||||
|
{order.deliveryType === 2 && order.expressMerchantName && (
|
||||||
|
<Text className='text-xs text-gray-400 mt-1'>配送门店: {order.expressMerchantName}</Text>
|
||||||
|
)}
|
||||||
{(order.sendStartTime || order.sendEndTime) && (
|
{(order.sendStartTime || order.sendEndTime) && (
|
||||||
<Text className='text-xs text-gray-400 mt-1'>
|
<Text className='text-xs text-gray-400 mt-1'>
|
||||||
期望配送: {order.sendStartTime?.slice(0, 10)} ~ {order.sendEndTime?.slice(0, 10)}
|
期望配送: {order.sendStartTime?.slice(0, 10)} ~ {order.sendEndTime?.slice(0, 10)}
|
||||||
@@ -389,6 +400,10 @@ const OrderDetailPage: React.FC = () => {
|
|||||||
<Text className='text-xs text-gray-400'>发货状态</Text>
|
<Text className='text-xs text-gray-400'>发货状态</Text>
|
||||||
<Text className='text-xs text-gray-600'>{DELIVERY_STATUS_MAP[order.deliveryStatus ?? 10]}</Text>
|
<Text className='text-xs text-gray-600'>{DELIVERY_STATUS_MAP[order.deliveryStatus ?? 10]}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
<View className='flex justify-between'>
|
||||||
|
<Text className='text-xs text-gray-400'>配送方式</Text>
|
||||||
|
<Text className='text-xs text-gray-600'>{DELIVERY_TYPE_MAP[order.deliveryType ?? 0] || '未知'}</Text>
|
||||||
|
</View>
|
||||||
<View className='flex justify-between'>
|
<View className='flex justify-between'>
|
||||||
<Text className='text-xs text-gray-400'>创建时间</Text>
|
<Text className='text-xs text-gray-400'>创建时间</Text>
|
||||||
<Text className='text-xs text-gray-600'>{formatTime(order.createTime)}</Text>
|
<Text className='text-xs text-gray-600'>{formatTime(order.createTime)}</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user