|
|
@@ -4,34 +4,30 @@ import {
|
|
|
productionReceptionFieldValue,
|
|
|
resolveProductionReceptionFields
|
|
|
} from '../protocol-production-reception.js'
|
|
|
+import {
|
|
|
+ resolveStatusTag,
|
|
|
+ protocolStatus,
|
|
|
+ donationStatus,
|
|
|
+ payMode,
|
|
|
+ payStatus,
|
|
|
+ paymentScheduleStatus,
|
|
|
+ auditStatus
|
|
|
+} from '../status-tag-registry.js'
|
|
|
|
|
|
-const STATUS_LABELS = Object.freeze({
|
|
|
- dsx: '待生效', dqr: '待确认', sxz: '生效中', ygq: '已过期',
|
|
|
- yzf: '已作废', sdfq: '属地废弃', zky: '转科研', zckc: '转细胞存储'
|
|
|
-})
|
|
|
-const PAY_MODE_LABELS = Object.freeze({ dj: '趸交', fq: '分期', fgd: '分改趸', djfq: '趸交+分期' })
|
|
|
const SEX_LABELS = Object.freeze({ '1': '男', '0': '女' })
|
|
|
const DELIVERY_LABELS = Object.freeze({ sc: '顺产', pgc: '剖宫产' })
|
|
|
const SAMPLE_STATUS_LABELS = Object.freeze({
|
|
|
ycj: '已采集', jcz: '检测中', yrk: '已入库', yzf: '已作废'
|
|
|
})
|
|
|
-const AUDIT_STATUS_LABELS = Object.freeze({
|
|
|
- shtg: '审核通过', shth: '审核退回', dsh: '待审核'
|
|
|
-})
|
|
|
const VOID_TYPE_LABELS = Object.freeze({
|
|
|
khhc: '客户毁存', jcbhg: '检测不合格'
|
|
|
})
|
|
|
-const PAYMENT_STATUS_LABELS = Object.freeze({
|
|
|
- dfj: '已付款', jfqrz: '付款确认中', yjf: '付款完成',
|
|
|
- tfqrz: '退费确认中', ytf: '已退费'
|
|
|
-})
|
|
|
const TRANSFER_TYPE_LABELS = Object.freeze({
|
|
|
wxzz: '微信转账', wx: '微信转账', wechat: '微信转账',
|
|
|
zzbzz: '支付宝转账', zfb: '支付宝转账', alipay: '支付宝转账',
|
|
|
yhkzz: '银行卡转账', bank: '银行卡转账',
|
|
|
xj: '现金', cash: '现金', lszz: '乐刷'
|
|
|
})
|
|
|
-const SCHEDULE_STATUS_LABELS = Object.freeze({ open: '待缴清', cleared: '已缴清', void: '已作废' })
|
|
|
|
|
|
function value(source, key) {
|
|
|
const result = source?.[key]
|
|
|
@@ -43,6 +39,36 @@ function label(map, source) {
|
|
|
return map[key] || (key ? (/[㐀-鿿]/u.test(key) ? key : '未知') : '—')
|
|
|
}
|
|
|
|
|
|
+/** 细胞存储走 protocolStatus;捐赠侧码(如 zckc)走 donationStatus */
|
|
|
+function bizStatusTag(code, source) {
|
|
|
+ const key = String(code || '').trim()
|
|
|
+ if (!key) return { label: '—', tagType: 'info' }
|
|
|
+ if (source === 'research_donation') {
|
|
|
+ if (donationStatus[key]) return resolveStatusTag(donationStatus, key)
|
|
|
+ if (protocolStatus[key]) return resolveStatusTag(protocolStatus, key)
|
|
|
+ return resolveStatusTag(donationStatus, key)
|
|
|
+ }
|
|
|
+ if (protocolStatus[key]) return resolveStatusTag(protocolStatus, key)
|
|
|
+ if (donationStatus[key]) return resolveStatusTag(donationStatus, key)
|
|
|
+ return resolveStatusTag(protocolStatus, key)
|
|
|
+}
|
|
|
+
|
|
|
+function payModeTag(code) {
|
|
|
+ return resolveStatusTag(payMode, code)
|
|
|
+}
|
|
|
+
|
|
|
+function transferPayTag(code) {
|
|
|
+ return resolveStatusTag(payStatus, code)
|
|
|
+}
|
|
|
+
|
|
|
+function scheduleTag(code) {
|
|
|
+ return resolveStatusTag(paymentScheduleStatus, code)
|
|
|
+}
|
|
|
+
|
|
|
+function auditTag(code) {
|
|
|
+ return resolveStatusTag(auditStatus, code)
|
|
|
+}
|
|
|
+
|
|
|
function voidTypeText(source) {
|
|
|
const backendLabel = String(source?.voidTypeLabel || '').trim()
|
|
|
if (backendLabel) return backendLabel
|
|
|
@@ -304,7 +330,7 @@ function sampleLifecycleCards(item, source) {
|
|
|
}
|
|
|
|
|
|
function paymentTransferCard(transfer, transferIndex) {
|
|
|
- const statusText = label(PAYMENT_STATUS_LABELS, transfer?.payStatus)
|
|
|
+ const pay = transferPayTag(transfer?.payStatus)
|
|
|
const transferType = transferTypeText(transfer)
|
|
|
const transferTime = value(transfer, 'transferTime')
|
|
|
return {
|
|
|
@@ -314,7 +340,8 @@ function paymentTransferCard(transfer, transferIndex) {
|
|
|
transferIndex: transferIndex + 1,
|
|
|
amount: value(transfer, 'transferAmount'),
|
|
|
meta: `${transferType} · ${transferTime}`,
|
|
|
- statusText,
|
|
|
+ statusText: pay.label,
|
|
|
+ statusTone: pay.tagType,
|
|
|
fields: [
|
|
|
{ label: '备注', value: value(transfer, 'remark') },
|
|
|
{ label: '财务备注', value: value(transfer, 'financeRemark') },
|
|
|
@@ -324,42 +351,50 @@ function paymentTransferCard(transfer, transferIndex) {
|
|
|
}
|
|
|
|
|
|
function paymentScheduleCards(pay) {
|
|
|
- return (pay?.schedules || []).map((schedule, scheduleIndex) => ({
|
|
|
- key: String(schedule?.id || `schedule-${scheduleIndex}`),
|
|
|
- title: `第 ${schedule?.scheduleNo || scheduleIndex + 1} 期`,
|
|
|
- variant: 'schedule',
|
|
|
- cardsLabel: '转账记录',
|
|
|
- statusText: label(SCHEDULE_STATUS_LABELS, schedule?.scheduleStatus),
|
|
|
- fields: [
|
|
|
- { label: '应缴金额', value: value(schedule, 'dueAmount'), money: true },
|
|
|
- { label: '应缴日期', value: value(schedule, 'dueDate') },
|
|
|
- { label: '实缴金额', value: value(schedule, 'paidAmount'), money: true },
|
|
|
- { label: '欠缴金额', value: value(schedule, 'arrearsAmount'), money: true }
|
|
|
- ],
|
|
|
- cards: (schedule?.transfers || []).map(paymentTransferCard)
|
|
|
- }))
|
|
|
+ return (pay?.schedules || []).map((schedule, scheduleIndex) => {
|
|
|
+ const status = scheduleTag(schedule?.scheduleStatus)
|
|
|
+ return {
|
|
|
+ key: String(schedule?.id || `schedule-${scheduleIndex}`),
|
|
|
+ title: `第 ${schedule?.scheduleNo || scheduleIndex + 1} 期`,
|
|
|
+ variant: 'schedule',
|
|
|
+ cardsLabel: '转账记录',
|
|
|
+ statusText: status.label,
|
|
|
+ statusTone: status.tagType,
|
|
|
+ fields: [
|
|
|
+ { label: '应缴金额', value: value(schedule, 'dueAmount'), money: true },
|
|
|
+ { label: '应缴日期', value: value(schedule, 'dueDate') },
|
|
|
+ { label: '实缴金额', value: value(schedule, 'paidAmount'), money: true },
|
|
|
+ { label: '欠缴金额', value: value(schedule, 'arrearsAmount'), money: true }
|
|
|
+ ],
|
|
|
+ cards: (schedule?.transfers || []).map(paymentTransferCard)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
function legacyPaymentDetailCards(payment, details) {
|
|
|
- return groupLegacyPaymentPeriods({ payment, details }).map((period, index) => ({
|
|
|
- key: `legacy-payment-${period.scheduleNo || index + 1}`,
|
|
|
- title: `第 ${period.scheduleNo || index + 1} 期`,
|
|
|
- variant: 'schedule',
|
|
|
- cardsLabel: '转账记录',
|
|
|
- statusText: label(SCHEDULE_STATUS_LABELS, period.scheduleStatus),
|
|
|
- fields: [
|
|
|
- { label: '应缴金额', value: period.dueAmount == null ? '—' : String(period.dueAmount), money: true },
|
|
|
- { label: '应缴日期', value: period.dueDate || '—' },
|
|
|
- { label: '确认实缴金额', value: String(period.paidAmount), money: true },
|
|
|
- { label: '欠缴金额', value: period.arrearsAmount == null ? '—' : String(period.arrearsAmount), money: true }
|
|
|
- ],
|
|
|
- cards: period.transfers.map((detail, transferIndex) =>
|
|
|
- paymentTransferCard(
|
|
|
- { ...detail, id: detail?.id || `legacy-transfer-${period.scheduleNo}-${transferIndex}` },
|
|
|
- transferIndex
|
|
|
+ return groupLegacyPaymentPeriods({ payment, details }).map((period, index) => {
|
|
|
+ const status = scheduleTag(period.scheduleStatus)
|
|
|
+ return {
|
|
|
+ key: `legacy-payment-${period.scheduleNo || index + 1}`,
|
|
|
+ title: `第 ${period.scheduleNo || index + 1} 期`,
|
|
|
+ variant: 'schedule',
|
|
|
+ cardsLabel: '转账记录',
|
|
|
+ statusText: status.label,
|
|
|
+ statusTone: status.tagType,
|
|
|
+ fields: [
|
|
|
+ { label: '应缴金额', value: period.dueAmount == null ? '—' : String(period.dueAmount), money: true },
|
|
|
+ { label: '应缴日期', value: period.dueDate || '—' },
|
|
|
+ { label: '确认实缴金额', value: String(period.paidAmount), money: true },
|
|
|
+ { label: '欠缴金额', value: period.arrearsAmount == null ? '—' : String(period.arrearsAmount), money: true }
|
|
|
+ ],
|
|
|
+ cards: period.transfers.map((detail, transferIndex) =>
|
|
|
+ paymentTransferCard(
|
|
|
+ { ...detail, id: detail?.id || `legacy-transfer-${period.scheduleNo}-${transferIndex}` },
|
|
|
+ transferIndex
|
|
|
+ )
|
|
|
)
|
|
|
- )
|
|
|
- }))
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
export default {
|
|
|
@@ -394,7 +429,7 @@ export default {
|
|
|
const status = detail?.source === 'research_donation'
|
|
|
? basic?.donationStatus
|
|
|
: basic?.protocolStatus
|
|
|
- return label(STATUS_LABELS, status)
|
|
|
+ return bizStatusTag(status, detail?.source).label
|
|
|
},
|
|
|
detailSections(detail) {
|
|
|
if (Array.isArray(detail?.sections)) {
|
|
|
@@ -405,13 +440,19 @@ export default {
|
|
|
const statusKey = source === 'research_donation' ? 'donationStatus' : 'protocolStatus'
|
|
|
const dateKey = source === 'research_donation' ? 'donationDate' : 'registerDate'
|
|
|
const numberKey = source === 'research_donation' ? 'donationNo' : 'protocolNo'
|
|
|
+ const bizStatus = bizStatusTag(basic?.[statusKey], source)
|
|
|
const values = [
|
|
|
{
|
|
|
key: 'protocol',
|
|
|
title: source === 'research_donation' ? '捐赠信息' : '协议信息',
|
|
|
fields: [
|
|
|
{ label: source === 'research_donation' ? '捐赠编号' : '协议编号', value: value(basic, numberKey) },
|
|
|
- { label: source === 'research_donation' ? '捐赠状态' : '协议状态', value: label(STATUS_LABELS, basic?.[statusKey]), tag: true },
|
|
|
+ {
|
|
|
+ label: source === 'research_donation' ? '捐赠状态' : '协议状态',
|
|
|
+ value: bizStatus.label,
|
|
|
+ tag: true,
|
|
|
+ tagType: bizStatus.tagType
|
|
|
+ },
|
|
|
{ label: source === 'research_donation' ? '捐赠日期' : '登记日期', value: value(basic, dateKey) },
|
|
|
{ label: '采集专员', value: person(basic?.collectorUserName, basic?.collectorUserId) },
|
|
|
...(source === 'cell_storage' ? [{ label: '协议总金额', value: value(basic, 'protocolTotalAmount') }] : []),
|
|
|
@@ -510,23 +551,24 @@ export default {
|
|
|
value: `¥${amt.toFixed(2)}(${cnt} 笔);与预签同一数据,不自动写入样本缴费`
|
|
|
}]
|
|
|
: [],
|
|
|
- cards: depositTransfers.map((tr, index) => ({
|
|
|
- key: String(tr?.id || `deposit-${index}`),
|
|
|
- title: `意向金转账 ${index + 1}`,
|
|
|
- statusText: label(
|
|
|
- { dfj: '已付款', jfqrz: '付款确认中', yjf: '付款完成', tfqrz: '退费确认中', ytf: '已退费' },
|
|
|
- tr?.payStatus
|
|
|
- ),
|
|
|
- fields: [
|
|
|
- { label: '转账金额', value: value(tr, 'transferAmount') },
|
|
|
- { label: '转账时间', value: value(tr, 'transferTime') },
|
|
|
- { label: '转账方式', value: transferTypeText(tr) },
|
|
|
- { label: '转账凭证', value: transferAttachmentValue(tr), type: 'attachments' },
|
|
|
- { label: '备注', value: value(tr, 'remark') },
|
|
|
- { label: '财务备注', value: value(tr, 'financeRemark') },
|
|
|
- { label: '状态', value: label(PAYMENT_STATUS_LABELS, tr?.payStatus), tag: true }
|
|
|
- ]
|
|
|
- }))
|
|
|
+ cards: depositTransfers.map((tr, index) => {
|
|
|
+ const pay = transferPayTag(tr?.payStatus)
|
|
|
+ return {
|
|
|
+ key: String(tr?.id || `deposit-${index}`),
|
|
|
+ title: `意向金转账 ${index + 1}`,
|
|
|
+ statusText: pay.label,
|
|
|
+ statusTone: pay.tagType,
|
|
|
+ fields: [
|
|
|
+ { label: '转账金额', value: value(tr, 'transferAmount') },
|
|
|
+ { label: '转账时间', value: value(tr, 'transferTime') },
|
|
|
+ { label: '转账方式', value: transferTypeText(tr) },
|
|
|
+ { label: '转账凭证', value: transferAttachmentValue(tr), type: 'attachments' },
|
|
|
+ { label: '备注', value: value(tr, 'remark') },
|
|
|
+ { label: '财务备注', value: value(tr, 'financeRemark') },
|
|
|
+ { label: '状态', value: pay.label, tag: true, tagType: pay.tagType }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
if (detail?.source === 'cell_storage' || detail?.payment || detail?.samplePayments) {
|
|
|
@@ -536,40 +578,46 @@ export default {
|
|
|
key: 'payment',
|
|
|
title: '缴费信息',
|
|
|
fields: [],
|
|
|
- cards: samplePays.map((pay, index) => ({
|
|
|
- key: String(pay?.id || pay?.sampleCode || `pay-${index}`),
|
|
|
- title: pay?.sampleCode || `样本缴费 ${index + 1}`,
|
|
|
- fields: [
|
|
|
- { label: '缴费模式', value: label(PAY_MODE_LABELS, pay?.payMode), tag: true },
|
|
|
- { label: '合同金额', value: value(pay, 'contractAmount') },
|
|
|
- ...(String(pay?.payMode || '') === 'dj'
|
|
|
- ? [{ label: '趸交截止时间', value: value(pay, 'lumpSumDeadline') }]
|
|
|
- : [
|
|
|
- { label: '分期期数', value: value(pay, 'installmentCount') },
|
|
|
- { label: '每期间隔(月)', value: value(pay, 'installmentIntervalMonths') },
|
|
|
- { label: '分期开始时间', value: value(pay, 'installmentStartDate') },
|
|
|
- { label: '提前催缴预警(天)', value: value(pay, 'installmentAdvanceDays') }
|
|
|
- ]),
|
|
|
- ...((pay?.schedules || []).map((sch, sIdx) => ({
|
|
|
- label: `第 ${sch?.scheduleNo || sIdx + 1} 期`,
|
|
|
- value: `应缴 ${sch?.dueAmount ?? '—'} / 实缴 ${sch?.paidAmount ?? '—'} / 欠缴 ${sch?.arrearsAmount ?? '—'} / ${sch?.dueDate || '—'}`
|
|
|
- })))
|
|
|
- ],
|
|
|
- cards: paymentScheduleCards(pay)
|
|
|
- }))
|
|
|
+ cards: samplePays.map((pay, index) => {
|
|
|
+ const mode = payModeTag(pay?.payMode)
|
|
|
+ return {
|
|
|
+ key: String(pay?.id || pay?.sampleCode || `pay-${index}`),
|
|
|
+ title: pay?.sampleCode || `样本缴费 ${index + 1}`,
|
|
|
+ fields: [
|
|
|
+ { label: '缴费模式', value: mode.label, tag: true, tagType: mode.tagType },
|
|
|
+ { label: '合同金额', value: value(pay, 'contractAmount') },
|
|
|
+ ...(String(pay?.payMode || '') === 'dj'
|
|
|
+ ? [{ label: '趸交截止时间', value: value(pay, 'lumpSumDeadline') }]
|
|
|
+ : [
|
|
|
+ { label: '分期期数', value: value(pay, 'installmentCount') },
|
|
|
+ { label: '每期间隔(月)', value: value(pay, 'installmentIntervalMonths') },
|
|
|
+ { label: '分期开始时间', value: value(pay, 'installmentStartDate') },
|
|
|
+ { label: '提前催缴预警(天)', value: value(pay, 'installmentAdvanceDays') }
|
|
|
+ ]),
|
|
|
+ ...((pay?.schedules || []).map((sch, sIdx) => ({
|
|
|
+ label: `第 ${sch?.scheduleNo || sIdx + 1} 期`,
|
|
|
+ value: `应缴 ${sch?.dueAmount ?? '—'} / 实缴 ${sch?.paidAmount ?? '—'} / 欠缴 ${sch?.arrearsAmount ?? '—'} / ${sch?.dueDate || '—'}`
|
|
|
+ })))
|
|
|
+ ],
|
|
|
+ cards: paymentScheduleCards(pay)
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
} else {
|
|
|
const legacyDetails = Array.isArray(detail?.paymentDetails) ? detail.paymentDetails : []
|
|
|
+ const legacyMode = payModeTag(detail?.payment?.payMode)
|
|
|
values.push({
|
|
|
key: 'payment',
|
|
|
title: '缴费信息',
|
|
|
- fields: fields(detail?.payment, [
|
|
|
- ['payMode', '缴费模式', { map: (item) => label(PAY_MODE_LABELS, item), tag: true }],
|
|
|
- ['contractAmount', '合同金额'], ['installmentCount', '分期期数'],
|
|
|
- ['installmentIntervalMonths', '每期间隔(月)'], ['lumpSumDeadline', '趸交截止时间'],
|
|
|
- ['installmentStartDate', '分期开始时间'], ['installmentAdvanceDays', '提前催缴预警(天)'],
|
|
|
- ['remark', '缴费备注']
|
|
|
- ]),
|
|
|
+ fields: [
|
|
|
+ { label: '缴费模式', value: legacyMode.label, tag: true, tagType: legacyMode.tagType },
|
|
|
+ ...fields(detail?.payment, [
|
|
|
+ ['contractAmount', '合同金额'], ['installmentCount', '分期期数'],
|
|
|
+ ['installmentIntervalMonths', '每期间隔(月)'], ['lumpSumDeadline', '趸交截止时间'],
|
|
|
+ ['installmentStartDate', '分期开始时间'], ['installmentAdvanceDays', '提前催缴预警(天)'],
|
|
|
+ ['remark', '缴费备注']
|
|
|
+ ])
|
|
|
+ ],
|
|
|
cards: legacyPaymentDetailCards(detail?.payment || {}, legacyDetails)
|
|
|
})
|
|
|
}
|
|
|
@@ -624,17 +672,21 @@ export default {
|
|
|
key: 'audits',
|
|
|
title: '审核记录',
|
|
|
fields: audits.length ? [] : [{ label: '记录', value: '暂无审核记录' }],
|
|
|
- cards: audits.map((row, index) => ({
|
|
|
- key: String(row?.id || `audit-${index}`),
|
|
|
- title: `审核 ${index + 1}`,
|
|
|
- statusText: label(AUDIT_STATUS_LABELS, row?.auditStatus),
|
|
|
- fields: [
|
|
|
- { label: '审核状态', value: label(AUDIT_STATUS_LABELS, row?.auditStatus), tag: true },
|
|
|
- { label: '审核人', value: person(row?.auditorUserName, row?.auditorUserId) },
|
|
|
- { label: '审核意见', value: value(row, 'auditRemark') },
|
|
|
- { label: '时间', value: value(row, 'createTime') }
|
|
|
- ]
|
|
|
- }))
|
|
|
+ cards: audits.map((row, index) => {
|
|
|
+ const audit = auditTag(row?.auditStatus)
|
|
|
+ return {
|
|
|
+ key: String(row?.id || `audit-${index}`),
|
|
|
+ title: `审核 ${index + 1}`,
|
|
|
+ statusText: audit.label,
|
|
|
+ statusTone: audit.tagType,
|
|
|
+ fields: [
|
|
|
+ { label: '审核状态', value: audit.label, tag: true, tagType: audit.tagType },
|
|
|
+ { label: '审核人', value: person(row?.auditorUserName, row?.auditorUserId) },
|
|
|
+ { label: '审核意见', value: value(row, 'auditRemark') },
|
|
|
+ { label: '时间', value: value(row, 'createTime') }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
const commonStatusFields = [
|
|
|
['effectiveTime', '协议生效时间'],
|