From bfaaa299a0aebd4ccc488cbe5a67e7d73304fb2c Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 24 四月 2026 15:56:03 +0800
Subject: [PATCH] fix: 图片预览路径替换为link

---
 src/views/salesManagement/receiptPaymentLedger/index.vue |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/views/salesManagement/receiptPaymentLedger/index.vue b/src/views/salesManagement/receiptPaymentLedger/index.vue
index 30ca600..f2b148f 100644
--- a/src/views/salesManagement/receiptPaymentLedger/index.vue
+++ b/src/views/salesManagement/receiptPaymentLedger/index.vue
@@ -210,6 +210,14 @@
     const n = Number(v);
     return Number.isFinite(n) ? n : 0;
   };
+  const toTime = (v) => {
+    const t = new Date(v).getTime();
+    return Number.isFinite(t) ? t : -Infinity;
+  };
+  const toId = (v) => {
+    const n = Number(v);
+    return Number.isFinite(n) ? n : -Infinity;
+  };
 
   // 浠ュ彸渚у綋鍓嶅睍绀烘暟鎹负鍑�
   const rows = receiptRecord.value || [];
@@ -234,14 +242,25 @@
     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 latestRowByContract = new Map();
+  for (const row of rows) {
+    const contractNo = row?.salesContractNo;
+    if (!contractNo) continue;
+    const existed = latestRowByContract.get(contractNo);
+    const currentTime = toTime(row?.receiptPaymentDate);
+    const existedTime = toTime(existed?.receiptPaymentDate);
+    const shouldReplace =
+      !existed ||
+      currentTime > existedTime ||
+      (currentTime === existedTime && toId(row?.id) > toId(existed?.id));
+    if (shouldReplace) {
+      latestRowByContract.set(contractNo, row);
     }
   }
+  const unReceiptTotal = Array.from(latestRowByContract.values()).reduce(
+    (sum, row) => sum + toNum(row?.unReceiptPaymentAmount),
+    0
+  );
 
   const columns = param?.columns || [];
   return columns.map((column, index) => {

--
Gitblit v1.9.3