fix(客户自提): 50 的徽标与副文案都改说「待取货」—— 徽标优先级漏放行自提单(真机报障)
开发者报障:「为什么不上待取货?好消息是没有配送任务的生成 坏消息 不上待取货」。 实测该单数据全对(本地库 tenant_br002,RLS 上下文内查): ORD_WEB_20261016_BR002_0001 | status=50 | self_pickup=true | 客户 CUS98392383347 财富中心 is_self_pickup=true | 配送任务 0 条 ⇒ 不是数据/守卫问题(不建配送任务是好的),是**显示层两处漏了自提这个来源**: ① 前端徽标(OrderManagementPage.tsx:3975):优先级判断只放行了免入库 `statusCode === 50 && isSkipInboundOrder ? derivedStatusLabel : listStatusText(...)` ⇒ 自提单掉进 i18n `orders.list.status.50`「待配送」,派生文案被吃掉。 改为同时放行 `isSkipInboundOrder || isSelfPickupOrder`(与 2026-10-11 免入库同一个坑, 该处注释本来就写着这个教训)。 ② 后端副文案(orderStatusDisplayService.buildProgressStatusHint):50 只认 skipInbound ⇒ 自提单副文案仍是「待配送员开始配送」(张冠李戴)。新增第 7 个参数 `selfPickup`, 自提单返回「待客户上门取货」(与免入库「待主系统骑手上门取货」平行), 列表查询把 `row.self_pickup === true` 传进去。 测试:新增 orderManagementHelpers.selfPickupBadge.test.ts 3 通过;server/tests/selfPickup.test.ts 增 1 条副文案用例(9 通过);既有免入库守卫 2 通过、orderStatusLabels.pickup 3 通过。 `npx tsc --noEmit`:前端 exit 0;后端只剩 src/prompts/defaults.ts:464 那条**别的会话**留下的 `variablesSchema` 缺失(非本次改动面,已单独报给开发者)。 新增/调整的界面文字(待批准):副文案「待客户上门取货」;徽标「待取货」沿用既有文案。
This commit is contained in:
@@ -680,7 +680,9 @@ export async function listOrdersForManagement(
|
||||
fulfillment,
|
||||
pickingEnabled,
|
||||
// 免入库单副文案同口径「待主系统骑手上门取货」(见 orderStatusDisplayService)
|
||||
skipInboundMap.get(orderCode) === true
|
||||
skipInboundMap.get(orderCode) === true,
|
||||
// 客户自提单副文案「待客户上门取货」(同上,避免「待配送员开始配送」张冠李戴)
|
||||
row.self_pickup === true
|
||||
) ||
|
||||
buildStatusHint(storedStatus, inspectionState, fulfillment, pickingEnabled),
|
||||
inspection_fail_items: failItemsMap.get(orderCode) || [],
|
||||
|
||||
@@ -262,7 +262,12 @@ export function buildProgressStatusHint(
|
||||
* 主系统**全免入库**单(2026-10-11 开发者定稿):我方不派车、50 就是"等主系统骑手取货",
|
||||
* 副文案必须与徽标「待取货」同口径,**不得**再写「待配送员开始配送」(张冠李戴)。
|
||||
*/
|
||||
skipInbound?: boolean
|
||||
skipInbound?: boolean,
|
||||
/**
|
||||
* **客户自提**单(2026-10-16):50 同样是「待取货」,但是**客户自己来拿**、由我方管理员
|
||||
* 点「确认取货」结案 ⇒ 副文案与免入库单不同口径(否则又是「待配送员开始配送」的张冠李戴)。
|
||||
*/
|
||||
selfPickup?: boolean
|
||||
): string | null {
|
||||
if (displayStatus === 20 && facts.itemCount > 0 && !facts.allocationFulfilled) {
|
||||
return '尚有明细未分配供应商/采购';
|
||||
@@ -293,7 +298,8 @@ export function buildProgressStatusHint(
|
||||
return pickingEnabled === false ? null : '待分拣完成';
|
||||
}
|
||||
if (displayStatus === 50) {
|
||||
// 免入库:我方不派车,货由**主系统骑手上门取走**(取走后靠 picked_up 收口 90)
|
||||
// 客户自提:客户自己上门拿;免入库:货由**主系统骑手上门取走**(取走后靠 picked_up 收口 90)
|
||||
if (selfPickup) return '待客户上门取货';
|
||||
return skipInbound ? '待主系统骑手上门取货' : '待配送员开始配送';
|
||||
}
|
||||
if (displayStatus === 60) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { buildProgressStatusHint } from '../src/services/orderStatusDisplayService';
|
||||
|
||||
/**
|
||||
* 客户「是否取货」(自提,无配送)—— 2026-10-15 开发者需求。
|
||||
@@ -96,6 +97,28 @@ describe('自提 · 列表派生(50 显示「待取货」,与主系统免入
|
||||
// 行类型补了字段
|
||||
expect(listQuery).toContain('self_pickup?: boolean;');
|
||||
});
|
||||
|
||||
/**
|
||||
* 2026-10-16 真机报障「为什么不上待取货」:徽标已是「待取货」(前端派生),
|
||||
* 但**副文案**还是「待配送员开始配送」—— `buildProgressStatusHint` 只认免入库,
|
||||
* 自提单传下去还是走普通 50 分支。副文案必须与徽标同口径(同一坑 2026-10-11 免入库踩过)。
|
||||
*/
|
||||
it('50 的副文案区分来源:自提单不得写「待配送员开始配送」', () => {
|
||||
const facts = {} as unknown as Parameters<typeof buildProgressStatusHint>[2];
|
||||
expect(buildProgressStatusHint(50, 'none', facts, undefined, undefined, false, true)).toBe(
|
||||
'待客户上门取货'
|
||||
);
|
||||
// 免入库口径不受影响
|
||||
expect(buildProgressStatusHint(50, 'none', facts, undefined, undefined, true, false)).toBe(
|
||||
'待主系统骑手上门取货'
|
||||
);
|
||||
// 普通单仍是原文案
|
||||
expect(buildProgressStatusHint(50, 'none', facts, undefined, undefined, false, false)).toBe(
|
||||
'待配送员开始配送'
|
||||
);
|
||||
// 列表侧必须把 self_pickup 作为第 7 个参数传进去,否则上面这条分支永远不生效
|
||||
expect(listQuery).toContain('row.self_pickup === true');
|
||||
});
|
||||
});
|
||||
|
||||
describe('自提 · 确认取货(管理员)', () => {
|
||||
|
||||
@@ -3965,10 +3965,15 @@ export const OrderManagement: React.FC = () => {
|
||||
};
|
||||
/**
|
||||
* ⚠️ i18n `orders.list.status.50` 的固定文案是「待配送」——徽标渲染时必须让
|
||||
* 免入库派生文案优先,否则 `listStatusText()` 会把它吃掉(列表仍显示「待配送」)。
|
||||
* 派生文案优先,否则 `listStatusText()` 会把它吃掉(列表仍显示「待配送」)。
|
||||
*
|
||||
* 派生文案有**两个**来源,都必须放行(2026-10-16 修:先前只放行了免入库,
|
||||
* 客户自提单照样被 i18n 吃掉 ⇒ 徽标显示「待配送」而按钮却已是「确认取货」):
|
||||
* · 主系统**免入库**单(`is_skip_inbound`)
|
||||
* · **客户自提**单(`self_pickup`)
|
||||
*/
|
||||
const statusBadgeText =
|
||||
statusCode === 50 && isSkipInboundOrder
|
||||
statusCode === 50 && (isSkipInboundOrder || isSelfPickupOrder)
|
||||
? derivedStatusLabel
|
||||
: listStatusText(statusCode, status.text);
|
||||
const StatusIcon = status.icon;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { mapManagementOrderRow } from './orderManagementHelpers';
|
||||
import { formatOrderStatusLabel } from '../../../utils/orderStatusLabels';
|
||||
|
||||
/**
|
||||
* 客户自提单在 50 展示「待取货」(2026-10-15 需求)—— **2026-10-16 真机报障回归**。
|
||||
*
|
||||
* 开发者报障原话:「为什么不上待取货?好消息是没有配送任务的生成,坏消息 不上待取货」。
|
||||
* 实测该单数据是对的(`order_status=50`、`orders.self_pickup=true`、客户 `is_self_pickup=true`、
|
||||
* 配送任务 0 条),坏在**徽标文案的优先级判断**:
|
||||
*
|
||||
* ```ts
|
||||
* const statusBadgeText =
|
||||
* statusCode === 50 && isSkipInboundOrder // ← 只放行免入库,自提单被落下
|
||||
* ? derivedStatusLabel
|
||||
* : listStatusText(statusCode, status.text); // i18n `status.50` 恒为「待配送」
|
||||
* ```
|
||||
*
|
||||
* 与 2026-10-11 免入库踩过的是**同一个坑**(见本文件同目录 `orderManagementHelpers.skipInbound.test.ts`
|
||||
* 的注释②)。因此这里钉两条:
|
||||
* ① 派生文案函数对 `selfPickup` 生效(50 → 待取货);
|
||||
* ② 页面徽标优先级判断必须**同时**放行免入库与自提(否则派生文案被 i18n 吃掉)。
|
||||
*/
|
||||
const page = readFileSync(new URL('./OrderManagementPage.tsx', import.meta.url), 'utf8');
|
||||
|
||||
describe('订单列表:客户自提 50 显示「待取货」', () => {
|
||||
it('① 行映射带过 self_pickup,派生文案为「待取货」', () => {
|
||||
const row = mapManagementOrderRow({
|
||||
order_code: 'ORD_WEB_20261016_BR002_0001',
|
||||
customer_code: 'CUS98392383347',
|
||||
order_status: 50,
|
||||
self_pickup: true,
|
||||
});
|
||||
expect(row.self_pickup).toBe(true);
|
||||
expect(formatOrderStatusLabel(row.order_status, { selfPickup: row.self_pickup })).toBe('待取货');
|
||||
});
|
||||
|
||||
it('② 徽标优先级必须同时放行「免入库」与「自提」,否则 i18n 的「待配送」会吃掉派生文案', () => {
|
||||
expect(page).toContain('statusCode === 50 && (isSkipInboundOrder || isSelfPickupOrder)');
|
||||
// 旧写法(只放行免入库)不得复活
|
||||
expect(page).not.toContain('statusCode === 50 && isSkipInboundOrder\n ? derivedStatusLabel');
|
||||
});
|
||||
|
||||
it('③ 普通单不受影响:50 仍是「待配送」', () => {
|
||||
const plain = mapManagementOrderRow({
|
||||
order_code: 'ORD_WEB_20261016_BR002_0002',
|
||||
order_status: 50,
|
||||
});
|
||||
expect(plain.self_pickup).toBe(false);
|
||||
expect(formatOrderStatusLabel(plain.order_status, { selfPickup: plain.self_pickup })).toBe(
|
||||
'待配送'
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user