Ver Fonte

feat(groupPackage): 新增套餐管理功能

- 添加保存套餐接口 saveThali- 添加根据ID获取套餐详情接口 getThaliById
- 在新增团购页面引入新接口并调整调用逻辑
- 优化保存草稿和提交套餐的功能
- 调整数据请求参数结构以适配新接口- 更新页面交互逻辑以支持新功能
congxuesong há 1 mês atrás
pai
commit
015faeecc6

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

@@ -17,6 +17,9 @@ export const xgkc = params => {
 export const saveDraft = params => {
   return http.post(PORT_NONE + `/PcGroupBuy/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);
 };
@@ -29,6 +32,6 @@ export const getMenuByStoreId = params => {
 export const getHolidayList = (params: any) => {
   return http.get<StoreUser.ResStoreUserList>(PORT_NONE + `/couponPlatform/getHolidayList`, params);
 };
-export const getStoreDetail = (params: StoreUser.ReqUserParams) => {
-  return http.get<StoreUser.ResStoreUserList>(PORT_NONE + `/store/info/getStoreDetail`, params);
+export const getThaliById = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/getThaliById`, params);
 };

+ 12 - 6
src/views/groupPackageManagement/newGroup.vue

@@ -457,7 +457,9 @@ import {
   getStoreDetail,
   getHolidayList,
   getUserByPhone,
-  getMenuByStoreId
+  getMenuByStoreId,
+  getThaliById,
+  saveThali
 } from "@/api/modules/groupPackageManagement";
 import { useRouter, useRoute } from "vue-router";
 import type { UploadProps, FormInstance } from "element-plus";
@@ -1051,12 +1053,15 @@ onMounted(async () => {
     holidayList.value = res.data.records;
   }
   if (type.value != "add") {
-    let res: any = await getStoreDetail({ id: id.value } as any);
+    const params = {
+      id: id.value,
+      userId: localGet("userId") || "104"
+    };
+    let res: any = await getThaliById(params);
     storeInfoModel.value = { ...storeInfoModel.value, ...res.data.lifeGroupBuyMain };
     let imageList: any[] = [];
     handleImageParam((res.data as any).businessLicenseAddress || [], imageList);
     storeInfoModel.value.imageList = imageList;
-    storeInfoModel.value.expirationDateList = storeInfoModel.value.expirationDateList.split(";");
     storeInfoModel.value.invoiceInformation = storeInfoModel.value.invoiceType.split(";");
     // 确保星期和节日字段存在
     const listVal = storeInfoModel.value.disableDateValue.split(";");
@@ -1749,8 +1754,9 @@ const handleSubmit = async (type?) => {
     }
     let res: any = await saveDraft(paramsObj);
     if (res && res.code == 200) {
+      ElMessage.success("保存成功");
+      goBack();
     }
-    // goBack();
   } else {
     ruleFormRef.value!.validate(async valid => {
       if (!valid) {
@@ -1774,10 +1780,10 @@ const handleSubmit = async (type?) => {
         }
       }
       // 组装提交参数
-      let res: any = await saveDraft(paramsObj);
+      let res: any = await saveThali(paramsObj);
       if (res && res.code == 200) {
+        ElMessage.success("保存成功");
       }
-      // goBack();
     });
   }
 };