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

refactor(api): 统一库存修改接口名称并优化调用参数

- 将 xgkc 接口统一重命名为 updateNum- 修改接口调用参数 status 为 num
- 更新所有引用该接口的 Vue 组件
-修正组件中库存字段名称 remainingInventory 为 inventoryNum
-优化图片上传预览样式,确保图片铺满容器
- 修正注释描述,移除不必要的假设说明
congxuesong 1 сар өмнө
parent
commit
1a812d42da

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

@@ -11,8 +11,8 @@ export const deleteThali = (params: { id: string }) => {
 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 updateNum = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/updateNum1`, params);
 };
 export const saveDraft = params => {
   return http.post(PORT_NONE + `/PcGroupBuy/saveDraft`, params);

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

@@ -11,8 +11,8 @@ export const deleteThali = (params: { id: string }) => {
 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 updateNum = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/updateNum`, params);
 };
 export const saveDraft = params => {
   return http.post(PORT_NONE + `/PcGroupBuy/saveDraft`, params);

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

@@ -11,8 +11,8 @@ export const deleteThali = (params: { id: string }) => {
 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 updateNum = params => {
+  return http.get(PORT_NONE + `/PcGroupBuy/updateNum11`, params);
 };
 export const saveDraft = params => {
   return http.post(PORT_NONE + `/PcGroupBuy/saveDraft`, params);

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

@@ -68,7 +68,7 @@
           {{ formInventory.packageName }}
         </el-form-item>
         <el-form-item label="剩余库存">
-          {{ formInventory.remainingInventory }}
+          {{ formInventory.inventoryNum }}
         </el-form-item>
         <el-form-item label="修改库存" prop="newInventory">
           <el-input v-model="formInventory.newInventory" placeholder="请输入" />
@@ -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, xgkc, deleteThali } from "@/api/modules/couponManagement";
+import { getThaliList, sjxj, updateNum, deleteThali } from "@/api/modules/couponManagement";
 import { ElMessageBox } from "element-plus/es";
 
 const router = useRouter();
@@ -100,7 +100,7 @@ const dialogFormVisible = ref(false);
 const formInventory: any = ref({
   id: "",
   packageName: "",
-  remainingInventory: "",
+  inventoryNum: "",
   newInventory: ""
 });
 const rowData = ref<any>();
@@ -302,9 +302,9 @@ const changeTypes = async (row: any, status: string) => {
   }
 };
 const changeInventory = (row: any) => {
-  formInventory.value.id = 1;
-  formInventory.value.packageName = 1;
-  formInventory.value.remainingInventory = 1;
+  formInventory.value.id = row.id;
+  formInventory.value.packageName = row.packageName;
+  formInventory.value.inventoryNum = row.inventoryNum;
   formInventory.value.newInventory = "";
   dialogFormVisible.value = true;
 };
@@ -313,7 +313,7 @@ const handleSubmit = async () => {
   if (!ruleFormRef.value) return;
   await ruleFormRef.value.validate(async (valid, fields) => {
     if (valid) {
-      let res = await xgkc({ id: formInventory.value.id, status: formInventory.value.newInventory });
+      let res = await updateNum({ id: formInventory.value.id, num: formInventory.value.newInventory });
       if (res && res.code == 200) {
         ElMessage.success("库存修改成功");
         dialogFormVisible.value = false;
@@ -328,7 +328,7 @@ const closeDialog = () => {
   formInventory.value = {
     id: "",
     packageName: "",
-    remainingInventory: "",
+    inventoryNum: "",
     newInventory: ""
   };
 };

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

@@ -93,13 +93,13 @@
     <el-dialog v-model="dialogFormVisible" title="修改库存" width="500">
       <el-form ref="ruleFormRef" :model="formInventory" :rules="rules" @submit.prevent>
         <el-form-item label="套餐名">
-          {{ formInventory.packageName }}
+          {{ formInventory.groupName }}
         </el-form-item>
         <el-form-item label="剩余库存">
-          {{ formInventory.remainingInventory }}
+          {{ formInventory.inventoryNum }}
         </el-form-item>
         <el-form-item label="修改库存" prop="newInventory">
-          <el-input v-model="formInventory.newInventory" placeholder="请输入" />
+          <el-input v-model="formInventory.newInventory" placeholder="请输入库存数量" />
         </el-form-item>
       </el-form>
       <template #footer>
@@ -154,14 +154,14 @@ 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, xgkc } from "@/api/modules/groupPackageManagement";
+import { deleteThali, getThaliList, sjxj, updateNum } from "@/api/modules/groupPackageManagement";
 
 const router = useRouter();
 const dialogFormVisible = ref(false);
 const formInventory: any = ref({
   id: "",
-  packageName: "",
-  remainingInventory: "",
+  groupName: "",
+  inventoryNum: "",
   newInventory: ""
 });
 const rowData = ref<any>();
@@ -432,8 +432,8 @@ const changeTypes = async (row: any, status: string) => {
 };
 const changeInventory = (row: any) => {
   formInventory.value.id = row.id;
-  formInventory.value.packageName = 1;
-  formInventory.value.remainingInventory = 1;
+  formInventory.value.groupName = row.groupName;
+  formInventory.value.inventoryNum = row.inventoryNum;
   formInventory.value.newInventory = "";
   dialogFormVisible.value = true;
 };
@@ -442,7 +442,7 @@ const handleSubmit = async () => {
   if (!ruleFormRef.value) return;
   await ruleFormRef.value.validate(async (valid, fields) => {
     if (valid) {
-      let res = await xgkc({ id: formInventory.value.id, status: formInventory.value.newInventory });
+      let res = await updateNum({ id: formInventory.value.id, num: formInventory.value.newInventory });
       if (res && res.code == 200) {
         ElMessage.success("库存修改成功");
         dialogFormVisible.value = false;
@@ -456,8 +456,8 @@ const closeDialog = () => {
   dialogFormVisible.value = false;
   formInventory.value = {
     id: "",
-    packageName: "",
-    remainingInventory: "",
+    groupName: "",
+    inventoryNum: "",
     newInventory: ""
   };
 };

+ 13 - 1
src/views/groupPackageManagement/newGroup.vue

@@ -1063,7 +1063,7 @@ onMounted(async () => {
     storeInfoModel.value.imageId = storeInfoModel.value.imageId ? storeInfoModel.value.imageId.split(",") : [];
     let imageValueStr: any[] = [];
     handleImageParam(storeInfoModel.value.imageValueStr || [], imageValueStr);
-    // 将 imageId 关联到对应的文件对象中(假设 imageValueStr 和 imageId 的顺序是对应的)
+    // 将 imageId 关联到对应的文件对象中
     if (imageValueStr.length > 0 && storeInfoModel.value.imageId.length > 0) {
       imageValueStr.forEach((file, index) => {
         if (storeInfoModel.value.imageId[index]) {
@@ -1961,6 +1961,18 @@ const handleImageParam = (list: any[], result: any[]) => {
   margin-bottom: 50px;
 }
 
+/* el-upload 图片预览铺满容器 */
+:deep(.el-upload-list--picture-card) {
+  .el-upload-list__item {
+    overflow: hidden;
+    .el-upload-list__item-thumbnail {
+      width: 100%;
+      height: 100%;
+      object-fit: fill;
+    }
+  }
+}
+
 /* 表单容器 */
 .formBox {
   display: flex;

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

@@ -72,7 +72,7 @@
           {{ formInventory.packageName }}
         </el-form-item>
         <el-form-item label="剩余库存">
-          {{ formInventory.remainingInventory }}
+          {{ formInventory.inventoryNum }}
         </el-form-item>
         <el-form-item label="修改库存" prop="newInventory">
           <el-input v-model="formInventory.newInventory" placeholder="请输入" />
@@ -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 { deleteThali, getThaliList, sjxj, xgkc } from "@/api/modules/voucherManagement";
+import { deleteThali, getThaliList, sjxj, updateNum } from "@/api/modules/voucherManagement";
 import { ElMessageBox } from "element-plus/es";
 
 const router = useRouter();
@@ -104,7 +104,7 @@ const dialogFormVisible = ref(false);
 const formInventory: any = ref({
   id: "",
   packageName: "",
-  remainingInventory: "",
+  inventoryNum: "",
   newInventory: ""
 });
 const rowData = ref<any>();
@@ -333,9 +333,9 @@ const changeTypes = async (row: any, status: string) => {
   }
 };
 const changeInventory = (row: any) => {
-  formInventory.value.id = 1;
-  formInventory.value.packageName = 1;
-  formInventory.value.remainingInventory = 1;
+  formInventory.value.id = row.id;
+  formInventory.value.packageName = row.packageName;
+  formInventory.value.inventoryNum = row.inventoryNum;
   formInventory.value.newInventory = "";
   dialogFormVisible.value = true;
 };
@@ -344,7 +344,7 @@ const handleSubmit = async () => {
   if (!ruleFormRef.value) return;
   await ruleFormRef.value.validate(async (valid, fields) => {
     if (valid) {
-      let res = await xgkc({ id: formInventory.value.id, status: formInventory.value.newInventory });
+      let res = await updateNum({ id: formInventory.value.id, num: formInventory.value.newInventory });
       if (res && res.code == 200) {
         ElMessage.success("库存修改成功");
         dialogFormVisible.value = false;
@@ -359,7 +359,7 @@ const closeDialog = () => {
   formInventory.value = {
     id: "",
     packageName: "",
-    remainingInventory: "",
+    inventoryNum: "",
     newInventory: ""
   };
 };