feat(miniprogram): split driver plan copy product into three lines
Make copy-to-group text easier to scan: 产品信息 / 计划数量 / 实际数量 as separate lines. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
36d27416d3
commit
c626023250
2 files changed
+211
-8
No files matched your search
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* 司机运输计划单「复制发群」纯文本(不含附件)
|
||||
* 规格:docs/superpowers/specs/2026-10-12-mini-pl-driver-plan-copy-text-enrich-design.md
|
||||
* 规格:docs/superpowers/specs/2026-10-13-mini-pl-driver-plan-copy-product-lines-design.md
|
||||
* (头信息/区块/边界继承 2026-10-12 enrich 设计)
|
||||
*/
|
||||
|
||||
const DASH = '—'
|
||||
@@ -41,18 +42,19 @@ function actualQtyOf(product) {
|
||||
return null
|
||||
}
|
||||
|
||||
/** 产品紧凑行:- 名称 型号 包装 计划数量:… 实际数量:… */
|
||||
function formatProductLine(product) {
|
||||
/** 产品三行:产品信息 / 计划数量 / 实际数量(组间不空行) */
|
||||
function formatProductLines(product) {
|
||||
const name = textOrDash(product?.productName ?? product?.product_name)
|
||||
const model = textOrDash(product?.model)
|
||||
const pack = textOrDash(product?.packageSpec ?? product?.package_spec)
|
||||
const unit = product?.unit
|
||||
const planPart = formatQtyWithUnit(planQtyOf(product), unit)
|
||||
const actualPart = formatQtyWithUnit(actualQtyOf(product), unit)
|
||||
return (
|
||||
`- ${name}${FIELD_GAP}${model}${FIELD_GAP}${pack}` +
|
||||
`${FIELD_GAP}计划数量:${planPart}${FIELD_GAP}实际数量:${actualPart}`
|
||||
)
|
||||
return [
|
||||
`- 产品信息:${name}${FIELD_GAP}${model}${FIELD_GAP}${pack}`,
|
||||
`- 计划数量:${planPart}`,
|
||||
`- 实际数量:${actualPart}`
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +76,7 @@ function appendInfoSection(lines, title, stops) {
|
||||
return
|
||||
}
|
||||
products.forEach((product) => {
|
||||
lines.push(formatProductLine(product))
|
||||
formatProductLines(product).forEach((line) => lines.push(line))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user