From d88f32029be10190a95dce8958398e806c19b26a Mon Sep 17 00:00:00 2001
From: sen <sen@qq.com>
Date: 星期三, 14 一月 2026 18:01:33 +0800
Subject: [PATCH] 资金流水界面修改
---
ui/admin-ui3/src/components/GenerateBillDialog/index.vue | 156 ++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 121 insertions(+), 35 deletions(-)
diff --git a/ui/admin-ui3/src/components/GenerateBillDialog/index.vue b/ui/admin-ui3/src/components/GenerateBillDialog/index.vue
index d921c00..7fee583 100644
--- a/ui/admin-ui3/src/components/GenerateBillDialog/index.vue
+++ b/ui/admin-ui3/src/components/GenerateBillDialog/index.vue
@@ -1,7 +1,8 @@
<template>
- <el-dialog v-model="visible" title="鐢熸垚搴旀敹璐﹀崟" width="1000px" destroy-on-close @closed="handleClosed">
+ <el-dialog v-model="visible" :title="type === 'receivable' ? '鐢熸垚搴旀敹璐﹀崟' : '鐢熸垚搴斾粯璐﹀崟'" width="1000px" destroy-on-close
+ @closed="handleClosed">
<div class="dialog-content">
- <h3 class="section-title">鏄惁鏍规嵁浠ヤ笅鏁版嵁鐢熸垚搴旀敹璐﹀崟</h3>
+ <h3 class="section-title">鏄惁鏍规嵁浠ヤ笅鏁版嵁鐢熸垚{{ type === 'receivable' ? '搴旀敹' : '搴斾粯' }}璐﹀崟</h3>
<el-form :model="formData" ref="formRef" label-position="left" label-width="80px">
<el-row :gutter="20">
@@ -23,53 +24,58 @@
</el-col>
</el-row>
</el-form>
+
<el-descriptions :column="3" border class="mb-6">
- <el-descriptions-item label="鍗曟嵁鏁伴噺">
- {{ statistics.documentCount }}
+ <el-descriptions-item label="鍗曟嵁鏁伴噺">{{ statistics.documentCount }}</el-descriptions-item>
+
+ <el-descriptions-item label="姹囩巼 (娓竵鍏戜汉姘戝竵)">{{ statistics.rate }}</el-descriptions-item>
+ <el-descriptions-item label="姹囩巼 (浜烘皯甯佸厬娓竵)">{{ statistics.rateRmb }}</el-descriptions-item>
+
+
+ <el-descriptions-item :label="type === 'receivable' ? '搴旀敹浜烘皯甯�' : '搴斾粯浜烘皯甯�'">
+ <span class="text-bold">{{ statistics.receivable }}</span>
</el-descriptions-item>
- <el-descriptions-item label="姹囩巼 (娓竵鍏戜汉姘戝竵)">
- {{ statistics.rate }}
+ <el-descriptions-item :label="type === 'receivable' ? '搴旀敹娓竵' : '搴斾粯娓竵'">
+ <span class="text-bold">{{ statistics.amountReceivable }}</span>
</el-descriptions-item>
- <!-- <el-descriptions-item label="姹囩巼 (浜烘皯甯佸厬娓竵)">
- {{ statistics.rateInverse || '-' }}
- </el-descriptions-item> -->
- <el-descriptions-item label="搴旀敹閲戦">
- <span class="text-bold">{{ statistics.totalReceivableAmount }}</span>
- </el-descriptions-item>
- <el-descriptions-item label="搴旀敹閲戦 (浠ヤ汉姘戝竵璁�)">
+ <el-descriptions-item :label="(type === 'receivable' ? '搴旀敹鎬婚噾棰�' : '搴斾粯鎬婚噾棰�') + ' (浠ヤ汉姘戝竵璁�)'">
<span class="text-primary">{{ statistics.totalAmountRmb }}</span>
</el-descriptions-item>
- <el-descriptions-item label="搴旀敹閲戦 (浠ユ腐甯佽)">
+
+ <el-descriptions-item :label="(type === 'receivable' ? '搴旀敹鎬婚噾棰�' : '搴斾粯鎬婚噾棰�') + ' (浠ユ腐甯佽)'">
<span class="text-success">{{ statistics.totalAmountHkd }}</span>
</el-descriptions-item>
+
+
</el-descriptions>
<div class="table-header">
<h3 class="section-title">璐﹀崟鏄庣粏</h3>
</div>
<el-table :data="detailList" border stripe height="300px" style="width: 100%">
- <el-table-column prop="systemNo" label="绯荤粺缂栧彿" width="120" />
- <el-table-column prop="sourceSystem" label="鏉ユ簮绯荤粺" width="120">
+ <el-table-column prop="systemNo" align="center" label="绯荤粺缂栧彿" width="140" />
+ <el-table-column prop="sourceSystem" align="center" label="鏉ユ簮绯荤粺" width="120">
<template #default="scope">
{{ dictFormat(sys_system, scope.row.sourceSystem) }}
</template>
- </el-table-column><!-- sys_system -->
- <el-table-column prop="businessSector" label="涓氬姟鏉垮潡" width="120">
+ </el-table-column>
+ <el-table-column prop="businessSector" align="center" label="涓氬姟鏉垮潡" width="120">
<template #default="scope">
{{ dictFormat(sys_business, scope.row.businessSector) }}
</template>
</el-table-column>
- <!-- sys_business -->
- <el-table-column prop="documentType" label="鍗曟嵁绫诲瀷" width="120">
+ <el-table-column prop="documentType" align="center" label="鍗曟嵁绫诲瀷" width="120">
<template #default="scope">
{{ dictFormat(sys_receipts, scope.row.documentType) }}
</template>
- </el-table-column><!-- sys_receipts -->
- <el-table-column prop="documentNo" label="鍗曟嵁缂栧彿" width="150" />
- <el-table-column prop="customerName" label="瀹㈡埛鍚嶇О" width="150" />
- <el-table-column prop="projectName" label="椤圭洰鍚嶇О" width="150" />
- <el-table-column prop="receivableAmount" label="搴旀敹閲戦" align="right" />
- <el-table-column prop="currency" label="甯佸埗" width="100">
+ </el-table-column>
+ <el-table-column prop="documentNo" align="center" label="鍗曟嵁缂栧彿" width="150" />
+ <el-table-column :prop="type === 'receivable' ? 'customerName' : 'supplierName'" align="center"
+ :label="type === 'receivable' ? '瀹㈡埛鍚嶇О' : '渚涘簲鍟嗗悕绉�'" width="150" />
+ <el-table-column prop="projectName" align="center" label="椤圭洰鍚嶇О" width="150" />
+ <el-table-column :prop="type === 'receivable' ? 'receivableAmount' : 'payableAmount'" align="center"
+ :label="type === 'receivable' ? '搴旀敹閲戦' : '搴斾粯閲戦'" />
+ <el-table-column prop="currency" align="center" label="甯佸埗" width="100">
<template #default="scope">
{{ dictFormat(sys_currency, scope.row.currency) }}
</template>
@@ -79,7 +85,7 @@
<template #footer>
<el-button @click="cancel">鍙栨秷</el-button>
- <el-button type="primary" @click="handleConfirm" >纭鐢熸垚</el-button>
+ <el-button type="primary" @click="handleConfirm">纭鐢熸垚</el-button>
</template>
</el-dialog>
</template>
@@ -101,6 +107,8 @@
const dictFormat = (dict: any, value: any) => {
return proxy.selectDictLabel(dict, value);
}
+// 澧炲姞绫诲瀷鍖哄垎
+const type = ref<'receivable' | 'payable'>('receivable');
// 瀹氫箟鎺ュ彛缁撴瀯
interface StatisticsData {
documentCount: number;
@@ -124,19 +132,92 @@
const emit = defineEmits(['confirm']);
// 鏆撮湶缁欑埗缁勪欢鐨勬墦寮�鏂规硶
-const open = (data: any, selectionList: any[]) => {
+// 淇敼 open 鏂规硶锛屽鍔� mode 鍙傛暟
+const open = (data: any, selectionList: any[], mode: 'receivable' | 'payable' = 'receivable') => {
+ type.value = mode;
visible.value = true;
+
if (data) {
- if (data) {
- // 鍋囪 data 鐨勭粨鏋勫氨鏄� mainForm 闇�瑕佺殑缁撴瀯
- Object.assign(statistics.value, data);
- // 纭繚鍚庣杩斿洖鐨勬槑缁嗗瓧娈靛悕涓庢涓�鑷�
- if (selectionList.length > 0) {
- detailList.value = [...selectionList];
- }
+ // 1. 澶勭悊鏄庣粏鏁版嵁鎷嗗垎锛堜綘鍘熸湁鐨勯�昏緫锛�
+ let processedList = [];
+ if (selectionList && selectionList.length > 0) {
+ processedList = selectionList.flatMap(item => {
+ const amountStr = mode === 'receivable' ? item.receivableAmountStr : item.payableAmountStr;
+ if (!amountStr) return [item];
+ const amountParts = amountStr.trim().split(/\s+/);
+ return amountParts.map(part => {
+ const match = part.match(/([\d.]+)([\u4e00-\u9fa5]+)/);
+ let amount = mode === 'receivable' ? item.receivableAmount : item.payableAmount;
+ let currencyValue = item.currency;
+ if (match) {
+ amount = parseFloat(match[1]);
+ const currencyName = match[2];
+ if (currencyName.includes('浜烘皯甯�')) currencyValue = 'RMB';
+ else if (currencyName.includes('娓竵')) currencyValue = 'HKD';
+ }
+ const newItem = { ...item };
+ if (mode === 'receivable') newItem.receivableAmount = amount;
+ else newItem.payableAmount = amount;
+ newItem.currency = currencyValue;
+ return newItem;
+ });
+ });
}
+ detailList.value = processedList;
+
+ // 2. 鎵ц璁$畻閫昏緫
+ const calcRes = calculateStatistics(processedList, mode);
+
+ const rateHkdToRmb = data.rate || 0; // 娓竵鍏戜汉姘戝竵 (渚嬪 0.91)
+
+ // 璁$畻 浜烘皯甯佸厬娓竵 (1 / 0.91)锛屼繚鐣�4浣嶅皬鏁�
+ const rateRmbToHkd = rateHkdToRmb !== 0
+ ? Number((1 / rateHkdToRmb).toFixed(4))
+ : 0;
+
+ // 3. 缁勮鏈�缁堢殑 statistics 瀵硅薄
+ const currentRate = data.rate || 0;
+ statistics.value = {
+ ...data,
+ rateRmb: rateRmbToHkd,
+ ...calcRes, // 灏嗚绠楀嚭鐨� receivable 鍜� amountReceivable 鍚堝苟杩涘幓
+ // 鑷姩璁$畻鎬婚噾棰濓紙浠ヤ汉姘戝竵涓哄噯 = 浜烘皯甯侀儴鍒� + 娓竵閮ㄥ垎 * 姹囩巼锛�
+ totalAmountRmb: Number((calcRes.receivable + calcRes.amountReceivable * currentRate).toFixed(2)),
+ // 鑷姩璁$畻鎬婚噾棰濓紙浠ユ腐甯佷负鍑� = 娓竵閮ㄥ垎 + 浜烘皯甯侀儴鍒� / 姹囩巼锛�
+ totalAmountHkd: currentRate !== 0
+ ? Number((calcRes.amountReceivable + calcRes.receivable / currentRate).toFixed(2))
+ : 0
+ };
}
+};
+
+/**
+ * 璁$畻璐﹀崟缁熻鏁版嵁
+ * @param list 鎷嗗垎鍚庣殑鏄庣粏鍒楄〃
+ * @param mode 褰撳墠妯″紡锛氬簲鏀舵垨搴斾粯
+ */
+const calculateStatistics = (list: any[], mode: 'receivable' | 'payable') => {
+ let rmbTotal = 0;
+ let hkdTotal = 0;
+
+ list.forEach(item => {
+ // 鏍规嵁妯″紡纭畾鍙栧�煎瓧娈�
+ const amount = mode === 'receivable' ? item.receivableAmount : item.payableAmount;
+ const val = Number(amount) || 0;
+
+ if (item.currency === 'RMB') {
+ rmbTotal += val;
+ } else if (item.currency === 'HKD') {
+ hkdTotal += val;
+ }
+ });
+
+ // 杩斿洖璁$畻缁撴灉锛屼繚鐣欎袱浣嶅皬鏁帮紙閬垮厤娴偣璇樊锛�
+ return {
+ receivable: Number(rmbTotal.toFixed(2)), // 瀵瑰簲浣犳ā鏉夸腑鐨� statistics.receivable
+ amountReceivable: Number(hkdTotal.toFixed(2)) // 瀵瑰簲浣犳ā鏉夸腑鐨� statistics.amountReceivable
+ };
};
// 3. 纭鐢熸垚鎸夐挳閫昏緫
const handleConfirm = async () => {
@@ -208,4 +289,9 @@
width: 180px;
background-color: #f5f7fa;
}
+::v-deep .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell {
+ border: var(--el-descriptions-table-border);
+ padding: 8px 11px;
+ width: 200px;
+}
</style>
\ No newline at end of file
--
Gitblit v1.8.0