生产/质检入库卡片展示样本状态并支持【样本废弃】;市场 Web 列表与移动市场部卡片补充样本状态及问号查看作废原因;样本表新增 void_desc,人工作废不联动接收但全部作废时自动作废协议(#131)。 Co-authored-by: Cursor <cursoragent@cursor.com>
551 lines
18 KiB
Vue
551 lines
18 KiB
Vue
<!-- 催缴信息:逾期 ∪ 未来 30 天待催期次 -->
|
||
<template>
|
||
<div class="page-container">
|
||
<section class="panel">
|
||
<div class="panel-top">
|
||
<h2 class="title-bar-heading">催缴信息</h2>
|
||
</div>
|
||
|
||
<div class="filter-block">
|
||
<el-form :model="searchForm" class="filter-form" @submit.prevent>
|
||
<div class="filter-grid">
|
||
<el-form-item label="关键词">
|
||
<el-input
|
||
v-model="searchForm.keyword"
|
||
placeholder="客户/样本/电话"
|
||
clearable
|
||
@keyup.enter="handleSearch"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="催缴类型">
|
||
<el-select
|
||
v-model="searchForm.chaseType"
|
||
placeholder="全部"
|
||
clearable
|
||
style="width: 100%"
|
||
>
|
||
<el-option label="仅逾期" value="overdue" />
|
||
<el-option label="仅未来30天" value="upcoming" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="缴费方式">
|
||
<el-select
|
||
v-model="searchForm.payMode"
|
||
placeholder="全部"
|
||
clearable
|
||
style="width: 100%"
|
||
>
|
||
<el-option label="趸交" value="dj" />
|
||
<el-option label="分期" value="fq" />
|
||
<el-option label="分改趸" value="fgd" />
|
||
</el-select>
|
||
</el-form-item>
|
||
</div>
|
||
<div class="filter-actions-row">
|
||
<div class="filter-actions-end">
|
||
<el-button class="btn-ghost" @click="handleReset">
|
||
<el-icon><RefreshLeft /></el-icon>重置
|
||
</el-button>
|
||
<el-button class="btn-main" type="primary" @click="handleSearch">
|
||
<el-icon><Search /></el-icon>搜索
|
||
</el-button>
|
||
</div>
|
||
</div>
|
||
</el-form>
|
||
</div>
|
||
|
||
<div class="list-body list-wrap">
|
||
<el-table
|
||
class="list-table"
|
||
:data="tableData"
|
||
v-loading="loading"
|
||
stripe
|
||
row-key="scheduleId"
|
||
>
|
||
<el-table-column
|
||
type="index"
|
||
label="序号"
|
||
min-width="68"
|
||
align="center"
|
||
:index="(i) => (pagination.page - 1) * pagination.pageSize + i + 1"
|
||
/>
|
||
<el-table-column label="客户" min-width="140" align="center">
|
||
<template #default="{ row }">
|
||
<div>{{ row.motherName || '—' }}</div>
|
||
<div v-if="row.motherPhone" class="muted-sub">{{ row.motherPhone }}</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="sampleCode"
|
||
label="样本编码"
|
||
min-width="140"
|
||
align="center"
|
||
show-overflow-tooltip
|
||
/>
|
||
<el-table-column label="样本状态" min-width="140" align="center">
|
||
<template #default="{ row }">
|
||
<SampleStatusTag :status="row.sampleStatus" :void-desc="row.voidDesc" />
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="市场专员" min-width="110" align="center">
|
||
<template #default="{ row }">{{ row.salesUserName || '—' }}</template>
|
||
</el-table-column>
|
||
<el-table-column label="缴费方式" min-width="100" align="center">
|
||
<template #default="{ row }">
|
||
<el-tag :type="payModeTagType(String(row.payMode || ''))" size="small">
|
||
{{ payModeLabel(String(row.payMode || '')) || '—' }}
|
||
</el-tag>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="期次" min-width="80" align="center">
|
||
<template #default="{ row }">第 {{ row.scheduleNo || '—' }} 期</template>
|
||
</el-table-column>
|
||
<el-table-column label="应缴日" min-width="120" align="center">
|
||
<template #default="{ row }">
|
||
<span :class="{ 'is-overdue': row.chaseStatus === 'overdue' }">
|
||
{{ row.dueDate || '—' }}
|
||
</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="应缴" min-width="100" align="center">
|
||
<template #default="{ row }">{{ formatAmount(row.dueAmount) }}</template>
|
||
</el-table-column>
|
||
<el-table-column label="已缴" min-width="100" align="center">
|
||
<template #default="{ row }">
|
||
<button
|
||
v-if="hasPaidAmount(row)"
|
||
type="button"
|
||
class="amount-link"
|
||
@click="openPeriodDialog(row)"
|
||
>
|
||
{{ formatAmount(row.paidAmount) }}
|
||
</button>
|
||
<span v-else class="muted">{{ formatAmount(row.paidAmount) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="欠缴" min-width="100" align="center">
|
||
<template #default="{ row }">{{ formatAmount(row.arrearsAmount) }}</template>
|
||
</el-table-column>
|
||
<el-table-column label="催缴状态" min-width="120" align="center">
|
||
<template #default="{ row }">
|
||
<el-tag
|
||
:type="paymentChaseStatusTagType(String(row.chaseStatus || ''))"
|
||
size="small"
|
||
>
|
||
<template v-if="row.chaseStatus === 'overdue'">
|
||
已逾期{{ row.daysOverdue ? ` ${row.daysOverdue} 天` : '' }}
|
||
</template>
|
||
<template v-else>
|
||
{{ row.daysUntilDue != null ? `${row.daysUntilDue} 天内到期` : '即将到期' }}
|
||
</template>
|
||
</el-tag>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="协议状态" min-width="100" align="center">
|
||
<template #default="{ row }">
|
||
<el-tag
|
||
:type="protocolStatusTagType(String(row.protocolStatus || ''))"
|
||
size="small"
|
||
>
|
||
{{
|
||
protocolStatusDisplayLabel(
|
||
String(row.protocolStatus || ''),
|
||
String(row.voidType || '')
|
||
)
|
||
}}
|
||
</el-tag>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="操作" min-width="120" fixed="right" align="center">
|
||
<template #default="{ row }">
|
||
<el-button class="btn-op-item" @click="handleViewProtocol(row)">
|
||
<el-icon><Document /></el-icon>协议单
|
||
</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<div class="pagination list-pager-bar">
|
||
<el-pagination
|
||
:current-page="pagination.page"
|
||
:page-size="pagination.pageSize"
|
||
:total="pagination.total"
|
||
:page-sizes="[10, 20, 50]"
|
||
layout="total, sizes, prev, pager, next"
|
||
@size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
|
||
@current-change="(val) => ((pagination.page = val), loadData())"
|
||
/>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<el-dialog
|
||
v-model="periodDialogVisible"
|
||
:title="periodDialogTitle"
|
||
width="720px"
|
||
class="dialog-form-layout"
|
||
align-center
|
||
append-to-body
|
||
modal-class="protocol-dialog-mask"
|
||
destroy-on-close
|
||
>
|
||
<div v-loading="periodLoading" class="period-dialog-body">
|
||
<div class="summary-grid">
|
||
<div class="summary-item">
|
||
<label>应缴</label>
|
||
<strong>{{ formatAmountYuan(periodSummary.dueAmount) }}</strong>
|
||
</div>
|
||
<div class="summary-item">
|
||
<label>实缴合计</label>
|
||
<strong class="amount-strong">{{ formatAmountYuan(periodSummary.paidAmount) }}</strong>
|
||
</div>
|
||
<div class="summary-item">
|
||
<label>欠缴</label>
|
||
<strong>{{ formatAmountYuan(periodSummary.arrearsAmount) }}</strong>
|
||
</div>
|
||
</div>
|
||
<div class="section-subtitle">转账明细</div>
|
||
<div v-if="!periodTransfers.length" class="muted">暂无转账笔</div>
|
||
<div v-for="(tr, idx) in periodTransfers" :key="String(tr.id || idx)" class="transfer-card">
|
||
<div class="transfer-card__main">
|
||
<div class="transfer-card__top">
|
||
<strong>第 {{ idx + 1 }} 笔</strong>
|
||
<el-tag :type="payStatusTagType(String(tr.payStatus || ''))" size="small">
|
||
{{ payStatusLabel(String(tr.payStatus || '')) || '—' }}
|
||
</el-tag>
|
||
<span class="amount-strong">{{ formatAmountYuan(tr.transferAmount) }}</span>
|
||
</div>
|
||
<div class="transfer-card__meta">
|
||
<span>{{ transferTypeLabel(String(tr.transferType || '')) || '—' }}</span>
|
||
<span>{{ formatDisplayOrDash(tr.transferTime) }}</span>
|
||
</div>
|
||
</div>
|
||
<div class="transfer-card__attach">
|
||
<span class="transfer-card__attach-label">转账凭证</span>
|
||
<ProtocolAttachmentReadonly
|
||
v-if="transferAttachmentFiles(tr).length"
|
||
:files="transferAttachmentFiles(tr)"
|
||
size="compact"
|
||
@preview="handleAttachPreview"
|
||
@download="handleAttachDownload"
|
||
/>
|
||
<span v-else class="muted">暂无凭证</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<template #footer>
|
||
<el-button class="btn-ghost" @click="periodDialogVisible = false">
|
||
<el-icon><Close /></el-icon>关闭
|
||
</el-button>
|
||
</template>
|
||
</el-dialog>
|
||
|
||
<el-dialog
|
||
v-model="attachPreviewVisible"
|
||
title="附件预览"
|
||
width="720px"
|
||
align-center
|
||
append-to-body
|
||
modal-class="protocol-dialog-mask"
|
||
destroy-on-close
|
||
>
|
||
<img
|
||
v-if="attachPreviewUrl"
|
||
:src="attachPreviewUrl"
|
||
alt="附件预览"
|
||
class="attach-preview-img"
|
||
/>
|
||
</el-dialog>
|
||
|
||
<ProtocolViewDialog
|
||
v-model="protocolVisible"
|
||
:protocol-id="protocolViewId"
|
||
:list-row="protocolViewRow"
|
||
show-audit-history
|
||
show-storage-cert
|
||
show-fullmoon-insurance
|
||
/>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { Search, RefreshLeft, Document, Close } from '@element-plus/icons-vue'
|
||
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
|
||
import SampleStatusTag from '@/components/business/sample-status-tag/index.vue'
|
||
import ProtocolAttachmentReadonly from '../protocol/ProtocolAttachmentReadonly.vue'
|
||
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
||
import {
|
||
fetchPaymentChaseList,
|
||
fetchSamplePaymentDetail
|
||
} from '@/api/protocol-sample-payment'
|
||
import { type CollectionProtocolRow } from '@/api/collection-protocol'
|
||
import { formatDisplayOrDash } from '@/utils/datetime-display'
|
||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||
import {
|
||
payModeLabel,
|
||
payModeTagType,
|
||
paymentChaseStatusTagType,
|
||
protocolStatusDisplayLabel,
|
||
protocolStatusTagType,
|
||
payStatusLabel,
|
||
payStatusTagType,
|
||
transferTypeLabel
|
||
} from '@/utils/status-tag-registry'
|
||
|
||
defineOptions({ name: 'CellStoragePaymentChase' })
|
||
|
||
const searchForm = reactive({
|
||
keyword: '',
|
||
chaseType: '',
|
||
payMode: ''
|
||
})
|
||
const loading = ref(false)
|
||
const tableData = ref<Record<string, any>[]>([])
|
||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||
|
||
const protocolVisible = ref(false)
|
||
const protocolViewId = ref('')
|
||
const protocolViewRow = ref<CollectionProtocolRow | null>(null)
|
||
|
||
const periodDialogVisible = ref(false)
|
||
const periodLoading = ref(false)
|
||
const periodDialogTitle = ref('')
|
||
const periodSummary = reactive({
|
||
dueAmount: null as number | null,
|
||
paidAmount: null as number | null,
|
||
arrearsAmount: null as number | null
|
||
})
|
||
const periodTransfers = ref<Record<string, any>[]>([])
|
||
|
||
const attachPreviewVisible = ref(false)
|
||
const attachPreviewUrl = ref('')
|
||
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
|
||
|
||
function formatAmount(v: unknown) {
|
||
if (v == null || v === '') return '—'
|
||
return formatMoneyDisplay(v as string | number)
|
||
}
|
||
|
||
function formatAmountYuan(v: unknown) {
|
||
if (v == null || v === '') return '—'
|
||
return `${formatMoneyDisplay(v as string | number)} 元`
|
||
}
|
||
|
||
function hasPaidAmount(row: Record<string, any>) {
|
||
const n = Number(row.paidAmount)
|
||
return Number.isFinite(n) && n > 0
|
||
}
|
||
|
||
function transferAttachmentFiles(tr: Record<string, any>) {
|
||
if (Array.isArray(tr.attachments) && tr.attachments.length) {
|
||
return tr.attachments
|
||
}
|
||
const urls = String(tr.transferAttachments || '')
|
||
.split(',')
|
||
.map((u) => u.trim())
|
||
.filter(Boolean)
|
||
return urls.map((url, idx) => ({
|
||
id: `url_${idx}`,
|
||
fileName: url.split('/').pop() || `附件${idx + 1}`,
|
||
fileUrl: url
|
||
}))
|
||
}
|
||
|
||
function fullFileUrl(url: string) {
|
||
if (!url) return ''
|
||
if (/^https?:\/\//i.test(url) || url.startsWith('/')) return url
|
||
return minioBaseUrl ? `${minioBaseUrl}/${url.replace(/^\//, '')}` : url
|
||
}
|
||
|
||
function handleAttachPreview(file: Record<string, unknown>) {
|
||
const url = String(file.fileUrl || '')
|
||
if (!url) return
|
||
attachPreviewUrl.value = fullFileUrl(url)
|
||
attachPreviewVisible.value = true
|
||
}
|
||
|
||
function handleAttachDownload(file: Record<string, unknown>) {
|
||
downloadAttachmentFile(file, { fullFileUrl })
|
||
}
|
||
|
||
async function loadData() {
|
||
loading.value = true
|
||
try {
|
||
const res = await fetchPaymentChaseList({
|
||
page: pagination.page,
|
||
pageSize: pagination.pageSize,
|
||
keyword: searchForm.keyword || undefined,
|
||
chaseType: searchForm.chaseType || undefined,
|
||
payMode: searchForm.payMode || undefined
|
||
})
|
||
tableData.value = (res.list || []) as Record<string, any>[]
|
||
pagination.total = res.total || 0
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
function handleSearch() {
|
||
pagination.page = 1
|
||
loadData()
|
||
}
|
||
|
||
function handleReset() {
|
||
searchForm.keyword = ''
|
||
searchForm.chaseType = ''
|
||
searchForm.payMode = ''
|
||
handleSearch()
|
||
}
|
||
|
||
function handleViewProtocol(row: Record<string, any>) {
|
||
protocolViewId.value = String(row.protocolId || '')
|
||
protocolViewRow.value = {
|
||
id: row.protocolId,
|
||
protocolNo: row.protocolNo,
|
||
motherName: row.motherName,
|
||
motherPhone: row.motherPhone,
|
||
protocolStatus: row.protocolStatus,
|
||
voidType: row.voidType
|
||
} as CollectionProtocolRow
|
||
protocolVisible.value = true
|
||
}
|
||
|
||
async function openPeriodDialog(row: Record<string, any>) {
|
||
const scheduleId = String(row.scheduleId || '')
|
||
const samplePaymentId = String(row.samplePaymentId || '')
|
||
if (!scheduleId || !samplePaymentId) return
|
||
const titleParts = [row.motherName, row.sampleCode].filter(Boolean)
|
||
periodDialogTitle.value = `${titleParts.join(' · ')}${titleParts.length ? ' · ' : ''}第 ${row.scheduleNo || '—'} 期转账记录`
|
||
periodDialogVisible.value = true
|
||
periodLoading.value = true
|
||
periodTransfers.value = []
|
||
// 摘要优先用列表口径(与缴费信息期次一致:dfj+jfqrz+yjf)
|
||
periodSummary.dueAmount = row.dueAmount ?? null
|
||
periodSummary.paidAmount = row.paidAmount ?? null
|
||
periodSummary.arrearsAmount = row.arrearsAmount ?? null
|
||
try {
|
||
const detail = await fetchSamplePaymentDetail(samplePaymentId)
|
||
const schedules = ((detail.schedules as any[]) || []) as Record<string, any>[]
|
||
const sch = schedules.find((s) => String(s.id) === scheduleId)
|
||
if (sch) {
|
||
periodSummary.dueAmount = sch.dueAmount ?? periodSummary.dueAmount
|
||
periodTransfers.value = (sch.transfers || []) as Record<string, any>[]
|
||
}
|
||
} finally {
|
||
periodLoading.value = false
|
||
}
|
||
}
|
||
|
||
onMounted(() => loadData())
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.muted-sub {
|
||
font-size: 12px;
|
||
color: var(--mint-text-muted, #64748b);
|
||
}
|
||
|
||
.is-overdue {
|
||
color: #dc2626;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.amount-link {
|
||
border: none;
|
||
background: none;
|
||
padding: 0;
|
||
color: var(--primary-dark, #059669);
|
||
font-weight: 600;
|
||
cursor: pointer;
|
||
border-bottom: 1px dashed rgba(5, 150, 105, 0.45);
|
||
}
|
||
|
||
.amount-strong {
|
||
color: var(--primary-dark, #059669);
|
||
}
|
||
|
||
.muted {
|
||
color: var(--mint-text-muted, #64748b);
|
||
}
|
||
|
||
.summary-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(3, 1fr);
|
||
gap: 10px;
|
||
margin-bottom: 14px;
|
||
}
|
||
|
||
.summary-item {
|
||
padding: 10px 12px;
|
||
border: 1px solid var(--border, #d9e8e2);
|
||
border-radius: 8px;
|
||
background: #f8fafc;
|
||
|
||
label {
|
||
display: block;
|
||
font-size: 11px;
|
||
color: #64748b;
|
||
margin-bottom: 2px;
|
||
}
|
||
}
|
||
|
||
.section-subtitle {
|
||
margin: 0 0 10px;
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.transfer-card {
|
||
display: flex;
|
||
gap: 12px 16px;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-bottom: 8px;
|
||
padding: 8px 12px;
|
||
border: 1px solid var(--border, #d9e8e2);
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.transfer-card__main {
|
||
min-width: 0;
|
||
flex: 1;
|
||
}
|
||
|
||
.transfer-card__top {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
gap: 8px 10px;
|
||
margin-bottom: 4px;
|
||
}
|
||
|
||
.transfer-card__meta {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 8px 16px;
|
||
font-size: 13px;
|
||
color: #64748b;
|
||
}
|
||
|
||
.transfer-card__attach {
|
||
display: flex;
|
||
flex-shrink: 0;
|
||
flex-wrap: wrap;
|
||
gap: 8px;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
max-width: 52%;
|
||
}
|
||
|
||
.transfer-card__attach-label {
|
||
flex-shrink: 0;
|
||
font-size: 12px;
|
||
color: #64748b;
|
||
}
|
||
|
||
.attach-preview-img {
|
||
display: block;
|
||
max-width: 100%;
|
||
margin: 0 auto;
|
||
}
|
||
</style>
|