From 9ea5ff67655241271bdf04bb50ca3a8d60c4e22a Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期二, 11 八月 2026 15:07:02 +0800
Subject: [PATCH] fix: 用河南鹤壁代码覆盖山西长治

---
 src/views/procurementManagement/purchaseReturnOrder/New.vue |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/views/procurementManagement/purchaseReturnOrder/New.vue b/src/views/procurementManagement/purchaseReturnOrder/New.vue
index 0453310..9474b11 100644
--- a/src/views/procurementManagement/purchaseReturnOrder/New.vue
+++ b/src/views/procurementManagement/purchaseReturnOrder/New.vue
@@ -259,16 +259,13 @@
               <el-table-column label="鏁伴噺"
                                prop="stockInNum"
                                width="100" />
-              <el-table-column label="閿�鍞彂璐ф暟閲�"
-                               prop="saleOutQuantity"
-                               width="120" />
                                <el-table-column label="鍙��璐ф暟閲�"
                                prop="unQuantity"
                                width="130" />
               <el-table-column label="宸查��璐ф暟閲�"
                                width="130">
                 <template #default="scope">
-                  {{ formattedNumber(scope.row, null, scope.row.totalReturnNum || 0) }}
+                  {{ calcAlreadyReturned(scope.row) }}
                 </template>
               </el-table-column>
               <el-table-column label="閫�璐ф暟閲�"
@@ -423,7 +420,7 @@
 <script setup>
 import {ref, computed, getCurrentInstance, watch, defineAsyncComponent} from "vue";
 import {createPurchaseReturnOrder} from "@/api/procurementManagement/purchase_return_order.js";
-import {getOptions, purchaseReturnableList} from "@/api/procurementManagement/procurementLedger.js";
+import {getOptions, purchaseList} from "@/api/procurementManagement/procurementLedger.js";
 import {userListNoPageByTenantId} from "@/api/system/user.js";
 const ProductList = defineAsyncComponent(() => import("@/views/procurementManagement/purchaseReturnOrder/ProductList.vue"));
 const props = defineProps({
@@ -531,6 +528,14 @@
 const toNumber = (val) => {
   const num = Number(val)
   return Number.isNaN(num) ? 0 : num
+}
+
+/** 宸查��璐ф暟閲� = 鍏ュ簱琛屾�绘暟閲� 鈭� 褰撳墠鍙��璐ф暟閲忥紙鍓╀綑锛� */
+const calcAlreadyReturned = (row) => {
+  const total = Number(row?.stockInNum ?? row?.totalQuantity ?? row?.quantity ?? 0)
+  const un = Number(row?.unQuantity ?? 0)
+  if (!Number.isFinite(total) || !Number.isFinite(un)) return 0
+  return Math.max(total - un, 0)
 }
 
 const getReturnTotal = (row) => {
@@ -669,7 +674,7 @@
 const fetchPurchaseLedgerOptions = () => {
   purchaseLedgerOptions.value = []
   if (formState.value.supplierId) {
-    purchaseReturnableList({ supplierId: formState.value.supplierId }).then((res) => {
+    purchaseList({supplierId: formState.value.supplierId,approvalStatus:3}).then((res) => {
       purchaseLedgerOptions.value = res.rows;
     });
   }
@@ -800,4 +805,4 @@
 }
 
 
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.3