Merge remote-tracking branch 'origin/master' into feature/20261016-settlement-adjustment-kingdee

This commit is contained in:
刘泉佳
2026-10-18 15:14:38 +08:00
40 changed files with 1511 additions and 537 deletions
@@ -733,7 +733,7 @@
</el-button>
</div>
<el-dialog v-model="candidate.visible" title="选择预结算单" width="88%" append-to-body>
<el-dialog v-model="candidate.visible" title="选择预付结算单" width="88%" append-to-body>
<el-card>
<el-form
:model="candidate.query"
@@ -742,7 +742,7 @@
label-width="88px"
class="formal-editor__candidate-search"
>
<el-form-item label="预结算单号"
<el-form-item label="预付结算单号"
><el-input v-model="candidate.query.preSettlementNo" clearable
/></el-form-item>
<el-form-item label="合同编号"
@@ -867,20 +867,6 @@
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
<el-table-column prop="cargoName" label="货物名称" min-width="140" align="center" />
<el-table-column prop="cargoType" label="货物类型" min-width="130" align="center" />
<el-table-column label="计费规则" min-width="190" align="center">
<template #default="{ row }">
<div class="formal-editor__billing-rule-cell">
<span>{{ displayValue(billingRuleName(row)) }}</span>
<el-icon
class="formal-editor__billing-rule-icon"
title="查看计费规则详情"
@click="openBillingRuleInfo(row)"
>
<InfoFilled />
</el-icon>
</div>
</template>
</el-table-column>
<el-table-column label="运输总量" min-width="150" align="center">
<template #default="{ row }">
<el-input-number
@@ -918,11 +904,29 @@
v-for="feeItem in adjustFeeItemNames"
:key="feeItem"
:label="feeItem"
min-width="140"
min-width="160"
align="center"
>
<template #default="{ row }">
<div v-if="isFreightFeeItem(feeItem)" class="formal-editor__billing-rule-cell">
<el-input-number
v-model="row.feeItems[feeItem]"
:min="0"
:precision="2"
:controls="false"
@change="recalculateAdjustRow(row, feeItem)"
/>
<el-icon
v-if="hasBillingRule(row)"
class="formal-editor__billing-rule-icon"
title="查看计费规则详情"
@click="openBillingRuleInfo(row)"
>
<InfoFilled />
</el-icon>
</div>
<el-input-number
v-else
v-model="row.feeItems[feeItem]"
:min="0"
:precision="2"
@@ -936,11 +940,6 @@
<el-input-number v-model="row.settlementAmountTax" :precision="2" :controls="false" />
</template>
</el-table-column>
<el-table-column label="备注" min-width="200" align="center">
<template #default="{ row }">
<el-input v-model="row.remark" maxlength="200" />
</template>
</el-table-column>
</el-table>
<el-form
:model="adjust"
@@ -948,8 +947,15 @@
label-width="auto"
class="formal-editor__adjust-reason"
>
<el-form-item label="调整原因" required>
<el-input v-model="adjust.reason" maxlength="200" show-word-limit />
<el-form-item label="备注">
<el-input
v-model="adjust.reason"
type="textarea"
:rows="2"
maxlength="200"
show-word-limit
placeholder="请输入"
/>
</el-form-item>
</el-form>
<template #footer>
@@ -970,51 +976,45 @@
<template v-if="billingRuleDialog.rule">
<div class="dialog-section-title">计费规则</div>
<el-descriptions :column="2" border class="formal-editor__billing-rule-detail">
<el-descriptions-item label="规则名称">{{
displayValue(billingRuleDialog.rule.name)
}}</el-descriptions-item>
<el-descriptions-item label="费用类型">{{
displayValue(billingRuleDialog.rule.feeType)
}}</el-descriptions-item>
<el-descriptions-item label="费用项">{{
displayValue(billingRuleDialog.rule.feeItem)
}}</el-descriptions-item>
<el-descriptions-item label="计费要素">{{
displayValue(billingRuleDialog.rule.billingElement)
}}</el-descriptions-item>
<el-descriptions-item label="计费类型">{{
displayValue(billingRuleDialog.rule.billingType)
}}</el-descriptions-item>
<el-descriptions-item label="计费单位">{{
displayValue(billingRuleDialog.rule.billingUnit)
}}</el-descriptions-item>
<el-descriptions-item label="单价">{{
displayValue(billingRuleDialog.rule.unitPrice)
}}</el-descriptions-item>
<el-descriptions-item label="最低计费量">{{
displayValue(billingRuleDialog.rule.minimumBillingWeight)
}}</el-descriptions-item>
<el-descriptions-item label="计费区间">{{
billingRuleRanges(billingRuleDialog.rule)
}}</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">{{
displayValue(billingRuleDialog.rule.remark)
}}</el-descriptions-item>
<el-descriptions-item label="费用项">
{{ displayValue(billingRuleDialog.rule.feeItem) }}
</el-descriptions-item>
<el-descriptions-item label="计费要素">
{{ displayValue(billingRuleDialog.rule.billingElement) }}
</el-descriptions-item>
<el-descriptions-item label="计费类型">
{{ displayValue(billingRuleDialog.rule.billingType) }}
</el-descriptions-item>
<el-descriptions-item label="计费单位">
{{ displayValue(billingRuleDialog.rule.billingUnit) }}
</el-descriptions-item>
<el-descriptions-item label="单价">
{{ displayValue(billingRuleDialog.rule.unitPrice) }}
</el-descriptions-item>
<el-descriptions-item label="最低计费量">
{{ displayValue(billingRuleDialog.rule.minimumBillingWeight) }}
</el-descriptions-item>
<el-descriptions-item label="计费区间">
{{ billingRuleRanges(billingRuleDialog.rule) }}
</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">
{{ displayValue(billingRuleDialog.rule.remark) }}
</el-descriptions-item>
</el-descriptions>
<div class="dialog-section-title formal-editor__billing-rule-match-title">匹配条件</div>
<el-descriptions :column="2" border class="formal-editor__billing-rule-detail">
<el-descriptions-item label="起运地">{{
displayValue(billingRuleDialog.rule.matchCondition.origin)
}}</el-descriptions-item>
<el-descriptions-item label="目的地">{{
displayValue(billingRuleDialog.rule.matchCondition.destination)
}}</el-descriptions-item>
<el-descriptions-item label="运输方式">{{
displayValue(billingRuleDialog.rule.matchCondition.transportMode)
}}</el-descriptions-item>
<el-descriptions-item label="货物类型">{{
displayValue(billingRuleDialog.rule.matchCondition.cargoType)
}}</el-descriptions-item>
<el-descriptions-item label="起运地">
{{ displayValue(billingRuleDialog.rule.matchCondition.origin) }}
</el-descriptions-item>
<el-descriptions-item label="目的地">
{{ displayValue(billingRuleDialog.rule.matchCondition.destination) }}
</el-descriptions-item>
<el-descriptions-item label="货物名称">
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoName) }}
</el-descriptions-item>
<el-descriptions-item label="货物类型">
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoType) }}
</el-descriptions-item>
</el-descriptions>
</template>
<el-empty v-else description="暂无计费规则详情" />
@@ -1026,6 +1026,7 @@
</template>
<script>
import { InfoFilled } from '@element-plus/icons-vue';
import { getMkPublicDetail } from '@/api/mk-process';
import {
adjustDetail,
@@ -1065,7 +1066,6 @@ import {
} from '@/option/settlement/formalSettlementTable';
import { getDictionary } from '@/api/system/dictbiz';
import { h } from 'vue';
import { InfoFilled } from '@element-plus/icons-vue';
import { mapGetters } from 'vuex';
import { formatContractOptionLabel } from '@/utils/contract';
import { normalizeCurrencyCode } from '@/utils/currency';
@@ -1257,7 +1257,13 @@ export default {
return isAdministrator(this.userInfo);
},
title() {
return this.readonly ? '查看正式结算单' : this.recordId ? '编辑正式结算单' : '新增正式结算单';
const billLabel =
this.form.settlementType === 'receivable' ? '收款结算单' : '付款结算单';
return this.readonly
? `查看${billLabel}`
: this.recordId
? `编辑${billLabel}`
: `新增${billLabel}`;
},
detailFeeItemNames() {
const names = new Set();
@@ -1379,7 +1385,17 @@ export default {
methods: {
formatContractOptionLabel,
hasPermission(code) {
return this.isAdmin || this.validData(this.permission?.[code], false);
if (this.isAdmin) return true;
const action = String(code || '').replace(
/^(payment_settlement_|receipt_settlement_|formal_settlement_)/,
''
);
const prefix =
this.form.settlementType === 'receivable' ? 'receipt_settlement' : 'payment_settlement';
return (
this.validData(this.permission?.[`${prefix}_${action}`], false) ||
this.validData(this.permission?.[`formal_settlement_${action}`], false)
);
},
async handleAdjustmentRepush(row) {
await this.$confirm(
@@ -2264,8 +2280,19 @@ export default {
)}.xlsx`
);
},
billingRuleName(row) {
return this.normalizeBillingRule(row).name;
hasBillingRule(row) {
const rule = this.normalizeBillingRule(row);
return Boolean(
rule.feeItem ||
rule.billingElement ||
rule.billingType ||
rule.unitPrice ||
rule.rules?.length ||
rule.matchCondition?.origin ||
rule.matchCondition?.destination ||
rule.matchCondition?.cargoName ||
rule.matchCondition?.cargoType
);
},
openBillingRuleInfo(row) {
this.billingRuleDialog.rule = this.normalizeBillingRule(row);
@@ -2291,26 +2318,8 @@ export default {
const matchCondition = this.parseObject(
source.matchCondition ?? source.billingMatchCondition ?? rule.matchCondition
);
const ruleNames = matchedRules
.map(item => item.ruleName || item.name || item.billingRuleName || item.feeItem)
.filter(Boolean);
return {
...rule,
name:
source.billingRuleName ||
source.feeRuleName ||
source.ruleName ||
source.billingPlanRuleName ||
source.billingPlanName ||
rule.name ||
rule.ruleName ||
rule.billingRuleName ||
rule.planName ||
rule.billingPlanName ||
ruleNames.join('、') ||
rule.feeItem ||
'',
feeType: source.billingFeeType || source.feeType || rule.feeType,
feeItem: source.billingFeeItem || source.feeItem || rule.feeItem,
billingElement:
source.billingElement ||
@@ -2328,7 +2337,11 @@ export default {
...matchCondition,
origin: matchCondition.origin || matchCondition.originName,
destination: matchCondition.destination || matchCondition.destinationName,
transportMode: matchCondition.transportMode || matchCondition.transportType,
cargoName:
matchCondition.cargoName ||
matchCondition.cargoNameLabel ||
source.cargoName ||
rule.cargoName,
cargoType: matchCondition.cargoType || matchCondition.cargoTypeName,
},
};
@@ -2406,7 +2419,11 @@ export default {
detailId: row.formalSettlementId ? row.id : null,
sourceDetailId: row.sourceDetailId || null,
feeKey,
reason: pending?.reason || '',
// 底部备注回显结算明细备注;暂存过的调整优先取暂存备注
reason:
pending?.reason !== undefined && pending?.reason !== null
? pending.reason
: row.remark || '',
rows: [],
targetRow: row.formalSettlementId ? null : row,
};
@@ -2429,7 +2446,6 @@ export default {
}
},
async saveAdjustment() {
if (!this.adjust.reason.trim()) return this.$message.warning('请输入调整原因');
if (this.adjust.rows.some(row => row.calculating)) {
return this.$message.warning('费用正在重新计算,请稍候');
}
@@ -2458,6 +2474,14 @@ export default {
.reduce((total, item) => total + Number(item.settlementAmountTax || 0), 0)
.toFixed(2)
);
const settlementAmountNoTax = Number(
this.adjust.rows
.reduce((total, item) => total + Number(item.settlementAmountNoTax || 0), 0)
.toFixed(2)
);
const hasSettlementAmountNoTax = this.adjust.rows.some(
item => item.settlementAmountNoTax !== undefined && item.settlementAmountNoTax !== null
);
const feeItems = this.adjust.rows.reduce((result, item) => {
Object.entries(item.feeItems || {}).forEach(([name, amount]) => {
result[name] = Number((Number(result[name] || 0) + Number(amount || 0)).toFixed(2));
@@ -2471,24 +2495,37 @@ export default {
originalAmount,
adjustAmount: Number((settlementAmount - originalAmount).toFixed(2)),
settlementAmountTax: settlementAmount,
settlementAmountNoTax: hasSettlementAmountNoTax
? settlementAmountNoTax
: target.settlementAmountNoTax,
feeItemsJson: JSON.stringify(feeItems),
freightAmount: this.adjust.rows.reduce(
(total, item) => total + Number(item.freightAmount || 0),
0
freightAmount: Number(
this.adjust.rows
.reduce((total, item) => total + Number(item.freightAmount || 0), 0)
.toFixed(2)
),
transportQuantity: this.adjust.rows.reduce(
(total, item) => total + Number(item.transportQuantity || 0),
0
transportQuantity: Number(
this.adjust.rows
.reduce((total, item) => total + Number(item.transportQuantity || 0), 0)
.toFixed(2)
),
mileage: Number(
this.adjust.rows
.reduce((total, item) => total + Number(item.mileage || 0), 0)
.toFixed(2)
),
mileage: this.adjust.rows.reduce((total, item) => total + Number(item.mileage || 0), 0),
unitPrice: edited.unitPrice,
remark: edited.remark,
// 底部备注写入结算明细备注
remark: this.adjust.reason || '',
pendingDetailAdjustment: true,
});
if (this.adjust.feeKey) {
const clonedRows = this.cloneAdjustRows(this.adjust.rows);
// 暂存后同步费用快照,避免再次打开调整弹窗或汇总时仍用调整前数据。
this.detailFeeSnapshots[this.adjust.feeKey] = clonedRows;
this.pendingAdjustments[this.adjust.feeKey] = {
reason: this.adjust.reason,
rows: this.cloneAdjustRows(this.adjust.rows),
rows: clonedRows,
};
}
await this.refreshSummaryFees();
@@ -2510,7 +2547,6 @@ export default {
feeItems: row.feeItems,
settlementAmountTax: row.settlementAmountTax,
settlementAmountNoTax: row.settlementAmountNoTax,
remark: row.remark,
})),
});
this.$message.success('调整保存成功');
@@ -2534,6 +2570,17 @@ export default {
}));
await this.confirmInvoiceClaims();
},
// 发票认领默认金额以当前结算金额为准:优先表单结算金额,其次结算合计,再次明细含税合计。
resolveInvoiceClaimSettlementAmount() {
const formAmount = Number(this.form.settlementAmount || 0);
if (formAmount > 0) return formAmount;
const summaryAmount = Number(this.summaryTotal || 0);
if (summaryAmount > 0) return summaryAmount;
return this.details.reduce(
(total, row) => total + Number(row.settlementAmountTax || row.settlementAmount || 0),
0
);
},
async confirmInvoiceClaims() {
if (!this.invoiceClaimDialog.selected.length) {
this.$message.warning('请至少选择一条发票');
@@ -2542,26 +2589,33 @@ export default {
this.invoiceClaimDialog.confirming = true;
try {
const existingNumbers = new Set(this.invoices.map(item => String(item.invoiceNo)));
const settlementAmount = this.resolveInvoiceClaimSettlementAmount();
if (settlementAmount > 0 && Number(this.form.settlementAmount || 0) <= 0) {
this.form.settlementAmount = Number(settlementAmount).toFixed(2);
}
let remaining = Math.max(
Number(this.form.settlementAmount || 0) -
settlementAmount -
this.invoices.reduce((total, item) => total + Number(item.matchedAmount || 0), 0),
0
);
const invoices = this.invoiceClaimDialog.selected
.filter(row => !existingNumbers.has(String(row.invoiceNo)))
.map(row => {
const sourceAmount = Number(row.matchedAmount || 0);
// 票池 matchedAmount 默认等于整张发票金额;可匹配口径优先取 availableInvoiceAmount
const sourceAmount = Number(
row.availableInvoiceAmount || row.matchedAmount || row.invoiceAmount || 0
);
// 可匹配金额大于剩余结算金额时,默认匹配金额取剩余结算金额(单张发票常见场景)
const matchedAmount =
Number(this.form.settlementAmount || 0) > 0
? Math.min(sourceAmount, remaining)
: sourceAmount;
if (Number(this.form.settlementAmount || 0) > 0) {
settlementAmount > 0 ? Math.min(sourceAmount, remaining) : sourceAmount;
if (settlementAmount > 0) {
remaining = Math.max(0, remaining - matchedAmount);
}
return {
...row,
invoiceType: row.invoiceTypeName || row.invoiceType || '',
matchedAmount,
availableInvoiceAmount: sourceAmount,
matchedAmount: Number(matchedAmount.toFixed(2)),
};
})
.filter(row => row.matchedAmount > 0);
@@ -2619,7 +2673,7 @@ export default {
}
matchedTotal += matchedAmount;
}
if (matchedTotal > Number(this.form.settlementAmount || 0)) {
if (matchedTotal > this.resolveInvoiceClaimSettlementAmount()) {
this.$message.warning('发票匹配结算单金额合计不能超过结算金额');
return false;
}
@@ -2727,7 +2781,7 @@ export default {
summaryFees: this.summaryFees
.filter(
row =>
row.manualFlag === 1 ||
Number(row.manualFlag) === 1 ||
row.id ||
Number(row.adjustAmount || 0) !== 0 ||
String(row.remark || '').trim()
@@ -2738,7 +2792,7 @@ export default {
feeItem: row.feeItem,
adjustAmount: Number(row.adjustAmount || 0),
remark: row.remark,
manualFlag: row.manualFlag || 0,
manualFlag: Number(row.manualFlag) === 1 ? 1 : 0,
})),
attachmentsJson: this.stringifyAttachments(this.attachments),
invoices: this.invoices.map(row => ({
@@ -3168,20 +3222,6 @@ export default {
.formal-editor__billing-rule-match-title {
margin-top: 20px;
}
.dialog-section-title {
display: flex;
align-items: center;
min-height: 22px;
font-size: 16px;
font-weight: 600;
}
.dialog-section-title::before {
width: 4px;
height: 18px;
margin-right: 8px;
background: #409eff;
content: '';
}
.formal-editor__attachment-missing {
margin-left: 12px;
color: var(--el-color-danger);
@@ -3,13 +3,13 @@
<div class="fs-table-panel__toolbar">
<div>
<el-button
v-if="hasPermission('formal_settlement_add')"
v-if="hasPermission('add')"
type="primary"
@click="$emit('create')"
>新增</el-button
>
<el-button
v-if="hasPermission('formal_settlement_payment')"
v-if="showPaymentAction && hasPermission('payment')"
type="primary"
plain
:disabled="!selection.length"
@@ -17,23 +17,23 @@
>付款申请</el-button
>
<el-button
v-if="hasPermission('formal_settlement_sync')"
v-if="hasPermission('sync')"
type="primary"
plain
:disabled="selection.length !== 1"
:disabled="!selection.length"
:loading="syncLoading"
@click="$emit('sync')"
>同步金蝶</el-button
>
<el-button
v-if="hasPermission('formal_settlement_print')"
v-if="hasPermission('print')"
type="primary"
plain
@click="emitSingle('print')"
>打印结算单</el-button
>
<el-button
v-if="hasPermission('formal_settlement_export')"
v-if="hasPermission('export')"
type="primary"
plain
@click="$emit('export')"
@@ -150,6 +150,9 @@ export default {
hasPermission: { type: Function, required: true },
mkEnabled: { type: Boolean, default: false },
searchVisible: { type: Boolean, default: true },
/** 是否展示付款申请按钮(仅付款结算单) */
showPaymentAction: { type: Boolean, default: true },
billLabel: { type: String, default: '结算单' },
},
emits: [
'create',
@@ -224,7 +227,7 @@ export default {
},
emitSingle(type) {
if (this.selection.length !== 1) {
this.$message.warning(`${type === 'print' ? '打印' : '操作'}需选择一条正式结算单`);
this.$message.warning(`${type === 'print' ? '打印' : '操作'}需选择一条${this.billLabel}`);
return;
}
this.$emit('action', { type, row: this.selection[0] });
@@ -234,27 +237,26 @@ export default {
},
rowActions(row) {
const actions = [];
if (this.hasPermission('formal_settlement_view'))
actions.push({ type: 'view', label: '查看' });
if (this.hasPermission('formal_settlement_edit') && this.isEditable(row))
if (this.hasPermission('view')) actions.push({ type: 'view', label: '查看' });
if (this.hasPermission('edit') && this.isEditable(row))
actions.push({ type: 'edit', label: '编辑' });
if (this.hasPermission('formal_settlement_delete') && row.approvalStatus === 'draft')
if (this.hasPermission('delete') && row.approvalStatus === 'draft')
actions.push({ type: 'delete', label: '删除', danger: true });
if (this.hasPermission('formal_settlement_submit') && this.isEditable(row))
if (this.hasPermission('submit') && this.isEditable(row))
actions.push({ type: 'submit', label: '提交' });
if (
this.mkEnabled &&
this.hasPermission('formal_settlement_approve') &&
this.hasPermission('approve') &&
['reviewing', 'approved'].includes(row.approvalStatus)
) {
actions.push({ type: 'mkAudit', label: '流程' });
}
if (!this.mkEnabled && this.hasPermission('formal_settlement_approve') && row.approvalStatus === 'reviewing') {
if (!this.mkEnabled && this.hasPermission('approve') && row.approvalStatus === 'reviewing') {
actions.push({ type: 'approve', label: '通过' });
actions.push({ type: 'return', label: '驳回', danger: true });
}
if (
this.hasPermission('formal_settlement_void') &&
this.hasPermission('void') &&
row.approvalStatus === 'approved' &&
row.kingdeeSyncStatus !== 'synced'
)
@@ -459,7 +459,7 @@
</section-card>
<section-card v-if="form.id && readonly" title="变更记录">
<el-table :data="adjustChangeRecords" border>
<el-table :data="changeRecords" border>
<el-table-column type="index" label="序号" width="64" align="center" />
<el-table-column
v-for="column in changeTableColumns"
@@ -753,20 +753,6 @@
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
<el-table-column prop="cargoName" label="货物名称" min-width="140" align="center" />
<el-table-column prop="cargoType" label="货物类型" min-width="130" align="center" />
<el-table-column label="计费规则" min-width="190" align="center">
<template #default="{ row }">
<div class="pre-settlement-editor__billing-rule-cell">
<span>{{ displayValue(billingRuleName(row)) }}</span>
<el-icon
class="pre-settlement-editor__billing-rule-icon"
title="查看计费规则详情"
@click="openBillingRuleInfo(row)"
>
<InfoFilled />
</el-icon>
</div>
</template>
</el-table-column>
<el-table-column label="运输总量" min-width="150" align="center">
<template #default="{ row }">
<span v-if="adjustDialog.readonly">{{ formatQuantity(row) }}</span>
@@ -809,11 +795,33 @@
v-for="feeItem in adjustFeeItemNames"
:key="feeItem"
:label="feeItem"
min-width="140"
min-width="160"
align="center"
>
<template #default="{ row }">
<div
v-if="isFreightFeeItem(feeItem)"
class="pre-settlement-editor__billing-rule-cell"
>
<el-input-number
v-model="row.feeItems[feeItem]"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@change="recalculateAdjustRow(row, feeItem)"
/>
<el-icon
v-if="hasBillingRule(row)"
class="pre-settlement-editor__billing-rule-icon"
title="查看计费规则详情"
@click="openBillingRuleInfo(row)"
>
<InfoFilled />
</el-icon>
</div>
<el-input-number
v-else
v-model="row.feeItems[feeItem]"
:min="0"
:precision="2"
@@ -833,11 +841,6 @@
/>
</template>
</el-table-column>
<el-table-column label="备注" min-width="200" align="center">
<template #default="{ row }">
<el-input v-model="row.remark" maxlength="200" :disabled="adjustDialog.readonly" />
</template>
</el-table-column>
</el-table>
<el-form
v-if="!adjustDialog.readonly"
@@ -846,7 +849,7 @@
label-width="auto"
class="pre-settlement-editor__adjust-reason"
>
<el-form-item label="调整原因">
<el-form-item label="备注">
<el-input
v-model="adjustDialog.reason"
type="textarea"
@@ -885,12 +888,6 @@
<template v-if="billingRuleDialog.rule">
<div class="dialog-section-title">计费规则</div>
<el-descriptions :column="2" border class="pre-settlement-editor__billing-rule-detail">
<el-descriptions-item label="规则名称">
{{ displayValue(billingRuleDialog.rule.name) }}
</el-descriptions-item>
<el-descriptions-item label="费用类型">
{{ displayValue(billingRuleDialog.rule.feeType) }}
</el-descriptions-item>
<el-descriptions-item label="费用项">
{{ displayValue(billingRuleDialog.rule.feeItem) }}
</el-descriptions-item>
@@ -926,8 +923,8 @@
<el-descriptions-item label="目的地">
{{ displayValue(billingRuleDialog.rule.matchCondition.destination) }}
</el-descriptions-item>
<el-descriptions-item label="运输方式">
{{ displayValue(billingRuleDialog.rule.matchCondition.transportMode) }}
<el-descriptions-item label="货物名称">
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoName) }}
</el-descriptions-item>
<el-descriptions-item label="货物类型">
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoType) }}
@@ -1203,8 +1200,8 @@ export default {
return this.editable && this.hasPermission('pre_settlement_adjust');
},
dialogTitle() {
if (this.readonly) return '查看预结算单';
return this.form.id ? '编辑预结算单' : '新增预结算单';
if (this.readonly) return '查看预付结算单';
return this.form.id ? '编辑预付结算单' : '新增预付结算单';
},
settlementTypeName() {
return this.form.settlementType === 'receivable' ? '应收' : '应付';
@@ -1286,13 +1283,6 @@ export default {
});
return Array.from(names);
},
adjustChangeRecords() {
return this.changeRecords.filter(
row =>
row.changeType === '结算明细项' &&
String(row.lineNo ?? '') === String(this.adjustDialog.detailLineNo ?? '')
);
},
},
watch: {
modelValue: {
@@ -1866,7 +1856,25 @@ export default {
});
const manualFees = this.summaryFees.filter(row => Number(row.manualFlag) === 1);
this.summaryFees = [...summaryMap.values(), ...manualFees];
const nextFeeMap = new Map();
summaryMap.forEach((row, key) => nextFeeMap.set(`0\u0000${key}`, row));
manualFees.forEach(row => {
const key = `1\u0000${row.feeType}\u0000${row.feeItem}`;
nextFeeMap.set(key, row);
});
// 按编辑前顺序回填,新增费用项追加到末尾,避免手工费用被统一挤到最后。
const orderedFees = [];
const previousKeys = this.summaryFees.map(
row => `${Number(row.manualFlag) === 1 ? 1 : 0}\u0000${row.feeType}\u0000${row.feeItem}`
);
previousKeys.forEach(key => {
const row = nextFeeMap.get(key);
if (!row) return;
orderedFees.push(row);
nextFeeMap.delete(key);
});
nextFeeMap.forEach(row => orderedFees.push(row));
this.summaryFees = orderedFees;
this.recalculateLocalAmount();
},
// 每条明细对应的费用行:[调整前基准行, 调整后当前行],缺少来源费用快照时退化为明细自身的汇总行。
@@ -2054,7 +2062,7 @@ export default {
}
},
async removeDetailRow(row) {
await this.$confirm('确认将该明细踢出预结算单?', '提示', { type: 'warning' });
await this.$confirm('确认将该明细踢出预付结算单?', '提示', { type: 'warning' });
if (!this.form.id || !row.id || row.id === row.sourceDetailId) {
this.details = this.details.filter(item => item !== row);
this.buildSummaryFeesFromDetails();
@@ -2229,7 +2237,11 @@ export default {
: '';
const sourceDetailId = String(this.adjustDialog.sourceDetailId || '');
const pending = sourceDetailId ? this.pendingAdjustments[sourceDetailId] : null;
this.adjustDialog.reason = pending?.reason || '';
// 底部备注回显结算明细备注;暂存过的调整优先取暂存备注
this.adjustDialog.reason =
pending?.reason !== undefined && pending?.reason !== null
? pending.reason
: detailRow.remark || '';
try {
// 已暂存的调整结果优先回显,避免重新打开时又回到调整前的数据。
if (pending?.rows?.length) {
@@ -2296,8 +2308,19 @@ export default {
this.adjustChangeRecordDetailRows = this.buildAdjustChangeRecordRows(row);
this.adjustChangeRecordVisible = true;
},
billingRuleName(row) {
return this.normalizeBillingRule(row).name;
hasBillingRule(row) {
const rule = this.normalizeBillingRule(row);
return Boolean(
rule.feeItem ||
rule.billingElement ||
rule.billingType ||
rule.unitPrice ||
rule.rules?.length ||
rule.matchCondition?.origin ||
rule.matchCondition?.destination ||
rule.matchCondition?.cargoName ||
rule.matchCondition?.cargoType
);
},
openBillingRuleInfo(row) {
this.billingRuleDialog.rule = this.normalizeBillingRule(row);
@@ -2324,27 +2347,8 @@ export default {
const matchCondition = this.parseObject(
source.matchCondition ?? source.billingMatchCondition ?? rule.matchCondition
);
const ruleNames = matchedRules
.map(item => item.ruleName || item.name || item.billingRuleName || item.feeItem)
.filter(Boolean);
const name =
source.billingRuleName ||
source.feeRuleName ||
source.ruleName ||
source.billingPlanRuleName ||
source.billingPlanName ||
rule.name ||
rule.ruleName ||
rule.billingRuleName ||
rule.planName ||
rule.billingPlanName ||
ruleNames.join('、') ||
rule.feeItem ||
'';
return {
...rule,
name,
feeType: source.billingFeeType || source.feeType || rule.feeType,
feeItem: source.billingFeeItem || source.feeItem || rule.feeItem,
billingElement:
source.billingElement ||
@@ -2362,7 +2366,11 @@ export default {
...matchCondition,
origin: matchCondition.origin || matchCondition.originName,
destination: matchCondition.destination || matchCondition.destinationName,
transportMode: matchCondition.transportMode || matchCondition.transportType,
cargoName:
matchCondition.cargoName ||
matchCondition.cargoNameLabel ||
source.cargoName ||
rule.cargoName,
cargoType: matchCondition.cargoType || matchCondition.cargoTypeName,
},
};
@@ -2452,9 +2460,13 @@ export default {
reason: this.adjustDialog.reason,
rows: this.adjustRows.map(row => ({ ...row, feeItems: { ...row.feeItems } })),
};
this.applyLocalAdjustment(this.adjustDialog.sourceDetailId, this.adjustRows);
this.applyLocalAdjustment(
this.adjustDialog.sourceDetailId,
this.adjustRows,
this.adjustDialog.reason
);
this.adjustDialog.visible = false;
this.$message.success('结算明细调整已暂存,保存预结算单后生效');
this.$message.success('结算明细调整已暂存,保存预付结算单后生效');
return;
}
await adjustDetail({
@@ -2469,7 +2481,6 @@ export default {
feeItems: row.feeItems,
settlementAmountTax: row.settlementAmountTax,
settlementAmountNoTax: row.settlementAmountNoTax,
remark: row.remark,
})),
});
this.adjustDialog.visible = false;
@@ -2480,12 +2491,12 @@ export default {
this.adjustDialog.saving = false;
}
},
applyLocalAdjustment(sourceDetailId, rows) {
applyLocalAdjustment(sourceDetailId, rows, detailRemark) {
const detail = this.details.find(
item => String(item.sourceDetailId || item.id) === String(sourceDetailId)
);
if (!detail) return;
// 原金额以进入预结算单时的费用快照为基准,调整金额 = 结算金额 - 原金额。
// 原金额以进入预付结算单时的费用快照为基准,调整金额 = 结算金额 - 原金额。
const baseRows = this.sourceFeeSnapshots[String(sourceDetailId)] || [];
const originalAmount = baseRows.length
? baseRows.reduce((sum, row) => sum + Number(row.settlementAmountTax || 0), 0)
@@ -2494,20 +2505,48 @@ export default {
(sum, row) => sum + Number(row.settlementAmountTax || 0),
0
);
const settlementAmountNoTax = rows.reduce(
(sum, row) => sum + Number(row.settlementAmountNoTax || 0),
0
);
const hasSettlementAmountNoTax = rows.some(
row => row.settlementAmountNoTax !== undefined && row.settlementAmountNoTax !== null
);
const freightAmount = rows.reduce((sum, row) => sum + Number(row.freightAmount || 0), 0);
const transportQuantity = rows.reduce(
(sum, row) => sum + Number(row.transportQuantity || 0),
0
);
const mileage = rows.reduce((sum, row) => sum + Number(row.mileage || 0), 0);
const feeItems = {};
rows.forEach(row =>
Object.entries(row.feeItems || {}).forEach(([name, amount]) => {
feeItems[name] = Number((Number(feeItems[name] || 0) + Number(amount || 0)).toFixed(2));
})
);
const firstRow = rows[0] || {};
Object.assign(detail, {
transportQuantity: Number(transportQuantity.toFixed(2)),
mileage: Number(mileage.toFixed(2)),
unitPrice: Number(firstRow.unitPrice || 0),
originalAmount: Number(originalAmount.toFixed(2)),
adjustAmount: Number((settlementAmountTax - originalAmount).toFixed(2)),
settlementAmountTax: Number(settlementAmountTax.toFixed(2)),
settlementAmountNoTax: hasSettlementAmountNoTax
? Number(settlementAmountNoTax.toFixed(2))
: detail.settlementAmountNoTax,
freightAmount: Number(freightAmount.toFixed(2)),
feeItemsJson: JSON.stringify(feeItems),
// 底部备注写入结算明细备注
remark: detailRemark ?? '',
});
// 暂存调整后同步费用缓存,保证货物名称/类型拼接与列表展示一致。
if (detail.id) {
this.detailFeeCache[detail.id] = rows.map(row => ({
...row,
feeItems: { ...row.feeItems },
}));
}
this.buildSummaryFeesFromDetails();
},
async persistPendingAdjustments() {
@@ -2535,11 +2574,14 @@ export default {
feeItems: pendingRow.feeItems,
settlementAmountTax: pendingRow.settlementAmountTax,
settlementAmountNoTax: pendingRow.settlementAmountNoTax,
remark: pendingRow.remark,
};
});
if (rows.length) {
await adjustDetail({ detailId: detail.id, changeReason: pending.reason, rows });
await adjustDetail({
detailId: detail.id,
changeReason: pending.reason,
rows,
});
}
}
this.pendingAdjustments = {};
@@ -2611,7 +2653,7 @@ export default {
XLSX.utils.book_append_sheet(workbook, sheet, '结算明细');
XLSX.writeFile(
workbook,
`${this.form.preSettlementNo || '预结算单'}结算明细${this.$dayjs().format(
`${this.form.preSettlementNo || '预付结算单'}结算明细${this.$dayjs().format(
'YYYY-MM-DD HH-mm-ss'
)}.xlsx`
);
@@ -55,7 +55,7 @@
<el-option label="正式结算单" value="formal" />
<el-option
v-if="form.settlementType === 'payable'"
label="预结算单"
label="预付结算单"
value="pre"
/>
</el-select>
@@ -508,7 +508,7 @@
<span class="completion-dialog__value">{{ displayValue(form.reconciliationNo) }}</span>
</div>
<div class="completion-dialog__field">
<span class="completion-dialog__label">预结算单号</span>
<span class="completion-dialog__label">预付结算单号</span>
<span class="completion-dialog__value">{{
displayValue(form.preSettlementNo || form.formalSettlementNo)
}}</span>
@@ -1278,10 +1278,13 @@ export default {
delete snapshot._externalKey;
delete snapshot.feeItems;
snapshot.feeItemsJson = row.feeItemsJson || JSON.stringify(row.feeItems || {});
snapshot.actualDepartureTime = this.normalizeExternalDateTime(row.actualDepartureTime);
snapshot.actualCompletionTime = this.normalizeExternalDateTime(row.actualCompletionTime);
return snapshot;
});
},
serializeExternalRows() {
const duplicateIds = new Set(this.duplicateRows.map(row => String(row.id)));
return this.externalDetails.map(row => {
const snapshot = { ...row };
delete snapshot._sourceRows;
@@ -1290,6 +1293,7 @@ export default {
snapshot.feeItemsJson = row.feeItemsJson || JSON.stringify(row.feeItems || {});
snapshot.actualDepartureTime = this.normalizeExternalDateTime(row.actualDepartureTime);
snapshot.actualCompletionTime = this.normalizeExternalDateTime(row.actualCompletionTime);
snapshot.suspectedDuplicate = duplicateIds.has(String(row.id));
return snapshot;
});
},
@@ -1336,6 +1340,11 @@ export default {
}
},
async handleComplete() {
const unmatchedInternal = this.internalDetails.filter(item => item.matchResult !== 'matched').length;
const unmatchedExternal = this.externalDetails.filter(item => item.matchStatus !== 'matched').length;
if (this.duplicateRows.length || unmatchedInternal || unmatchedExternal) {
return this.$message.warning('所有内外部账单明细必须一一匹配且不存在疑似重复');
}
if (
Number(this.form.differenceCount || 0) !== 0 ||
Number(this.form.differenceQuantity || 0) !== 0 ||
@@ -1694,8 +1703,11 @@ export default {
},
normalizeExternalDateTime(value) {
if (!value) return null;
const text = String(value);
return text.length === 10 ? `${text}T00:00:00` : text;
const text = String(value).trim();
if (!text) return null;
const date = this.$dayjs(text);
if (date.isValid()) return date.format('YYYY-MM-DD HH:mm:ss');
return text.length === 10 ? `${text} 00:00:00` : text.replace('T', ' ');
},
refreshLocalStats() {
const internalQuantity = this.internalDetails.reduce(
@@ -16,6 +16,7 @@
<script>
import FormalSettlementEditor from './components/formal-settlement-editor.vue';
import { readSettlementTransfer, removeSettlementTransfer } from '@/utils/settlement-transfer';
import { settlementBillLabel, settlementListPath } from '@/utils/settlement-menu';
const LIST_REFRESH_KEY = 'formal-settlement-list-refresh';
@@ -35,12 +36,25 @@ export default {
readonly() {
return this.$route.query.mode === 'view';
},
settlementType() {
return this.$route.query.settlementType || this.transferPayload?.settlementType || 'payable';
},
billLabel() {
return settlementBillLabel(this.settlementType);
},
pageTitle() {
return this.readonly ? '查看正式结算' : this.recordId ? '编辑正式结算' : '新增正式结算';
return this.readonly
? `查看${this.billLabel}`
: this.recordId
? `编辑${this.billLabel}`
: `新增${this.billLabel}`;
},
listPath() {
return this.$route.query.listPath || settlementListPath(this.settlementType);
},
editorInitialData() {
const settlementType = this.$route.query.settlementType;
if (!this.transferPayload && !settlementType) return null;
const settlementType = this.settlementType;
if (!this.transferPayload && !this.$route.query.settlementType) return null;
return {
...(this.transferPayload || {}),
...(settlementType ? { settlementType } : {}),
@@ -63,7 +77,7 @@ export default {
goBack() {
removeSettlementTransfer(this.$route.query.transferToken);
this.$router.$avueRouter.closeTag();
this.$router.push('/settlement/formal-settlement');
this.$router.push(this.listPath);
},
syncTagTitle() {
this.$nextTick(() => {
+170 -74
View File
@@ -52,53 +52,32 @@
<section class="formal-page__table-panel">
<el-tabs
v-if="!lockedSettlementType"
type="border-card"
v-model="activeSettlementType"
@tab-change="handleSettlementTypeChange"
>
<el-tab-pane label="应付" name="payable">
<formal-settlement-table-panel
:key="activeSettlementType"
:rows="rows"
:columns="columns"
:loading="loading"
:page="page"
:has-permission="hasPermissionFn"
:sync-loading="syncLoading"
:mk-enabled="mkEnabled"
v-model:search-visible="searchVisible"
@create="openCreate"
@payment="openPaymentDialog"
@sync="handleSync"
@export="handleExport"
@refresh="loadTable"
@page-change="onPageChange"
@action="onAction"
@update:selection="selection = $event"
:key="'payable'"
v-bind="tablePanelProps"
v-on="tablePanelListeners"
/>
</el-tab-pane>
<el-tab-pane label="应收" name="receivable">
<formal-settlement-table-panel
:key="activeSettlementType"
:rows="rows"
:columns="columns"
:loading="loading"
:page="page"
:has-permission="hasPermissionFn"
:sync-loading="syncLoading"
:mk-enabled="mkEnabled"
v-model:search-visible="searchVisible"
@create="openCreate"
@payment="openPaymentDialog"
@sync="handleSync"
@export="handleExport"
@refresh="loadTable"
@page-change="onPageChange"
@action="onAction"
@update:selection="selection = $event"
:key="'receivable'"
v-bind="tablePanelProps"
v-on="tablePanelListeners"
/>
</el-tab-pane>
</el-tabs>
<formal-settlement-table-panel
v-else
:key="activeSettlementType"
v-bind="tablePanelProps"
v-on="tablePanelListeners"
/>
</section>
<formal-settlement-editor
v-model="editor.visible"
@@ -116,7 +95,7 @@
<section-card title="付款信息">
<template v-if="paymentDialog.rows.length > 1">
<div class="formal-payment-dialog__batch-tip">
已选择 {{ paymentDialog.rows.length }} 条同合同应付正式结算单,请确认各单申请金额。
已选择 {{ paymentDialog.rows.length }} 条同合同付款结算单,请确认各单申请金额。
</div>
<el-table :data="paymentDialog.rows" border>
<el-table-column prop="formalSettlementNo" label="结算单号" min-width="160" />
@@ -176,6 +155,12 @@
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue';
import { mapGetters } from 'vuex';
import { createSettlementTransfer } from '@/utils/settlement-transfer';
import {
hasSettlementPermission,
settlementBillLabel,
settlementListPath,
} from '@/utils/settlement-menu';
import { isAdministrator } from '@/utils/auth';
import { downloadFile } from '@/utils/util';
import * as api from '@/api/settlement/formalSettlement';
import * as paymentApi from '@/api/payment/paymentApplication';
@@ -210,6 +195,14 @@ export default {
name: 'FormalSettlement',
components: { FormalSettlementEditor, FormalSettlementTablePanel },
mixins: [organizationSearch],
props: {
/** 菜单拆分后锁定结算类型:payable=付款结算单,receivable=收款结算单 */
lockedSettlementType: {
type: String,
default: '',
validator: value => ['', 'payable', 'receivable'].includes(value),
},
},
data() {
return {
ArrowDown,
@@ -237,9 +230,52 @@ export default {
};
},
computed: {
...mapGetters(['permission']),
...mapGetters(['permission', 'userInfo']),
isAdmin() {
return isAdministrator(this.userInfo);
},
billLabel() {
return settlementBillLabel(this.activeSettlementType);
},
hasPermissionFn() {
return code => this.permission?.[code] !== false;
return actionOrCode => {
const action = String(actionOrCode || '').replace(
/^(payment_settlement_|receipt_settlement_|formal_settlement_)/,
''
);
return hasSettlementPermission(this, this.activeSettlementType, action);
};
},
tablePanelProps() {
return {
rows: this.rows,
columns: this.columns,
loading: this.loading,
page: this.page,
hasPermission: this.hasPermissionFn,
syncLoading: this.syncLoading,
mkEnabled: this.mkEnabled,
searchVisible: this.searchVisible,
showPaymentAction: this.activeSettlementType === 'payable',
billLabel: this.billLabel,
};
},
tablePanelListeners() {
return {
create: this.openCreate,
payment: this.openPaymentDialog,
sync: this.handleSync,
export: this.handleExport,
refresh: this.loadTable,
'page-change': this.onPageChange,
action: this.onAction,
'update:selection': selection => {
this.selection = selection;
},
'update:searchVisible': visible => {
this.searchVisible = visible;
},
};
},
visibleSearchFields() {
return this.searchExpanded ? this.searchFields : this.searchFields.slice(0, 4);
@@ -249,6 +285,14 @@ export default {
},
},
watch: {
lockedSettlementType: {
immediate: true,
handler(value) {
if (value === 'payable' || value === 'receivable') {
this.activeSettlementType = value;
}
},
},
'$route.query.detailNo'(detailNo) {
if (detailNo) this.openRouteDetail(detailNo);
},
@@ -258,6 +302,9 @@ export default {
this.ownFullPath = this.$route.fullPath;
},
mounted() {
if (this.lockedSettlementType === 'payable' || this.lockedSettlementType === 'receivable') {
this.activeSettlementType = this.lockedSettlementType;
}
this.loadOrganizationOptions();
this.loadTable();
this.openRouteDetail();
@@ -276,8 +323,8 @@ export default {
}
},
methods: {
hasPermission(code) {
return this.permission?.[code] !== false;
hasPermission(actionOrCode) {
return this.hasPermissionFn(actionOrCode);
},
async loadTable() {
this.loading = true;
@@ -330,15 +377,23 @@ export default {
path: '/settlement/formal-settlement/form',
query: {
mode: 'add',
name: '新增正式结算',
name: `新增${this.billLabel}`,
settlementType: this.activeSettlementType,
listPath: settlementListPath(this.activeSettlementType),
},
});
},
openEdit(row) {
const settlementType = row.settlementType || this.activeSettlementType;
this.$router.push({
path: '/settlement/formal-settlement/form',
query: { mode: 'edit', id: row.id, name: '编辑正式结算' },
query: {
mode: 'edit',
id: row.id,
name: `编辑${settlementBillLabel(settlementType)}`,
settlementType,
listPath: settlementListPath(settlementType),
},
});
},
openView(row) {
@@ -351,20 +406,22 @@ export default {
const data = this.unwrapData(response);
const row = (data.records || []).find(item => item.formalSettlementNo === formalSettlementNo);
if (!row) {
this.$message.warning('未找到对应的正式结算单');
this.$message.warning(`未找到对应的${this.billLabel}`);
return;
}
this.activeSettlementType = row.settlementType || this.activeSettlementType;
if (!this.lockedSettlementType) {
this.activeSettlementType = row.settlementType || this.activeSettlementType;
}
this.openView(row);
},
async handleDelete(row) {
await this.$confirm('确认删除该正式结算草稿?', '提示', { type: 'warning' });
await this.$confirm(`确认删除该${this.billLabel}草稿?`, '提示', { type: 'warning' });
await api.remove(row.id);
this.$message.success('删除成功');
this.loadTable();
},
async handleSubmit(row) {
await this.$confirm('提交后来源预结算将保持锁定,确认提交?', '提示', { type: 'warning' });
await this.$confirm('提交后来源预付结算单将保持锁定,确认提交?', '提示', { type: 'warning' });
const previousApprovalStatus = row.approvalStatus || '';
await api.submit({ id: row.id });
await submitMkApprovalFlow({
@@ -379,7 +436,7 @@ export default {
},
handleMkAudit(row) {
if (!row?.id) {
this.$message.warning('正式结算单ID为空,无法打开审核页');
this.$message.warning(`${this.billLabel}ID为空,无法打开审核页`);
return;
}
getMKApprovalUrl({ bizId: String(row.id) })
@@ -397,7 +454,7 @@ export default {
},
async handleApprove(row) {
await this.$confirm(
'审核通过后正式结算生效,金额只能通过结算调整单处理,确认通过?',
`审核通过后${this.billLabel}生效,金额只能通过结算调整单处理,确认通过?`,
'提示',
{ type: 'warning' }
);
@@ -419,7 +476,7 @@ export default {
this.loadTable();
},
async handleVoid(row) {
const { value } = await this.$prompt('请输入作废原因', '作废正式结算单', {
const { value } = await this.$prompt('请输入作废原因', `作废${this.billLabel}`, {
inputValidator: value => Boolean(value?.trim()) || '请输入作废原因',
});
await api.voidBill({ id: row.id, reason: value });
@@ -428,46 +485,80 @@ export default {
},
selectedOne(action) {
if (this.selection.length !== 1) {
this.$message.warning(`${action}需选择一条正式结算单`);
this.$message.warning(`${action}需选择一条${this.billLabel}`);
return null;
}
return this.selection[0];
},
async handleSync() {
if (this.syncLoading) return;
const row = this.selectedOne('同步金蝶');
if (!row) return;
const rows = (this.selection || []).filter(row => row.approvalStatus === 'approved');
if (!rows.length) {
this.$message.warning(`请选择至少一条审批通过的${this.billLabel}`);
return;
}
this.syncLoading = true;
try {
const response = await api.syncKingdee(row.id);
const data = this.unwrapData(response);
this.$message.success(`同步成功,金蝶单据号:${data}`);
await this.loadTable();
// 附件联带同步提示:同步成功但附件未全部上传时追加 warning,重推即自动补传
const freshRow = (this.rows || []).find(item => String(item.id) === String(row.id));
if (freshRow && ['pending', 'partial'].includes(freshRow.attachmentSyncStatus)) {
this.$message({
type: 'warning',
message: '该单附件未全部上传,可重推补传',
duration: 8000,
});
let successCount = 0;
let failCount = 0;
let lastFailReason = '';
for (const row of rows) {
try {
await api.syncKingdee(row.id, { meta: { suppressErrorMessage: true } });
successCount += 1;
} catch (error) {
failCount += 1;
lastFailReason = String(error?.message || error || '未知错误').trim() || '未知错误';
}
}
await this.loadTable();
if (rows.length === 1) {
if (failCount) {
await this.$alert(`同步失败,${lastFailReason}`, '同步结果', {
type: 'error',
confirmButtonText: '知道了',
});
} else {
let message = '同步成功';
const freshRow = (this.rows || []).find(item => String(item.id) === String(rows[0].id));
if (freshRow && ['pending', 'partial'].includes(freshRow.attachmentSyncStatus)) {
message += '\n该单附件未全部上传,可重推补传';
}
await this.$alert(message, '同步结果', {
type: 'success',
confirmButtonText: '知道了',
});
}
return;
}
let batchMessage = `完成同步${successCount}条,失败${failCount}条`;
const idSet = new Set(rows.map(row => String(row.id)));
const pendingCount = (this.rows || []).filter(
row =>
idSet.has(String(row.id)) && ['pending', 'partial'].includes(row.attachmentSyncStatus)
).length;
if (pendingCount) {
batchMessage += `\n其中${pendingCount}单附件未全部上传,可重推补传`;
}
await this.$alert(batchMessage, '同步结果', {
type: failCount ? 'warning' : 'success',
confirmButtonText: '知道了',
});
} finally {
this.syncLoading = false;
}
},
async openPaymentDialog() {
if (!this.selection.length) return this.$message.warning('请至少选择一条正式结算单');
if (!this.selection.length) return this.$message.warning(`请至少选择一条${this.billLabel}`);
const rows = this.selection;
if (rows.some(row => row.approvalStatus !== 'approved' || row.settlementType !== 'payable'))
return this.$message.warning('仅审批通过的应付正式结算单允许发起付款申请');
return this.$message.warning('仅审批通过的付款结算单允许发起付款申请');
const contractIds = new Set(rows.map(row => String(row.contractId || '')));
if (contractIds.size !== 1 || contractIds.has(''))
return this.$message.warning('付款申请必须选择同一个合同的正式结算单');
return this.$message.warning('付款申请必须选择同一个合同的付款结算单');
const paymentRows = rows.map(row => ({ ...row, appliedAmount: this.paymentRemaining(row) }));
if (paymentRows.some(row => row.appliedAmount <= 0))
return this.$message.warning('所选正式结算单均须存在剩余可申请金额');
return this.$message.warning('所选付款结算单均须存在剩余可申请金额');
try {
const sourceFormalSettlements = await Promise.all(
paymentRows.map(async row => {
@@ -503,7 +594,7 @@ export default {
})
);
if (sourceFormalSettlements.some(row => row.appliedAmount <= 0)) {
this.$message.warning('所选正式结算单均须存在剩余可申请金额');
this.$message.warning('所选付款结算单均须存在剩余可申请金额');
return;
}
const transferToken = createSettlementTransfer({
@@ -523,7 +614,7 @@ export default {
const paymentRows = this.paymentDialog.rows;
if (paymentRows.length > 1) {
if (paymentRows.some(row => Number(row.appliedAmount || 0) <= 0))
return this.$message.warning('请输入各正式结算单的申请付款金额');
return this.$message.warning('请输入各付款结算单的申请付款金额');
if (paymentRows.some(row => Number(row.appliedAmount) > this.paymentRemaining(row)))
return this.$message.warning('申请付款金额不能超过剩余可申请金额');
} else if (Number(this.paymentDialog.form.appliedAmount || 0) <= 0) {
@@ -559,9 +650,11 @@ export default {
win.document.write(
`<!doctype html><html><head><title>${
row.formalSettlementNo
}</title><style>body{font-family:Arial,"Microsoft YaHei",sans-serif;padding:32px;color:#222}h1{text-align:center}.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px 28px;margin-top:30px}.item{border-bottom:1px solid #ddd;padding:8px 0}.actions{text-align:center;margin-top:36px}@media print{.actions{display:none}}</style></head><body><h1>正式结算单</h1><div class="grid"><div class="item">结算单号:${this.escapeHtml(
}</title><style>body{font-family:Arial,"Microsoft YaHei",sans-serif;padding:32px;color:#222}h1{text-align:center}.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px 28px;margin-top:30px}.item{border-bottom:1px solid #ddd;padding:8px 0}.actions{text-align:center;margin-top:36px}@media print{.actions{display:none}}</style></head><body><h1>${this.escapeHtml(
settlementBillLabel(row.settlementType || this.activeSettlementType)
)}</h1><div class="grid"><div class="item">结算单号:${this.escapeHtml(
row.formalSettlementNo
)}</div><div class="item">预结算单号:${this.escapeHtml(
)}</div><div class="item">预付结算单号:${this.escapeHtml(
row.preSettlementNos
)}</div><div class="item">项目:${this.escapeHtml(
row.projectName
@@ -586,12 +679,15 @@ export default {
const params = this.buildQueryParams();
if (this.selection.length) params.ids = this.selection.map(item => item.id).join(',');
const { data } = await api.exportList(params);
downloadFile(data, `正式结算单${this.$dayjs().format('YYYY-MM-DD HH-mm-ss')}.xlsx`);
downloadFile(
data,
`${this.billLabel}${this.$dayjs().format('YYYY-MM-DD HH-mm-ss')}.xlsx`
);
},
buildQueryParams() {
// 所属组织级联返回 id 路径,转成组织名称传给后端(用副本,避免污染搜索框回显)
const params = this.normalizeOrganizationSearch({ ...this.query }, 'deptName');
params.settlementType = this.activeSettlementType;
params.settlementType = this.lockedSettlementType || this.activeSettlementType;
const range = params.createDateRange || [];
delete params.createDateRange;
if (range.length === 2) {
@@ -0,0 +1,12 @@
<template>
<formal-settlement locked-settlement-type="payable" />
</template>
<script>
import FormalSettlement from './formal-settlement.vue';
export default {
name: 'PaymentSettlement',
components: { FormalSettlement },
};
</script>
+2 -2
View File
@@ -1,7 +1,7 @@
<template>
<basic-container class="pre-settlement-form-page">
<div class="pre-settlement-form-page__title">{{ pageTitle }}</div>
<!-- 新增来源明细可直接调整:计费试算走独立接口,调整结果先暂存,保存预结算单时再落库。 -->
<!-- 新增来源明细可直接调整:计费试算走独立接口,调整结果先暂存,保存预付结算单时再落库。 -->
<pre-settlement-editor
v-model="editorVisible"
page-mode
@@ -31,7 +31,7 @@ export default {
return this.$route.query.id || '';
},
pageTitle() {
return this.recordId || this.savedRecordId ? '编辑预结算' : '新增预结算';
return this.recordId || this.savedRecordId ? '编辑预付结算单' : '新增预付结算单';
},
},
watch: {
@@ -1,7 +1,7 @@
<template>
<mk-public-shell biz-type="pre-settlement" :get-form="getForm">
<basic-container>
<div class="mk-public-form-title">查看预结算</div>
<div class="mk-public-form-title">查看预付结算单</div>
<pre-settlement-editor
ref="page"
:model-value="true"
+26 -20
View File
@@ -446,13 +446,13 @@ export default {
openCreate() {
this.$router.push({
path: '/settlement/pre-settlement/form',
query: { mode: 'add', name: '新增预结算' },
query: { mode: 'add', name: '新增预付结算单' },
});
},
openEdit(row) {
this.$router.push({
path: '/settlement/pre-settlement/form',
query: { mode: 'edit', id: row.id, name: '编辑预结算' },
query: { mode: 'edit', id: row.id, name: '编辑预付结算单' },
});
},
openView(row) {
@@ -465,7 +465,7 @@ export default {
const records = data?.data?.records || [];
const row = records.find(item => item.preSettlementNo === preSettlementNo);
if (!row) {
this.$message.warning('未找到对应的预结算单');
this.$message.warning('未找到对应的预付结算单');
return;
}
this.openView(row);
@@ -474,30 +474,30 @@ export default {
return ['draft', 'returned'].includes(row.approvalStatus);
},
async handleDelete(row) {
await this.$confirm('确认删除该预结算草稿?', '提示', { type: 'warning' });
await this.$confirm('确认删除该预付结算单草稿?', '提示', { type: 'warning' });
await remove(row.id);
this.$message.success('删除成功');
this.loadTable();
},
selectedOne(operationName) {
if (this.selection.length !== 1) {
this.$message.warning(`${operationName}需选择一条预结算单`);
this.$message.warning(`${operationName}需选择一条预付结算单`);
return null;
}
return this.selection[0];
},
handleAdvanceApplication() {
if (!this.selection.length) {
this.$message.warning('请选择需要发起预付申请的预结算单');
this.$message.warning('请选择需要发起预付申请的预付结算单');
return;
}
if (this.selection.some(row => !row.contractId)) {
this.$message.warning('所选预结算单缺少合同ID,无法发起预付申请');
this.$message.warning('所选预付结算单缺少合同ID,无法发起预付申请');
return;
}
const contractIds = new Set(this.selection.map(row => String(row.contractId)));
if (contractIds.size > 1) {
this.$message.warning('预付申请只能选择同一合同下的预结算单');
this.$message.warning('预付申请只能选择同一合同下的预付结算单');
return;
}
if (
@@ -508,7 +508,7 @@ export default {
row.formalSettlementNo
)
) {
this.$message.warning('仅审批通过、未转正式结算的应付预结算单可发起预付');
this.$message.warning('仅审批通过、未转付款结算的应付预付结算单可发起预付');
return;
}
const sourcePreSettlements = this.selection.map(row => ({
@@ -533,11 +533,11 @@ export default {
},
handleFormalSettlement() {
if (!this.selection.length) {
this.$message.warning('请选择需要转正式结算的预结算单');
this.$message.warning('请选择需要转付款结算的预付结算单');
return;
}
if (this.selection.some(row => row.approvalStatus !== 'approved')) {
this.$message.warning('仅审核通过的预结算单可转正式结算');
this.$message.warning('仅审核通过的预付结算单可转付款结算');
return;
}
const hasCompleteProjectIds = this.selection.every(
@@ -549,7 +549,7 @@ export default {
)
);
if (projectKeys.size > 1) {
this.$message.warning('尾款结算只能选择同一项目下的预结算单');
this.$message.warning('尾款结算只能选择同一项目下的预付结算单');
return;
}
const transferToken = createSettlementTransfer({
@@ -560,14 +560,20 @@ export default {
});
this.$router.push({
path: '/settlement/formal-settlement/form',
query: { mode: 'add', name: '新增正式结算', transferToken },
query: {
mode: 'add',
name: '新增付款结算单',
settlementType: 'payable',
listPath: '/settlement/payment-settlement',
transferToken,
},
});
},
async openPrintDialog() {
const row = this.selectedOne('打印结算单');
if (!row) return;
if (row.approvalStatus === 'voided') {
this.$message.warning('已作废的预结算单不能打印');
this.$message.warning('已作废的预付结算单不能打印');
return;
}
this.printDialog.row = row;
@@ -622,8 +628,8 @@ export default {
)
.join('');
return `<!doctype html><html><head><meta charset="utf-8"><title>${this.escapeHtml(
detail.preSettlementNo || '预结算单'
)}</title><style>body{font-family:Arial,"Microsoft YaHei",sans-serif;color:#222;padding:28px}h1{text-align:center;font-size:24px}.meta{display:grid;grid-template-columns:repeat(3,1fr);gap:14px 24px;margin:24px 0}.meta div{border-bottom:1px solid #ddd;padding:7px 0}table{width:100%;border-collapse:collapse;margin-top:16px}th,td{border:1px solid #bbb;padding:9px;text-align:center;font-size:13px}th{background:#f5f5f5}.actions{text-align:center;margin-top:24px}@media print{.actions{display:none}}</style></head><body><h1>预结算单</h1><div class="meta"><div>预结算单号:${this.escapeHtml(
detail.preSettlementNo || '预付结算单'
)}</title><style>body{font-family:Arial,"Microsoft YaHei",sans-serif;color:#222;padding:28px}h1{text-align:center;font-size:24px}.meta{display:grid;grid-template-columns:repeat(3,1fr);gap:14px 24px;margin:24px 0}.meta div{border-bottom:1px solid #ddd;padding:7px 0}table{width:100%;border-collapse:collapse;margin-top:16px}th,td{border:1px solid #bbb;padding:9px;text-align:center;font-size:13px}th{background:#f5f5f5}.actions{text-align:center;margin-top:24px}@media print{.actions{display:none}}</style></head><body><h1>预付结算单</h1><div class="meta"><div>预付结算单号:${this.escapeHtml(
detail.preSettlementNo
)}</div><div>项目名称:${this.escapeHtml(
detail.projectName
@@ -651,7 +657,7 @@ export default {
const params = this.buildQuery();
if (this.selection.length) params.ids = this.selection.map(item => item.id).join(',');
const { data } = await exportList(params);
downloadFile(data, `预结算单${this.$dayjs().format('YYYY-MM-DD HH-mm-ss')}.xlsx`);
downloadFile(data, `预付结算单${this.$dayjs().format('YYYY-MM-DD HH-mm-ss')}.xlsx`);
},
async handleSubmit(row) {
const previousApprovalStatus = row.approvalStatus || '';
@@ -668,7 +674,7 @@ export default {
},
handleMkAudit(row) {
if (!row?.id) {
this.$message.warning('预结算单ID为空,无法打开审核页');
this.$message.warning('预付结算单ID为空,无法打开审核页');
return;
}
getMKApprovalUrl({ bizId: String(row.id) })
@@ -685,7 +691,7 @@ export default {
});
},
async handleApprove(row) {
await this.$confirm('确认审批通过该预结算单?', '提示', { type: 'warning' });
await this.$confirm('确认审批通过该预付结算单?', '提示', { type: 'warning' });
await approve({ id: row.id });
this.$message.success('审批通过');
this.loadTable();
@@ -700,7 +706,7 @@ export default {
this.loadTable();
},
async handleVoid(row) {
const { value } = await this.$prompt('请输入作废原因', '作废预结算单', {
const { value } = await this.$prompt('请输入作废原因', '作废预付结算单', {
inputType: 'textarea',
inputValidator: value => Boolean(value?.trim()) || '请输入作废原因',
});
@@ -0,0 +1,12 @@
<template>
<formal-settlement locked-settlement-type="receivable" />
</template>
<script>
import FormalSettlement from './formal-settlement.vue';
export default {
name: 'ReceiptSettlement',
components: { FormalSettlement },
};
</script>
@@ -54,9 +54,11 @@
</div>
<el-table
ref="mainTableRef"
v-loading="loading"
:data="rows"
:size="tableSize"
:height="listTableHeight"
border
class="settlement-detail-page__table"
@selection-change="selectionChange"
@@ -146,7 +148,21 @@
show-overflow-tooltip
>
<template #default="{ row }">
{{ formatFeeDetailCell(row, column.prop) }}
<div
v-if="isFreightFeeColumn(column)"
class="settlement-detail-page__billing-rule-cell"
>
<span>{{ formatFeeDetailCell(row, column.prop) }}</span>
<el-icon
v-if="hasBillingRule(row)"
class="settlement-detail-page__billing-rule-icon"
title="查看计费规则详情"
@click.stop="openBillingRuleInfo(row)"
>
<InfoFilled />
</el-icon>
</div>
<span v-else>{{ formatFeeDetailCell(row, column.prop) }}</span>
</template>
</el-table-column>
</el-table>
@@ -934,11 +950,70 @@
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="billingRuleDialog.visible"
title="计费规则详情"
width="720px"
append-to-body
destroy-on-close
>
<template v-if="billingRuleDialog.rule">
<div class="dialog-section-title">计费规则</div>
<el-descriptions :column="2" border class="settlement-detail-page__billing-rule-detail">
<el-descriptions-item label="费用项">
{{ displayValue(billingRuleDialog.rule.feeItem) }}
</el-descriptions-item>
<el-descriptions-item label="计费要素">
{{ displayValue(billingRuleDialog.rule.billingElement) }}
</el-descriptions-item>
<el-descriptions-item label="计费类型">
{{ displayValue(billingRuleDialog.rule.billingType) }}
</el-descriptions-item>
<el-descriptions-item label="计费单位">
{{ displayValue(billingRuleDialog.rule.billingUnit) }}
</el-descriptions-item>
<el-descriptions-item label="单价">
{{ displayValue(billingRuleDialog.rule.unitPrice) }}
</el-descriptions-item>
<el-descriptions-item label="最低计费量">
{{ displayValue(billingRuleDialog.rule.minimumBillingWeight) }}
</el-descriptions-item>
<el-descriptions-item label="计费区间">
{{ billingRuleRanges(billingRuleDialog.rule) }}
</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">
{{ displayValue(billingRuleDialog.rule.remark) }}
</el-descriptions-item>
</el-descriptions>
<div class="dialog-section-title settlement-detail-page__billing-rule-match-title">
匹配条件
</div>
<el-descriptions :column="2" border class="settlement-detail-page__billing-rule-detail">
<el-descriptions-item label="起运地">
{{ displayValue(billingRuleDialog.rule.matchCondition.origin) }}
</el-descriptions-item>
<el-descriptions-item label="目的地">
{{ displayValue(billingRuleDialog.rule.matchCondition.destination) }}
</el-descriptions-item>
<el-descriptions-item label="货物名称">
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoName) }}
</el-descriptions-item>
<el-descriptions-item label="货物类型">
{{ displayValue(billingRuleDialog.rule.matchCondition.cargoType) }}
</el-descriptions-item>
</el-descriptions>
</template>
<el-empty v-else description="暂无计费规则详情" />
<template #footer>
<el-button type="primary" @click="billingRuleDialog.visible = false">关闭</el-button>
</template>
</el-dialog>
</basic-container>
</template>
<script>
import { ArrowDown, ArrowUp, Close } from '@element-plus/icons-vue';
import { ArrowDown, ArrowUp, Close, InfoFilled } from '@element-plus/icons-vue';
import {
changeRecordColumns,
feeDetailBaseColumns,
@@ -990,7 +1065,7 @@ const ADJUST_BILLING_TYPE_MAP = {
};
export default {
components: { SettlementTableTools },
components: { SettlementTableTools, InfoFilled },
props: {
settlementType: {
type: String,
@@ -1002,6 +1077,7 @@ export default {
ArrowDown,
ArrowUp,
Close,
InfoFilled,
searchFields,
tableColumns,
tableFeeItemNames: [],
@@ -1018,6 +1094,8 @@ export default {
rows: [],
selection: [],
page: { current: 1, size: 10, total: 0 },
// 底部详情/调整面板打开时压缩主表高度,露出表格滚动条
listTableHeight: undefined,
detailDialog: {
visible: false,
title: '费用明细',
@@ -1027,6 +1105,10 @@ export default {
},
feeRows: [],
dynamicFeeColumns: [],
billingRuleDialog: {
visible: false,
rule: null,
},
adjustDialog: { visible: false, loading: false, submitting: false, row: null },
adjustRows: [],
adjustDynamicFeeColumns: [],
@@ -1210,11 +1292,28 @@ export default {
transportCargoTypeOptions() {
return this.cargoTypeOptions.filter(item => item.children?.length);
},
/** 底部单据详情或调整面板是否展开(与 teleport 面板显示条件一致) */
isBottomPanelOpen() {
return Boolean(this.detailDialog.visible || this.adjustDialog.visible);
},
},
watch: {
'$route.fullPath'() {
this.openRouteDetail();
},
isBottomPanelOpen() {
this.$nextTick(() => this.updateListTableHeight());
},
searchVisible() {
if (this.isBottomPanelOpen) {
this.$nextTick(() => this.updateListTableHeight());
}
},
searchExpanded() {
if (this.isBottomPanelOpen) {
this.$nextTick(() => this.updateListTableHeight());
}
},
displayTableColumns: {
immediate: true,
handler(columns) {
@@ -1238,6 +1337,7 @@ export default {
},
},
async mounted() {
window.addEventListener('resize', this.updateListTableHeight);
this.loadTransportTypeOptions();
this.loadCargoTypeOptions();
this.loadPriceUnitOptions();
@@ -1249,6 +1349,7 @@ export default {
this.closeInnerDialogs();
},
beforeUnmount() {
window.removeEventListener('resize', this.updateListTableHeight);
this.closeInnerDialogs();
},
methods: {
@@ -1262,6 +1363,26 @@ export default {
this.previewDialog.visible = false;
this.generateContractDialog.visible = false;
},
/** 底部面板打开时按剩余视口压缩主表高度,关闭后恢复自适应 */
updateListTableHeight() {
if (!this.isBottomPanelOpen) {
this.listTableHeight = undefined;
this.$nextTick(() => this.$refs.mainTableRef?.doLayout?.());
return;
}
const tablePanel = this.$el?.querySelector?.('.settlement-detail-page__table-panel');
const toolbar = tablePanel?.querySelector('.settlement-detail-page__toolbar');
const pagination = tablePanel?.querySelector('.settlement-detail-page__pagination');
const panelTop = tablePanel?.getBoundingClientRect?.()?.top ?? 200;
const toolbarHeight = toolbar?.offsetHeight ?? 56;
const paginationHeight = pagination?.offsetHeight ?? 64;
// 与 .settlement-detail-page__detail-panel 的 max-height: min(60vh, 560px) 对齐
const bottomPanelHeight = Math.min(window.innerHeight * 0.6, 560);
const available =
window.innerHeight - panelTop - toolbarHeight - paginationHeight - bottomPanelHeight - 8;
this.listTableHeight = Math.max(180, Math.floor(available));
this.$nextTick(() => this.$refs.mainTableRef?.doLayout?.());
},
contractCategoryName(value) {
return (
this.contractCategoryOptions.find(item => String(item.value) === String(value))?.label ||
@@ -1690,6 +1811,8 @@ export default {
this.detailDialog.visible = false;
this.detailDialog.row = null;
this.changeRecordsDialog.visible = false;
this.billingRuleDialog.visible = false;
this.billingRuleDialog.rule = null;
},
closeAdjustPanel() {
this.clearAdjustCalculations();
@@ -1934,6 +2057,108 @@ export default {
isFreightFeeItem(name) {
return String(name || '').includes('运费') || String(name || '').includes('运输费');
},
isFreightFeeColumn(column = {}) {
return (
column.prop === 'freightAmount' ||
this.isFreightFeeItem(column.label) ||
this.isFreightFeeItem(column.feeItemName)
);
},
hasBillingRule(row) {
const rule = this.normalizeBillingRule(row);
return Boolean(
rule.feeItem ||
rule.billingElement ||
rule.billingType ||
rule.unitPrice ||
rule.rules?.length ||
rule.matchCondition?.origin ||
rule.matchCondition?.destination ||
rule.matchCondition?.cargoName ||
rule.matchCondition?.cargoType
);
},
openBillingRuleInfo(row) {
this.billingRuleDialog.rule = this.normalizeBillingRule(row);
this.billingRuleDialog.visible = true;
},
normalizeBillingRule(row) {
const source = row || {};
const nested = [
source.billingRule,
source.billingRuleInfo,
source.billingRuleJson,
source.billingRulesJson,
source.billingRules,
source.billingPlanRule,
source.feeRule,
source.rule,
].find(value => value !== undefined && value !== null && value !== '');
const parsedNested = this.parseJsonValue(nested);
const matchedRules = Array.isArray(parsedNested)
? parsedNested.filter(item => item && typeof item === 'object')
: [];
let rule = this.parseObject(matchedRules[0] || parsedNested || nested);
if (!Object.keys(rule).length && typeof nested === 'string') rule = { name: nested };
const matchCondition = this.parseObject(
source.matchCondition ?? source.billingMatchCondition ?? rule.matchCondition
);
return {
...rule,
feeItem: source.billingFeeItem || source.feeItem || rule.feeItem,
billingElement:
source.billingElement ||
source.billingFactor ||
rule.billingElement ||
rule.billingFactor,
billingType: source.billingType || rule.billingType,
billingUnit: source.billingUnit || source.priceUnit || rule.billingUnit || rule.priceUnit,
unitPrice: source.billingUnitPrice ?? source.unitPrice ?? rule.unitPrice,
minimumBillingWeight:
source.minimumBillingWeight ?? rule.minimumBillingWeight ?? rule.lowerLimit,
remark: source.billingRuleRemark || source.ruleRemark || rule.remark,
rules: matchedRules,
matchCondition: {
...matchCondition,
origin: matchCondition.origin || matchCondition.originName,
destination: matchCondition.destination || matchCondition.destinationName,
cargoName:
matchCondition.cargoName ||
matchCondition.cargoNameLabel ||
source.cargoName ||
rule.cargoName,
cargoType: matchCondition.cargoType || matchCondition.cargoTypeName,
},
};
},
billingRuleRanges(rule) {
const ranges = Array.isArray(rule?.limitRanges) ? rule.limitRanges : [];
if (ranges.length) {
return ranges
.map(
item => `${item.lowerLimit ?? '-'}~${item.upperLimit ?? '-'}:${item.unitPrice ?? '-'}`
)
.join(';');
}
if (rule?.lowerLimit !== undefined || rule?.upperLimit !== undefined) {
return `${rule.lowerLimit ?? '-'}~${rule.upperLimit ?? '-'}`;
}
return '-';
},
parseJsonValue(value) {
if (value === undefined || value === null || value === '') return null;
if (typeof value === 'object') return value;
if (typeof value !== 'string') return value;
try {
return JSON.parse(value);
} catch (error) {
return value;
}
},
parseObject(value) {
const parsed = this.parseJsonValue(value);
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
},
async saveAdjustFee() {
if (!this.adjustRows.length || !this.adjustDialog.row) {
this.$message.warning('没有可调整的费用明细');
@@ -3011,6 +3236,28 @@ export default {
padding-top: 16px;
}
.settlement-detail-page__billing-rule-cell {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
max-width: 100%;
}
.settlement-detail-page__billing-rule-icon {
flex: 0 0 auto;
color: var(--el-color-primary);
cursor: pointer;
}
.settlement-detail-page__billing-rule-detail {
margin-top: 12px;
}
.settlement-detail-page__billing-rule-match-title {
margin-top: 20px;
}
@media screen and (max-width: 992px) {
.settlement-detail-page__detail-panel {
left: 0;