修改菜品分类接口

This commit is contained in:
ctw committed 2025-01-17 15:00:14 +08:00
1 parent 373de198e4
commit 0fa67d4d02
5 files changed
+54 -51

No files matched your search

+6 -4
View File
@@ -158,7 +158,7 @@ import { useMessage } from "/@/hooks/message"
import { rule } from "/@/utils/validate"
import { useDict } from "/@/hooks/dict"
import { displayPrice } from "/@/utils/formatMoney"
import { fetchList as getCanteenCategory } from "/@/api/canteen/canteenCategory"
import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCategory"
import { getObj, addObj, putObj, getCanteenDailyMenuList } from "/@/api/canteen/canteenDailyMenu"
const emit = defineEmits(["refresh"])
@@ -339,10 +339,12 @@ const handleClickSelect = async () => {
selectObjs.value = [...selectedFood.value]
await getDataListAndSelect() // 获取菜品数据并且勾选表格行
// 获取菜品分类数据
// 获取菜品分类
try {
const res = await getCanteenCategory({ current: 1, size: 999999 })
categoryOptions.value = res.data.records
const res = await getCanteenCategory()
if (res.code === 0) {
categoryOptions.value = res.data
}
} catch (error) {
categoryOptions.value = []
}
+13 -9
View File
@@ -81,7 +81,7 @@
<script setup lang="ts" name="systemCanteenDailyMenu">
import { ElMessageBox } from "element-plus"
import { delObjs, selectTimeFoodApi, selectWeekInfo } from "/@/api/canteen/canteenDailyMenu"
import { fetchList } from "/@/api/canteen/canteenCategory"
import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCategory"
import { useMessage } from "/@/hooks/message"
import { pageJoin } from "/@/api/wallet/mch-manage"
import { displayPrice } from "/@/utils/formatMoney"
@@ -218,16 +218,20 @@ const merchantInit = async () => {
}
}
// 菜品分类
const canteenCategoryOption = ref<any>([])
// 获取菜品分类
const getCanteenCategory = async () => {
const res = await fetchList({ current: 1, size: 9999 })
if (res.code === 0) {
canteenCategoryOption.value = res.data.records
}
}
onMounted(async () => {
await getCanteenCategory()
try {
// 获取菜品分类
const res = await getCanteenCategory()
if (res.code === 0) {
canteenCategoryOption.value = res.data
}
} catch (error) {
canteenCategoryOption.value = []
}
await merchantInit()
})
</script>
+2 -2
View File
@@ -127,7 +127,7 @@ import { fetchList, delObjs } from "/@/api/canteen/canteenSpu"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
import { displayPrice } from "/@/utils/formatMoney"
import { fetchList as getCanteenCategory } from "/@/api/canteen/canteenCategory"
import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCategory"
// 引入组件
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
@@ -151,7 +151,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
onMounted(async () => {
try {
const res = await getCanteenCategory()
categoryOptions.value = res.data.records
categoryOptions.value = res.data
} catch (error) {
categoryOptions.value = []
}