Эх сурвалжийг харах

refactor(api):重构优惠券和套餐管理接口

- 将 sjxj 方法重命名为 updateStatus 并更新对应 URL
- 调整接口参数,新增 approvalComments 字段-重新组织部分接口导出顺序- 更新前端调用逻辑以匹配新接口名称
- 修改状态传参方式,从字符串改为数字常量
congxuesong 1 сар өмнө
parent
commit
e3d34010ee

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

@@ -8,8 +8,8 @@ export const getThaliList = 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);
+export const updateStatus = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/updateStatus1`, params);
 };
 export const updateNum = params => {
   return http.get(PORT_NONE + `/PcGroupBuy/updateNum1`, params);

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

@@ -8,8 +8,8 @@ export const getThaliList = 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);
+export const updateStatus = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/updateStatus`, params);
 };
 export const updateNum = params => {
   return http.get(PORT_NONE + `/PcGroupBuy/updateNum`, params);
@@ -20,12 +20,6 @@ export const saveDraft = params => {
 export const saveThali = params => {
   return http.post(PORT_NONE + `/PcGroupBuy/saveThali`, params);
 };
-export const getUserByPhone = params => {
-  return http.get(PORT_NONE + `/store/user/getUserByPhone`, params);
-};
-export const getDetail = params => {
-  return http.get(PORT_NONE + `/store/info/getDetail`, params);
-};
 export const getMenuByStoreId = params => {
   return http.get(PORT_NONE + `/menuPlatform/getMenuByStoreId`, params);
 };
@@ -35,3 +29,9 @@ export const getHolidayList = (params: any) => {
 export const getThaliById = params => {
   return http.get(PORT_NONE + `/PcGroupBuy/getThaliById`, params);
 };
+export const getUserByPhone = params => {
+  return http.get(PORT_NONE + `/store/user/getUserByPhone`, params);
+};
+export const getDetail = params => {
+  return http.get(PORT_NONE + `/store/info/getDetail`, params);
+};

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

@@ -8,8 +8,8 @@ export const getThaliList = 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);
+export const updateStatus = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/updateStatus1`, params);
 };
 export const updateNum = params => {
   return http.get(PORT_NONE + `/PcGroupBuy/updateNum11`, params);

+ 5 - 5
src/views/couponManagement/index.vue

@@ -15,7 +15,7 @@
         <el-button
           link
           type="primary"
-          @click="changeTypes(scope.row, 'on')"
+          @click="changeTypes(scope.row, 5)"
           v-if="canShowButton(scope.row.status, OPERATION_PERMISSIONS.上架)"
         >
           上架
@@ -23,7 +23,7 @@
         <el-button
           link
           type="primary"
-          @click="changeTypes(scope.row, 'off')"
+          @click="changeTypes(scope.row, 6)"
           v-if="canShowButton(scope.row.status, OPERATION_PERMISSIONS.下架)"
         >
           下架
@@ -92,7 +92,7 @@ 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, delThaliById } from "@/api/modules/couponManagement";
+import { getThaliList, updateStatus, updateNum, delThaliById } from "@/api/modules/couponManagement";
 import { ElMessageBox } from "element-plus/es";
 import { localGet } from "@/utils";
 
@@ -298,9 +298,9 @@ const deleteRow = row => {
   });
 };
 const handleClick = () => {};
-const changeTypes = async (row: any, status: string) => {
+const changeTypes = async (row, status) => {
   rowData.value = row;
-  let res = await sjxj({ id: row.id, status: status });
+  let res = await updateStatus({ id: row.id, status: status, approvalComments: "" });
   if (res && res.code == 200) {
     ElMessage.success("操作成功");
     proTable.value?.getTableList();

+ 5 - 5
src/views/groupPackageManagement/index.vue

@@ -35,7 +35,7 @@
         <el-button
           link
           type="primary"
-          @click="changeTypes(scope.row, 'on')"
+          @click="changeTypes(scope.row, 5)"
           v-if="canShowButton(scope.row.status, OPERATION_PERMISSIONS.上架)"
         >
           上架
@@ -43,7 +43,7 @@
         <el-button
           link
           type="primary"
-          @click="changeTypes(scope.row, 'off')"
+          @click="changeTypes(scope.row, 6)"
           v-if="canShowButton(scope.row.status, OPERATION_PERMISSIONS.下架)"
         >
           下架
@@ -148,7 +148,7 @@ 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 { delThaliById, getThaliList, sjxj, updateNum } from "@/api/modules/groupPackageManagement";
+import { delThaliById, getThaliList, updateStatus, updateNum } from "@/api/modules/groupPackageManagement";
 import { localGet } from "@/utils";
 
 const router = useRouter();
@@ -416,9 +416,9 @@ const deleteRow = row => {
   });
 };
 const handleClick = () => {};
-const changeTypes = async (row: any, status: string) => {
+const changeTypes = async (row, status) => {
   rowData.value = row;
-  let res = await sjxj({ id: row.id, status: status });
+  let res = await updateStatus({ id: row.id, status: status, approvalComments: "" });
   if (res && res.code == 200) {
     ElMessage.success("操作成功");
     proTable.value?.getTableList();

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

@@ -19,7 +19,7 @@
         <el-button
           link
           type="primary"
-          @click="changeTypes(scope.row, 'on')"
+          @click="changeTypes(scope.row, 5)"
           v-if="canShowButton(scope.row.status, OPERATION_PERMISSIONS.上架)"
         >
           上架
@@ -27,7 +27,7 @@
         <el-button
           link
           type="primary"
-          @click="changeTypes(scope.row, 'off')"
+          @click="changeTypes(scope.row, 6)"
           v-if="canShowButton(scope.row.status, OPERATION_PERMISSIONS.下架)"
         >
           下架
@@ -96,7 +96,7 @@ 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 { delThaliById, getThaliList, sjxj, updateNum } from "@/api/modules/voucherManagement";
+import { delThaliById, getThaliList, updateStatus, updateNum } from "@/api/modules/voucherManagement";
 import { ElMessageBox } from "element-plus/es";
 import { localGet } from "@/utils";
 
@@ -331,7 +331,7 @@ const deleteRow = row => {
 const handleClick = () => {};
 const changeTypes = async (row: any, status: string) => {
   rowData.value = row;
-  let res = await sjxj({ id: row.id, status: status });
+  let res = await updateStatus({ id: row.id, status: status, approvalComments: "" });
   if (res && res.code == 200) {
     ElMessage.success("操作成功");
     proTable.value?.getTableList();