104 lines
4.0 KiB
JavaScript
104 lines
4.0 KiB
JavaScript
import { formatMoney } from '../money.js'
|
|
import {
|
|
resolveStatusTag,
|
|
samplePaymentProgress,
|
|
payMode,
|
|
protocolStatus,
|
|
donationStatus
|
|
} from '../status-tag-registry.js'
|
|
|
|
function money(value) {
|
|
return formatMoney(value)
|
|
}
|
|
|
|
function progressTag(code) {
|
|
return resolveStatusTag(samplePaymentProgress, 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)
|
|
}
|
|
|
|
export default {
|
|
key: 'payment',
|
|
resource: 'payments',
|
|
actions: {
|
|
specialist: ['view', 'register-transfer', 'edit-transfer', 'submit', 'withdraw'],
|
|
manager: ['view', 'register-transfer', 'edit-transfer', 'submit', 'withdraw']
|
|
},
|
|
listParams: ({ status } = {}) => ({ payMode: status || '' }),
|
|
statusOptions: [{ text: '全部缴费模式', value: '' }],
|
|
// 缴费列表用搜索下方 van-dropdown-menu(对齐预签约/运费),不走筛选弹层
|
|
filterFields: [],
|
|
inlineDropdownFilters: [
|
|
{
|
|
key: 'payMode',
|
|
allText: '全部缴费方式',
|
|
options: [
|
|
{ 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: samplePaymentProgress.dfj.label, value: 'dfj' },
|
|
{ text: samplePaymentProgress.bfyj.label, value: 'bfyj' },
|
|
{ text: samplePaymentProgress.yjq.label, value: 'yjq' }
|
|
]
|
|
}
|
|
],
|
|
detailSections(detail) {
|
|
const progress = progressTag(detail?.progressStatus || detail?.paymentProgress)
|
|
const protocol = protocolStatusTag(detail?.protocolStatus)
|
|
const mode = payModeTag(detail?.payMode)
|
|
return [
|
|
{
|
|
key: 'summary',
|
|
title: '缴费概览',
|
|
fields: [
|
|
{ label: '客户', value: detail?.motherName || '—' },
|
|
{ label: '联系电话', value: detail?.motherPhone || '—' },
|
|
{ label: '样本编码', value: detail?.sampleCode || '—' },
|
|
{ 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: protocol.label, tag: true, tagType: protocol.tagType },
|
|
{ label: '缴费进度', value: progress.label, tag: true, tagType: progress.tagType }
|
|
]
|
|
}
|
|
]
|
|
},
|
|
initialForm(detail, target = {}) {
|
|
const transfer = (detail?.schedules || [])
|
|
.flatMap((row) => row.transfers || [])
|
|
.find((row) => String(row.id || '') === String(target.transferId || '')) || {}
|
|
const fields = ['transferAmount', 'transferTime', 'transferType', 'transferAttachments', 'remark']
|
|
return {
|
|
transfer: Object.fromEntries(fields
|
|
.filter((key) => Object.prototype.hasOwnProperty.call(transfer, key))
|
|
.map((key) => [key, transfer[key]]))
|
|
}
|
|
},
|
|
transferFields: [
|
|
{ key: 'transferAmount', label: '转账金额', type: 'number', required: true },
|
|
{ key: 'transferTime', label: '转账时间', type: 'datetime' },
|
|
{ key: 'transferType', label: '转账方式', type: 'select', optionKey: 'transferTypes', required: true },
|
|
{ key: 'transferAttachments', label: '转账凭证', type: 'upload' },
|
|
{ key: 'remark', label: '备注', type: 'textarea' }
|
|
]
|
|
}
|