Add tenant-scoped teams and projects, order attribution across four businesses, conversion inheritance, scoped statistics and audited reassignment. Reuse existing Web and mobile UI patterns; team regions and hospitals remain informational. Include incremental SQL and isolated regression coverage. Actual MySQL and browser/WebView integration validation remains pending; relates to issue #13.
183 lines
7.3 KiB
JavaScript
183 lines
7.3 KiB
JavaScript
import { commonFields } from './shared.js'
|
|
import {
|
|
formatPresignDate,
|
|
formatPresignDateTime,
|
|
formatPresignMoney,
|
|
presignStatusLabel,
|
|
presignStatusTone
|
|
} from '../presign/presign-presenter.js'
|
|
import { resolveStatusTag, payMode, payStatus } from '../status-tag-registry.js'
|
|
|
|
const transferTypeLabels = Object.freeze({
|
|
wxzz: '微信转账', wx: '微信转账', wechat: '微信转账',
|
|
zzbzz: '支付宝转账', zfb: '支付宝转账', alipay: '支付宝转账',
|
|
yhkzz: '银行卡转账', bank: '银行卡转账',
|
|
xj: '现金', cash: '现金', lszz: '乐刷'
|
|
})
|
|
|
|
function dictionaryLabel(map, value) {
|
|
const key = String(value || '').trim()
|
|
return map[key] || (key ? '未知' : '—')
|
|
}
|
|
|
|
function person(name, id) {
|
|
const displayName = String(name || '').trim()
|
|
const referenceId = String(id || '').trim()
|
|
if (displayName && displayName !== referenceId) return displayName
|
|
return referenceId ? '未知人员' : '—'
|
|
}
|
|
|
|
function referenceName(name, id) {
|
|
const displayName = String(name || '').trim()
|
|
const referenceId = String(id || '').trim()
|
|
if (displayName && displayName !== referenceId) return displayName
|
|
return referenceId ? '未知' : '—'
|
|
}
|
|
|
|
function presignStatus(value) {
|
|
const code = String(value || '').trim()
|
|
if (!code) return '—'
|
|
const result = presignStatusLabel(code)
|
|
return result === code ? '未知' : result
|
|
}
|
|
|
|
function displayValue(value) {
|
|
return value && value !== '-' ? value : '—'
|
|
}
|
|
|
|
function payModeLabel(value) {
|
|
const key = String(value || '').trim()
|
|
if (!key) return '—'
|
|
return resolveStatusTag(payMode, key).label
|
|
}
|
|
|
|
export default {
|
|
key: 'presign',
|
|
resource: 'presign-orders',
|
|
actions: {
|
|
specialist: ['view', 'create', 'edit', 'convert'],
|
|
manager: ['view', 'create', 'edit', 'convert']
|
|
},
|
|
listParams: ({ status } = {}) => ({ orderStatus: status || '' }),
|
|
statusOptions: [
|
|
{ text: '全部状态', value: '' },
|
|
{ text: '草稿', value: 'draft' },
|
|
{ text: '进行中', value: 'active' },
|
|
{ text: '已转正式', value: 'converted' },
|
|
{ text: '已作废', value: 'void' }
|
|
],
|
|
filterFields: [
|
|
{
|
|
key: 'orderStatus', label: '订单状态', type: 'select', options: [
|
|
{ text: '草稿', value: 'draft' },
|
|
{ text: '进行中', value: 'active' },
|
|
{ text: '已转正式', value: 'converted' },
|
|
{ text: '已作废', value: 'void' }
|
|
]
|
|
}
|
|
],
|
|
statusLabel(detail) {
|
|
return presignStatus(detail?.orderStatus)
|
|
},
|
|
statusTone(detail) {
|
|
return presignStatusTone(detail?.orderStatus)
|
|
},
|
|
detailSections(detail) {
|
|
const status = String(detail?.orderStatus || '')
|
|
const transfers = (detail?.transfers || []).map((transfer, index) => {
|
|
const payment = resolveStatusTag(payStatus, transfer?.payStatus || 'dfj')
|
|
return {
|
|
...transfer,
|
|
title: `意向金转账 ${index + 1}`,
|
|
statusLabel: payment.label,
|
|
statusTone: payment.tagType,
|
|
transferAmount: formatPresignMoney(transfer?.transferAmount),
|
|
transferTime: formatPresignDateTime(transfer?.transferTime)
|
|
}
|
|
})
|
|
return [
|
|
{
|
|
key: 'base',
|
|
title: '预签信息',
|
|
fields: [
|
|
{ label: '所属项目', value: detail?.projectName || (detail?.projectId ? '历史项目' : '未归属') },
|
|
{ label: '项目组', value: detail?.teamName || '—' },
|
|
{ label: '业务日期', value: displayValue(formatPresignDate(detail?.orderDate)) },
|
|
{ label: '母亲姓名', value: detail?.motherName || '—' },
|
|
{ label: '预产期', value: displayValue(formatPresignDate(detail?.expectedDeliveryDate)) },
|
|
{ label: '采集地区', value: referenceName(detail?.regionName, detail?.regionId) },
|
|
{ label: '采集医院', value: referenceName(detail?.hospitalName, detail?.hospitalId) },
|
|
{ label: '市场专员', value: person(detail?.collectorUserName, detail?.collectorUserId) },
|
|
{ label: '采集经理', value: person(detail?.regionManagerUserName, detail?.regionManagerUserId) },
|
|
{ label: '采集时间', value: displayValue(formatPresignDateTime(detail?.sampleCollectTime)) },
|
|
{ label: '缴费方式', value: payModeLabel(detail?.payMode) },
|
|
{
|
|
label: '样本类型',
|
|
value: Array.isArray(detail?.sampleTypeNames) && detail.sampleTypeNames.length
|
|
? detail.sampleTypeNames.filter(Boolean).join('、') || '—'
|
|
: '—'
|
|
},
|
|
{ label: '合同金额', value: displayValue(formatPresignMoney(detail?.contractAmount)) },
|
|
{ label: '到账金额', value: displayValue(formatPresignMoney(detail?.confirmedDepositAmount)) },
|
|
{ label: '订单状态', value: presignStatus(status), tag: true, tagType: presignStatusTone(status) },
|
|
{ label: '备注', value: detail?.remark || '—' },
|
|
{ label: '创建时间', value: displayValue(formatPresignDateTime(detail?.createTime)) }
|
|
],
|
|
raw: {},
|
|
cards: []
|
|
},
|
|
{
|
|
key: 'transfers',
|
|
title: '意向金转账',
|
|
fields: [],
|
|
raw: { transfers },
|
|
cards: transfers.map((transfer, index) => ({
|
|
key: String(transfer?.id || `transfer-${index}`),
|
|
title: transfer.title,
|
|
statusText: transfer.statusLabel,
|
|
statusTone: transfer.statusTone,
|
|
fields: [
|
|
{ label: '转账方式', value: dictionaryLabel(transferTypeLabels, transfer.transferType) },
|
|
{ label: '转账金额', value: transfer.transferAmount || '—' },
|
|
{ label: '转账时间', value: transfer.transferTime || '—' },
|
|
{
|
|
label: '转账附件',
|
|
type: 'attachments',
|
|
value: transfer.attachments?.length
|
|
? transfer.attachments
|
|
: transfer.transferAttachments || ''
|
|
},
|
|
{ label: '备注', value: transfer.remark || '—' },
|
|
{ label: '财务备注', value: transfer.financeRemark || '—' }
|
|
]
|
|
}))
|
|
}
|
|
]
|
|
},
|
|
formSections: [
|
|
{
|
|
key: 'base', title: '预签信息', fields: [
|
|
{ key: 'orderDate', label: '预签日期', type: 'date', valueFormat: 'YYYYMMDD' },
|
|
{ key: 'motherName', label: '客户姓名', required: true },
|
|
{ key: 'expectedDeliveryDate', label: '预产期', type: 'date', valueFormat: 'YYYYMMDD' },
|
|
{ key: 'regionId', label: '采集地区', type: 'select', optionKey: 'regions' },
|
|
{ key: 'hospitalId', label: '采集医院', type: 'select', optionKey: 'hospitals' },
|
|
{ key: 'sampleCollectTime', label: '采集时间', type: 'datetime' },
|
|
{ key: 'payMode', label: '缴费模式' },
|
|
{ key: 'sampleTypeIds', label: '样本类型', type: 'multi-select', optionKey: 'sampleTypes' },
|
|
{ key: 'contractAmount', label: '合同金额', type: 'number' },
|
|
{ key: 'remark', ...commonFields.remark }
|
|
]
|
|
},
|
|
{
|
|
key: 'transfers', title: '意向金', repeat: true, createOnly: true, fields: [
|
|
{ key: 'transferAmount', label: '转账金额', type: 'number' },
|
|
{ key: 'transferTime', label: '转账时间', type: 'datetime' },
|
|
{ key: 'transferType', label: '转账方式' },
|
|
{ key: 'transferAttachments', label: '转账附件', type: 'upload' },
|
|
{ key: 'remark', ...commonFields.remark }
|
|
]
|
|
}
|
|
]
|
|
}
|