This commit is contained in:
2026-08-31 10:38:21 +08:00
parent a10eea247f
commit a75ac1cfa4
13 changed files with 864 additions and 161 deletions
@@ -51,7 +51,7 @@
v-else-if="field.type === 'number'"
v-model="form[field.prop]"
:min="0"
:precision="6"
:precision="2"
:controls="false"
:disabled="!editable || form.currency === 'RMB'"
@change="recalculateLocalAmount"
@@ -104,10 +104,10 @@
@change="handleManualFeeTypeChange(row)"
>
<el-option
v-for="item in feeOptions"
:key="item.feeType"
:label="item.feeTypeName || item.feeType"
:value="item.feeType"
v-for="item in feeCategoryOptions"
:key="item.id || item.dictValue"
:label="item.dictKey || item.dictValue"
:value="item.dictValue"
/>
</el-select>
<el-select
@@ -899,14 +899,25 @@ export default {
currency: first.currency || 'RMB',
localCurrency: first.localCurrency || 'RMB',
});
this.details = rows.map(row => ({
this.details = rows.map(row => this.normalizeSourceDetail(row));
this.buildSummaryFeesFromDetails();
},
normalizeSourceDetail(row) {
const originalAmount =
row.originalAmount ?? row.totalAmount ?? row.afterAmount ?? row.settlementAmount ?? 0;
return {
...row,
sourceDetailId: row.sourceDetailId || row.id,
originalAmount,
adjustAmount: row.adjustAmount ?? 0,
settlementAmountTax:
row.settlementAmountTax ?? row.totalAmount ?? row.afterAmount ?? row.settlementAmount,
row.settlementAmountTax ??
row.totalAmount ??
row.afterAmount ??
row.settlementAmount ??
originalAmount,
feeItemsJson: row.feeItemsJson || JSON.stringify(row.feeItems || {}),
}));
this.buildSummaryFeesFromDetails();
};
},
resetEditor() {
this.form = emptyPreSettlementForm();
@@ -1054,7 +1065,7 @@ export default {
sourceDetailIds: this.details.map(row => row.sourceDetailId || row.id),
summaryFees: this.summaryFees.map(row => ({
id: row.id || undefined,
feeType: row.feeType || '',
feeType: this.feeCategoryValue(row.feeType),
feeItem: row.feeItem,
originalAmount: Number(row.originalAmount || 0),
adjustAmount: Number(row.adjustAmount || 0),
@@ -1079,14 +1090,25 @@ export default {
if (!this.manualFeeItems(row.feeType).includes(row.feeItem)) row.feeItem = '';
},
manualFeeItems(feeType) {
return this.feeOptions.find(item => item.feeType === feeType)?.feeItems || [];
return (
this.feeOptions.find(
item => this.feeCategoryValue(item.feeType) === this.feeCategoryValue(feeType)
)?.feeItems || []
);
},
feeCategoryValue(value) {
if (value === undefined || value === null || value === '') return '';
const option = this.feeCategoryOptions.find(
item => String(item.dictKey) === String(value) || String(item.dictValue) === String(value)
);
return option?.dictValue || value;
},
feeCategoryName(value) {
if (value === undefined || value === null || value === '') return '';
const option = this.feeCategoryOptions.find(
item => String(item.dictKey) === String(value) || String(item.dictValue) === String(value)
);
return option?.dictValue || value;
return option?.dictKey || value;
},
transportTypeName(value) {
if (value === undefined || value === null || value === '') return '';
@@ -1124,7 +1146,7 @@ export default {
const feeOption = this.feeOptions.find(item =>
(item.feeItems || []).some(name => String(name) === String(feeItem))
);
const feeType = feeOption?.feeType || fallbackFeeType || '';
const feeType = this.feeCategoryValue(feeOption?.feeType || fallbackFeeType);
const key = `${feeType}\u0000${feeItem}`;
const current = summaryMap.get(key) || {
id: '',
@@ -1239,7 +1261,7 @@ export default {
const existingIds = new Set(this.details.map(row => String(row.sourceDetailId || row.id)));
this.candidateSelection.forEach(row => {
if (!existingIds.has(String(row.id))) {
this.details.push({ ...row, sourceDetailId: row.id });
this.details.push(this.normalizeSourceDetail(row));
}
});
this.candidateDialog.confirming = true;