From 8da567101119df5e51546ab5741c0936475dcbb1 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 25 五月 2026 01:39:32 +0800
Subject: [PATCH] fix: 售后详情、移除金额相关、自定义数量

---
 src/views/customerService/feedbackRegistration/components/formDia.vue |   45 ++++++----
 src/views/customerService/feedbackRegistration/index.vue              |   21 +++++
 src/views/customerService/components/viewDia.vue                      |  123 ++++++++++++++++++++++++++++++
 src/api/customerService/index.js                                      |    9 ++
 src/views/customerService/afterSalesHandling/index.vue                |   16 +++
 5 files changed, 194 insertions(+), 20 deletions(-)

diff --git a/src/api/customerService/index.js b/src/api/customerService/index.js
index 571601a..e115ae8 100644
--- a/src/api/customerService/index.js
+++ b/src/api/customerService/index.js
@@ -130,3 +130,12 @@
         params: query,
     })
 }
+
+// 鍞悗鍗曡鎯�
+export function getAfterSalesServiceById(id) {
+    return request({
+        url: '/afterSalesService/getById',
+        method: 'get',
+        params: { id }
+    })
+}
diff --git a/src/views/customerService/afterSalesHandling/index.vue b/src/views/customerService/afterSalesHandling/index.vue
index a42337d..a3adcc9 100644
--- a/src/views/customerService/afterSalesHandling/index.vue
+++ b/src/views/customerService/afterSalesHandling/index.vue
@@ -102,6 +102,7 @@
 			></PIMTable>
 		</div>
 		<form-dia ref="formDia" @close="handleQuery"></form-dia>
+    <view-dia ref="viewDia"></view-dia>
     <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="after_sales_service" :record-id="recordId"  />
   </div>
 </template>
@@ -109,6 +110,7 @@
 <script setup>
 import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick, defineAsyncComponent} from "vue";
 import FormDia from "@/views/customerService/afterSalesHandling/components/formDia.vue";
+import ViewDia from "@/views/customerService/components/viewDia.vue";
 import { ElMessageBox } from "element-plus";
 import {
 	afterSalesServiceListPage,
@@ -213,6 +215,15 @@
     },
     align: "center"
   },
+  {
+    label: "鏁伴噺",
+    prop: "productModelQuantities",
+    align: "center",
+    formatData: params => {
+      if (!params) return "0";
+      return String(params).split(',').reduce((sum, val) => sum + (Number(val) || 0), 0);
+    }
+  },
 	{
     label: "闂鎻忚堪",
     prop: "proDesc",
@@ -247,10 +258,10 @@
 				}
 			},
 			{
-				name: "鏌ョ湅",
+				name: "璇︽儏",
 				type: "text",
 				clickFun: (row) => {
-					openForm("view", row);
+					viewDia.value?.openDialog(row);
 				},
 			},
 			// TODO 涓哄啓鎶ュ憡娣诲姞鐨�
@@ -278,6 +289,7 @@
 	selectedRows.value = selection;
 };
 const formDia = ref()
+const viewDia = ref()
 const fileListRef = ref(null)
 const fileListDialogVisible = ref(false)
 const currentFileRow = ref(null)
