feat:部门管理员查看每日菜单

This commit is contained in:
dzc committed 2026-05-07 15:14:55 +08:00
1 parent 93a85f1929
commit 0b167a92db
4 files changed
+80 -61

No files matched your search

+3
View File
@@ -19,6 +19,8 @@
import { reactive } from "vue"
import * as mchApi from "/@/api/wallet/mch-manage"
const emit = defineEmits(['update:modelValue']);
const selectId = defineModel()
const props = withDefaults(
@@ -71,6 +73,7 @@ async function getOptions() {
state.options = data.records ?? []
if (props.autoFirst && state.options.length != 0) {
state.selectId = state.options[0].id
emit("update:modelValue", state.selectId)
}
} finally {
setTimeout(() => (state.loading = false), 500)
+47 -45
View File
@@ -1,34 +1,26 @@
<template>
<div class="layout-padding" v-loading="loading">
<el-row class="flex items-center">
<el-form-item label="商户" prop="merchantId" class="w-60 my-6">
<select-mch v-model="merchantId" :apiParams="{ types: '1' }" />
</el-form-item>
<el-row class="flex items-center">
<el-form-item label="商户" prop="merchantId" class="w-60 my-6">
<select-mch v-model="merchantId" autoFirst :apiParams="{ types: '1', deptId: currentUserDeptId }" />
</el-form-item>
<div class="ml-4">
<el-button
icon="folder-add"
type="primary"
@click="copyDialogRef.openDialog()"
v-auth="'canteen_canteenOnlineCategory_add'"
>
一键复制
</el-button>
</div>
</el-row>
<div class="ml-4">
<el-button icon="folder-add" type="primary" @click="copyDialogRef.openDialog()"
v-auth="'canteen_canteenOnlineCategory_add'">
一键复制
</el-button>
</div>
</el-row>
<h1 class="mx-auto text-5xl mt-[-40px]">今日菜谱</h1>
<table v-if="weekData.data.length > 0" class="w-11/12 border-collapse cursor-pointer mx-auto">
<tr>
<div class="text-4xl mr-2 text-right" @click="addClick(-1)">&lt;</div>
<td
v-for="(item, index) in weekData.data"
:key="index"
@click="timeClick(item, index)"
<td v-for="(item, index) in weekData.data" :key="index" @click="timeClick(item, index)"
:class="{ selectedSpan: isActive === index }"
class="border-2 border-solid border-gray-200 text-center"
>
class="border-2 border-solid border-gray-200 text-center">
<span>{{ item }}</span>
</td>
<div class="text-4xl ml-2 text-left" @click="addClick(1)">&gt;</div>
@@ -40,12 +32,14 @@
<tr class="food">
<td v-if="!loading" class="text-center" @click="addFood(1)">早餐</td>
<div class="food_list">
<td class="food_list_item" v-for="(item, index) in foodData1" :key="index" @click="delteData(item.tid)">
<td class="food_list_item" v-for="(item, index) in foodData1" :key="index"
@click="delteData(item.tid)">
<el-image style="width: 80px; height: 80px" :src="imageBaseUrl + item.picUrl" fit="cover" />
<div class="w-full flex justify-around items-center text-black mt-2">
<span>{{ item.name }}</span>
<span class="mx-1">|</span>
<span class="text-sm">{{ canteenCategoryOption.find((v: any) => v.id == item.categoryId)?.name }}</span>
<span class="text-sm">{{canteenCategoryOption.find((v: any) => v.id ==
item.categoryId)?.name}}</span>
</div>
<div class="w-full text-lg text-center text-red-600">{{ displayPrice(item.price) }}</div>
</td>
@@ -54,26 +48,31 @@
<tr class="food">
<td v-if="!loading" class="text-center" @click="addFood(2)">中餐</td>
<div class="food_list">
<td class="food_list_item" v-for="(item, index) in foodData2" :key="index" @click="delteData(item.tid)">
<td class="food_list_item" v-for="(item, index) in foodData2" :key="index"
@click="delteData(item.tid)">
<el-image style="width: 80px; height: 80px" :src="imageBaseUrl + item.picUrl" fit="cover" />
<div class="w-full flex justify-around items-center text-black mt-2">
<span>{{ item.name }}</span>
<span class="mx-1">|</span>
<span class="text-sm">{{ canteenCategoryOption.find((v: any) => v.id == item.categoryId)?.name }}</span>
<span class="text-sm">{{canteenCategoryOption.find((v: any) => v.id ==
item.categoryId)?.name}}</span>
</div>
<div class="w-full text-lg text-center text-red-600">{{ displayPrice(item.price) }}</div>
</td>
</div>
</tr>
<tr class="food">
<td v-if="!loading" class="text-center" @click="addFood(3)">晚餐</td>
<td v-if="!loading" class="text-center" @click="addFood(3)">晚餐</td>
<div class="food_list">
<td class="food_list_item" v-for="(item, index) in foodData3" :key="index" @click="delteData(item.tid)">
<el-image style="width: 80px; height: 80px" loading="lazy" :src="imageBaseUrl + item.picUrl" fit="cover" />
<td class="food_list_item" v-for="(item, index) in foodData3" :key="index"
@click="delteData(item.tid)">
<el-image style="width: 80px; height: 80px" loading="lazy" :src="imageBaseUrl + item.picUrl"
fit="cover" />
<div class="w-full flex justify-around items-center text-black mt-2">
<span>{{ item.name }}</span>
<span class="mx-1">|</span>
<span class="text-sm">{{ canteenCategoryOption.find((v: any) => v.id == item.categoryId)?.name }}</span>
<span class="text-sm">{{canteenCategoryOption.find((v: any) => v.id ==
item.categoryId)?.name}}</span>
</div>
<div class="w-full text-lg text-center text-red-600">{{ displayPrice(item.price) }}</div>
</td>
@@ -96,10 +95,16 @@ import { useMessage } from "/@/hooks/message"
import { pageJoin } from "/@/api/wallet/mch-manage"
import { displayPrice } from "/@/utils/formatMoney"
import { auth } from "/@/utils/authFunction"
import { useUserInfo } from "/@/stores/userInfo"
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
const imageBaseUrl = import.meta.env.VITE_IMAGE_BASE_PATH
// 定义变量内容
const stores = useUserInfo()
const { userInfos } = storeToRefs(stores)
const currentUserDeptId = ref(null)
const formDialogRef = ref()
const loading = ref(true)
@@ -118,7 +123,6 @@ const weekData = reactive({
data: [],
}) //时间数组
const merchantId = ref() // 商户Id
const merchantInfo = ref<any>([])
const addFood = async (hourType: number) => {
if (!auth("canteen_canteenDailyMenu_add")) return
@@ -211,20 +215,9 @@ const delteData = async (tid: number) => {
loading.value = false
}
})
.catch(() => {})
.catch(() => { })
}
// 获取下拉框选项
const merchantInit = async () => {
const res = await pageJoin({ current: 1, size: 9999, types: 1 }).finally(() => (loading.value = false))
merchantInfo.value = res.data.records
//默认选中第一个
if (merchantInfo.value) {
merchantId.value = merchantInfo.value[0].id
fetchData()
}
}
// 菜品分类
const canteenCategoryOption = ref<any>([])
@@ -242,9 +235,16 @@ onMounted(async () => {
}
} catch (error) {
canteenCategoryOption.value = []
} finally {
loading.value = false
}
const currentUser = userInfos.value.user
console.log("currentUser:", userInfos.value);
if (userInfos.value.roleCodes.includes("DEPT_ADMIN")) {
if (currentUser && currentUser.deptId) {
currentUserDeptId.value = currentUser.deptId
}
}
await merchantInit()
})
</script>
@@ -258,7 +258,7 @@ onMounted(async () => {
align-items: center;
margin-top: 30px;
& > td {
&>td {
width: 60px;
color: rgb(0, 118, 228);
font-size: 26px;
@@ -293,6 +293,7 @@ onMounted(async () => {
}
}
}
.selectedSpan {
border: 2px solid rgb(255, 187, 0);
border-left: 2px solid transparent;
@@ -301,6 +302,7 @@ onMounted(async () => {
position: relative;
cursor: default;
}
.selectedSpan::before {
content: "";
position: absolute;
+22 -14
View File
@@ -1,10 +1,8 @@
<template>
<div class="layout-padding">
<div class="layout-padding-view">
<div
ref="containerRef"
class="relative h-full w-full overflow-y-scroll scrollbar-hidden bg-gradient-to-br from-[#232e55] to-[#040a1b] py-2"
>
<div ref="containerRef"
class="relative h-full w-full overflow-y-scroll scrollbar-hidden bg-gradient-to-br from-[#232e55] to-[#040a1b] py-2">
<!-- 背景圆点 -->
<div class="pointer-events-none absolute inset-0 pattern-dots opacity-[0.08]"></div>
@@ -24,16 +22,17 @@
<div class="h-8 relative mx-4 flex items-center justify-between">
<div class="flex items-center">
<h1 class="text-4xl text-[#b0bfff] font-bold tracking-wider">今日午餐菜品</h1>
<div class="text-xl text-blue-400 drop-shadow-lg ml-5">{{ currentDate }}&nbsp;&nbsp;&nbsp;{{ currentTime }}</div>
<div class="text-xl text-blue-400 drop-shadow-lg ml-5">{{ currentDate }}&nbsp;&nbsp;&nbsp;{{
currentTime }}</div>
</div>
<!-- 全屏按钮 -->
<el-tooltip :content="isFullscreen ? '退出全屏' : '全屏'" placement="left" effect="dark">
<button
@click="toggleFullScreen"
class="flex h-8 w-8 items-center justify-center rounded-xl bg-[#F7D6C3]/20 transition-all hover:scale-110 hover:bg-[#F7D6C3]/40"
>
<el-icon class="icon h-10 w-10 font-bold bg-contain bg-center bg-no-repeat"><FullScreen /></el-icon>
<button @click="toggleFullScreen"
class="flex h-8 w-8 items-center justify-center rounded-xl bg-[#F7D6C3]/20 transition-all hover:scale-110 hover:bg-[#F7D6C3]/40">
<el-icon class="icon h-10 w-10 font-bold bg-contain bg-center bg-no-repeat">
<FullScreen />
</el-icon>
</button>
</el-tooltip>
</div>
@@ -42,17 +41,21 @@
<div class="w-full flex flex-wrap items-center" v-for="(hourType, index) in foodData" :key="index">
<div v-for="dish in hourType" :key="dish.id" class="p-2" :style="cardStyle">
<div class="relative overflow-hidden rounded-tl rounded-tr" :style="foodCardStyle">
<img :src="imageBaseUrl + dish.picUrl" :alt="dish.name" class="h-full w-full object-cover" />
<img :src="imageBaseUrl + dish.picUrl" :alt="dish.name"
class="h-full w-full object-cover" />
<div class="ribbon">午餐</div>
<div class="absolute left-1 top-1">
<star-medal :text="canteenCategoryOption?.find((v: any) => v.id == dish.categoryId)?.name" />
<star-medal
:text="canteenCategoryOption?.find((v: any) => v.id == dish.categoryId)?.name" />
</div>
</div>
<div class="w-full flex items-center justify-between bg-[#AEBBF9]/40 px-2 py-2 backdrop-blur-sm rounded-bl rounded-br">
<div
class="w-full flex items-center justify-between bg-[#AEBBF9]/40 px-2 py-2 backdrop-blur-sm rounded-bl rounded-br">
<h3 class="text-2xl font-bold text-[#7cacff] drop-shadow-lg line-clamp-1 whitespace-nowrap">
{{ dish.name }}
</h3>
<p class="text-3xl font-bold text-[#a9c7ff] drop-shadow-lg whitespace-nowrap">¥{{ displayPrice(dish.price) }}</p>
<p class="text-3xl font-bold text-[#a9c7ff] drop-shadow-lg whitespace-nowrap">¥{{
displayPrice(dish.price) }}</p>
</div>
</div>
</div>
@@ -218,23 +221,28 @@ const getCanteenDishesCategory = async () => {
background-image: radial-gradient(#eff4ee 1px, transparent 10px);
background-size: 10px 10px;
}
.ink-cloud {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%23F7D6C3' d='M50,0C36.7,0,25,11.7,25,25c0,13.3,11.7,25,25,25s25-11.7,25-25C75,11.7,63.3,0,50,0z M50,40c-8.3,0-15-6.7-15-15s6.7-15,15-15s15,6.7,15,15S58.3,40,50,40z'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 50 50' to='360 50 50' dur='20s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}
.scrollbar-hidden::-webkit-scrollbar {
display: none;
}
.scrollbar-hidden {
scrollbar-width: none;
-ms-overflow-style: none;
}
::selection {
background: #1879ff;
color: #fff;
}
.ribbon {
width: 80px;
height: 20px;
@@ -1,6 +1,6 @@
<template>
<el-dialog title="编辑外卖配置" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="100px"
<el-dialog :title="form.id ? '编辑支付平台配置' : '新增支付平台配置'" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="120px"
v-loading="loading">
<el-row :gutter="24">
<el-col :span="12" class="mb20">
@@ -43,6 +43,12 @@
<el-input v-model="form.settingJson.subMchid" />
</el-form-item>
</div>
<div class="w-full" v-else-if="form.platformType == '20'">
<el-alert title="支付宝支付配置" type="primary" effect="dark" :closable="false" />
<el-form-item class="mt-[10px]" label="支付宝商户号" prop="settingJson.subMchid">
<el-input v-model="form.settingJson.subMchid" />
</el-form-item>
</div>
</el-row>
</el-form>
<template #footer>