feat(miniprogram): add pound QR label helpers and node checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-09-24 21:13:08 +08:00
1 parent a6e0c4481f
commit b1719fab23
2 files changed
+59

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
/**
* 磅单二维码弹窗文案工具(与 web-admin PoundSlipQrcodeView / DbPoundSlipQrcodeDialog 对齐)
*/
export function poundQrDialogTitle(businessType) {
return String(businessType || '').trim() === '出库' ? '出库磅单二维码' : '入库磅单二维码'
}
/** 与 DbPoundSlipQrcodeDialog.formatQrcodeProductLabel 一致 */
export function formatQrcodeProductLabel(row) {
const product = String(row?.product || '').trim()
const specification = String(row?.specification || '').trim()
if (!specification) return product
if (product.endsWith(specification)) {
const base = product.slice(0, -specification.length).trimEnd()
return base ? `${base} ${specification}` : specification
}
return `${product} ${specification}`.trim()
}
export function formatPoundQrProductLine(row, quantityUnit = '吨') {
const unit = String(quantityUnit || '').trim() || '吨'
const label = formatQrcodeProductLabel(row)
const qty = row?.quantity
const qtyText = qty === 0 || qty ? String(qty) : '--'
return `${label}(${qtyText} ${unit})`
}
export function normalizePoundQrRemarks(row) {
const a = String(row?.remarks ?? '').trim()
if (a) return a
return String(row?.remark ?? '').trim()
}