From 79537f4527695f3c6fbfb2d287edd877a289d472 Mon Sep 17 00:00:00 2001
From: ZN <zhang_12370@163.com>
Date: 星期三, 01 四月 2026 11:54:41 +0800
Subject: [PATCH] 售后服务-临期售后管理根据进销存升级同步

---
 src/views/customerService/expiryAfterSales/index.vue              |   72 ++++++++++++++---------
 src/api/customerService/index.js                                  |   10 +-
 src/views/customerService/expiryAfterSales/components/formDia.vue |   52 +++++++++-------
 3 files changed, 77 insertions(+), 57 deletions(-)

diff --git a/src/api/customerService/index.js b/src/api/customerService/index.js
index b92033b..17b967b 100644
--- a/src/api/customerService/index.js
+++ b/src/api/customerService/index.js
@@ -45,7 +45,7 @@
 // 涓存湡鍞悗绠$悊-鍒嗛〉鏌ヨ
 export function expiryAfterSalesListPage(query) {
   return request({
-    url: '/expiryAfterSales/listPage',
+    url: '/afterSalesNearExpiryService/listPage',
     method: 'get',
     params: query,
   })
@@ -54,7 +54,7 @@
 // 涓存湡鍞悗绠$悊-鏂板
 export function expiryAfterSalesAdd(query) {
   return request({
-    url: '/expiryAfterSales/add',
+    url: '/afterSalesNearExpiryService/add',
     method: 'post',
     data: query,
   })
@@ -63,16 +63,16 @@
 // 涓存湡鍞悗绠$悊-鏇存柊
 export function expiryAfterSalesUpdate(query) {
   return request({
-    url: '/expiryAfterSales/update',
+    url: '/afterSalesNearExpiryService/update',
     method: 'post',
     data: query,
   })
 }
 
 // 涓存湡鍞悗绠$悊-鍒犻櫎
-export function expiryAfterSalesDelete(query) {
+export function expiryAfterSalesDelete(ids) {
   return request({
-    url: '/expiryAfterSales/delete',
+    url: '/afterSalesNearExpiryService/delete?ids=' + ids,
     method: 'delete',
     data: query,
   })
diff --git a/src/views/customerService/expiryAfterSales/components/formDia.vue b/src/views/customerService/expiryAfterSales/components/formDia.vue
index a6ae725..2fe603b 100644
--- a/src/views/customerService/expiryAfterSales/components/formDia.vue
+++ b/src/views/customerService/expiryAfterSales/components/formDia.vue
@@ -160,8 +160,9 @@
 <script setup>
 import {ref, computed} from "vue";
 import useUserStore from "@/store/modules/user.js";
-// import {userListNoPageByTenantId} from "@/api/system/user.js"; // 鏆傛椂娉ㄩ噴鎺夛紝浣跨敤鍋囨暟鎹�
-// import {expiryAfterSalesAdd, expiryAfterSalesUpdate} from "@/api/customerService/index.js"; // 鏆傛椂娉ㄩ噴鎺夛紝浣跨敤鍋囨暟鎹�
+import { getCurrentDate } from "@/utils/index.js";
+import {userListNoPageByTenantId} from "@/api/system/user.js";
+import {expiryAfterSalesAdd, expiryAfterSalesUpdate} from "@/api/customerService/index.js";
 const { proxy } = getCurrentInstance()
 const emit = defineEmits(['close'])
 const dialogFormVisible = ref(false);
@@ -217,14 +218,10 @@
   operationType.value = type;
   dialogFormVisible.value = true;
 	
-	// 妯℃嫙鑾峰彇鐢ㄦ埛鍒楄〃
-	userList.value = [
-		{ userId: 1, nickName: "寮犱笁" },
-		{ userId: 2, nickName: "鏉庡洓" },
-		{ userId: 3, nickName: "鐜嬩簲" },
-		{ userId: 4, nickName: "璧靛叚" },
-		{ userId: 5, nickName: "瀛欏叓" }
-	];
+	// 鑾峰彇鐢ㄦ埛鍒楄〃
+	userListNoPageByTenantId().then(res => {
+		userList.value = res.data;
+	});
 
 	if (type === 'add') {
 		// 鏂板鏃堕噸缃〃鍗�
@@ -255,12 +252,30 @@
 const submitForm = () => {
 	proxy.$refs["formRef"].validate(valid => {
 		if (valid) {
-			// 妯℃嫙鎻愪氦鎿嶄綔
-			setTimeout(() => {
-				console.log("妯℃嫙鎻愪氦鐨勬暟鎹�:", form.value);
+			const submitData = {
+				id: form.value.id,
+				productName: form.value.productName,
+				batchNumber: form.value.batchNumber,
+				expireDate: form.value.expiryDate,
+				stockQuantity: form.value.stockQuantity,
+				customerName: form.value.customerName,
+				contactPhone: form.value.contactPhone,
+				disRes: form.value.problemDesc,
+				status: form.value.status,
+				disposeUserId: form.value.handlerId,
+				disposeNickName: userList.value.find(item => item.userId === form.value.handlerId)?.nickName,
+				disposeResult: form.value.handleResult,
+				disDate: form.value.handleDate
+			};
+			
+			const apiCall = operationType.value === 'add' ? expiryAfterSalesAdd : expiryAfterSalesUpdate;
+			apiCall(submitData).then(() => {
 				proxy.$modal.msgSuccess(operationType.value === 'add' ? "鏂板鎴愬姛" : "鏇存柊鎴愬姛");
 				closeDia();
-			}, 300);
+			}).catch(error => {
+				console.error('鎻愪氦鏁版嵁澶辫触:', error);
+				proxy.$modal.msgError('鎻愪氦鏁版嵁澶辫触锛岃绋嶅悗閲嶈瘯');
+			});
 		}
 	});
 }
@@ -271,15 +286,6 @@
   dialogFormVisible.value = false;
   emit('close')
 };
-
-// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
-function getCurrentDate() {
-	const today = new Date();
-	const year = today.getFullYear();
-	const month = String(today.getMonth() + 1).padStart(2, "0");
-	const day = String(today.getDate()).padStart(2, "0");
-	return `${year}-${month}-${day}`;
-}
 
 defineExpose({
   openDialog,
diff --git a/src/views/customerService/expiryAfterSales/index.vue b/src/views/customerService/expiryAfterSales/index.vue
index df44504..ee5395d 100644
--- a/src/views/customerService/expiryAfterSales/index.vue
+++ b/src/views/customerService/expiryAfterSales/index.vue
@@ -72,7 +72,7 @@
 import {onMounted, ref} from "vue";
 import FormDia from "@/views/customerService/expiryAfterSales/components/formDia.vue";
 import {ElMessageBox} from "element-plus";
-// import {expiryAfterSalesDelete, expiryAfterSalesListPage} from "@/api/customerService/index.js"; // 鏆傛椂娉ㄩ噴鎺夛紝浣跨敤鍋囨暟鎹�
+import {expiryAfterSalesDelete, expiryAfterSalesListPage} from "@/api/customerService/index.js";
 import useUserStore from "@/store/modules/user.js";
 const { proxy } = getCurrentInstance();
 const userStore = useUserStore()
@@ -127,7 +127,8 @@
 			label: "澶勭悊鐘舵��",
 			prop: "status",
 			width: "",
-			slot: true,
+			dataType: "slot",
+			slot: "status",
 		},
 		{
 			label: "澶勭悊浜�",
@@ -142,7 +143,8 @@
 		{
 			label: "鎿嶄綔",
 			prop: "operation",
-			slot: true,
+			dataType: "slot",
+			slot: "operation",
 			width: "200",
 		},
 	],
@@ -190,21 +192,39 @@
 // 鑾峰彇鍒楄〃鏁版嵁
 const getList = () => {
 	tableLoading.value = true;
-	// 鍙栨秷娉ㄩ噴骞朵娇鐢ㄧ湡瀹濧PI
-	// expiryAfterSalesListPage({
-	// 	...searchForm.value,
-	// 	current: page.value.current,
-	// 	size: page.value.size
-	// }).then(res => {
-	// 	tableData.value = res.data.records;
-	// 	page.value.total = res.data.total;
-	// 	tableLoading.value = false;
-	// });
+	// 鏋勯�犳煡璇㈠弬鏁帮紝鏄犲皠鍓嶇瀛楁鍒板悗绔瓧娈�
+	const queryParams = {
+		expireDate: searchForm.value.expiryDate,
+		disDate: searchForm.value.handleDate,
+		status: searchForm.value.status,
+		current: page.value.current,
+		size: page.value.size
+	};
 	
-	// 鏆傛椂杩斿洖绌烘暟鎹�
-	tableData.value = [];
-	page.value.total = 0;
-	tableLoading.value = false;
+	expiryAfterSalesListPage(queryParams).then(res => {
+		// 鏄犲皠鍚庣杩斿洖鏁版嵁鍒板墠绔〃鏍�
+		tableData.value = res.data.records.map(item => ({
+			id: item.id,
+			productName: item.productName,
+			batchNumber: item.batchNumber,
+			expiryDate: item.expireDate,
+			stockQuantity: item.stockQuantity,
+			customerName: item.customerName,
+			contactPhone: item.contactPhone,
+			problemDesc: item.disRes,
+			status: item.status,
+			handlerId: item.disposeUserId,
+			handlerName: item.disposeNickName,
+			handleResult: item.disposeResult,
+			handleDate: item.disDate
+		}));
+		page.value.total = res.data.total;
+		tableLoading.value = false;
+	}).catch(error => {
+		console.error('鑾峰彇鍒楄〃鏁版嵁澶辫触:', error);
+		tableLoading.value = false;
+		proxy.$modal.msgError('鑾峰彇鏁版嵁澶辫触锛岃绋嶅悗閲嶈瘯');
+	});
 };
 
 // 鎵撳紑寮规
@@ -230,18 +250,12 @@
 	})
 		.then(() => {
 			tableLoading.value = true;
-			// 鍙栨秷娉ㄩ噴骞朵娇鐢ㄧ湡瀹濧PI
-			// expiryAfterSalesDelete(ids).then(() => {
-			// 	proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-			// 	getList();
-			// }).finally(() => {
-			// 	tableLoading.value = false;
-			// });
-			
-			// 鏆傛椂妯℃嫙鍒犻櫎鎴愬姛
-			tableLoading.value = false;
-			proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-			getList();
+			expiryAfterSalesDelete(ids).then(() => {
+				proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+				getList();
+			}).finally(() => {
+				tableLoading.value = false;
+			});
 		})
 		.catch(() => {
 			proxy.$modal.msg("宸插彇娑�");

--
Gitblit v1.9.3