congxuesong 1 ماه پیش
والد
کامیت
05302cd17b

+ 34 - 0
src/api/modules/couponManagement.ts

@@ -0,0 +1,34 @@
+import { ResPage, StoreUser } from "@/api/interface/index";
+import { PORT_NONE } from "@/api/config/servicePort";
+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 sjxj = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/sjxj`, params);
+};
+export const xgkc = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/xgkc`, params);
+};
+export const saveDraft = params => {
+  return http.post(PORT_NONE + `/PcGroupBuy/saveDraft`, 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);
+};
+export const getHolidayList = (params: any) => {
+  return http.get<StoreUser.ResStoreUserList>(PORT_NONE + `/couponPlatform/getHolidayList`, params);
+};
+export const getCouponDetail = (params: StoreUser.ReqUserParams) => {
+  return http.get<StoreUser.ResStoreUserList>(PORT_NONE + `/store/info/getStoreDetail`, params);
+};

+ 37 - 0
src/api/modules/orderManagement.ts

@@ -0,0 +1,37 @@
+import { ResPage, StoreUser } from "@/api/interface/index";
+import { PORT_NONE } from "@/api/config/servicePort";
+import http from "@/api";
+
+export const getThaliList = params => {
+  return http.get<ResPage<StoreUser.ResStoreUserList>>(PORT_NONE + `/PcGroupBuy/getThaliList`, params);
+};
+export const getCpList = params => {
+  return http.get<ResPage<StoreUser.ResStoreUserList>>(PORT_NONE + `/PcGroupBuy/getCpList`, params);
+};
+export const deleteThali = (params: { id: string }) => {
+  return http.delete(PORT_NONE + `/PcGroupBuy/deleteThali`, params);
+};
+export const sjxj = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/sjxj`, params);
+};
+export const xgkc = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/xgkc`, params);
+};
+export const saveDraft = params => {
+  return http.post(PORT_NONE + `/PcGroupBuy/saveDraft`, 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);
+};
+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);
+};

+ 34 - 0
src/api/modules/voucherManagement.ts