diff --git a/src/views/customerService/components/viewDia.vue b/src/views/customerService/components/viewDia.vue
new file mode 100644
index 0000000..96452b4
--- /dev/null
+++ b/src/views/customerService/components/viewDia.vue
@@ -0,0 +1,123 @@
+<template>
+  <el-dialog v-model="dialogVisible" title="鍞悗鍗曡鎯�" width="80%" @close="closeDia">
+    <div v-loading="loading">
+      <span class="descriptions">鍩虹璧勬枡</span>
+      <el-descriptions :column="4" border style="margin-top: 10px;">
+        <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ detail.customerName || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="鍞悗绫诲瀷">{{ getDictLabel(classificationOptions, detail.serviceType) }}</el-descriptions-item>
+        <el-descriptions-item label="鍏宠仈閿�鍞崟鍙�">{{ detail.salesContractNo || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="绱ф�ョ▼搴�">{{ getDictLabel(degreeOfUrgencyOptions, detail.urgency) }}</el-descriptions-item>
+        <el-descriptions-item label="宸ュ崟缂栧彿">{{ detail.afterSalesServiceNo || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="澶勭悊鐘舵��">
+          <el-tag :type="detail.status === 1 ? 'danger' : 'success'" size="small">
+            {{ detail.status === 1 ? '寰呭鐞�' : '宸插鐞�' }}
+          </el-tag>
+        </el-descriptions-item>
+        <el-descriptions-item label="鐧昏浜�">{{ detail.checkNickName || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="鍙嶉鏃ユ湡">{{ detail.feedbackDate || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="瀹㈡埛璇夋眰" :span="4">{{ detail.proDesc || '-' }}</el-descriptions-item>
+      </el-descriptions>
+
+      <div style="margin-top: 20px;">
+        <span class="descriptions">澶勭悊淇℃伅</span>
+        <el-descriptions :column="3" border style="margin-top: 10px;">
+          <el-descriptions-item label="澶勭悊浜�">{{ detail.disposeNickName || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="澶勭悊鏃ユ湡">{{ detail.disDate || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="澶勭悊缁撴灉" :span="3">{{ detail.disRes || '-' }}</el-descriptions-item>
+        </el-descriptions>
+      </div>
+
+      <div style="margin-top: 20px;">
+        <span class="descriptions">鍏宠仈浜у搧</span>
+        <el-table :data="tableData" border style="width: 100%; margin-top: 10px;">
+          <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+          <el-table-column prop="productCategory" label="浜у搧澶х被" align="center" />
+          <el-table-column prop="specificationModel" label="瑙勬牸鍨嬪彿" align="center" />
+          <el-table-column prop="unit" label="鍗曚綅" align="center" />
+          <el-table-column prop="expressCompany" label="蹇�掑叕鍙�" align="center" />
+          <el-table-column prop="expressNumber" label="蹇�掑崟鍙�" align="center" />
+          <el-table-column prop="shippingCarNumber" label="鍙戣揣杞︾墝" align="center" />
+          <el-table-column prop="shippingDate" label="鍙戣揣鏃ユ湡" align="center" />
+          <el-table-column prop="quantity" label="鍞悗鏁伴噺" align="center" />
+        </el-table>
+      </div>
+    </div>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button @click="closeDia">鍏抽棴</el-button>
+      </div>
+    </template>
+  </el-dialog>
+</template>
+
+<script setup>
+import { ref, computed, getCurrentInstance } from 'vue';
+import { getAfterSalesServiceById } from '@/api/customerService/index.js';
+
+const { proxy } = getCurrentInstance();
+const dialogVisible = ref(false);
+const loading = ref(false);
+const detail = ref({});
+const tableData = ref([]);
+
+const { post_sale_waiting_list, degree_of_urgency } = proxy.useDict(
+  "post_sale_waiting_list",
+  "degree_of_urgency"
+);
+const classificationOptions = computed(() => post_sale_waiting_list?.value || []);
+const degreeOfUrgencyOptions = computed(() => degree_of_urgency?.value || []);
+
+const getDictLabel = (options, value) => {
+  if (!value) return '-';
+  const item = options.find(i => String(i.value) === String(value));
+  return item ? item.label : value;
+};
+
+const openDialog = (row) => {
+  dialogVisible.value = true;
+  loading.value = true;
+  detail.value = {};
+  tableData.value = [];
+  
+  getAfterSalesServiceById(row.id).then(res => {
+    loading.value = false;
+    if (res.code === 200) {
+      detail.value = res.data || {};
+      let productData = res.data?.salesLedgerDto?.productData || [];
+      const selectedIds = res.data.productModelIds ? String(res.data.productModelIds).split(",") : [];
+      tableData.value = productData.filter(item => selectedIds.includes(String(item.id)));
+    }
+  }).catch(() => {
+    loading.value = false;
+  });
+};
+
+const closeDia = () => {
+  dialogVisible.value = false;
+};
+
+defineExpose({
+  openDialog
+});
+</script>
+
+<style scoped>
+.descriptions {
+  display: inline-block;
+  font-size: 1rem;
+  font-weight: 600;
+  padding-left: 12px;
+  position: relative;
+}
+.descriptions::before {
+  content: "";
+  position: absolute;
+  left: 0;
+  top: 50%;
+  transform: translateY(-50%);
+  width: 4px;
+  height: 1rem;
+  background-color: #002fa7;
+  border-radius: 2px;
+}
+</style>
diff --git a/src/views/customerService/feedbackRegistration/components/formDia.vue b/src/views/customerService/feedbackRegistration/components/formDia.vue
index 5932032..e606107 100644
--- a/src/views/customerService/feedbackRegistration/components/formDia.vue
+++ b/src/views/customerService/feedbackRegistration/components/formDia.vue
@@ -97,6 +97,9 @@
                 {{ getShippingStatusText(row) }}
               </el-tag>
             </template>
+            <template #quantity="{ row }">
+              <el-input-number v-model="row.quantity" :min="0" size="small" />
+            </template>
           </PIMTable>
         </div>
       </div>
@@ -147,6 +150,7 @@
       salesContractNo: "",
       proDesc: "",
       customerName: "",
+      productModelQuantities: "",
     },
     rules: {
       customerName: [
@@ -240,25 +244,12 @@
       align: "center",
     },
     { label: "鍙戣揣鏃ユ湡", prop: "shippingDate", minWidth: 100, align: "center" },
-    { label: "鏁伴噺", prop: "quantity", width: 100 },
-    { label: "绋庣巼(%)", prop: "taxRate", width: 100 },
     {
-      label: "鍚◣鍗曚环(鍏�)",
-      prop: "taxInclusiveUnitPrice",
-      width: 160,
-      formatData: formatCurrency,
-    },
-    {
-      label: "鍚◣鎬讳环(鍏�)",
-      prop: "taxInclusiveTotalPrice",
-      width: 160,
-      formatData: formatCurrency,
-    },
-    {
-      label: "涓嶅惈绋庢�讳环(鍏�)",
-      prop: "taxExclusiveTotalPrice",
-      width: 160,
-      formatData: formatCurrency,
+      label: "鏁伴噺",
+      prop: "quantity",
+      width: 140,
+      dataType: "slot",
+      slot: "quantity",
     },
     {
       dataType: "action",
@@ -446,6 +437,21 @@
               id: item.id,
             })
           );
+          const opt = associatedSalesOrderNumberOptions.value.find(
+            item => item.value === form.value.salesContractNo
+          );
+          if (opt) {
+            let restoredData = (opt.productData || []).map(normalizeProductRow);
+            const selectedIds = form.value.productModelIds ? String(form.value.productModelIds).split(",") : [];
+            const quantities = form.value.productModelQuantities ? String(form.value.productModelQuantities).split(",") : [];
+            tableData.value = restoredData.filter(item => selectedIds.includes(String(item.id))).map(item => {
+              let qIndex = selectedIds.indexOf(String(item.id));
+              if (qIndex !== -1 && qIndex < quantities.length && quantities[qIndex] !== "") {
+                 item.quantity = Number(quantities[qIndex]);
+              }
+              return item;
+            });
+          }
         }
       }
       console.log(form.value);
@@ -458,6 +464,9 @@
         form.value.productModelIds = tableData.value
           .map(item => item.id)
           .join(",");
+        form.value.productModelQuantities = tableData.value
+          .map(item => item.quantity || 0)
+          .join(",");
         if (operationType.value === "add") {
           afterSalesServiceAdd(form.value).then(response => {
             proxy.$modal.msgSuccess("鏂板鎴愬姛");
diff --git a/src/views/customerService/feedbackRegistration/index.vue b/src/views/customerService/feedbackRegistration/index.vue
index d15749d..bcbb326 100644
--- a/src/views/customerService/feedbackRegistration/index.vue
+++ b/src/views/customerService/feedbackRegistration/index.vue
@@ -112,6 +112,7 @@
     </div>
     <form-dia ref="formDia"
               @close="handleQuery"></form-dia>
+    <view-dia ref="viewDia"></view-dia>
   </div>
 </template>
 
@@ -126,6 +127,7 @@
     nextTick,
   } from "vue";
   import FormDia from "@/views/customerService/feedbackRegistration/components/formDia.vue";
+  import ViewDia from "@/views/customerService/components/viewDia.vue";
   import { ElMessageBox } from "element-plus";
   import {
     afterSalesServiceDelete,
@@ -255,6 +257,15 @@
       align: "center",
     },
     {
+      label: "鏁伴噺",
+      prop: "productModelQuantities",
+      align: "center",
+      formatData: params => {
+        if (!params) return "0";
+        return String(params).split(',').reduce((sum, val) => sum + (Number(val) || 0), 0);
+      }
+    },
+    {
       label: "瀹㈡埛璇夋眰",
       prop: "proDesc",
       width: 300,
@@ -269,7 +280,16 @@
       dataType: "action",
       label: "鎿嶄綔",
       fixed: "right",
+      width: 180,
+      align: "center",
       operation: [
+        {
+          name: "璇︽儏",
+          type: "text",
+          clickFun: row => {
+            viewDia.value?.openDialog(row);
+          },
+        },
         {
           name: "缂栬緫",
           type: "text",
@@ -307,6 +327,7 @@
     selectedRows.value = selection;
   };
   const formDia = ref();
+  const viewDia = ref();
 
   // 瀛楀吀鑾峰彇
   /* 

--
Gitblit v1.9.3