From af6425ddea9760344a043be0d69e33aec251f135 Mon Sep 17 00:00:00 2001
From: zjf <1799650030@qq.com>
Date: Mon, 16 Dec 2024 16:24:12 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BC=95=E5=85=A5=E5=8C=85=E5=8E=A2=EF=BC=8C?=
=?UTF-8?q?=E5=AE=8C=E5=96=84=E6=AF=8F=E6=97=A5=E8=8F=9C=E8=B0=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/canteen/boxesInfo.ts | 41 +++++
src/api/canteen/canteenDailyMenu.ts | 1 +
src/api/canteen/merchantInfo.ts | 13 ++
src/views/canteen/boxesInfo/form.vue | 148 +++++++++++++++++++
src/views/canteen/boxesInfo/index.vue | 138 +++++++++++++++++
src/views/canteen/canteenDailyMenu/form.vue | 39 ++++-
src/views/canteen/canteenDailyMenu/index.vue | 105 ++++---------
7 files changed, 401 insertions(+), 84 deletions(-)
create mode 100644 src/api/canteen/boxesInfo.ts
create mode 100644 src/views/canteen/boxesInfo/form.vue
create mode 100644 src/views/canteen/boxesInfo/index.vue
diff --git a/src/api/canteen/boxesInfo.ts b/src/api/canteen/boxesInfo.ts
new file mode 100644
index 0000000..ae43cf2
--- /dev/null
+++ b/src/api/canteen/boxesInfo.ts
@@ -0,0 +1,41 @@
+import request from "/@/utils/request"
+
+export function fetchList(query?: Object) {
+ return request({
+ url: '/canteen/boxesInfo/page',
+ method: 'get',
+ params: query
+ })
+}
+
+export function addObj(obj?: Object) {
+ return request({
+ url: '/canteen/boxesInfo',
+ method: 'post',
+ data: obj
+ })
+}
+
+export function getObj(id?: string) {
+ return request({
+ url: '/canteen/boxesInfo/' + id,
+ method: 'get'
+ })
+}
+
+export function delObjs(ids?: Object) {
+ return request({
+ url: '/canteen/boxesInfo',
+ method: 'delete',
+ data: ids
+ })
+}
+
+export function putObj(obj?: Object) {
+ return request({
+ url: '/canteen/boxesInfo',
+ method: 'put',
+ data: obj
+ })
+}
+
diff --git a/src/api/canteen/canteenDailyMenu.ts b/src/api/canteen/canteenDailyMenu.ts
index b50e990..8a2d58d 100644
--- a/src/api/canteen/canteenDailyMenu.ts
+++ b/src/api/canteen/canteenDailyMenu.ts
@@ -64,3 +64,4 @@ export function selectTimeFoodApi(query?: Object) {
params: query
})
}
+
diff --git a/src/api/canteen/merchantInfo.ts b/src/api/canteen/merchantInfo.ts
index 89ebb89..b72588a 100644
--- a/src/api/canteen/merchantInfo.ts
+++ b/src/api/canteen/merchantInfo.ts
@@ -39,3 +39,16 @@ export function putObj(obj?: Object) {
})
}
+/**
+ * 商户下拉
+ * @param type
+ */
+export function selectMerchantList(type?: string) {
+ return request({
+ url: '/canteen/merchantInfo/selectMerchantList',
+ method: 'get',
+ params:{
+ type:type
+ }
+ })
+}
diff --git a/src/views/canteen/boxesInfo/form.vue b/src/views/canteen/boxesInfo/form.vue
new file mode 100644
index 0000000..21f1d8f
--- /dev/null
+++ b/src/views/canteen/boxesInfo/form.vue
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/canteen/boxesInfo/index.vue b/src/views/canteen/boxesInfo/index.vue
new file mode 100644
index 0000000..05ecb76
--- /dev/null
+++ b/src/views/canteen/boxesInfo/index.vue
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+
+ 查询
+
+ 重置
+
+
+
+
+
+
+ 新 增
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/canteen/canteenDailyMenu/form.vue b/src/views/canteen/canteenDailyMenu/form.vue
index ac55da2..49985be 100644
--- a/src/views/canteen/canteenDailyMenu/form.vue
+++ b/src/views/canteen/canteenDailyMenu/form.vue
@@ -9,9 +9,9 @@
- 早餐
- 午餐
- 晚餐
+ 早餐
+ 午餐
+ 晚餐
未知类型
@@ -49,6 +49,7 @@ const emit = defineEmits(['refresh']);
//业务变量
const foodData = ref([])
const spuIds = ref([])
+const spuImages = ref([])
// 定义变量内容
const dataFormRef = ref();
const visible = ref(false)
@@ -64,13 +65,14 @@ const form = reactive({
hourType: '',
merchantId: '',
deptId: '',
+ spuIds:''
});
// 定义校验规则
const dataRules = ref({})
// 打开弹窗
-const openDialog = (id: string) => {
+const openDialog = (id: string,time?: string, hourType?: number,merchantId?:number) => {
visible.value = true
form.id = ''
@@ -84,10 +86,37 @@ const openDialog = (id: string) => {
form.id = id
getcanteenDailyMenuData(id)
}
-};
+ if (time) {
+ form.startTime = time
+ }
+ if (hourType) {
+ form.hourType = hourType
+ }
+ form.merchantId = merchantId
+};
+watch(spuIds, (newValue, oldValue) => {
+ spuImages.value = []
+ form.spuIds = newValue
+ //更新值
+ if (newValue) {
+ const newValues = newValue.toString().split(',')
+ for (let index = 0; index < newValues.length; index++) {
+ const data = newValues[index]
+ foodData.value.forEach((sData) => {
+ if (sData.id?.toString() === data) {
+ spuImages.value.push(sData.picUrl?.toString())
+ }
+ })
+ }
+ }
+})
// 提交
const onSubmit = async () => {
+ if (spuIds.value.length<=0){
+ useMessage().warning("请选择菜品")
+ return
+ }
const valid = await dataFormRef.value.validate().catch(() => {
});
if (!valid) return false;
diff --git a/src/views/canteen/canteenDailyMenu/index.vue b/src/views/canteen/canteenDailyMenu/index.vue
index 410ecaa..dada007 100644
--- a/src/views/canteen/canteenDailyMenu/index.vue
+++ b/src/views/canteen/canteenDailyMenu/index.vue
@@ -1,4 +1,5 @@
+