From 3c767da261cc352f9a7c539df6027357d97381f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E5=A4=A9?= Date: Tue, 13 Oct 2026 11:25:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=BD=95=E5=8D=95):=20=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E8=BF=9B=E8=B4=A7=E4=B8=8D=E5=86=8D=E6=95=B4=E7=89=87=E6=A0=87?= =?UTF-8?q?=E7=BA=A2=EF=BC=88=E8=A1=8C=E7=BA=A7=E9=9B=B6=E4=BB=B7=E8=B1=81?= =?UTF-8?q?=E5=85=8D=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 选「独立进货」后售价按设计恒为 0,行组件的零价「创建阻断」红框未豁免 ⇒ 所有行标红。提交口(validateOrder)早已豁免,属视觉误报。行级传 blockZeroSaleEnabled 时加 isIndependentInboundCustomer 豁免;补契约测试与设计文档说明。 --- docs/design/20261012-独立进货(自用哨兵客户).md | 5 +++++ .../order/OrderParsedItemRow.independentInbound.test.ts | 7 +++++++ src/pages/orders/CustomerOrder.tsx | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/design/20261012-独立进货(自用哨兵客户).md b/docs/design/20261012-独立进货(自用哨兵客户).md index 498bbd3..f841dfd 100644 --- a/docs/design/20261012-独立进货(自用哨兵客户).md +++ b/docs/design/20261012-独立进货(自用哨兵客户).md @@ -77,6 +77,11 @@ 「订单金额、行销售额、返利、毛利」**所有**销售额公式天然算 0,不需要逐个改财务 SQL。 配套:分配口与结案口的「售价为 0 禁止提交/结案」闸门对哨兵单放行(成本价另有 >0 硬拦)。 +- **行级也豁免(2026-10-13 修误报)**:录单页每行的「零价创建阻断」**红框**同样对哨兵单豁免 + (`CustomerOrder.tsx` 传 `blockZeroSaleEnabled={blockZeroSaleEnabled && !isIndependentInboundCustomer(…)}`)。 + 此前只豁免了**提交口**(`validateOrder`)、**行级没豁免** ⇒ 选「独立进货」后**所有行标红** + (售价恒 0 被行组件 `OrderParsedItemRow.createBlocked` 误判为阻断);**提交不受影响,纯视觉误报**。 + **第二重(防御)**:统一排除谓词 `salesVisibleOrderSql()`,已加在以下面: 判据统一走新模块的谓词 `COALESCE(.customer_code,'') <> '__INDEPENDENT_INBOUND__'`: diff --git a/src/components/order/OrderParsedItemRow.independentInbound.test.ts b/src/components/order/OrderParsedItemRow.independentInbound.test.ts index 86585f2..507377c 100644 --- a/src/components/order/OrderParsedItemRow.independentInbound.test.ts +++ b/src/components/order/OrderParsedItemRow.independentInbound.test.ts @@ -27,4 +27,11 @@ describe('录单页:独立进货隐藏销售价输入框', () => { it('③ 录单页按"客户=独立进货"传开关', () => { expect(page).toContain('hidePriceInput={isIndependentInboundCustomer(selectedCustomer?.customer_code)}'); }); + + it('④ 零价「创建阻断」红框也对独立进货豁免(2026-10-13 修误报)', () => { + // 售价恒为 0 ⇒ 行组件的 createBlocked 会整片标红;提交口早已豁免,行级也要一起豁免 + expect(page).toContain( + 'blockZeroSaleEnabled && !isIndependentInboundCustomer(selectedCustomer?.customer_code)' + ); + }); }); diff --git a/src/pages/orders/CustomerOrder.tsx b/src/pages/orders/CustomerOrder.tsx index e4a12ac..dfcf5a6 100644 --- a/src/pages/orders/CustomerOrder.tsx +++ b/src/pages/orders/CustomerOrder.tsx @@ -2515,7 +2515,11 @@ export const CustomerOrder: React.FC = () => { index={index} variant="customer" highlighted={focusItemId === item.id} - blockZeroSaleEnabled={blockZeroSaleEnabled} + // 独立进货:销售价恒为 0(无销售)⇒ 行级「零价阻断」红框也要一起豁免, + // 否则整片标红(提交口早已豁免,见 validateOrder 的 independentInboundOrder) + blockZeroSaleEnabled={ + blockZeroSaleEnabled && !isIndependentInboundCustomer(selectedCustomer?.customer_code) + } showProcessingMethod catalogSkus={skuMappings} categoryOptions={categoryOptions}