Commit 57265fcdc8176a5c8dc41d602bd1e4acf9c0382f
1 parent
2a496b6c
新增配送阶段信息展示,优化订单和配送订单列表,增加相关字段和格式化函数。
Showing
3 changed files
with
76 additions
and
0 deletions
.claude/settings.local.json
0 → 100644
src/views/delivery/DeliveryOrderList.vue
| @@ -32,6 +32,9 @@ | @@ -32,6 +32,9 @@ | ||
| 32 | <template v-if="column.key === 'status'"> | 32 | <template v-if="column.key === 'status'"> |
| 33 | <a-tag :color="statusColor[record.status]">{{ statusMap[record.status] }}</a-tag> | 33 | <a-tag :color="statusColor[record.status]">{{ statusMap[record.status] }}</a-tag> |
| 34 | </template> | 34 | </template> |
| 35 | + <template v-if="column.key === 'deliveryStage'"> | ||
| 36 | + <a-tag :color="deliveryStageOf(record).color">{{ deliveryStageOf(record).text }}</a-tag> | ||
| 37 | + </template> | ||
| 35 | <template v-if="column.key === 'action'"> | 38 | <template v-if="column.key === 'action'"> |
| 36 | <a-space> | 39 | <a-space> |
| 37 | <a @click="openDetail(record)">详情</a> | 40 | <a @click="openDetail(record)">详情</a> |
| @@ -56,9 +59,21 @@ | @@ -56,9 +59,21 @@ | ||
| 56 | <a-descriptions-item label="配送订单号">{{ queryResult.orderNo }}</a-descriptions-item> | 59 | <a-descriptions-item label="配送订单号">{{ queryResult.orderNo }}</a-descriptions-item> |
| 57 | <a-descriptions-item label="外部订单号">{{ queryResult.outOrderNo }}</a-descriptions-item> | 60 | <a-descriptions-item label="外部订单号">{{ queryResult.outOrderNo }}</a-descriptions-item> |
| 58 | <a-descriptions-item label="状态">{{ statusMap[queryResult.status] }}</a-descriptions-item> | 61 | <a-descriptions-item label="状态">{{ statusMap[queryResult.status] }}</a-descriptions-item> |
| 62 | + <a-descriptions-item label="配送阶段"> | ||
| 63 | + <a-tag :color="deliveryStageOf(queryResult).color">{{ deliveryStageOf(queryResult).text }}</a-tag> | ||
| 64 | + </a-descriptions-item> | ||
| 59 | <a-descriptions-item label="配送费">¥{{ queryResult.totalFee }}</a-descriptions-item> | 65 | <a-descriptions-item label="配送费">¥{{ queryResult.totalFee }}</a-descriptions-item> |
| 60 | <a-descriptions-item label="距离">{{ queryResult.distance }} km</a-descriptions-item> | 66 | <a-descriptions-item label="距离">{{ queryResult.distance }} km</a-descriptions-item> |
| 61 | <a-descriptions-item label="预计时间">{{ queryResult.estimatedMinutes }} 分钟</a-descriptions-item> | 67 | <a-descriptions-item label="预计时间">{{ queryResult.estimatedMinutes }} 分钟</a-descriptions-item> |
| 68 | + <a-descriptions-item label="骑手ID">{{ queryResult.riderId || '-' }}</a-descriptions-item> | ||
| 69 | + <a-descriptions-item label="接单时间">{{ formatNodeTime(queryResult.grapTime) }}</a-descriptions-item> | ||
| 70 | + <a-descriptions-item label="到店时间">{{ formatNodeTime(queryResult.arriveShopTime) }}</a-descriptions-item> | ||
| 71 | + <a-descriptions-item label="到店位置"> | ||
| 72 | + {{ queryResult.arriveShopLng && queryResult.arriveShopLat ? `${queryResult.arriveShopLng}, ${queryResult.arriveShopLat}` : '-' }} | ||
| 73 | + </a-descriptions-item> | ||
| 74 | + <a-descriptions-item label="到店距离">{{ formatArriveDistance(queryResult.arriveShopDistance) }}</a-descriptions-item> | ||
| 75 | + <a-descriptions-item label="取货时间">{{ formatNodeTime(queryResult.pickTime) }}</a-descriptions-item> | ||
| 76 | + <a-descriptions-item label="完成时间">{{ formatNodeTime(queryResult.completeTime) }}</a-descriptions-item> | ||
| 62 | </a-descriptions> | 77 | </a-descriptions> |
| 63 | </div> | 78 | </div> |
| 64 | </a-modal> | 79 | </a-modal> |
| @@ -106,6 +121,7 @@ const columns = computed(() => { | @@ -106,6 +121,7 @@ const columns = computed(() => { | ||
| 106 | { title: '收件人', dataIndex: 'recipName' }, | 121 | { title: '收件人', dataIndex: 'recipName' }, |
| 107 | { title: '配送费', dataIndex: 'moneyDelivery' }, | 122 | { title: '配送费', dataIndex: 'moneyDelivery' }, |
| 108 | { title: '状态', key: 'status' }, | 123 | { title: '状态', key: 'status' }, |
| 124 | + { title: '配送阶段', key: 'deliveryStage' }, | ||
| 109 | { title: '操作', key: 'action' }, | 125 | { title: '操作', key: 'action' }, |
| 110 | ] | 126 | ] |
| 111 | if (!isAdmin.value) { | 127 | if (!isAdmin.value) { |
| @@ -204,6 +220,38 @@ async function cancelOrder(record: any) { | @@ -204,6 +220,38 @@ async function cancelOrder(record: any) { | ||
| 204 | await loadList() | 220 | await loadList() |
| 205 | } | 221 | } |
| 206 | 222 | ||
| 223 | +function hasNodeTime(value: any) { | ||
| 224 | + return value !== undefined && value !== null && value !== '' && Number(value) > 0 | ||
| 225 | +} | ||
| 226 | + | ||
| 227 | +function deliveryStageOf(record: any) { | ||
| 228 | + if (record.status === 3) { | ||
| 229 | + return hasNodeTime(record.arriveShopTime) | ||
| 230 | + ? { text: '已到店待取货', color: 'purple' } | ||
| 231 | + : { text: '待到店', color: 'cyan' } | ||
| 232 | + } | ||
| 233 | + if (record.status === 4) return { text: '配送中', color: 'processing' } | ||
| 234 | + if (record.status === 6) return { text: '已完成', color: 'green' } | ||
| 235 | + if (record.status === 2) return { text: '待接单', color: 'blue' } | ||
| 236 | + if (record.status === 10) return { text: '已取消', color: 'red' } | ||
| 237 | + return { text: statusMap[record.status] || '-', color: 'default' } | ||
| 238 | +} | ||
| 239 | + | ||
| 240 | +function formatNodeTime(value: any) { | ||
| 241 | + if (!hasNodeTime(value)) return '-' | ||
| 242 | + if (typeof value === 'string' && Number.isNaN(Number(value))) return value | ||
| 243 | + const date = new Date(Number(value) * 1000) | ||
| 244 | + if (Number.isNaN(date.getTime())) return '-' | ||
| 245 | + const pad = (n: number) => String(n).padStart(2, '0') | ||
| 246 | + return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}` | ||
| 247 | +} | ||
| 248 | + | ||
| 249 | +function formatArriveDistance(value: any) { | ||
| 250 | + if (value === undefined || value === null || value === '') return '-' | ||
| 251 | + const meters = Number(value) | ||
| 252 | + return Number.isFinite(meters) ? `${meters.toFixed(2)} 米` : '-' | ||
| 253 | +} | ||
| 254 | + | ||
| 207 | onMounted(async () => { | 255 | onMounted(async () => { |
| 208 | await loadCities() | 256 | await loadCities() |
| 209 | await loadList() | 257 | await loadList() |
src/views/order/OrderList.vue
| @@ -50,6 +50,9 @@ | @@ -50,6 +50,9 @@ | ||
| 50 | <template v-if="column.key === 'status'"> | 50 | <template v-if="column.key === 'status'"> |
| 51 | <a-tag :color="statusColor[record.status]">{{ statusMap[record.status] }}</a-tag> | 51 | <a-tag :color="statusColor[record.status]">{{ statusMap[record.status] }}</a-tag> |
| 52 | </template> | 52 | </template> |
| 53 | + <template v-if="column.key === 'deliveryStage'"> | ||
| 54 | + <a-tag :color="deliveryStageOf(record).color">{{ deliveryStageOf(record).text }}</a-tag> | ||
| 55 | + </template> | ||
| 53 | <template v-if="column.key === 'isTrans'"> | 56 | <template v-if="column.key === 'isTrans'"> |
| 54 | <a-tag v-if="record.isTrans === 2" color="orange">申请中</a-tag> | 57 | <a-tag v-if="record.isTrans === 2" color="orange">申请中</a-tag> |
| 55 | <a-tag v-else-if="record.isTrans === 1" color="blue">已转单</a-tag> | 58 | <a-tag v-else-if="record.isTrans === 1" color="blue">已转单</a-tag> |
| @@ -203,6 +206,7 @@ const columns = computed(() => { | @@ -203,6 +206,7 @@ const columns = computed(() => { | ||
| 203 | { title: 'ID', dataIndex: 'id', width: 80 }, | 206 | { title: 'ID', dataIndex: 'id', width: 80 }, |
| 204 | { title: '订单号', dataIndex: 'orderNo', ellipsis: true }, | 207 | { title: '订单号', dataIndex: 'orderNo', ellipsis: true }, |
| 205 | { title: '状态', key: 'status' }, | 208 | { title: '状态', key: 'status' }, |
| 209 | + { title: '配送阶段', key: 'deliveryStage' }, | ||
| 206 | { title: '骑手ID', dataIndex: 'riderId' }, | 210 | { title: '骑手ID', dataIndex: 'riderId' }, |
| 207 | { title: '转单', key: 'isTrans' }, | 211 | { title: '转单', key: 'isTrans' }, |
| 208 | { title: '配送费', dataIndex: 'moneyDelivery' }, | 212 | { title: '配送费', dataIndex: 'moneyDelivery' }, |
| @@ -362,6 +366,23 @@ async function handleRefund(status: number) { | @@ -362,6 +366,23 @@ async function handleRefund(status: number) { | ||
| 362 | } finally { saving.value = false } | 366 | } finally { saving.value = false } |
| 363 | } | 367 | } |
| 364 | 368 | ||
| 369 | +function hasNodeTime(value: any) { | ||
| 370 | + return value !== undefined && value !== null && value !== '' && Number(value) > 0 | ||
| 371 | +} | ||
| 372 | + | ||
| 373 | +function deliveryStageOf(record: any) { | ||
| 374 | + if (record.status === 3) { | ||
| 375 | + return hasNodeTime(record.arriveShopTime) | ||
| 376 | + ? { text: '已到店待取货', color: 'purple' } | ||
| 377 | + : { text: '待到店', color: 'cyan' } | ||
| 378 | + } | ||
| 379 | + if (record.status === 4) return { text: '配送中', color: 'processing' } | ||
| 380 | + if (record.status === 6) return { text: '已完成', color: 'green' } | ||
| 381 | + if (record.status === 2) return { text: '待接单', color: 'blue' } | ||
| 382 | + if (record.status === 10) return { text: '已取消', color: 'red' } | ||
| 383 | + return { text: statusMap[record.status] || '-', color: 'default' } | ||
| 384 | +} | ||
| 385 | + | ||
| 365 | onMounted(async () => { | 386 | onMounted(async () => { |
| 366 | await loadCities() | 387 | await loadCities() |
| 367 | await loadList() | 388 | await loadList() |