feat: finish P0 per-sample payment and presign order integration

Wire finance transfer list, protocol view v2 readonly payment, and mark design/plan as P0 implemented.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-10-03 11:25:47 +08:00
1 parent a9112414c9
commit e7677d1661
7 files changed
+2279 -612

No files matched your search

@@ -48,6 +48,20 @@ export function fetchSubmitPaymentTransferFinance(transferId: string) {
})
}
export function fetchPaymentTransferList(params?: {
page?: number
pageSize?: number
payStatus?: string
keyword?: string
installmentDueDateStart?: string
installmentDueDateEnd?: string
}) {
return request.get<PageList<Record<string, unknown>>>({
url: '/web/admin/payment-transfers',
params
})
}
export function fetchPaymentTransferReceiptConfirmList(params?: {
page?: number
pageSize?: number
@@ -87,7 +87,12 @@
size="small"
class="payment-card__status"
>
{{ protocolStatusDisplayLabel(String(row.protocolStatus || ''), String(row.voidType || '')) }}
{{
protocolStatusDisplayLabel(
String(row.protocolStatus || ''),
String(row.voidType || '')
)
}}
</el-tag>
</div>
</div>
@@ -158,13 +163,7 @@
>
<el-icon><Check /></el-icon>缴费确认
</el-button>
<el-button
v-if="col.key === 'yjf'"
class="btn-op-item primary"
@click.stop="openRefundFinanceDialog(row)"
>
<el-icon><Check /></el-icon>退费确认
</el-button>
<!-- 新模型退费改协议级登记,看板不再提交退费确认 -->
</div>
</article>
@@ -260,12 +259,7 @@
/>
</el-form-item>
<el-form-item label="备注" class="form-col-span-2">
<el-input
v-model="receiptForm.remark"
type="textarea"
:rows="3"
placeholder="选填"
/>
<el-input v-model="receiptForm.remark" type="textarea" :rows="3" placeholder="选填" />
</el-form-item>
<el-form-item label="上传凭证" class="form-col-span-2">
<div
@@ -304,11 +298,7 @@
</div>
<div class="attachment-footer">
<span class="attachment-name" :title="file.fileName">{{ file.fileName }}</span>
<el-icon
class="action-btn"
title="删除"
@click="removeReceiptAttachment(fIdx)"
>
<el-icon class="action-btn" title="删除" @click="removeReceiptAttachment(fIdx)">
<Delete />
</el-icon>
</div>
@@ -342,108 +332,6 @@
</template>
</el-dialog>
<el-dialog
v-model="refundDialogVisible"
title="退费确认"
width="640px"
class="dialog-form-layout"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
>
<el-form
ref="refundFormRef"
:model="refundForm"
:rules="refundFormRules"
label-position="top"
class="biz-dialog-form"
>
<div class="form-grid-2">
<el-form-item label="退费金额(元)" prop="refundAmount" class="form-col-span-2">
<AmountInput
v-model="refundForm.refundAmount"
:min="0.01"
:step="100"
placeholder="请输入退费金额"
/>
</el-form-item>
<el-form-item label="退费备注" prop="refundRemark" class="form-col-span-2">
<el-input
v-model="refundForm.refundRemark"
type="textarea"
:rows="3"
placeholder="选填"
/>
</el-form-item>
<el-form-item label="退费附件" class="form-col-span-2">
<div
class="attachment-upload"
:class="{ 'is-dragover': isRefundAttachDragover }"
v-bind="refundAttachDropHandlers"
>
<div class="attachment-list">
<el-upload
:auto-upload="false"
:show-file-list="false"
:multiple="true"
accept="image/*,video/*,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.zip,.rar"
@change="handleRefundAttachmentChange"
>
<div class="upload-card">
<el-icon :size="22" color="#047857"><Plus /></el-icon>
<span class="upload-card-text">上传附件</span>
</div>
</el-upload>
<div
v-for="(file, fIdx) in refundForm.attachments"
:key="file.id || fIdx"
class="attachment-item"
:class="{ 'is-uploading': file._uploading }"
>
<div class="attachment-preview">
<template v-if="file.fileUrl && isImageUrl(file.fileUrl)">
<img :src="fullFileUrl(file.fileUrl)" :alt="file.fileName" />
</template>
<template v-else>
<div class="attachment-preview__icon attachment-preview__icon--doc">
<el-icon :size="28"><Document /></el-icon>
</div>
</template>
</div>
<div class="attachment-footer">
<span class="attachment-name" :title="file.fileName">{{ file.fileName }}</span>
<el-icon class="action-btn" title="删除" @click="removeRefundAttachment(fIdx)">
<Delete />
</el-icon>
</div>
</div>
</div>
<p class="form-tip">
支持拖拽或点击上传图片、文档等,多个附件将一并提交,单文件不超过 20MB
</p>
</div>
</el-form-item>
</div>
</el-form>
<template #footer>
<el-button class="btn-ghost" @click="refundDialogVisible = false">
<el-icon><Close /></el-icon>
取消
</el-button>
<el-button
class="btn-main"
type="primary"
:loading="refundSubmitLoading"
@click="submitRefundFinance"
>
<el-icon><Check /></el-icon>
确认提交
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="paymentDetailVisible"
title="缴费信息详情"
@@ -503,16 +391,19 @@
fetchPaymentDetailList,
fetchUpdatePaymentDetailDraft,
fetchSubmitReceiptFinance,
fetchSubmitRefundFinance,
type CollectionProtocolRow,
type PaymentDetailDraftPayload
} from '@/api/collection-protocol'
import {
fetchPaymentTransferList,
fetchUpdatePaymentTransfer,
fetchSubmitPaymentTransferFinance
} from '@/api/protocol-sample-payment'
import { fetchUploadAttachment } from '@/api/business'
import { useAttachmentDropZone } from '@/composables/useAttachmentDropZone'
import { maskIdCard } from '@/utils/mask-sensitive'
import {
isPaymentDueWithinWarnWindow,
protocolStatusLabel,
protocolStatusDisplayLabel,
protocolStatusTagType,
payModeLabel,
@@ -527,7 +418,7 @@
defineOptions({ name: 'CellStoragePaymentInfoTab' })
type PayStatusKey = 'dfj' | 'jfqrz' | 'yjf' | 'tfqrz' | 'ytf'
type PayStatusKey = 'dfj' | 'jfqrz' | 'yjf'
interface KanbanColumnDef {
key: PayStatusKey
@@ -542,12 +433,11 @@
loading: boolean
}
/** P0:看板仅保留收款三列;退费列下线(旧 detail 退费态仍可由财务旧接口处理) */
const kanbanColumns: KanbanColumnDef[] = [
{ key: 'dfj', label: '待缴费' },
{ key: 'jfqrz', label: '缴费确认中' },
{ key: 'yjf', label: '已缴费' },
{ key: 'tfqrz', label: '退费确认中' },
{ key: 'ytf', label: '已退费' }
{ key: 'yjf', label: '已缴费' }
]
function createColumnState(): KanbanColumnState {
@@ -559,9 +449,7 @@
const columnStates = reactive<Record<PayStatusKey, KanbanColumnState>>({
dfj: createColumnState(),
jfqrz: createColumnState(),
yjf: createColumnState(),
tfqrz: createColumnState(),
ytf: createColumnState()
yjf: createColumnState()
})
const expandedCardIds = ref<Set<string>>(new Set())
const viewVisible = ref(false)
@@ -580,6 +468,7 @@
const receiptSaveLoading = ref(false)
const receiptSubmitLoading = ref(false)
const receiptTargetId = ref('')
const receiptIsTransfer = ref(false)
const receiptPreviewRow = ref<Record<string, unknown> | null>(null)
const receiptFormRef = ref<FormInstance>()
const receiptForm = reactive({
@@ -594,24 +483,6 @@
transferAmount: [{ required: true, message: '请填写转账金额', trigger: 'blur' }]
}
const refundDialogVisible = ref(false)
const refundSubmitLoading = ref(false)
const refundTargetIds = ref<string[]>([])
const refundFormRef = ref<FormInstance>()
const refundForm = reactive({
refundAmount: null as number | null,
refundRemark: '',
attachments: [] as Array<{
id: string
fileName: string
fileUrl: string
_uploading?: boolean
}>
})
const refundFormRules: FormRules = {
refundAmount: [{ required: true, message: '请填写退费金额', trigger: 'blur' }]
}
let loadRequestId = 0
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
@@ -625,18 +496,40 @@
}
}
function isTransferRow(row: Record<string, unknown>) {
return row.source === 'formal' || Boolean(row.sampleCode && row.scheduleId)
}
async function loadColumn(key: PayStatusKey) {
const col = columnStates[key]
col.loading = true
try {
const res = await fetchPaymentDetailList({
page: col.page,
pageSize: col.pageSize,
payStatus: key,
...listQueryParams()
})
col.list = res.list || []
col.total = res.total ?? 0
const q = listQueryParams()
const [legacy, transfer] = await Promise.all([
fetchPaymentDetailList({
page: col.page,
pageSize: col.pageSize,
payStatus: key,
...q
}),
fetchPaymentTransferList({
page: col.page,
pageSize: col.pageSize,
payStatus: key,
keyword: q.keyword,
installmentDueDateStart: q.installmentDueDateStart,
installmentDueDateEnd: q.installmentDueDateEnd
})
])
let transferList = transfer.list || []
if (q.transferType) {
transferList = transferList.filter(
(r) => String(r.transferType || '') === String(q.transferType)
)
}
// 新转账笔优先展示,其后拼接旧 detail(version=1)
col.list = [...transferList, ...(legacy.list || [])]
col.total = (transfer.total ?? 0) + (legacy.total ?? 0)
} finally {
col.loading = false
}
@@ -742,12 +635,11 @@
const id = String(row.id || '')
if (!id) return
receiptTargetId.value = id
receiptIsTransfer.value = isTransferRow(row)
receiptPreviewRow.value = row
receiptForm.transferType = String(row.transferType || '')
receiptForm.transferAmount =
row.transferAmount != null && row.transferAmount !== ''
? Number(row.transferAmount)
: null
row.transferAmount != null && row.transferAmount !== '' ? Number(row.transferAmount) : null
receiptForm.transferTime = row.transferTime ? String(row.transferTime) : ''
receiptForm.remark = String(row.remark || '')
receiptForm.attachments = mapRowAttachments(row.attachments, row.transferAttachments)
@@ -843,7 +735,12 @@
}
receiptSaveLoading.value = true
try {
await fetchUpdatePaymentDetailDraft(receiptTargetId.value, buildReceiptPayload())
const payload = buildReceiptPayload()
if (receiptIsTransfer.value) {
await fetchUpdatePaymentTransfer(receiptTargetId.value, payload)
} else {
await fetchUpdatePaymentDetailDraft(receiptTargetId.value, payload)
}
receiptDialogVisible.value = false
loadAllColumns()
} finally {
@@ -874,7 +771,13 @@
}
receiptSubmitLoading.value = true
try {
await fetchSubmitReceiptFinance(receiptTargetId.value, buildReceiptPayload())
const payload = buildReceiptPayload()
if (receiptIsTransfer.value) {
await fetchUpdatePaymentTransfer(receiptTargetId.value, payload)
await fetchSubmitPaymentTransferFinance(receiptTargetId.value)
} else {
await fetchSubmitReceiptFinance(receiptTargetId.value, payload)
}
receiptDialogVisible.value = false
loadAllColumns()
} finally {
@@ -882,31 +785,6 @@
}
}
function resetRefundForm(defaultAmount?: number) {
refundForm.refundAmount = defaultAmount ?? null
refundForm.refundRemark = ''
refundForm.attachments = []
refundFormRef.value?.clearValidate()
}
function openRefundFinanceDialog(row: Record<string, unknown>) {
const id = String(row.id || '')
if (!id) return
refundTargetIds.value = [id]
const defaultAmount = row.transferAmount != null ? Number(row.transferAmount) : undefined
resetRefundForm(
defaultAmount != null && !Number.isNaN(defaultAmount) ? defaultAmount : undefined
)
refundDialogVisible.value = true
}
function refundAttachmentsToUrls() {
return refundForm.attachments
.filter((f) => f.fileUrl && !f._uploading)
.map((f) => f.fileUrl)
.join(',')
}
function fullFileUrl(url: string) {
if (!url) return ''
if (/^https?:\/\//i.test(url)) return url
@@ -917,70 +795,6 @@
return /\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(url)
}
async function handleRefundAttachmentChange(uploadFile: { raw?: File }) {
const file = uploadFile.raw
if (!file) return
const tempId = `temp_${Date.now()}`
refundForm.attachments.push({
id: tempId,
fileName: file.name,
fileUrl: '',
_uploading: true
})
const idx = refundForm.attachments.length - 1
try {
const fd = new FormData()
fd.append('folder', 'protocol-payment-refund')
fd.append('file', file)
const res = await fetchUploadAttachment(fd)
refundForm.attachments[idx] = {
id: res.id || tempId,
fileName: file.name || res.fileName,
fileUrl: res.fileUrl,
_uploading: false
}
} catch {
ElMessage.error('文件上传失败')
refundForm.attachments.splice(idx, 1)
}
}
function removeRefundAttachment(index: number) {
refundForm.attachments.splice(index, 1)
}
const { isDragover: isRefundAttachDragover, dropZoneHandlers: refundAttachDropHandlers } =
useAttachmentDropZone({
onFiles: (files) => {
for (const file of files) {
void handleRefundAttachmentChange({ raw: file })
}
}
})
async function submitRefundFinance() {
if (!refundTargetIds.value.length) return
const valid = await refundFormRef.value?.validate().catch(() => false)
if (!valid) return
if (refundForm.attachments.some((f) => f._uploading)) {
ElMessage.warning('附件上传中,请稍候')
return
}
const payload = {
refundAmount: Number(refundForm.refundAmount),
refundRemark: refundForm.refundRemark?.trim() || undefined,
refundAttachments: refundAttachmentsToUrls() || undefined
}
refundSubmitLoading.value = true
try {
await fetchSubmitRefundFinance(refundTargetIds.value[0], payload)
refundDialogVisible.value = false
loadAllColumns()
} finally {
refundSubmitLoading.value = false
}
}
function handleSearch() {
loadAllColumns(true)
}
File diff suppressed because it is too large. Load diff