feat(web-admin): append pound QR links in copy-to-driver text
Include multi-line public pound QR URLs after the driver link when dibang slips exist. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
5b4c1bc991
commit
ab3a90c3f5
5 files changed
+58
-4
No files matched your search
@@ -195,6 +195,29 @@ function buildLegacyDriverStopBlocks(
|
||||
return blocks
|
||||
}
|
||||
|
||||
export function buildPoundQrcodePublicUrl(inventoryId: string, origin = window.location.origin) {
|
||||
return `${origin}/#/public/pl/pound-qrcode/${encodeURIComponent(inventoryId)}`
|
||||
}
|
||||
|
||||
export function buildPoundQrcodeLinksFromInventoryRecords(
|
||||
records: {
|
||||
dbInventoryId: string
|
||||
dbPurchasePlanId?: string
|
||||
businessType?: string
|
||||
partnerCompany?: string
|
||||
}[],
|
||||
origin = window.location.origin
|
||||
) {
|
||||
return records
|
||||
.filter((r) => r.dbPurchasePlanId?.trim() && r.dbInventoryId?.trim())
|
||||
.map((r) => {
|
||||
const bt = (r.businessType || '').trim()
|
||||
const pc = (r.partnerCompany || '').trim()
|
||||
const label = bt && pc ? `${bt} · ${pc}` : bt || pc || '磅单'
|
||||
return { label, url: buildPoundQrcodePublicUrl(r.dbInventoryId, origin) }
|
||||
})
|
||||
}
|
||||
|
||||
export function buildDriverSummaryFromPlan(options: {
|
||||
plan?: DriverSummaryPlan | null
|
||||
planNo?: string
|
||||
@@ -218,6 +241,7 @@ export function buildDriverSummaryFromPlan(options: {
|
||||
destinationNotes?: string
|
||||
startPoint?: string
|
||||
endPoint?: string
|
||||
poundQrcodeLinks?: { label: string; url: string }[]
|
||||
}) {
|
||||
const plan = options.plan || {}
|
||||
const plate = options.licensePlate || plan.licensePlate || '—'
|
||||
@@ -248,5 +272,13 @@ export function buildDriverSummaryFromPlan(options: {
|
||||
|
||||
lines.push('')
|
||||
lines.push(`司机链接:${options.driverUrl || '—'}`)
|
||||
const links = (options.poundQrcodeLinks || []).filter((x) => x?.url)
|
||||
if (links.length) {
|
||||
lines.push('')
|
||||
lines.push('磅单二维码链接:')
|
||||
for (const item of links) {
|
||||
lines.push(`${item.label}:${item.url}`)
|
||||
}
|
||||
}
|
||||
return lines.join('\n')
|
||||
}
|
||||
Reference in new issue
Block a user