优化
This commit is contained in:
@@ -58,6 +58,7 @@ let detailRequest = 0
|
||||
onBeforeUnmount(() => { disposed = true; detailRequest += 1; resetClearanceResults() })
|
||||
|
||||
const taxRefundInbounds = computed(() => detail.value?.inbounds.filter((item) => item.taxMode === 'TAX_REFUND') ?? [])
|
||||
const pendingReceipts = computed(() => detail.value?.documents.filter((item) => item.receipt && item.receiptStatus !== 'CONFIRMED') ?? [])
|
||||
const locked = computed(() => Boolean(detail.value?.startedAt) || detail.value?.status === 'DECLARING' || detail.value?.status === 'COMPLETED')
|
||||
const merchantStatusLabel = computed(() => detail.value?.merchantStatus
|
||||
? MERCHANT_CUSTOMS_STATUS_LABELS[detail.value.merchantStatus]
|
||||
@@ -273,29 +274,43 @@ async function downloadFile(document: MerchantCustomsDocument, kind: 'source' |
|
||||
}
|
||||
}
|
||||
|
||||
async function confirmReceipt(document: MerchantCustomsDocument) {
|
||||
async function confirmReceipt() {
|
||||
const documents = pendingReceipts.value
|
||||
if (!documents.length) return
|
||||
let confirmedCount = 0
|
||||
try {
|
||||
await ElMessageBox.confirm('确认已核对整份报关行回执吗?确认后平台会把确认结果发送给报关行执行。', '确认报关行回执', { type: 'warning' })
|
||||
await ElMessageBox.confirm(`确认已核对 ${documents.length} 份报关行回执吗?确认后平台会把确认结果发送给报关行执行。`, '确认报关行回执', { type: 'warning' })
|
||||
mutating.value = true
|
||||
await confirmMerchantCustomsReceipt(document)
|
||||
ElMessage.success('回执确认成功')
|
||||
for (const document of documents) {
|
||||
await confirmMerchantCustomsReceipt(document)
|
||||
confirmedCount += 1
|
||||
}
|
||||
ElMessage.success(`已确认 ${documents.length} 份回执`)
|
||||
await loadDetail()
|
||||
} catch (error) {
|
||||
if (error === 'cancel' || error === 'close') return
|
||||
ElMessage.error(merchantCustomsErrorMessage(error, '回执确认失败'))
|
||||
if (confirmedCount) await loadDetail()
|
||||
ElMessage.error(`${confirmedCount ? `已确认 ${confirmedCount}/${documents.length} 份,` : ''}${merchantCustomsErrorMessage(error, '回执确认失败')}`)
|
||||
} finally { mutating.value = false }
|
||||
}
|
||||
|
||||
async function rejectReceipt(document: MerchantCustomsDocument) {
|
||||
async function rejectReceipt() {
|
||||
const documents = pendingReceipts.value
|
||||
if (!documents.length) return
|
||||
let rejectedCount = 0
|
||||
try {
|
||||
const reason = await ElMessageBox.prompt('请填写打回原因', '打回报关行回执', { inputValidator: (value) => value.trim() ? true : '请输入打回原因' })
|
||||
mutating.value = true
|
||||
await rejectMerchantCustomsReceipt(document, reason.value)
|
||||
ElMessage.success('回执已打回')
|
||||
for (const document of documents) {
|
||||
await rejectMerchantCustomsReceipt(document, reason.value)
|
||||
rejectedCount += 1
|
||||
}
|
||||
ElMessage.success(`已打回 ${documents.length} 份回执`)
|
||||
await loadDetail()
|
||||
} catch (error) {
|
||||
if (error === 'cancel' || error === 'close') return
|
||||
ElMessage.error(merchantCustomsErrorMessage(error, '回执打回失败'))
|
||||
if (rejectedCount) await loadDetail()
|
||||
ElMessage.error(`${rejectedCount ? `已打回 ${rejectedCount}/${documents.length} 份,` : ''}${merchantCustomsErrorMessage(error, '回执打回失败')}`)
|
||||
} finally { mutating.value = false }
|
||||
}
|
||||
|
||||
@@ -404,6 +419,10 @@ function clearanceResultStatusLabel(value: MerchantClearanceResult) {
|
||||
<section class="customs-section">
|
||||
<div class="customs-section-title">
|
||||
<h3>资料版本历史</h3>
|
||||
<div v-if="pendingReceipts.length && detail.status === 'DECLARING'" class="customs-receipt-actions">
|
||||
<el-button type="success" :disabled="mutating" @click="confirmReceipt">确认全部回执</el-button>
|
||||
<el-button type="danger" plain :disabled="mutating" @click="rejectReceipt">打回全部回执</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-empty v-if="!detail.documents.length" description="尚未上传退税报关资料" :image-size="54" />
|
||||
<div v-else class="customs-document-list">
|
||||
@@ -422,10 +441,6 @@ function clearanceResultStatusLabel(value: MerchantClearanceResult) {
|
||||
<el-button link type="primary" :loading="downloadingKey === `${item.documentId}:source`" @click="downloadFile(item, 'source')"><Download :size="15" />源文件</el-button>
|
||||
<el-button v-if="item.receipt" link type="success" :loading="downloadingKey === `${item.documentId}:receipt`" @click="downloadFile(item, 'receipt')"><Download :size="15" />报关行回执</el-button>
|
||||
<el-button v-if="item.finalDocument" link type="success" :loading="downloadingKey === `${item.documentId}:final`" @click="downloadFile(item, 'final')"><Download :size="15" />报关完税文件</el-button>
|
||||
<template v-if="item.receipt && item.receiptStatus !== 'CONFIRMED' && detail.status === 'DECLARING'">
|
||||
<el-button link type="success" :disabled="mutating" @click="confirmReceipt(item)">确认整份回执</el-button>
|
||||
<el-button link type="danger" :disabled="mutating" @click="rejectReceipt(item)">打回回执</el-button>
|
||||
</template>
|
||||
<el-tag v-if="item.receipt" size="small" :type="item.receiptStatus === 'CONFIRMED' ? 'success' : item.receiptStatus === 'REJECTED' ? 'danger' : 'warning'">{{ item.receiptStatus === 'CONFIRMED' ? '已确认' : item.receiptStatus === 'REJECTED' ? `已打回:${item.receiptRejectReason || '待补充'}` : '待确认' }}</el-tag>
|
||||
<template v-if="canEdit && !locked && !item.frozen">
|
||||
<el-button link type="primary" :disabled="mutating" @click="beginEditInbounds(item)"><Pencil :size="15" />改关联</el-button>
|
||||
@@ -472,6 +487,7 @@ function clearanceResultStatusLabel(value: MerchantClearanceResult) {
|
||||
.clearance-result-row p { grid-column:1 / -1; margin:0; color:var(--navy); font-size:12px; }
|
||||
.customs-section-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
|
||||
.customs-section-title h3 { margin: 0; color: var(--navy); font-size: 14px; }
|
||||
.customs-receipt-actions { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||
.customs-help-heading { display: flex; align-items: center; gap: 4px; }
|
||||
.customs-inbound-options { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 14px; border: 1px solid var(--client-border); border-radius: var(--client-radius); background: var(--client-header-bg); }
|
||||
.customs-inbound-options :deep(.el-checkbox) { margin-right: 0; }
|
||||
|
||||
Reference in New Issue
Block a user