|
|
@@ -1,21 +1,14 @@
|
|
|
import { formatMoney } from '../money.js'
|
|
|
+import {
|
|
|
+ resolveStatusTag,
|
|
|
+ samplePaymentProgress,
|
|
|
+ paymentScheduleStatus,
|
|
|
+ payStatus,
|
|
|
+ payMode,
|
|
|
+ protocolStatus,
|
|
|
+ donationStatus
|
|
|
+} from '../status-tag-registry.js'
|
|
|
|
|
|
-const PAY_MODE = Object.freeze({ dj: '趸交', fq: '分期', fgd: '分改趸', djfq: '趸交+分期' })
|
|
|
-const PROTOCOL_STATUS = Object.freeze({
|
|
|
- dsx: '待生效', dqr: '待确认', sxz: '生效中', ygq: '已过期',
|
|
|
- yzf: '已作废', sdfq: '属地废弃', zckc: '转细胞存储', zky: '转科研'
|
|
|
-})
|
|
|
-const PAYMENT_PROGRESS = Object.freeze({
|
|
|
- dfj: '待缴清', bfyj: '部分已缴', yjq: '已缴清',
|
|
|
- 待缴清: '待缴清', 待缴费: '待缴清', 部分已缴: '部分已缴', 部分缴费: '部分已缴', 已缴清: '已缴清'
|
|
|
-})
|
|
|
-const SCHEDULE_STATUS = Object.freeze({
|
|
|
- open: '待缴清', cleared: '已缴清', void: '已作废',
|
|
|
- pending: '待缴清', partial: '部分到账', paid: '已缴清', closed: '已关闭'
|
|
|
-})
|
|
|
-const PAY_STATUS = Object.freeze({
|
|
|
- dfj: '已付款', jfqrz: '付款确认中', yjf: '付款完成', tfqrz: '退费确认中', ytf: '已退费'
|
|
|
-})
|
|
|
const TRANSFER_TYPE = Object.freeze({
|
|
|
wxzz: '微信转账', wx: '微信转账', wechat: '微信转账',
|
|
|
zzbzz: '支付宝转账', zfb: '支付宝转账', alipay: '支付宝转账',
|
|
|
@@ -39,8 +32,33 @@ function displayDate(value) {
|
|
|
: text || '—'
|
|
|
}
|
|
|
|
|
|
+function progressTag(code) {
|
|
|
+ return resolveStatusTag(samplePaymentProgress, code)
|
|
|
+}
|
|
|
+
|
|
|
+function scheduleTag(code) {
|
|
|
+ return resolveStatusTag(paymentScheduleStatus, code)
|
|
|
+}
|
|
|
+
|
|
|
+function transferPayTag(code) {
|
|
|
+ return resolveStatusTag(payStatus, code)
|
|
|
+}
|
|
|
+
|
|
|
+function payModeTag(code) {
|
|
|
+ return resolveStatusTag(payMode, code)
|
|
|
+}
|
|
|
+
|
|
|
+/** 缴费详情协议状态:细胞存储走 protocolStatus,捐赠侧码(如 zckc)走 donationStatus */
|
|
|
+function protocolStatusTag(code) {
|
|
|
+ const key = String(code || '').trim()
|
|
|
+ if (!key) return { label: '—', tagType: 'info' }
|
|
|
+ if (protocolStatus[key]) return resolveStatusTag(protocolStatus, key)
|
|
|
+ if (donationStatus[key]) return resolveStatusTag(donationStatus, key)
|
|
|
+ return resolveStatusTag(protocolStatus, key)
|
|
|
+}
|
|
|
+
|
|
|
function transferCard(transfer, index) {
|
|
|
- const statusText = label(PAY_STATUS, transfer?.payStatus)
|
|
|
+ const pay = transferPayTag(transfer?.payStatus)
|
|
|
const transferType = label(TRANSFER_TYPE, transfer?.transferType)
|
|
|
const transferTime = transfer?.transferTime || '—'
|
|
|
return {
|
|
|
@@ -50,8 +68,8 @@ function transferCard(transfer, index) {
|
|
|
transferIndex: index + 1,
|
|
|
amount: money(transfer?.transferAmount),
|
|
|
meta: `${transferType} · ${transferTime}`,
|
|
|
- statusText,
|
|
|
- statusTone: statusText.includes('确认中') ? 'warning' : statusText === '付款完成' ? 'success' : 'info',
|
|
|
+ statusText: pay.label,
|
|
|
+ statusTone: pay.tagType,
|
|
|
fields: [
|
|
|
{ label: '备注', value: transfer?.remark || '—' },
|
|
|
{ label: '财务备注', value: transfer?.financeRemark || '—' },
|
|
|
@@ -61,15 +79,15 @@ function transferCard(transfer, index) {
|
|
|
}
|
|
|
|
|
|
function scheduleCard(schedule, index) {
|
|
|
- const statusText = label(SCHEDULE_STATUS, schedule?.scheduleStatus)
|
|
|
+ const status = scheduleTag(schedule?.scheduleStatus)
|
|
|
const transfers = schedule?.transfers || []
|
|
|
return {
|
|
|
key: String(schedule?.id || `schedule-${index}`),
|
|
|
title: `第 ${schedule?.scheduleNo || index + 1} 期`,
|
|
|
variant: 'schedule',
|
|
|
cardsLabel: '转账记录',
|
|
|
- statusText,
|
|
|
- statusTone: statusText === '已缴清' ? 'success' : statusText === '部分到账' ? 'primary' : 'warning',
|
|
|
+ statusText: status.label,
|
|
|
+ statusTone: status.tagType,
|
|
|
fields: [
|
|
|
{ label: '应缴金额', value: money(schedule?.dueAmount), money: true },
|
|
|
{ label: '应缴日', value: displayDate(schedule?.dueDate) },
|
|
|
@@ -96,25 +114,26 @@ export default {
|
|
|
key: 'payMode',
|
|
|
allText: '全部缴费方式',
|
|
|
options: [
|
|
|
- { text: '趸交', value: 'dj' },
|
|
|
- { text: '分期', value: 'fq' },
|
|
|
- { text: '分改趸', value: 'fgd' },
|
|
|
- { text: '趸交+分期', value: 'djfq' }
|
|
|
+ { text: payMode.dj.label, value: 'dj' },
|
|
|
+ { text: payMode.fq.label, value: 'fq' },
|
|
|
+ { text: payMode.fgd.label, value: 'fgd' },
|
|
|
+ { text: payMode.djfq.label, value: 'djfq' }
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
key: 'progressStatus',
|
|
|
allText: '全部缴费进度',
|
|
|
options: [
|
|
|
- { text: '待缴清', value: 'dfj' },
|
|
|
- { text: '部分已缴', value: 'bfyj' },
|
|
|
- { text: '已缴清', value: 'yjq' }
|
|
|
+ { text: samplePaymentProgress.dfj.label, value: 'dfj' },
|
|
|
+ { text: samplePaymentProgress.bfyj.label, value: 'bfyj' },
|
|
|
+ { text: samplePaymentProgress.yjq.label, value: 'yjq' }
|
|
|
]
|
|
|
}
|
|
|
],
|
|
|
detailSections(detail) {
|
|
|
- const progress = label(PAYMENT_PROGRESS, detail?.progressStatus || detail?.paymentProgress)
|
|
|
- const protocolStatus = label(PROTOCOL_STATUS, detail?.protocolStatus)
|
|
|
+ const progress = progressTag(detail?.progressStatus || detail?.paymentProgress)
|
|
|
+ const protocol = protocolStatusTag(detail?.protocolStatus)
|
|
|
+ const mode = payModeTag(detail?.payMode)
|
|
|
return [
|
|
|
{
|
|
|
key: 'summary',
|
|
|
@@ -124,12 +143,12 @@ export default {
|
|
|
{ label: '客户', value: detail?.motherName || '—' },
|
|
|
{ label: '联系电话', value: detail?.motherPhone || '—' },
|
|
|
{ label: '样本编码', value: detail?.sampleCode || '—' },
|
|
|
- { label: '缴费方式', value: label(PAY_MODE, detail?.payMode), tag: true, tagType: 'primary' },
|
|
|
+ { label: '缴费方式', value: mode.label, tag: true, tagType: mode.tagType },
|
|
|
{ label: '合同额', value: money(detail?.contractAmount) },
|
|
|
{ label: '已缴 / 待缴', value: `${money(detail?.paidAmount)} / ${money(detail?.dueRemainAmount ?? detail?.remainAmount)}` },
|
|
|
{ label: '整体进度', value: `已缴清 ${Number(detail?.clearedScheduleCount || 0)}/${Number(detail?.activeScheduleCount || 0)} 期` },
|
|
|
- { label: '协议状态', value: protocolStatus, tag: true },
|
|
|
- { label: '缴费进度', value: progress, tag: true }
|
|
|
+ { label: '协议状态', value: protocol.label, tag: true, tagType: protocol.tagType },
|
|
|
+ { label: '缴费进度', value: progress.label, tag: true, tagType: progress.tagType }
|
|
|
]
|
|
|
},
|
|
|
{
|