gongchunyi
9 小时以前 17bdc12280602e882f42445d10d68e9e2575773f
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;
   // 取消注释并使用真实API
   // 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;
         // 取消注释并使用真实API
         // 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("已取消");