小程序自采列表: 规格整行显示 + 单价预填去 0
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:0 视为未定价 ⇒ 留空(点击即可直接填,无需先删 0),>0 才预填;pickCostPriceHint 的「0 合法」语义不变。
均只改自采列表卡片,新增两条契约测试。
This commit is contained in:
雨天
2026-10-16 17:21:56 +08:00
parent f2e4980dce
commit 6db5eb9e77
6 changed files with 62 additions and 9 deletions
+12 -2
View File
@@ -227,6 +227,16 @@ function pickCostPriceHint(row) {
return '';
}
/**
* 单价输入**预填**:0 视为「尚未定价」⇒ **留空**(点击即可直接输入,免得先删一个 0);
* 只有 > 0 的真实价才预填。⚠️ 只影响「预填」,不改 `pickCostPriceHint` 的「0 合法」语义
* (取值/回退仍按 0 处理,提交空串也仍是 0)。
*/
function prefillPriceInput(hint) {
const n = Number(hint);
return Number.isFinite(n) && n > 0 ? String(hint) : '';
}
function resolveActualQty(row) {
const raw = row?.actual_qty_input;
if (raw !== undefined && raw !== null && String(raw).trim() !== '') {
@@ -434,7 +444,7 @@ function buildProductGroups(rows) {
warehouseDemandRecord: recordAll,
planQtyText: planText,
actual_qty_input: toInputString(null, group.planQtyTotal),
actual_price_input: toInputString(pickCostPriceHint(first), ''),
actual_price_input: prefillPriceInput(pickCostPriceHint(first)),
unit: displayText(first?.unit, group.unit),
unitIndex: first?.unitIndex || 0,
unitOptions: first?.unitOptions || group.unitOptions,
@@ -475,7 +485,7 @@ function decoratePurchaseRow(row, categoryOptions) {
can_skip_warehouse: canSkipWarehouseDemand(row),
order_supplier_name: displayText(row.order_supplier_name, ''),
actual_qty_input: toInputString(row.actual_qty, row.purchase_qty),
actual_price_input: toInputString(pickCostPriceHint(row), ''),
actual_price_input: prefillPriceInput(pickCostPriceHint(row)),
direct_delivery: isSkuDirectDelivery(row),
photoRequired: needsDirectDeliveryPhoto(row),
photoCount: directDeliveryPhotoCount(row),