| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- /**
- * ETC/油卡充值申请发微信群纯文本(无序号)
- */
- import { countPlAttachmentUrls } from '@/utils/plFuelRegisterCopy'
- const TYPE_LABELS = {
- etc: 'ETC',
- fuel: '油卡',
- shanxia: '山峡'
- }
- export function getPlRechargeTypeLabel(type) {
- return TYPE_LABELS[type] || type || '—'
- }
- export function buildVehicleRechargeApplyCopyText(row = {}) {
- const dash = '—'
- const plate = String(row.licensePlate || '').trim() || dash
- const odometer =
- row.odometerKm != null && Number.isFinite(Number(row.odometerKm))
- ? `${Number(row.odometerKm).toFixed(1)} KM`
- : dash
- return [
- `【${plate} - ETC/油卡充值申请】`,
- `申请单号:${row.applyNo || dash}`,
- `充值类型:${getPlRechargeTypeLabel(row.rechargeType)}`,
- `申请日期:${row.applyDate || dash}`,
- `申请人:${row.applicantName || dash}`,
- `车牌号:${plate}`,
- `期初公里数:${odometer}`,
- `附件个数:${countPlAttachmentUrls(row.attachmentUrls)}`,
- `备注:${String(row.remark || '').trim() || dash}`
- ].join('\n')
- }
- /** 复制到剪贴板;成功返回 true */
- export function copyVehicleRechargeApplyToClipboard(row) {
- const text = buildVehicleRechargeApplyCopyText(row)
- if (!text) {
- uni.showToast({ title: '暂无可复制内容', icon: 'none' })
- return Promise.resolve(false)
- }
- return new Promise((resolve) => {
- uni.setClipboardData({
- data: text,
- success: () => {
- uni.showToast({ title: '已复制', icon: 'success' })
- resolve(true)
- },
- fail: () => {
- uni.showToast({ title: '复制失败', icon: 'none' })
- resolve(false)
- }
- })
- })
- }
|