fix(录单): 独立进货不再整片标红(行级零价豁免)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s

选「独立进货」后售价按设计恒为 0,行组件的零价「创建阻断」红框未豁免 ⇒ 所有行标红。提交口(validateOrder)早已豁免,属视觉误报。行级传 blockZeroSaleEnabled 时加 isIndependentInboundCustomer 豁免;补契约测试与设计文档说明。
This commit is contained in:
雨天
2026-10-13 11:25:23 +08:00
parent e4f6269780
commit 3c767da261
3 changed files with 17 additions and 1 deletions
@@ -77,6 +77,11 @@
「订单金额、行销售额、返利、毛利」**所有**销售额公式天然算 0,不需要逐个改财务 SQL。
配套:分配口与结案口的「售价为 0 禁止提交/结案」闸门对哨兵单放行(成本价另有 >0 硬拦)。
- **行级也豁免(2026-10-13 修误报)**:录单页每行的「零价创建阻断」**红框**同样对哨兵单豁免
(`CustomerOrder.tsx` 传 `blockZeroSaleEnabled={blockZeroSaleEnabled && !isIndependentInboundCustomer(…)}`)。
此前只豁免了**提交口**(`validateOrder`)、**行级没豁免** ⇒ 选「独立进货」后**所有行标红**
(售价恒 0 被行组件 `OrderParsedItemRow.createBlocked` 误判为阻断);**提交不受影响,纯视觉误报**。
**第二重(防御)**:统一排除谓词 `salesVisibleOrderSql()`,已加在以下面:
判据统一走新模块的谓词 `COALESCE(<alias>.customer_code,'') <> '__INDEPENDENT_INBOUND__'`:
@@ -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)'
);
});
});
+5 -1
View File
@@ -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}