From 4b44783dfbc0ab21b8970cce25fddfc1cfffeafb Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 23 四月 2026 16:47:20 +0800
Subject: [PATCH] fix: 回款登记加上合计数据
---
src/views/salesManagement/receiptPaymentLedger/index.vue | 125 ++++++++++++++++++++++++++---------------
1 files changed, 79 insertions(+), 46 deletions(-)
diff --git a/src/views/salesManagement/receiptPaymentLedger/index.vue b/src/views/salesManagement/receiptPaymentLedger/index.vue
index 2cec625..30ca600 100644
--- a/src/views/salesManagement/receiptPaymentLedger/index.vue
+++ b/src/views/salesManagement/receiptPaymentLedger/index.vue
@@ -16,7 +16,7 @@
>
</div>
</div>
- <div style="display: flex">
+ <div class="ledger-content">
<div class="table_list">
<el-table
:data="tableData"
@@ -27,38 +27,39 @@
:summary-method="summarizeMainTable"
@row-click="rowClickMethod"
height="calc(100vh - 18.5em)"
+ style="width: 100%"
>
<el-table-column
align="center"
label="搴忓彿"
type="index"
- width="60"
+ min-width="60"
/>
<el-table-column
label="瀹㈡埛鍚嶇О"
prop="customerName"
show-overflow-tooltip
- width="200"
+ min-width="200"
/>
<el-table-column
- label="寮�绁ㄩ噾棰�(鍏�)"
+ label="鍚堝悓閲戦(鍏�)"
prop="invoiceTotal"
show-overflow-tooltip
:formatter="formattedNumber"
- width="200"
+ min-width="200"
/>
<el-table-column
label="鍥炴閲戦(鍏�)"
prop="receiptPaymentAmount"
show-overflow-tooltip
:formatter="formattedNumber"
- width="200"
+ min-width="200"
/>
<el-table-column
label="搴旀敹閲戦(鍏�)"
prop="unReceiptPaymentAmount"
show-overflow-tooltip
- width="200"
+ min-width="200"
>
<template #default="{ row, column }">
<el-text type="danger">
@@ -84,54 +85,53 @@
show-summary
:summary-method="summarizeMainTable1"
height="calc(100vh - 18.5em)"
+ style="width: 100%"
>
<el-table-column
align="center"
label="搴忓彿"
type="index"
- width="60"
+ min-width="60"
/>
<el-table-column
label="鍙戠敓鏃ユ湡"
- prop="happenTime"
+ prop="receiptPaymentDate"
show-overflow-tooltip
- width="110"
+ min-width="110"
/>
<el-table-column
- label="寮�绁ㄩ噾棰�(鍏�)"
- prop="invoiceAmount"
+ label="閿�鍞悎鍚屽彿"
+ prop="salesContractNo"
+ show-overflow-tooltip
+ min-width="200"
+ />
+ <el-table-column
+ label="鍚堝悓閲戦(鍏�)"
+ prop="invoiceTotal"
show-overflow-tooltip
:formatter="formattedNumber"
- width="200"
+ min-width="200"
/>
<el-table-column
label="鍥炴閲戦(鍏�)"
- prop="receiptAmount"
+ prop="receiptPaymentAmount"
show-overflow-tooltip
:formatter="formattedNumber"
- width="200"
+ min-width="200"
/>
<el-table-column
label="搴旀敹閲戦(鍏�)"
- prop="unReceiptAmount"
+ prop="unReceiptPaymentAmount"
show-overflow-tooltip
- width="200"
+ min-width="200"
>
<template #default="{ row, column }">
<el-text type="danger">
- {{ formattedNumber(row, column, row.unReceiptAmount) }}
+ {{ formattedNumber(row, column, row.unReceiptPaymentAmount) }}
</el-text>
</template>
</el-table-column>
</el-table>
- <pagination
- v-show="recordTotal > 0"
- :total="recordTotal"
- layout="total, sizes, prev, pager, next, jumper"
- :page="recordPage.current"
- :limit="recordPage.size"
- @pagination="recordPaginationChange"
- />
</div>
</div>
</div>
@@ -172,7 +172,6 @@
getList();
};
const paginationChange = (obj) => {
- console.log("paginationChange", current, limit);
page.current = obj.page;
page.size = obj.limit;
getList();
@@ -191,7 +190,8 @@
});
};
const formattedNumber = (row, column, cellValue) => {
- return parseFloat(cellValue).toFixed(2);
+ const num = Number(cellValue);
+ return Number.isFinite(num) ? num.toFixed(2) : "0.00";
};
// 涓昏〃鍚堣鏂规硶
const summarizeMainTable = (param) => {
@@ -206,25 +206,52 @@
};
// 瀛愯〃鍚堣鏂规硶
const summarizeMainTable1 = (param) => {
- var summarizeTable = proxy.summarizeTable(
- param,
- ["invoiceAmount", "receiptAmount", "unReceiptAmount"],
- {
- ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
- futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ const toNum = (v) => {
+ const n = Number(v);
+ return Number.isFinite(n) ? n : 0;
+ };
+
+ // 浠ュ彸渚у綋鍓嶅睍绀烘暟鎹负鍑�
+ const rows = receiptRecord.value || [];
+
+ // 鍚堝悓閲戦鎸夐攢鍞悎鍚屽彿鍘婚噸
+ const invoiceByContract = new Map();
+ for (const row of rows) {
+ const contractNo = row?.salesContractNo;
+ if (!contractNo) continue;
+ if (!invoiceByContract.has(contractNo)) {
+ invoiceByContract.set(contractNo, toNum(row?.invoiceTotal));
}
- );
- // 鍙栨渶鍚庝竴琛屾暟鎹�;
- if (receiptRecord.value?.length > 0) {
- const index = tableData.value.findIndex(
- (item) => item.id == customerId.value
- );
- summarizeTable[summarizeTable.length - 1] =
- tableData.value[index].unReceiptPaymentAmount.toFixed(2);
- } else {
- summarizeTable[summarizeTable.length - 1] = 0.0;
}
- return summarizeTable;
+ const invoiceTotal = Array.from(invoiceByContract.values()).reduce(
+ (sum, val) => sum + val,
+ 0
+ );
+
+ // 鍥炴閲戦姝e父姹傚拰
+ const receiptTotal = rows.reduce(
+ (sum, row) => sum + toNum(row?.receiptPaymentAmount),
+ 0
+ );
+
+ // 搴旀敹閲戦淇濇寔涓昏〃褰撳墠瀹㈡埛鍙e緞
+ let unReceiptTotal = 0;
+ if (rows.length > 0) {
+ const index = tableData.value.findIndex((item) => item.id == customerId.value);
+ if (index > -1) {
+ unReceiptTotal = toNum(tableData.value[index]?.unReceiptPaymentAmount);
+ }
+ }
+
+ const columns = param?.columns || [];
+ return columns.map((column, index) => {
+ if (index === 0) return "鍚堣";
+ const prop = column?.property ?? column?.prop;
+ if (prop === "invoiceTotal") return invoiceTotal.toFixed(2);
+ if (prop === "receiptPaymentAmount") return receiptTotal.toFixed(2);
+ if (prop === "unReceiptPaymentAmount") return unReceiptTotal.toFixed(2);
+ return "";
+ });
};
const receiptPaymentList = (id) => {
@@ -265,7 +292,13 @@
</script>
<style scoped lang="scss">
+.ledger-content {
+ display: flex;
+ gap: 12px;
+}
+
.table_list {
- width: 50%;
+ flex: 1;
+ min-width: 0;
}
</style>
--
Gitblit v1.9.3