chore(shipping-notice): 统一货代发货生命周期阶段命名并优化全链路业务逻辑

This commit is contained in:
hugo committed 2026-08-17 19:56:51 +08:00
1 parent 5ef8329bd8
commit 4ec4e57005
183 files changed
+14653 -3936

No files matched your search

@@ -15,6 +15,32 @@ const i18n = createI18n({
messages: {
'zh-CN': {
'chat.shippingOrderReview.processGate.actionCodes.retry_inventory_matching': '重新库存匹配',
workspace: {
shippingNotice: {
processGate: {
reasons: {
inventory_shortage_review_required: '存在库存缺口,需要人工处理',
},
},
},
},
chat: {
shippingOrderReview: {
saveOrderAndValidate: '保存订单并校验',
currentProcessing: {
waitingStart: '等待系统启动',
},
currentTask: {
statusRunning: '系统处理中',
nextStepWaitingExternal: '等待外部系统回执,暂不需要人工操作',
},
},
shippingProcessing: {
gateReasons: {
generic: '当前步骤需要人工处理',
},
},
},
},
},
});
@@ -44,6 +70,20 @@ describe('ReviewCurrentProcessingCard', () => {
expect(wrapper.find('[data-testid="review-current-processing-retry"]').exists()).toBe(true);
});
it('hides the order-review entry when the user is already in the lifecycle workbench', () => {
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
stageCode: 'order_review',
userStatus: 'waiting_human',
primaryAction: { code: 'open_order_review', i18nKey: 'chat.shippingProcessing.action.open_order_review' },
},
global: { plugins: [i18n] },
});
// 批次中心可以用它进入工作台;工作台当前阶段不能再显示同一个自跳转入口。
expect(wrapper.find('[data-testid="review-current-task-primary-action"]').exists()).toBe(false);
});
it('renders Gate label_key for every primary action presentation', () => {
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
@@ -60,13 +100,87 @@ describe('ReviewCurrentProcessingCard', () => {
expect(wrapper.find('[data-testid="review-current-task-primary-action"]').text()).toBe('重新库存匹配');
});
it('does not render save and validate as a current-task action', () => {
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
stageCode: 'order_review',
userStatus: 'waiting_human',
},
global: { plugins: [i18n] },
});
// 保存订单并校验是底栏唯一动作;未提交校验必须给出明确交接提示,不能显示系统处理中。
expect(wrapper.find('[data-testid="review-current-task-primary-action"]').exists()).toBe(false);
expect(wrapper.get('[data-testid="review-current-task-next-step-text"]').text()).toBe('保存订单并校验');
});
it('labels an unqueued automatic Gate as waiting for system start', () => {
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
stageCode: 'fulfillment_prep',
userStatus: 'running',
gateStatus: 'pending',
},
global: { plugins: [i18n] },
});
expect(wrapper.get('[data-testid="review-current-task-status"]').text()).toContain('等待系统启动');
});
it('explains external wait without calling it generic system processing', () => {
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
stageCode: 'upload_complete',
userStatus: 'running',
gateStatus: 'waiting_external',
},
global: { plugins: [i18n] },
});
expect(wrapper.get('[data-testid="review-current-task-next-step-text"]').text())
.toBe('等待外部系统回执,暂不需要人工操作');
});
it('never exposes an internal action code when its presentation is absent', () => {
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
stageCode: 'order_review',
userStatus: 'waiting_human',
primaryAction: { code: 'edit_draft' },
},
global: { plugins: [i18n] },
});
// 回退显示 edit_draft 会泄漏内部能力码;必须 fail-closed 隐藏。
expect(wrapper.find('[data-testid="review-current-task-primary-action"]').exists()).toBe(false);
expect(wrapper.text()).not.toContain('edit_draft');
});
it('renders a localized reason instead of an internal blocking code in the next step', () => {
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
stageCode: 'inventory_matching',
userStatus: 'waiting_human',
blockingReason: { code: 'inventory_shortage_review_required' },
},
global: { plugins: [i18n] },
});
const nextStep = wrapper.get('[data-testid="review-current-task-next-step-text"]').text();
expect(nextStep).toBe('存在库存缺口,需要人工处理');
expect(nextStep).not.toContain('inventory_shortage_review_required');
});
it('renders server-provided recovery actions without duplicating the primary action', async () => {
const wrapper = mount(ReviewCurrentProcessingCard, {
props: {
stageCode: 'inventory_matching',
userStatus: 'waiting_human',
primaryAction: { code: 'retry_inventory_matching', i18nKey: 'retry_inventory_matching' },
recoveryActions: [{ code: 'retry_inventory_from_preparation' }],
recoveryActions: [{
code: 'retry_inventory_from_preparation',
i18nKey: 'chat.shippingOrderReview.processGate.actionCodes.retry_inventory_matching',
}],
},
global: { plugins: [i18n] },
});