小程序自采列表: 规格整行显示 + 单价预填去 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
@@ -106,7 +106,6 @@
>{{product.photoCount > 0 ? '已拍' + product.photoCount : (product.photoRequired ? '拍照' : '拍照')}}</view>
<view class="product-row-name">
<text class="task-title ptp-row-title">{{product.productName}}</text>
<text wx:if="{{product.specText}}" class="product-row-spec">规格:{{product.specText}}</text>
<text wx:if="{{product.remarkText}}" class="product-row-remark">{{product.remarkText}}</text>
<text wx:if="{{product.warehouseDemandRecord}}" class="task-sub">仓内加工 · 只读记录</text>
</view>
@@ -158,6 +157,8 @@
>转供应商</view>
</view>
<view wx:if="{{product.specText}}" class="product-row-spec">规格:{{product.specText}}</view>
<view wx:if="{{product.needs_product_setup}}" class="setup-hint">未匹配商品库,请在下方逐单确认名称和分类</view>
<view wx:if="{{product.needs_product_setup}}" class="product-children">
@@ -1390,13 +1390,14 @@
overflow-wrap: anywhere;
}
/* 规格:整行显示在卡片行下方(2026-10-16 从商品名列移出,避免被挤到折行) */
.product-row-spec {
display: block;
margin-top: 2rpx;
margin-top: 4rpx;
padding: 0 2rpx;
font-size: 22rpx;
font-weight: 400;
color: #71717a;
line-height: 1.35;
line-height: 1.4;
word-break: break-word;
overflow-wrap: anywhere;
}
+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),