From 2aaa32f860d4f3fbda01eded1b20a7cab9d3a393 Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期三, 24 十二月 2025 10:58:20 +0800
Subject: [PATCH] 应付接口

---
 ui/admin-ui3/src/components/GenerateBillDialog/index.vue |   70 ++++++++++++++++++++++++++---------
 1 files changed, 52 insertions(+), 18 deletions(-)

diff --git a/ui/admin-ui3/src/components/GenerateBillDialog/index.vue b/ui/admin-ui3/src/components/GenerateBillDialog/index.vue
index d921c00..be29b90 100644
--- a/ui/admin-ui3/src/components/GenerateBillDialog/index.vue
+++ b/ui/admin-ui3/src/components/GenerateBillDialog/index.vue
@@ -48,28 +48,28 @@
         <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 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 prop="documentNo" align="center" label="鍗曟嵁缂栧彿" width="150" />
+        <el-table-column prop="customerName" align="center" label="瀹㈡埛鍚嶇О" width="150" />
+        <el-table-column prop="projectName" align="center" label="椤圭洰鍚嶇О" width="150" />
+        <el-table-column prop="receivableAmount" align="center" label="搴旀敹閲戦" />
+        <el-table-column prop="currency" align="center" label="甯佸埗" width="100">
           <template #default="scope">
             {{ dictFormat(sys_currency, scope.row.currency) }}
           </template>
@@ -79,7 +79,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>
@@ -127,15 +127,49 @@
 const open = (data: any, selectionList: any[]) => {
   visible.value = true;
   if (data) {
-    if (data) {
-      // 鍋囪 data 鐨勭粨鏋勫氨鏄� mainForm 闇�瑕佺殑缁撴瀯
-      Object.assign(statistics.value, data);
-      // 纭繚鍚庣杩斿洖鐨勬槑缁嗗瓧娈靛悕涓庢涓�鑷�
-      if (selectionList.length > 0) {
-        detailList.value = [...selectionList];
-      }
-    }
+    Object.assign(statistics.value, data);
 
+    if (selectionList && selectionList.length > 0) {
+      detailList.value = selectionList.flatMap(item => {
+        if (!item.receivableAmountStr) return [item];
+
+        // 1. 鎷嗗垎澶氫釜甯佺瀛楃涓�
+        const amountParts = item.receivableAmountStr.trim().split(/\s+/);
+
+        return amountParts.map(part => {
+          // 2. 姝e垯瑙f瀽鎻愬彇鏁板�煎拰甯佺鍚嶇О
+          // ([\d.]+) 鍖归厤鏁板瓧鍜屽皬鏁扮偣
+          // ([\u4e00-\u9fa5]+) 鍖归厤涓枃瀛楃锛堝竵绉嶏級
+          const match = part.match(/([\d.]+)([\u4e00-\u9fa5]+)/);
+
+          let amount = item.receivableAmount; // 榛樿鍊�
+          let currencyValue = item.currency;   // 榛樿鍊�
+
+          if (match) {
+            amount = parseFloat(match[1]); // 鎻愬彇鐨勬暟瀛�
+            const currencyName = match[2]; // 鎻愬彇鐨勫竵绉嶆枃瀛楋紝濡� "娓竵"
+
+            // 3. 鏍规嵁鎻愬彇鐨勬枃瀛楀尮閰嶅瓧鍏镐腑鐨� Value
+            // 鍋囪瀛楀吀 sys_currency.value: 0 鏄汉姘戝竵, 1 鏄腐甯� (璇锋牴鎹偍瀹為檯瀛楀吀鍊艰皟鏁�)
+            if (currencyName.includes('浜烘皯甯�')) {
+              currencyValue = 'RMB'; // 瀵瑰簲瀛楀吀鐨勪汉姘戝竵value
+            } else if (currencyName.includes('娓竵')) {
+              currencyValue = 'HKD'; // 瀵瑰簲瀛楀吀鐨勬腐甯乿alue
+            }
+          }
+
+          // 4. 杩斿洖鏂板璞★紝瑕嗙洊閲戦鍜屽竵鍒�
+          return {
+            ...item,
+            receivableAmount: amount, // 璧嬪�兼彁鍙栫殑鏁板瓧
+            currency: currencyValue,   // 璧嬪�煎尮閰嶅埌鐨勫瓧鍏窱D
+            receivableAmountStr: part  // 淇濇寔鎷嗗垎鍚庣殑鏂囨湰
+          };
+        });
+      });
+    } else {
+      detailList.value = [];
+    }
   }
 };
 // 3. 纭鐢熸垚鎸夐挳閫昏緫

--
Gitblit v1.8.0