|
@@ -24,7 +24,7 @@ const ACTION_LABELS = Object.freeze({
|
|
|
submit: '提交财务确认',
|
|
submit: '提交财务确认',
|
|
|
withdraw: '撤回转账',
|
|
withdraw: '撤回转账',
|
|
|
link: '关联样本',
|
|
link: '关联样本',
|
|
|
- unlink: '取消运费'
|
|
|
|
|
|
|
+ unlink: '取消样本关联'
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const PAY_MODE_LABELS = Object.freeze({ dj: '趸交', fq: '分期', fgd: '分改趸', djfq: '趸交+分期' })
|
|
const PAY_MODE_LABELS = Object.freeze({ dj: '趸交', fq: '分期', fgd: '分改趸', djfq: '趸交+分期' })
|
|
@@ -180,21 +180,48 @@ function chaseCard(item) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function hasPresentValue(value) {
|
|
|
|
|
+ if (value == null) return false
|
|
|
|
|
+ if (typeof value === 'number') return Number.isFinite(value)
|
|
|
|
|
+ return String(value).trim() !== ''
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function isPaymentPeriodPresent(period) {
|
|
|
|
|
+ if (!period || typeof period !== 'object') return false
|
|
|
|
|
+ return (
|
|
|
|
|
+ hasPresentValue(period.scheduleNo) ||
|
|
|
|
|
+ hasPresentValue(period.dueAmount) ||
|
|
|
|
|
+ hasPresentValue(period.displayPaidAmount) ||
|
|
|
|
|
+ hasPresentValue(period.paidAmount) ||
|
|
|
|
|
+ hasPresentValue(period.arrearsAmount) ||
|
|
|
|
|
+ hasPresentValue(period.dueDate) ||
|
|
|
|
|
+ hasPresentValue(period.payDate)
|
|
|
|
|
+ )
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function paymentPeriodBlock(period, index) {
|
|
|
|
|
+ const scheduleNo = Number(period.scheduleNo) || index + 1
|
|
|
|
|
+ const paidRaw = period.displayPaidAmount ?? period.paidAmount
|
|
|
|
|
+ return {
|
|
|
|
|
+ key: String(period.id || `period-${scheduleNo}`),
|
|
|
|
|
+ scheduleNo,
|
|
|
|
|
+ dueAmount: money(period.dueAmount),
|
|
|
|
|
+ paidAmount: money(paidRaw),
|
|
|
|
|
+ fields: [
|
|
|
|
|
+ field('应缴费时间', period.dueDate),
|
|
|
|
|
+ field('已缴费时间', period.payDate),
|
|
|
|
|
+ field('欠缴费金额', money(period.arrearsAmount), { money: true })
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function paymentCard(item) {
|
|
function paymentCard(item) {
|
|
|
const progress = label({}, item.paymentProgress || item.progress || (Number(item.paidAmount || 0) > 0 ? '部分已缴' : '待缴清'))
|
|
const progress = label({}, item.paymentProgress || item.progress || (Number(item.paidAmount || 0) > 0 ? '部分已缴' : '待缴清'))
|
|
|
- const periods = Array.from({ length: 6 }, (_, index) => item.periods?.[index] || {})
|
|
|
|
|
- const periodFields = periods.flatMap((period, index) => {
|
|
|
|
|
- const prefix = `第${index + 1}期·`
|
|
|
|
|
- return [
|
|
|
|
|
- field(`${prefix}应缴费金额(元)`, money(period.dueAmount), { money: true }),
|
|
|
|
|
- field(`${prefix}应缴费时间`, period.dueDate),
|
|
|
|
|
- field(`${prefix}已缴费金额`, money(period.displayPaidAmount ?? period.paidAmount), { money: true }),
|
|
|
|
|
- field(`${prefix}已缴费时间`, period.payDate),
|
|
|
|
|
- field(`${prefix}欠缴费金额`, money(period.arrearsAmount), { money: true })
|
|
|
|
|
- ]
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ const periods = (Array.isArray(item.periods) ? item.periods : []).filter(isPaymentPeriodPresent)
|
|
|
return {
|
|
return {
|
|
|
- title: text(item.motherName), subtitle: text(item.sampleCode), status: progress,
|
|
|
|
|
|
|
+ title: text(item.motherName),
|
|
|
|
|
+ subtitle: text(item.sampleCode),
|
|
|
|
|
+ status: progress,
|
|
|
fields: [
|
|
fields: [
|
|
|
field('协议号', item.protocolNo, { wide: true }),
|
|
field('协议号', item.protocolNo, { wide: true }),
|
|
|
field('姓名', item.motherName), field('手机号', item.motherPhone),
|
|
field('姓名', item.motherName), field('手机号', item.motherPhone),
|
|
@@ -203,8 +230,10 @@ function paymentCard(item) {
|
|
|
field('合同总额', money(item.contractAmount), { money: true }),
|
|
field('合同总额', money(item.contractAmount), { money: true }),
|
|
|
field('缴费方式', label(PAY_MODE_LABELS, item.payMode), { tag: true }),
|
|
field('缴费方式', label(PAY_MODE_LABELS, item.payMode), { tag: true }),
|
|
|
field('优惠金额', money(item.discountAmount), { money: true }),
|
|
field('优惠金额', money(item.discountAmount), { money: true }),
|
|
|
- field('应收总额', money(item.receivableAmount), { money: true }),
|
|
|
|
|
- ...periodFields,
|
|
|
|
|
|
|
+ field('应收总额', money(item.receivableAmount), { money: true })
|
|
|
|
|
+ ],
|
|
|
|
|
+ periodBlocks: periods.map(paymentPeriodBlock),
|
|
|
|
|
+ footerFields: [
|
|
|
field('累计实缴', money(item.paidAmount), { money: true }),
|
|
field('累计实缴', money(item.paidAmount), { money: true }),
|
|
|
field('待缴金额', money(item.dueRemainAmount ?? item.remainAmount), { money: true }),
|
|
field('待缴金额', money(item.dueRemainAmount ?? item.remainAmount), { money: true }),
|
|
|
field('备注', item.remark, { wide: true })
|
|
field('备注', item.remark, { wide: true })
|
|
@@ -213,38 +242,48 @@ function paymentCard(item) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function freightSampleBlock(row, index) {
|
|
|
|
|
+ const sampleCode = text(row?.sampleCode, '')
|
|
|
|
|
+ const title = sampleCode
|
|
|
|
|
+ ? `样本 ${index + 1} · ${sampleCode}`
|
|
|
|
|
+ : `样本 ${index + 1}`
|
|
|
|
|
+ return {
|
|
|
|
|
+ key: String(row?.id || row?.sampleId || `${sampleCode || 'sample'}-${index}`),
|
|
|
|
|
+ title,
|
|
|
|
|
+ status: label(SOURCE_LABELS, row?.sampleSource),
|
|
|
|
|
+ fields: [
|
|
|
|
|
+ field('协议号', row?.protocolNo, { wide: true }),
|
|
|
|
|
+ field('母亲姓名', row?.motherName),
|
|
|
|
|
+ field('子女姓名', row?.newbornName),
|
|
|
|
|
+ field('样本编码', row?.sampleCode, { wide: true }),
|
|
|
|
|
+ field('样本类型', row?.sampleTypeName, { wide: true })
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function freightCard(role, item) {
|
|
function freightCard(role, item) {
|
|
|
const rows = Array.isArray(item.items) ? item.items : []
|
|
const rows = Array.isArray(item.items) ? item.items : []
|
|
|
const first = rows[0] || {}
|
|
const first = rows[0] || {}
|
|
|
const transportMode = label({}, item.transportModeLabel || item.transportMode)
|
|
const transportMode = label({}, item.transportModeLabel || item.transportMode)
|
|
|
const source = label(SOURCE_LABELS, first.sampleSource || item.sourceLabel)
|
|
const source = label(SOURCE_LABELS, first.sampleSource || item.sourceLabel)
|
|
|
- const itemFields = rows.flatMap((row, index) => {
|
|
|
|
|
- const prefix = index === 0 ? '' : `样本${index + 1}·`
|
|
|
|
|
- return [
|
|
|
|
|
- field(`${prefix}来源`, label(SOURCE_LABELS, row.sampleSource), { tag: true }),
|
|
|
|
|
- field(`${prefix}协议号`, row.protocolNo, { wide: true }),
|
|
|
|
|
- field(`${prefix}母亲姓名`, row.motherName),
|
|
|
|
|
- field(`${prefix}子女姓名`, row.newbornName),
|
|
|
|
|
- field(`${prefix}样本编码`, row.sampleCode, { wide: true }),
|
|
|
|
|
- field(`${prefix}样本类型`, row.sampleTypeName, { wide: true })
|
|
|
|
|
- ]
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ const sampleCount = Number(item.visibleItemCount ?? rows.length) || 0
|
|
|
return {
|
|
return {
|
|
|
title: text(item.freightNo),
|
|
title: text(item.freightNo),
|
|
|
subtitle: `${transportMode} · ${money(item.freightAmount)}`,
|
|
subtitle: `${transportMode} · ${money(item.freightAmount)}`,
|
|
|
status: source,
|
|
status: source,
|
|
|
fields: [
|
|
fields: [
|
|
|
- field('批次号', item.freightNo, { wide: true }), field('运输方式', transportMode, { tag: true }),
|
|
|
|
|
|
|
+ field('运输方式', transportMode, { tag: true }),
|
|
|
field('运费金额', money(item.freightAmount), { money: true }),
|
|
field('运费金额', money(item.freightAmount), { money: true }),
|
|
|
- field('关联数', String(item.visibleItemCount ?? item.items?.length ?? 0)),
|
|
|
|
|
- ...itemFields,
|
|
|
|
|
|
|
+ field('关联数', String(sampleCount)),
|
|
|
field('创建人', personName(item.creatorName || item.createByName, item.createBy)),
|
|
field('创建人', personName(item.creatorName || item.createByName, item.createBy)),
|
|
|
field('创建时间', item.createTime),
|
|
field('创建时间', item.createTime),
|
|
|
field('更新时间', item.updateTime),
|
|
field('更新时间', item.updateTime),
|
|
|
field('备注', item.remark, { wide: true })
|
|
field('备注', item.remark, { wide: true })
|
|
|
],
|
|
],
|
|
|
- privacyNote: role === 'specialist' ? '仅展示当前权限范围内的关联样本' : '',
|
|
|
|
|
- actions: allowed(item, ['edit', 'link', 'unlink'])
|
|
|
|
|
|
|
+ sampleBlocks: rows.map(freightSampleBlock),
|
|
|
|
|
+ sampleCount,
|
|
|
|
|
+ privacyNote: '',
|
|
|
|
|
+ actions: allowed(item, ['edit', 'delete', 'link', 'unlink'])
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|