From 9840e565b021ca4ed199ea40d2c8b47bc9feeb3f Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 03 九月 2026 14:50:49 +0800
Subject: [PATCH] fix: 金额优化

---
 src/views/procurementManagement/procurementLedger/index.vue |   10 ++++++++--
 src/views/procurementManagement/paymentLedger/index.vue     |   14 +++++++++++---
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/views/procurementManagement/paymentLedger/index.vue b/src/views/procurementManagement/paymentLedger/index.vue
index b913032..19816a4 100644
--- a/src/views/procurementManagement/paymentLedger/index.vue
+++ b/src/views/procurementManagement/paymentLedger/index.vue
@@ -202,6 +202,14 @@
     page.size = obj.limit;
     getList();
   };
+  // 灏嗘湭鍏ュ簱閲戦骞跺叆宸插叆搴撻噾棰濓紝鏈叆搴撻噾棰濈疆0
+  const mergeUnshippedAmount = row => {
+    if (row && row.unshippedAmount) {
+      row.shippedAmount = (Number(row.shippedAmount) || 0) + (Number(row.unshippedAmount) || 0);
+      row.unshippedAmount = 0;
+    }
+    return row;
+  };
   const getList = () => {
     tableLoading.value = true;
     paymentLedgerList({
@@ -210,7 +218,7 @@
     }).then(res => {
       let result = res.data;
       tableLoading.value = false;
-      tableData.value = result.records || [];
+      tableData.value = (result.records || []).map(mergeUnshippedAmount);
       total.value = result.total || 0;
       if (tableData.value.length > 0) {
         currentSupplierId.value = tableData.value[0].supplierId;
@@ -231,11 +239,11 @@
         tableLoadingSon.value = false;
         let result = res.data;
         if (Array.isArray(result)) {
-          tableDataSon.value = result;
+          tableDataSon.value = result.map(mergeUnshippedAmount);
           sonPage.total = result.length;
           handlePagination({ page: sonPage.current, limit: sonPage.size });
         } else {
-          originalTableDataSon.value = result.records || [];
+          originalTableDataSon.value = (result.records || []).map(mergeUnshippedAmount);
           sonPage.total = result.total || 0;
         }
       })
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index a34e7e9..f59ed95 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -90,7 +90,7 @@
         <el-table-column label="鍏ュ簱鐘舵��" prop="stockInStatus" width="100" show-overflow-tooltip>
           <template #default="scope">
             <el-tag :type="getStockInStatusType(scope.row.stockInStatus)" size="small">
-              {{ scope.row.stockInStatus || '--' }}
+              {{ formatStockInStatus(scope.row.stockInStatus) || '--' }}
             </el-tag>
           </template>
         </el-table-column>
@@ -480,11 +480,17 @@
   return typeMap[status] || "";
 };
 
+// 鍏ュ簱鐘舵�佹樉绀猴細鍏ュ簱涓篃灞曠ず涓哄畬鍏ㄥ叆搴�
+const formatStockInStatus = status => {
+  if (status === "鍏ュ簱涓�") return "瀹屽叏鍏ュ簱";
+  return status;
+};
+
 // 鑾峰彇鍏ュ簱鐘舵�佹爣绛剧被鍨�
 const getStockInStatusType = status => {
   const typeMap = {
     "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
-    "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
+    "鍏ュ簱涓�": "success", // 鍏ュ簱涓� - 缁胯壊
     "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
   };
   return typeMap[status] || "";

--
Gitblit v1.9.3