From f3cec0341563c2c0dd4f5df609d0689c6c450bfc Mon Sep 17 00:00:00 2001
From: ZN <zhang_12370@163.com>
Date: 星期六, 21 三月 2026 17:11:12 +0800
Subject: [PATCH] feat(采购退货): 增加退货详情查看功能并完善退货流程

---
 src/views/customerService/feedbackRegistration/components/formDia.vue |   61 ++++++++++++++++++------------
 1 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/src/views/customerService/feedbackRegistration/components/formDia.vue b/src/views/customerService/feedbackRegistration/components/formDia.vue
index 2af71da..8f9bb91 100644
--- a/src/views/customerService/feedbackRegistration/components/formDia.vue
+++ b/src/views/customerService/feedbackRegistration/components/formDia.vue
@@ -185,6 +185,31 @@
 const serviceTypeOptions = computed(() => post_sale_waiting_list?.value || []);
 const urgencyOptions = computed(() => degree_of_urgency?.value || []);
 
+const getProductRowId = (row) => {
+  return row?.id ?? row?.productModelId ?? row?.modelId ?? `${row?.productCategory || row?.productName || ""}-${row?.specificationModel || row?.model || ""}-${row?.unit || ""}`
+}
+
+const normalizeProductRow = (row) => {
+  return {
+    ...row,
+    id: getProductRowId(row),
+    productCategory: row?.productCategory ?? row?.productName ?? '',
+    specificationModel: row?.specificationModel ?? row?.model ?? '',
+    unit: row?.unit ?? '',
+    approveStatus: row?.approveStatus ?? null,
+    shippingStatus: row?.shippingStatus ?? '',
+    expressCompany: row?.expressCompany ?? '',
+    expressNumber: row?.expressNumber ?? '',
+    shippingCarNumber: row?.shippingCarNumber ?? '',
+    shippingDate: row?.shippingDate ?? '',
+    quantity: row?.quantity ?? 0,
+    taxRate: row?.taxRate ?? 0,
+    taxInclusiveUnitPrice: row?.taxInclusiveUnitPrice ?? 0,
+    taxInclusiveTotalPrice: row?.taxInclusiveTotalPrice ?? 0,
+    taxExclusiveTotalPrice: row?.taxExclusiveTotalPrice ?? 0,
+  }
+}
+
 const tableColumn = ref([
   { label: "浜у搧澶х被", prop: "productCategory" },
   { label: "瑙勬牸鍨嬪彿", prop: "specificationModel" },
@@ -239,7 +264,7 @@
         name: "鍒犻櫎",
         type: "text",
         clickFun: (row) => {
-          tableData.value = tableData.value.filter(i => i.id !== row.id)
+          tableData.value = tableData.value.filter(i => getProductRowId(i) !== getProductRowId(row))
         },
 
       },
@@ -251,37 +276,21 @@
 const isShowProductSelectDialog = ref(false)
 const handleSelectProducts = (rows) => {
   if (!Array.isArray(rows)) return
-  const existingIds = new Set(tableData.value.map(i => i.id))
+  const existingIds = new Set(tableData.value.map(i => String(getProductRowId(i))))
   const mapped = rows
-    .filter(r => !existingIds.has(r.id))
-    .map(r => ({
-      id: r.id,
-      productCategory: r.productName,
-      specificationModel: r.model,
-      unit: r.unit || '',
-      approveStatus: null,
-      shippingStatus: '',
-      expressCompany: '',
-      expressNumber: '',
-      shippingCarNumber: '',
-      shippingDate: '',
-      quantity: 0,
-      taxRate: 0,
-      taxInclusiveUnitPrice: 0,
-      taxInclusiveTotalPrice: 0,
-      taxExclusiveTotalPrice: 0,
-    }))
+    .map(normalizeProductRow)
+    .filter(r => !existingIds.has(String(getProductRowId(r))))
   tableData.value = tableData.value.concat(mapped)
 }
 const currentSelectedProductIds = computed(() => {
-  return tableData.value.map(item => item.id)
+  return tableData.value.map(item => getProductRowId(item)).filter(item => item !== undefined && item !== null && item !== '')
 })
 
 const associatedSalesOrderNumberChange = () => {
   const opt = associatedSalesOrderNumberOptions.value.find(
     (item) => item.value === form.value.salesContractNo
   )
-  tableData.value = opt?.productData || []
+  tableData.value = (opt?.productData || []).map(normalizeProductRow)
   form.value.salesLedgerId = opt?.id || null
 }
 
@@ -291,7 +300,7 @@
   const opt = associatedSalesOrderNumberOptions.value.find(
     (item) => item.value === form.value.salesContractNo
   )
-  return opt?.productData || []
+  return (opt?.productData || []).map(normalizeProductRow)
 })
 
 const customerNameChange = (val) => {
@@ -356,7 +365,11 @@
 // 鎵撳紑寮规
 const openDialog =async (type, row) => {
   // 璇锋眰澶氫釜鎺ュ彛锛岃幏鍙栨暟鎹�
-  let res = await getAllCustomerList();
+  let res = await getAllCustomerList({
+    current: 1,
+  size: 1000,
+  total: 0,
+  });
   if(res.records){
     customerNameOptions.value = res.records.map(item => ({
       label: item.customerName,

--
Gitblit v1.9.3