Merge pull request '结算调整单接入金蝶列表展示与冲销预检' (#6) from feature/20261016-settlement-adjustment-kingdee into master
Reviewed-on: #6
This commit was merged in pull request #6.
This commit is contained in:
@@ -177,6 +177,22 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-descriptions
|
||||
v-if="form.settlementType === 'payable'"
|
||||
:column="3"
|
||||
border
|
||||
class="formal-editor__settle-summary"
|
||||
>
|
||||
<el-descriptions-item label="结算合计(原金额)">
|
||||
{{ formatMoney(form.settlementAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="已付金额(含预付、核销)">
|
||||
{{ formatMoney(settlePaidTotal) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="剩余未付金额">
|
||||
{{ formatMoney(settleRemainTotal) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</section-card>
|
||||
|
||||
<section-card title="结算明细">
|
||||
@@ -577,28 +593,27 @@
|
||||
<template #default="{ row }">{{ displayValue(row.claimStatusName) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-table v-else :data="paymentApplications" border>
|
||||
<el-table v-else :data="paymentRecords" border>
|
||||
<el-table-column type="index" label="序号" width="64" align="center" />
|
||||
<el-table-column prop="paymentTypeName" label="付款类型" min-width="120" align="center">
|
||||
<template #default="{ row }">{{ displayValue(row.paymentTypeName) }}</template>
|
||||
<el-table-column label="付款类型" min-width="120" align="center">
|
||||
<template #default="{ row }">{{ displayValue(row.typeName) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="付款方式" min-width="140" align="center">
|
||||
<template #default="{ row }">{{ paymentMethodName(row.paymentMethod) }}</template>
|
||||
<template #default="{ row }">{{ row.recordType ? '-' : paymentMethodName(row.paymentMethod) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="paymentNo" label="单据号" min-width="160" align="center" />
|
||||
<el-table-column prop="appliedAmount" label="申请付款金额" min-width="145" align="center">
|
||||
<el-table-column prop="appliedAmount" label="申请/核销金额" min-width="145" align="center">
|
||||
<template #default="{ row }">{{ formatMoney(row.appliedAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="paidAmount" label="已付款金额" min-width="130" align="center">
|
||||
<template #default="{ row }">{{ formatMoney(row.paidAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="approvalStatusName"
|
||||
label="单据状态"
|
||||
min-width="120"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">{{ displayValue(row.approvalStatusName) }}</template>
|
||||
<el-table-column label="单据状态" min-width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ row.recordType
|
||||
? settlementStatusName(row.billStatus)
|
||||
: displayValue(row.approvalStatusName) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="kingdeeBillNo" label="金蝶单据号" min-width="150" align="center">
|
||||
<template #default="{ row }">{{ displayValue(row.kingdeeBillNo) }}</template>
|
||||
@@ -639,6 +654,22 @@
|
||||
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center">
|
||||
<template #default="{ row }">{{ displayValue(row.createTime) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="hasPermission('settlement_adjustment_repush')"
|
||||
label="操作"
|
||||
width="120"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link
|
||||
v-if="row.approvalStatus === 'approved' && row.kingdeeSyncStatus === 'synced'"
|
||||
type="danger"
|
||||
@click="handleAdjustmentRepush(row)"
|
||||
>重新推送</el-link
|
||||
>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</section-card>
|
||||
|
||||
@@ -1042,6 +1073,10 @@ import { mapGetters } from 'vuex';
|
||||
import { formatContractOptionLabel } from '@/utils/contract';
|
||||
import { isTierUnitPrice, isUnitPriceAdjustable } from '@/utils/settlement-adjust-rule';
|
||||
import { normalizeCurrencyCode } from '@/utils/currency';
|
||||
import {
|
||||
settlementRecordTypeName,
|
||||
settlementStatusName,
|
||||
} from '@/utils/settlementStatus';
|
||||
import { downloadFileByUrl } from '@/utils/util';
|
||||
import {
|
||||
downloadKingdeeInvoiceFile,
|
||||
@@ -1052,6 +1087,7 @@ import KingdeeInvoicePoolDialog from '@/components/kingdee-invoice-pool-dialog/m
|
||||
import ProjectAdvanceWriteOff from './project-advance-write-off.vue';
|
||||
import * as XLSX from 'xlsx';
|
||||
import { isAdministrator } from '@/utils/auth';
|
||||
import * as settlementAdjustmentApi from '@/api/settlement/settlementAdjustment';
|
||||
|
||||
// 结算币种为本位币(人民币)时汇率恒为1,汇率日期、结算汇率与按汇率换算的本位币合计都不展示
|
||||
const LOCAL_CURRENCY_HIDDEN_FIELDS = ['exchangeRateDate', 'exchangeRate', 'localSettlementAmount'];
|
||||
@@ -1084,6 +1120,7 @@ export default {
|
||||
details: [],
|
||||
summaryFees: [],
|
||||
paymentApplications: [],
|
||||
advancePayments: [],
|
||||
receiptClaims: [],
|
||||
adjustments: [],
|
||||
changeRecords: [],
|
||||
@@ -1263,6 +1300,34 @@ export default {
|
||||
summaryTotal() {
|
||||
return this.summaryFees.reduce((total, row) => total + Number(row.settlementAmount || 0), 0);
|
||||
},
|
||||
// 已付金额(含预付、核销):编辑态取来源预结算预付快照 + 当前核销行实时合计(草稿态无尾款申请);只读态用落库值
|
||||
settlePaidTotal() {
|
||||
if (!this.editable) return Number(this.form.paidAmount || 0);
|
||||
const advancePaid = this.sources.reduce(
|
||||
(sum, item) => sum + Number(item.advancePaidAmount || 0),
|
||||
0
|
||||
);
|
||||
const writeOff = this.projectAdvanceWriteOffs.reduce(
|
||||
(sum, row) => sum + Number(row.writeOffAmount || 0),
|
||||
0
|
||||
);
|
||||
return advancePaid + writeOff;
|
||||
},
|
||||
settleRemainTotal() {
|
||||
return Math.max(Number(this.form.settlementAmount || 0) - Number(this.settlePaidTotal || 0), 0);
|
||||
},
|
||||
// 付款记录合并表:预付付款记录(进度预付/项目预付核销)+ 尾款付款申请
|
||||
paymentRecords() {
|
||||
const advances = (this.advancePayments || []).map(row => ({
|
||||
...row,
|
||||
typeName: settlementRecordTypeName(row.recordType),
|
||||
}));
|
||||
const tails = (this.paymentApplications || []).map(row => ({
|
||||
...row,
|
||||
typeName: row.paymentTypeName,
|
||||
}));
|
||||
return [...advances, ...tails];
|
||||
},
|
||||
filteredDetails() {
|
||||
return this.details.filter(row =>
|
||||
Object.entries(this.appliedDetailQuery).every(([field, keyword]) => {
|
||||
@@ -1338,6 +1403,17 @@ export default {
|
||||
this.validData(this.permission?.[`formal_settlement_${action}`], false)
|
||||
);
|
||||
},
|
||||
async handleAdjustmentRepush(row) {
|
||||
await this.$confirm(
|
||||
'请确认金蝶旧应付/应收单已由财务手工冲销,继续将生成全新财务应付/应收单。',
|
||||
'高危操作确认',
|
||||
{ type: 'warning', confirmButtonText: '确认重新推送' }
|
||||
);
|
||||
const res = await settlementAdjustmentApi.repush(row.id);
|
||||
this.$message.success(`已生成新金蝶单据:${res.data?.data || res.data || '-'}`);
|
||||
await this.loadFormalDetail(this.recordId);
|
||||
this.$emit('success');
|
||||
},
|
||||
async loadFormalDetail(id) {
|
||||
const response = this.publicMode
|
||||
? await getMkPublicDetail('formal-settlement', id)
|
||||
@@ -1359,6 +1435,7 @@ export default {
|
||||
this.detailFeeSnapshots = {};
|
||||
this.pendingAdjustments = {};
|
||||
this.paymentApplications = data.paymentApplications || [];
|
||||
this.advancePayments = data.advancePayments || [];
|
||||
if (this.readonly && this.form.settlementType === 'receivable' && !this.publicMode) {
|
||||
this.receiptClaims = this.unwrapData(await getReceiptClaims(id)) || [];
|
||||
}
|
||||
@@ -1402,6 +1479,7 @@ export default {
|
||||
this.adjustments = [];
|
||||
this.changeRecords = [];
|
||||
this.projectAdvanceWriteOffs = [];
|
||||
this.advancePayments = [];
|
||||
this.attachments = [];
|
||||
this.selectedAttachmentRows = [];
|
||||
this.invoices = [];
|
||||
@@ -1550,6 +1628,19 @@ export default {
|
||||
this.sources.map(item => getPreSettlementDetail(item.preSettlementId))
|
||||
);
|
||||
const settlements = responses.map(response => this.unwrapData(response) || {});
|
||||
// 预结算转正式:带出来源预结算已保存的项目预付核销行(后端保存时转移源行)
|
||||
const writeOffRows = settlements.flatMap(settlement => settlement.projectAdvanceWriteOffs || []);
|
||||
const existingWriteOffIds = new Set(
|
||||
this.projectAdvanceWriteOffs.map(row => String(row.paymentApplicationId))
|
||||
);
|
||||
writeOffRows.forEach(row => {
|
||||
if (existingWriteOffIds.has(String(row.paymentApplicationId))) return;
|
||||
existingWriteOffIds.add(String(row.paymentApplicationId));
|
||||
this.projectAdvanceWriteOffs.push({
|
||||
...row,
|
||||
writeOffAmount: Number(row.writeOffAmount || 0),
|
||||
});
|
||||
});
|
||||
this.details = settlements.flatMap(settlement =>
|
||||
(settlement.details || []).map(detail => ({
|
||||
...detail,
|
||||
@@ -1720,7 +1811,7 @@ export default {
|
||||
this.candidate.page.current = 1;
|
||||
this.loadCandidates();
|
||||
},
|
||||
confirmCandidates() {
|
||||
async confirmCandidates() {
|
||||
const merged = [...this.sources, ...this.candidate.selected];
|
||||
const map = new Map(
|
||||
merged.map(item => [
|
||||
@@ -1728,6 +1819,7 @@ export default {
|
||||
{ ...item, preSettlementId: item.preSettlementId || item.id },
|
||||
])
|
||||
);
|
||||
const previousIds = new Set(this.sources.map(item => String(item.preSettlementId || item.id)));
|
||||
this.sources = [...map.values()];
|
||||
this.form.sourcePreSettlementIds = this.sources.map(item => item.preSettlementId);
|
||||
if (this.sources.length) {
|
||||
@@ -1744,6 +1836,26 @@ export default {
|
||||
this.form.localSettlementAmount =
|
||||
this.form.settlementAmount * Number(this.form.exchangeRate || 1);
|
||||
this.candidate.visible = false;
|
||||
// 预结算转正式:带出来源预结算已保存的项目预付核销行(后端保存时转移源行,额度单份占用)
|
||||
const newIds = this.sources
|
||||
.map(item => item.preSettlementId)
|
||||
.filter(id => !previousIds.has(String(id)));
|
||||
if (!newIds.length) return;
|
||||
const responses = await Promise.all(newIds.map(id => getPreSettlementDetail(id)));
|
||||
const rows = responses.flatMap(response =>
|
||||
this.unwrapData(response)?.projectAdvanceWriteOffs || []
|
||||
);
|
||||
const existing = new Set(
|
||||
this.projectAdvanceWriteOffs.map(row => String(row.paymentApplicationId))
|
||||
);
|
||||
rows.forEach(row => {
|
||||
if (existing.has(String(row.paymentApplicationId))) return;
|
||||
existing.add(String(row.paymentApplicationId));
|
||||
this.projectAdvanceWriteOffs.push({
|
||||
...row,
|
||||
writeOffAmount: Number(row.writeOffAmount || 0),
|
||||
});
|
||||
});
|
||||
},
|
||||
removeSource(index) {
|
||||
this.sources.splice(index, 1);
|
||||
@@ -2784,6 +2896,9 @@ export default {
|
||||
};
|
||||
return this.displayValue(labels[value] || value);
|
||||
},
|
||||
settlementStatusName(status) {
|
||||
return settlementStatusName(status, this.displayValue);
|
||||
},
|
||||
unwrapData(response) {
|
||||
const body = response?.data || response || {};
|
||||
return body?.data || body;
|
||||
@@ -3166,6 +3281,9 @@ export default {
|
||||
.formal-editor__negative-amount {
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
.formal-editor__settle-summary {
|
||||
margin-top: 8px;
|
||||
}
|
||||
.formal-editor :deep(.formal-editor__negative-amount .el-input__inner) {
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user