Bläddra i källkod

refactor(api): 统一删除套餐接口命名并调整调用方式- 将 deleteThali 接口统一重命名为 delThaliById
- 修改接口调用方式为 GET 请求
- 在调用时增加 groupType 参数支持
- 更新所有相关页面的接口引用和调用逻辑
- 优化拒绝原因字段显示逻辑
- 调整初始化参数获取方式,使用本地存储值
- 增加删除确认对话框的按钮文字本地化- 保存成功后自动返回上一页

congxuesong 1 månad sedan
förälder
incheckning
e4713f3014

+ 2 - 2
src/api/modules/couponManagement.ts

@@ -5,8 +5,8 @@ import http from "@/api";
 export const getThaliList = params => {
   return http.get<ResPage<StoreUser.ResStoreUserList>>(PORT_NONE + `/PcGroupBuy/getThaliList`, params);
 };
-export const deleteThali = (params: { id: string }) => {
-  return http.delete(PORT_NONE + `/PcGroupBuy/deleteThali`, params);
+export const delThaliById = (params: { id: string }) => {
+  return http.get(PORT_NONE + `/PcGroupBuy/deleteThali`, params);
 };
 export const sjxj = params => {
   return http.get(PORT_NONE + `/PcGroupBuy/sjxj`, params);

+ 2 - 2
src/api/modules/groupPackageManagement.ts

@@ -5,8 +5,8 @@ import http from "@/api";
 export const getThaliList = params => {
   return http.get<ResPage<StoreUser.ResStoreUserList>>(PORT_NONE + `/PcGroupBuy/getThaliList`, params);
 };
-export const deleteThali = (params: { id: string }) => {
-  return http.delete(PORT_NONE + `/PcGroupBuy/deleteThali`, params);
+export const delThaliById = (params: { id: string }) => {
+  return http.get(PORT_NONE + `/PcGroupBuy/delThaliById`, params);
 };
 export const sjxj = params => {
   return http.get(PORT_NONE + `/PcGroupBuy/sjxj`, params);

+ 2 - 2
src/api/modules/voucherManagement.ts

@@ -5,8 +5,8 @@ import http from "@/api";
 export const getThaliList = params => {
   return http.get<ResPage<StoreUser.ResStoreUserList>>(PORT_NONE + `/PcGroupBuy/getThaliList`, params);
 };
-export const deleteThali = (params: { id: string }) => {
-  return http.delete(PORT_NONE + `/PcGroupBuy/deleteThali`, params);
+export const delThaliById = (params: { id: string }) => {
+  return http.get(PORT_NONE + `/PcGroupBuy/deleteThali`, params);
 };
 export const sjxj = params => {
   return http.get(PORT_NONE + `/PcGroupBuy/sjxj`, params);

+ 9 - 4
src/views/couponManagement/index.vue

@@ -92,8 +92,9 @@ import { ElMessage } from "element-plus";
 import ProTable from "@/components/ProTable/index.vue";
 import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface";
 import { Plus } from "@element-plus/icons-vue";
-import { getThaliList, sjxj, updateNum, deleteThali } from "@/api/modules/couponManagement";
+import { getThaliList, sjxj, updateNum, delThaliById } from "@/api/modules/couponManagement";
 import { ElMessageBox } from "element-plus/es";
+import { localGet } from "@/utils";
 
 const router = useRouter();
 const dialogFormVisible = ref(false);
@@ -282,11 +283,15 @@ const editRow = row => {
 };
 const deleteRow = row => {
   ElMessageBox.confirm("确定要删除吗?", "提示", {
-    confirmButtonText: "OK",
-    cancelButtonText: "Cancel",
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
     type: "warning"
   }).then(() => {
-    deleteThali(row.id).then(() => {
+    const params = {
+      id: row.id,
+      groupType: localGet("businessSection") || "1"
+    };
+    delThaliById(params).then(() => {
       ElMessage.success("删除成功");
       proTable.value?.getTableList();
     });

+ 16 - 25
src/views/groupPackageManagement/index.vue

@@ -127,13 +127,7 @@
         <div class="reject-reason-item">
           <div class="reject-reason-label">拒绝原因:</div>
           <div class="reject-reason-value reject-reason-text">
-            {{
-              rejectReasonData.rejectReason ||
-              rejectReasonData.rejectionReason ||
-              rejectReasonData.refuseReason ||
-              rejectReasonData.auditReason ||
-              "暂无拒绝原因"
-            }}
+            {{ rejectReasonData.approvalComments || "暂无拒绝原因" }}
           </div>
         </div>
       </div>
@@ -154,7 +148,8 @@ import { ElMessage } from "element-plus";
 import ProTable from "@/components/ProTable/index.vue";
 import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface";
 import { Plus } from "@element-plus/icons-vue";
-import { deleteThali, getThaliList, sjxj, updateNum } from "@/api/modules/groupPackageManagement";
+import { delThaliById, getThaliList, sjxj, updateNum } from "@/api/modules/groupPackageManagement";
+import { localGet } from "@/utils";
 
 const router = useRouter();
 const dialogFormVisible = ref(false);
@@ -171,10 +166,7 @@ const rejectReasonDialogVisible = ref(false);
 const rejectReasonData = ref<any>({
   groupName: "",
   groupNo: "",
-  rejectReason: "",
-  rejectionReason: "",
-  refuseReason: "",
-  auditReason: ""
+  approvalComments: ""
 });
 
 // 定义表单类型
@@ -367,11 +359,10 @@ watch(
 );
 // 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
 const initParam = reactive({
-  storeId: "104",
-  groupType: "1",
+  storeId: localGet("createdId") || "104",
+  groupType: localGet("businessSection") || "1",
   status: activeName
 });
-
 // 页面加载时触发查询
 onMounted(() => {
   proTable.value?.getTableList();
@@ -410,17 +401,20 @@ const editRow = row => {
 };
 const deleteRow = row => {
   ElMessageBox.confirm("确定要删除吗?", "提示", {
-    confirmButtonText: "OK",
-    cancelButtonText: "Cancel",
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
     type: "warning"
   }).then(() => {
-    deleteThali(row.id).then(() => {
+    const params = {
+      id: row.id,
+      groupType: localGet("businessSection") || "1"
+    };
+    delThaliById(params).then(() => {
       ElMessage.success("删除成功");
       proTable.value?.getTableList();
     });
   });
 };
-
 const handleClick = () => {};
 const changeTypes = async (row: any, status: string) => {
   rowData.value = row;
@@ -464,12 +458,9 @@ const closeDialog = () => {
 // 查看拒绝原因
 const viewRejectReason = (row: any) => {
   rejectReasonData.value = {
-    groupName: row.groupName || "",
-    groupNo: row.groupNo || "",
-    rejectReason: row.rejectReason || "",
-    rejectionReason: row.rejectionReason || "",
-    refuseReason: row.refuseReason || "",
-    auditReason: row.auditReason || ""
+    groupName: row.groupName || "--",
+    groupNo: row.groupNo || "--",
+    approvalComments: row.approvalComments || "--"
   };
   rejectReasonDialogVisible.value = true;
 };

+ 4 - 3
src/views/groupPackageManagement/newGroup.vue

@@ -1565,7 +1565,7 @@ const openDishDialog = async (groupIndex: number, dishIndex: number) => {
   currentDishIndex.value = dishIndex;
   dishSearchKeyword.value = "";
   const params = {
-    storeId: 104,
+    storeId: localGet("createdId") || "104",
     phoneId: 18641153170,
     dishType: 0
   };
@@ -1770,8 +1770,8 @@ const handleSubmit = async (type?) => {
     lifeGroupBuyThalis: lifeGroupBuyThalis.value
   };
   paramsObj.lifeGroupBuyMain.status = type ? "0" : "1";
-  paramsObj.lifeGroupBuyMain.groupType = 1;
-  paramsObj.lifeGroupBuyMain.storeId = localGet("storeId") || "104";
+  paramsObj.lifeGroupBuyMain.groupType = localGet("businessSection") || "1";
+  paramsObj.lifeGroupBuyMain.storeId = localGet("createdId") || "104";
   if (id.value) {
     paramsObj.lifeGroupBuyMain.id = id.value;
   }
@@ -1812,6 +1812,7 @@ const handleSubmit = async (type?) => {
       let res: any = await saveThali(paramsObj);
       if (res && res.code == 200) {
         ElMessage.success("保存成功");
+        goBack();
       }
     });
   }

+ 9 - 4
src/views/voucherManagement/index.vue

@@ -96,8 +96,9 @@ import { ElMessage } from "element-plus";
 import ProTable from "@/components/ProTable/index.vue";
 import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface";
 import { Plus } from "@element-plus/icons-vue";
-import { deleteThali, getThaliList, sjxj, updateNum } from "@/api/modules/voucherManagement";
+import { delThaliById, getThaliList, sjxj, updateNum } from "@/api/modules/voucherManagement";
 import { ElMessageBox } from "element-plus/es";
+import { localGet } from "@/utils";
 
 const router = useRouter();
 const dialogFormVisible = ref(false);
@@ -313,11 +314,15 @@ const editRow = row => {
 };
 const deleteRow = row => {
   ElMessageBox.confirm("确定要删除吗?", "提示", {
-    confirmButtonText: "OK",
-    cancelButtonText: "Cancel",
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
     type: "warning"
   }).then(() => {
-    deleteThali(row.id).then(() => {
+    const params = {
+      id: row.id,
+      groupType: localGet("businessSection") || "1"
+    };
+    delThaliById(params).then(() => {
       ElMessage.success("删除成功");
       proTable.value?.getTableList();
     });