From 187deb5047e7a3d1ff835ec29f60f81669f1dea8 Mon Sep 17 00:00:00 2001
From: ouyangxq <775153912@qq.com>
Date: Fri, 2 Oct 2026 22:26:42 +0800
Subject: [PATCH] fix(first-leg): show cancelled orders as terminal details
---
shared/src/index.ts | 1 +
.../components/OrderProgressPanel.vue | 5 ++--
.../store/firstLegDraftCommands.test.mjs | 27 ++++++++++++++++++-
src/modules/first-leg/store/firstLegOrders.ts | 4 +--
.../first-leg/utils/firstLegOrder.test.mjs | 6 +++++
src/modules/first-leg/utils/firstLegOrder.ts | 4 +--
.../views/FirstLegOrdersView.test.mjs | 2 +-
.../first-leg/views/FirstLegOrdersView.vue | 22 ++++++++-------
8 files changed, 53 insertions(+), 18 deletions(-)
diff --git a/shared/src/index.ts b/shared/src/index.ts
index a1a89da..bbee384 100644
--- a/shared/src/index.ts
+++ b/shared/src/index.ts
@@ -92,6 +92,7 @@ export const FIRST_LEG_ORDER_STATUSES = [
{ code: 'LOADED', label: '装柜完成' },
{ code: 'DELIVERED', label: '派送完成' },
{ code: 'COMPLETED', label: '已完成' },
+ { code: 'CANCELLED', label: '已取消' },
] as const
export type FirstLegOrderStatus = (typeof FIRST_LEG_ORDER_STATUSES)[number]['code']
diff --git a/src/modules/first-leg/components/OrderProgressPanel.vue b/src/modules/first-leg/components/OrderProgressPanel.vue
index 550ef10..4c0aa2b 100644
--- a/src/modules/first-leg/components/OrderProgressPanel.vue
+++ b/src/modules/first-leg/components/OrderProgressPanel.vue
@@ -26,14 +26,15 @@ function stageState(index: number) {
-
+ 订单已取消,不再继续履约。
+
-
{{ stage.label }}
订单提交后开始记录主状态进度。
-
+
diff --git a/src/modules/first-leg/store/firstLegDraftCommands.test.mjs b/src/modules/first-leg/store/firstLegDraftCommands.test.mjs
index 67fefb4..3590799 100644
--- a/src/modules/first-leg/store/firstLegDraftCommands.test.mjs
+++ b/src/modules/first-leg/store/firstLegDraftCommands.test.mjs
@@ -28,7 +28,10 @@ function harness(t) {
const module = compile('./firstLegOrders.ts', {
vue, pinia,
'@/modules/first-leg/api/firstLeg': api,
- '@/modules/first-leg/api/unifiedOrders': {},
+ '@/modules/first-leg/api/unifiedOrders': {
+ getMerchantUnifiedOrder: async () => ({ summary: { orderId: 'one', mainStatus: null }, order: { order: { id: 'one', status: behavior.status, version: behavior.version, receivingWarehouseId: 'warehouse' } }, timeline: [] }),
+ isUnifiedOrderQueryUnavailable: () => false,
+ },
'@/modules/first-leg/utils/firstLegOrder': { canClientEditFirstLegOrder: status => status === 'DRAFT', getFirstLegStatusLabel: value => value },
'@/modules/first-leg/utils/warehousePagination': {},
})
@@ -38,6 +41,28 @@ function harness(t) {
return { store, api, calls, behavior, draft }
}
+test('raw and unified cancelled detail remain CANCELLED even when unified mainStatus is null', async t => {
+ const h = harness(t)
+ h.behavior.status = 'CANCELLED'
+ const raw = await h.store.loadDraftDetail('one')
+ assert.equal(raw.status, 'CANCELLED')
+ const unified = await h.store.loadDetail('one')
+ assert.equal(unified.status, 'CANCELLED')
+ h.behavior.status = 'APPROVED'
+ const unknown = await h.store.loadDetail('one')
+ assert.notEqual(unknown.status, 'CANCELLED', 'unknown summary must not be reclassified as cancellation')
+})
+
+test('cancelled detail summary has no pending overseas synchronization entries', () => {
+ const source = readFileSync(new URL('../views/FirstLegOrdersView.vue', import.meta.url), 'utf8')
+ const script = source.match(/