# Conflicts:
#	.env.development
This commit is contained in:
dzc committed 2025-01-19 11:55:12 +08:00
commit 7d780d9f0c
13 files changed
+249 -205

No files matched your search

+6 -3
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"])
@@ -337,11 +337,14 @@ const handleClickSelect = async () => {
selectDialogVisible.value = true
selectObjs.value = [...selectedFood.value]
await getDataListAndSelect() // 获取菜品数据并且勾选表格行
await getDataListAndSelect() // 获取菜品数据并且勾选表格行
// 获取菜品分类
try {
const res = await getCanteenCategory()
categoryOptions.value = res.data.records
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 = []
}
+30 -27
View File
@@ -2,7 +2,10 @@
<el-card class="card" v-loading="loading">
<el-row>
<el-col :span="4" v-for="(item, index) in navMenuList" :key="index">
<div :class="['nav-menu-item-top', item.id == currentActiveMenuId ? 'nav-menu-item-active' : '']" @click="currentActiveMenuId = item.id">
<div
:class="['nav-menu-item-top', item.id == currentActiveMenuId ? 'nav-menu-item-active' : '']"
@click="currentActiveMenuId = item.id"
>
<el-image class="nav-menu-item-icon" :src="imageBaseUrl + item.menuPic" fit="cover" />
<div class="nav-menu-item-name">{{ $t(item.name) }}</div>
</div>
@@ -10,7 +13,7 @@
</el-row>
<br />
<el-row v-if="currentActiveMenuId" style="background-color: #e2eff677; border-radius: 1rem; padding: 2rem 6rem">
<el-col v-for="(item, index) in navMenuListBottom" :key="index" :span="!item.meta?.isHide ? 3 : 0">
<el-col v-for="(item, index) in navMenuListBottom" :key="index" :span="!item.meta?.isHide ? 4 : 0">
<div v-if="!item.meta?.isHide" class="nav-menu-item-bottom" @click="handleClickBottomMenu(item)">
<el-image class="nav-menu-item-icon" :src="imageBaseUrl + item.menuPic" fit="cover" />
<div class="nav-menu-item-name">{{ $t(item.name) }}</div>
@@ -21,55 +24,55 @@
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ElMessage } from 'element-plus';
import { useMenuApi } from '/@/api/admin/menu';
import { ref } from "vue"
import { ElMessage } from "element-plus"
import { useMenuApi } from "/@/api/admin/menu"
const router = useRouter();
const menuApi = useMenuApi();
const loading = ref(false);
const navMenuList = ref<any>([]);
const currentActiveMenuId = ref('');
const imageBaseUrl = import.meta.env.VITE_IMAGE_BASE_PATH;
const router = useRouter()
const menuApi = useMenuApi()
const loading = ref(false)
const navMenuList = ref<any>([])
const currentActiveMenuId = ref("")
const imageBaseUrl = import.meta.env.VITE_IMAGE_BASE_PATH
// 获取菜单列表
const getNavMenuList = async () => {
loading.value = true;
loading.value = true
try {
const res = await menuApi.getAdminMenu().finally(() => (loading.value = false));
const res = await menuApi.getAdminMenu().finally(() => (loading.value = false))
if (res.code == 0 && res.data.length > 0) {
navMenuList.value = res.data;
navMenuList.value = res.data
}
} catch (error) {
navMenuList.value = [];
ElMessage.error('加载错误');
loading.value = false;
navMenuList.value = []
ElMessage.error("加载错误")
loading.value = false
}
};
}
const navMenuListBottom = computed(() => {
if (navMenuList.value) {
const currentMenuItem = navMenuList.value.find((item: any) => item.id == currentActiveMenuId.value);
if (currentMenuItem && currentMenuItem.children) return currentMenuItem.children;
const currentMenuItem = navMenuList.value.find((item: any) => item.id == currentActiveMenuId.value)
if (currentMenuItem && currentMenuItem.children) return currentMenuItem.children
} else {
return [];
return []
}
});
})
// 点击菜单项
const handleClickBottomMenu = (item: any) => {
router.push(item.path);
};
router.push(item.path)
}
onMounted(async () => {
await getNavMenuList();
});
await getNavMenuList()
})
</script>
<style scoped lang="scss">
.card {
padding: 5vw;
height: 100%;
height: calc(100vh - 85px);
background-image: linear-gradient(0deg, #ffffff 0%, #e4ebff 100%);
}
.nav-menu-item-top {