@@ -0,0 +1,34 @@
+import { ResPage, StoreUser } from "@/api/interface/index";
+import { PORT_NONE } from "@/api/config/servicePort";
+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 sjxj = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/sjxj`, params);
+};
+export const xgkc = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/xgkc`, params);
+};
+export const saveDraft = params => {
+  return http.post(PORT_NONE + `/PcGroupBuy/saveDraft`, params);
+};
+export const getUserByPhone = params => {
+  return http.get(PORT_NONE + `/store/user/getUserByPhone`, params);
+};
+export const getVoucherDetail = params => {
+  return http.get(PORT_NONE + `/store/info/getDetail`, params);
+};
+export const getMenuByStoreId = params => {
+  return http.get(PORT_NONE + `/menuPlatform/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);
+};

+ 36 - 29
src/views/couponManagement/index.vue

@@ -92,8 +92,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 { audit, getStaffConfigList } from "@/api/modules/staffConfig";
-import { getThaliList } from "@/api/modules/groupPackageManagement";
+import { getThaliList, sjxj, xgkc, deleteThali } from "@/api/modules/couponManagement";
+import { ElMessageBox } from "element-plus/es";
 
 const router = useRouter();
 const dialogFormVisible = ref(false);
@@ -105,7 +105,10 @@ const formInventory: any = ref({
 });
 const rowData = ref<any>();
 const activeName = ref("");
-
+// 定义表单类型
+interface RuleForm {
+  newInventory: string;
+}
 const ruleFormRef = ref<FormInstance>();
 const rules = reactive<FormRules<RuleForm>>({
   newInventory: [
@@ -267,22 +270,35 @@ const getTableList = (params: any) => {
   return getThaliList(newParams);
 };
 
+const newGroupBuying = () => {
+  router.push(`/couponManagement/newCoupon?type=add`);
+};
 // 跳转详情页
 const toDetail = row => {
-  router.push(`/couponManagement/detail?id=${row.id}&type=edit`);
+  router.push(`/couponManagement/detail?id=${row.id}`);
 };
-const editRow = row => {};
-const deleteRow = row => {};
-const newGroupBuying = () => {
-  router.push(`/couponManagement/newCoupon?id=104&type=add`);
+const editRow = row => {
+  router.push(`/couponManagement/newCoupon?id=${row.id}&type=edit`);
+};
+const deleteRow = row => {
+  ElMessageBox.confirm("确定要删除吗?", "提示", {
+    confirmButtonText: "OK",
+    cancelButtonText: "Cancel",
+    type: "warning"
+  }).then(() => {
+    deleteThali(row.id).then(() => {
+      ElMessage.success("删除成功");
+      proTable.value?.getTableList();
+    });
+  });
 };
 const handleClick = () => {};
-const changeTypes = (row: any, status: string) => {
+const changeTypes = async (row: any, status: string) => {
   rowData.value = row;
-  if (status === "on") {
-    handleChangeStatus(row, "1");
-  } else {
-    handleChangeStatus(row, "2");
+  let res = await sjxj({ id: row.id, status: status });
+  if (res && res.code == 200) {
+    ElMessage.success("操作成功");
+    proTable.value?.getTableList();
   }
 };
 const changeInventory = (row: any) => {
@@ -292,26 +308,17 @@ const changeInventory = (row: any) => {
   formInventory.value.newInventory = "";
   dialogFormVisible.value = true;
 };
-const handleChangeStatus = async (row: any, status: string) => {
-  try {
-    let res = await audit({ id: row.id, status: status, rejectionReason: form.comment });
-    if (res.code == 200) {
-      proTable.value?.getTableList();
-      if (status === "2") closeDialog();
-      ElMessage.success("审核成功");
-    }
-  } catch (error) {
-    ElMessage.error("操作失败");
-  }
-};
-
 // 弹窗提交
 const handleSubmit = async () => {
   if (!ruleFormRef.value) return;
-  await ruleFormRef.value.validate((valid, fields) => {
+  await ruleFormRef.value.validate(async (valid, fields) => {
     if (valid) {
-      ElMessage.success("修改成功");
-      dialogFormVisible.value = false;
+      let res = await xgkc({ id: formInventory.value.id, status: formInventory.value.newInventory });
+      if (res && res.code == 200) {
+        ElMessage.success("库存修改成功");
+        dialogFormVisible.value = false;
+        proTable.value?.getTableList();
+      }
     }
   });
 };

+ 44 - 4
src/views/couponManagement/newCoupon.vue

@@ -101,16 +101,20 @@
  * 优惠券管理 - 新增页面
  * 功能:支持优惠券的新增操作
  */
-import { ref, reactive, watch, nextTick } from "vue";
+import { ref, reactive, watch, nextTick, onMounted } from "vue";
 import { ElMessage } from "element-plus";
-import { useRouter } from "vue-router";
+import { useRoute, useRouter } from "vue-router";
 import type { FormInstance } from "element-plus";
-
+import { getCouponDetail } from "@/api/modules/couponManagement";
 // ==================== 响应式数据定义 ====================
 
 // 路由相关
 const router = useRouter();
+const route = useRoute();
 
+// 页面状态
+const type = ref<string>(""); // 页面类型:add-新增, edit-编辑
+const id = ref<string>(""); // 页面ID参数
 // ==================== 表单验证规则 ====================
 const rules = reactive({
   couponName: [{ required: true, message: "请输入优惠券名称" }],
@@ -318,7 +322,43 @@ watch(
 );
 
 // ==================== 事件处理函数 ====================
-
+/**
+ * 组件挂载时初始化
+ * 从路由参数中获取页面类型和ID
+ */
+onMounted(async () => {
+  id.value = (route.query.id as string) || "";
+  type.value = (route.query.type as string) || "";
+  // 不要删除-开始
+  // let param = {
+  //   // phone: localGet("iphone")
+  //   phone: "18641153170"
+  // };
+  // const resP: any = await getUserByPhone(param);
+  // if (resP.data && resP.data.storeId) {
+  //   localSet("createdId", resP.data.storeId);
+  //   const resD: any = await getDetail({
+  //     id: localGet("createdId")
+  //   });
+  //   if (resD.data && resD.data.commissionRate) {
+  //     localSet("commissionRate", resD.data.commissionRate);
+  //   }
+  //   if (resD.data && resD.data.businessSection) {
+  //     localSet("businessSection", resD.data.businessSection);
+  //   }
+  // } else {
+  //   ElMessage.warning("请完成商家入驻后再进行新建团购");
+  // }
+  // if (!getGroupCombination()) {
+  //   ElMessage.warning("请完成商家入驻后重新登录再进行新建团购");
+  //   return;
+  // }
+  // 不要删除-结束
+  if (type.value != "add") {
+    // TODO: 加载优惠券详情数据
+    // let res: any = await getCouponDetail({ id: id.value });
+  }
+});
 /**
  * 返回上一页
  */

+ 10 - 2
src/views/orderManagement/index.vue

@@ -36,7 +36,7 @@ import { onActivated, onMounted, reactive, ref } from "vue";
 import { useRouter } from "vue-router";
 import ProTable from "@/components/ProTable/index.vue";
 import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface";
-import { getThaliList } from "@/api/modules/groupPackageManagement";
+import { getThaliList, getCpList } from "@/api/modules/orderManagement";
 
 const router = useRouter();
 const proTable = ref<ProTableInstance>();
@@ -189,6 +189,14 @@ const handleClick = () => {
 // 显示菜品弹窗
 const showDishDialog = (row: any) => {
   // TODO: 根据实际API获取菜品数据
+  // const params = {
+  //   storeId: "104",
+  //   status: "1"
+  // };
+  // let res: any = await getCpList(params);
+  // if (res && res.code == 200) {
+  //   dishList.value = res.data.records;
+  // }
   // 这里先使用模拟数据
   dishList.value = [
     { category: "蔬菜", name: "黄豆芽", price: 5, quantity: 1 },
@@ -199,7 +207,7 @@ const showDishDialog = (row: any) => {
 
 // 跳转详情页
 const toDetail = (row: any) => {
-  router.push(`/orderManagementDetail?id=${row.id}`);
+  router.push(`/orderManagement/detail?id=${row.id}`);
 };
 </script>
 

+ 36 - 30
src/views/voucherManagement/index.vue

@@ -96,8 +96,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 { audit, getStaffConfigList } from "@/api/modules/staffConfig";
-import { getThaliList } from "@/api/modules/groupPackageManagement";
+import { deleteThali, getThaliList, sjxj, xgkc } from "@/api/modules/voucherManagement";
+import { ElMessageBox } from "element-plus/es";
 
 const router = useRouter();
 const dialogFormVisible = ref(false);
@@ -109,7 +109,10 @@ const formInventory: any = ref({
 });
 const rowData = ref<any>();
 const activeName = ref("");
-
+// 定义表单类型
+interface RuleForm {
+  newInventory: string;
+}
 const ruleFormRef = ref<FormInstance>();
 const rules = reactive<FormRules<RuleForm>>({
   newInventory: [
@@ -298,23 +301,35 @@ const getTableList = (params: any) => {
   let newParams = JSON.parse(JSON.stringify(params));
   return getThaliList(newParams);
 };
-
+const newGroupBuying = () => {
+  router.push(`/voucherManagement/newVoucher?type=add`);
+};
 // 跳转详情页
 const toDetail = row => {
-  router.push(`/voucherManagement/detail?id=${row.id}&type=edit`);
+  router.push(`/voucherManagement/detail?id=${row.id}`);
 };
-const editRow = row => {};
-const deleteRow = row => {};
-const newGroupBuying = () => {
-  router.push(`/voucherManagement/newVoucher?id=104&type=add`);
+const editRow = row => {
+  router.push(`/voucherManagement/newVoucher?id=${row.id}&type=edit`);
+};
+const deleteRow = row => {
+  ElMessageBox.confirm("确定要删除吗?", "提示", {
+    confirmButtonText: "OK",
+    cancelButtonText: "Cancel",
+    type: "warning"
+  }).then(() => {
+    deleteThali(row.id).then(() => {
+      ElMessage.success("删除成功");
+      proTable.value?.getTableList();
+    });
+  });
 };
 const handleClick = () => {};
-const changeTypes = (row: any, status: string) => {
+const changeTypes = async (row: any, status: string) => {
   rowData.value = row;
-  if (status === "on") {
-    handleChangeStatus(row, "1");
-  } else {
-    handleChangeStatus(row, "2");
+  let res = await sjxj({ id: row.id, status: status });
+  if (res && res.code == 200) {
+    ElMessage.success("操作成功");
+    proTable.value?.getTableList();
   }
 };
 const changeInventory = (row: any) => {
@@ -324,26 +339,17 @@ const changeInventory = (row: any) => {
   formInventory.value.newInventory = "";
   dialogFormVisible.value = true;
 };
-const handleChangeStatus = async (row: any, status: string) => {
-  try {
-    let res = await audit({ id: row.id, status: status, rejectionReason: form.comment });
-    if (res.code == 200) {
-      proTable.value?.getTableList();
-      if (status === "2") closeDialog();
-      ElMessage.success("审核成功");
-    }
-  } catch (error) {
-    ElMessage.error("操作失败");
-  }
-};
-
 // 弹窗提交
 const handleSubmit = async () => {
   if (!ruleFormRef.value) return;
-  await ruleFormRef.value.validate((valid, fields) => {
+  await ruleFormRef.value.validate(async (valid, fields) => {
     if (valid) {
-      ElMessage.success("修改成功");
-      dialogFormVisible.value = false;
+      let res = await xgkc({ id: formInventory.value.id, status: formInventory.value.newInventory });
+      if (res && res.code == 200) {
+        ElMessage.success("库存修改成功");
+        dialogFormVisible.value = false;
+        proTable.value?.getTableList();
+      }
     }
   });
 };

+ 3 - 18
src/views/voucherManagement/newVoucher.vue

@@ -231,12 +231,11 @@
  * 代金券管理 - 新增/编辑页面
  * 功能:支持代金券的新增和编辑操作
  */
-import { ref, reactive, onMounted, watch, nextTick } from "vue";
+import { ref, reactive, watch, nextTick, onMounted } from "vue";
 import { ElMessage } from "element-plus";
-import { Plus, Delete } from "@element-plus/icons-vue";
-import { getHolidayList } from "@/api/modules/groupPackageManagement";
-import { useRouter, useRoute } from "vue-router";
+import { useRoute, useRouter } from "vue-router";
 import type { FormInstance } from "element-plus";
+import { getVoucherDetail } from "@/api/modules/voucherManagement";
 
 // ==================== 响应式数据定义 ====================
 
@@ -656,20 +655,6 @@ watch(
 onMounted(async () => {
   id.value = (route.query.id as string) || "";
   type.value = (route.query.type as string) || "";
-
-  // 获取节日列表
-  let params = {
-    year: new Date().getFullYear(),
-    page: 1,
-    size: 500,
-    openFlag: 1,
-    holidayName: ""
-  };
-  let res = await getHolidayList(params);
-  if (res && res.code == 200) {
-    holidayList.value = res.data.records;
-  }
-
   // 编辑模式下加载数据
   if (type.value != "add") {
     // TODO: 加载代金券详情数据