From aafc93ba6151d04b37c170a9a982237109f56eb1 Mon Sep 17 00:00:00 2001 From: ctw <> Date: Mon, 13 Jan 2025 16:55:56 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B6=85=E5=B8=82=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E8=BE=93=E5=85=A5=E7=A9=BA=E6=A0=BC=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E5=92=8C=E6=95=B0=E5=AD=97=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supermarket/supermarketBrand/form.vue | 96 +++--- .../supermarket/supermarketBrand/index.vue | 79 +++-- .../supermarket/supermarketCategory/form.vue | 90 ++--- .../supermarket/supermarketCategory/index.vue | 79 +++-- src/views/supermarket/supermarketSpu/form.vue | 320 +++++++++--------- .../supermarket/supermarketSpu/index.vue | 117 ++++--- 6 files changed, 437 insertions(+), 344 deletions(-) diff --git a/src/views/supermarket/supermarketBrand/form.vue b/src/views/supermarket/supermarketBrand/form.vue index 3bddb84..41a0de8 100644 --- a/src/views/supermarket/supermarketBrand/form.vue +++ b/src/views/supermarket/supermarketBrand/form.vue @@ -10,7 +10,7 @@ - + @@ -22,20 +22,22 @@ - + - + - {{ item.label }} + {{ item.label }} + @@ -51,87 +53,87 @@ diff --git a/src/views/supermarket/supermarketBrand/index.vue b/src/views/supermarket/supermarketBrand/index.vue index af7a60f..ffdf083 100644 --- a/src/views/supermarket/supermarketBrand/index.vue +++ b/src/views/supermarket/supermarketBrand/index.vue @@ -14,7 +14,13 @@
- + 新 增 编辑 - + 删除 @@ -87,66 +99,71 @@ diff --git a/src/views/supermarket/supermarketCategory/form.vue b/src/views/supermarket/supermarketCategory/form.vue index 609686e..2f27196 100644 --- a/src/views/supermarket/supermarketCategory/form.vue +++ b/src/views/supermarket/supermarketCategory/form.vue @@ -10,7 +10,7 @@ - + @@ -22,14 +22,16 @@ - + - {{ item.label }} + {{ item.label }} + @@ -52,85 +54,85 @@ diff --git a/src/views/supermarket/supermarketCategory/index.vue b/src/views/supermarket/supermarketCategory/index.vue index 95d0ef1..ba764af 100644 --- a/src/views/supermarket/supermarketCategory/index.vue +++ b/src/views/supermarket/supermarketCategory/index.vue @@ -14,7 +14,13 @@
- + 新 增 编辑 - + 删除 @@ -88,67 +100,72 @@ diff --git a/src/views/supermarket/supermarketSpu/form.vue b/src/views/supermarket/supermarketSpu/form.vue index 88760ad..99bf759 100644 --- a/src/views/supermarket/supermarketSpu/form.vue +++ b/src/views/supermarket/supermarketSpu/form.vue @@ -11,23 +11,28 @@ - + - + - + - + @@ -50,13 +55,18 @@ - - - - - - - + + + + + + + @@ -69,56 +79,58 @@ - + - {{ item.label }} + {{ item.label }} + - - - - - + + + + + - + - + - - - - - + + + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -149,11 +161,11 @@ - - - - - + + + + + - @@ -106,84 +128,99 @@
- +
From 62f19c9e4f6d654f8822838512b917c5d6ad1fed Mon Sep 17 00:00:00 2001 From: ctw <> Date: Mon, 13 Jan 2025 18:21:52 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=B6=85=E5=B8=82=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=B8=85=E9=99=A4=E7=A9=BA=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E8=BE=93=E5=85=A5=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E7=9A=84=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supermarketAuxiliaryCode/form.vue | 46 ++++---- .../components/supermarketUnit/form.vue | 100 +++++++++--------- .../components/supermarketUnit/index.vue | 71 ++++++++----- src/views/supermarket/supermarketSpu/form.vue | 37 ++++--- .../supermarket/supermarketSpu/index.vue | 4 +- 5 files changed, 146 insertions(+), 112 deletions(-) diff --git a/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/form.vue b/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/form.vue index 7f7de51..e4e15cd 100644 --- a/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/form.vue +++ b/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/form.vue @@ -4,7 +4,7 @@ - + @@ -19,56 +19,56 @@ diff --git a/src/views/supermarket/supermarketSpu/components/supermarketUnit/form.vue b/src/views/supermarket/supermarketSpu/components/supermarketUnit/form.vue index b86ee44..8622b09 100644 --- a/src/views/supermarket/supermarketSpu/components/supermarketUnit/form.vue +++ b/src/views/supermarket/supermarketSpu/components/supermarketUnit/form.vue @@ -4,19 +4,19 @@ - + - + - + @@ -31,29 +31,29 @@ - + + + + + + - - - - - - - - - - + + + + + - + - + @@ -68,71 +68,71 @@ diff --git a/src/views/supermarket/supermarketSpu/components/supermarketUnit/index.vue b/src/views/supermarket/supermarketSpu/components/supermarketUnit/index.vue index 4d30457..341346b 100644 --- a/src/views/supermarket/supermarketSpu/components/supermarketUnit/index.vue +++ b/src/views/supermarket/supermarketSpu/components/supermarketUnit/index.vue @@ -31,7 +31,12 @@
-->
- 新 增 @@ -67,17 +77,30 @@ - - + + - - + + @@ -91,11 +114,11 @@ diff --git a/src/views/supermarket/supermarketSpu/form.vue b/src/views/supermarket/supermarketSpu/form.vue index 99bf759..52989b7 100644 --- a/src/views/supermarket/supermarketSpu/form.vue +++ b/src/views/supermarket/supermarketSpu/form.vue @@ -36,11 +36,6 @@ - @@ -82,6 +77,11 @@ + + + + + @@ -226,6 +226,7 @@ import { rule } from "/@/utils/validate" import supermarketAuxiliaryCode from "./components/supermarketAuxiliaryCode/index.vue" import supermarketUnit from "./components/supermarketUnit/index.vue" import { TabPaneName } from "element-plus" +import { displayPrice, storePrice } from "/@/utils/formatMoney" const emit = defineEmits(["refresh"]) @@ -297,16 +298,18 @@ const brandOptions = ref([]) // 超市品牌的下拉选项 const supplierOptions = ref([]) // 货商的下拉选项 // 初始化表单数据 -const getsupermarketSpuData = (id: string) => { +const getsupermarketSpuData = async (id: string) => { // 获取数据 loading.value = true - getObj(id) - .then((res: any) => { - Object.assign(form, res.data) - }) - .finally(() => { - loading.value = false - }) + const res = await getObj(id).finally(() => (loading.value = false)) + res.data.supermarketUnitEntityList.map((item: any) => { + item.costPrice = displayPrice(item.costPrice, "") + item.promotionPrice = displayPrice(item.promotionPrice, "") + item.purchasePrice = displayPrice(item.purchasePrice, "") + item.retailPrice = displayPrice(item.retailPrice, "") + }) + Object.assign(form, res.data) + console.log(res.data) } // 打开弹窗 @@ -376,6 +379,10 @@ const onSubmit = async () => { loading.value = true if (form.id) { form.supermarketUnitEntityList.map((item: any) => { + item.costPrice = storePrice(item.costPrice) + item.promotionPrice = storePrice(item.promotionPrice) + item.purchasePrice = storePrice(item.purchasePrice) + item.retailPrice = storePrice(item.retailPrice) if (item.isNew) { item.id = "" delete item.isNew @@ -391,6 +398,10 @@ const onSubmit = async () => { } else { form.supermarketUnitEntityList.map((item: any) => { item.id = "" + item.costPrice = storePrice(item.costPrice) + item.promotionPrice = storePrice(item.promotionPrice) + item.purchasePrice = storePrice(item.purchasePrice) + item.retailPrice = storePrice(item.retailPrice) }) form.supermarketAuxiliaryCodeEntityList.map((item: any) => { item.id = "" diff --git a/src/views/supermarket/supermarketSpu/index.vue b/src/views/supermarket/supermarketSpu/index.vue index 76980f8..c049ade 100644 --- a/src/views/supermarket/supermarketSpu/index.vue +++ b/src/views/supermarket/supermarketSpu/index.vue @@ -81,7 +81,7 @@ @@ -96,7 +96,7 @@ From adcc3888e7269f487ad626844d649b2b1adbbe0f Mon Sep 17 00:00:00 2001 From: ctw <> Date: Mon, 13 Jan 2025 19:39:35 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E8=8F=9C=E8=B0=B1?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8F=9C=E5=93=81=E7=B1=BB=E5=88=AB=E5=92=8C?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/canteen/canteenDailyMenu/form.vue | 8 ++-- src/views/canteen/canteenDailyMenu/index.vue | 44 +++++++++++++++----- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/views/canteen/canteenDailyMenu/form.vue b/src/views/canteen/canteenDailyMenu/form.vue index c1e8bf3..433ca34 100644 --- a/src/views/canteen/canteenDailyMenu/form.vue +++ b/src/views/canteen/canteenDailyMenu/form.vue @@ -35,12 +35,14 @@
-
+
{{ item.name }} | - {{ "某分类" }} + + {{ categoryOptions.find((v: any) => v.id == item.categoryId)?.name ?? "未知" }} +
-
{{ "¥6.6" }}
+
{{ displayPrice(item.price) }}
diff --git a/src/views/canteen/canteenDailyMenu/index.vue b/src/views/canteen/canteenDailyMenu/index.vue index e156aee..73abfa2 100644 --- a/src/views/canteen/canteenDailyMenu/index.vue +++ b/src/views/canteen/canteenDailyMenu/index.vue @@ -33,7 +33,12 @@ fit="cover" @click="delteData(item.tid)" /> -
{{ item.name }}
+
+ {{ item.name }} + | + {{ canteenCategoryOption.find((v: any) => v.id == item.categoryId)?.name }} +
+
{{ displayPrice(item.price) }}
@@ -47,12 +52,12 @@ fit="cover" @click="delteData(item.tid)" /> -
+
{{ item.name }} | - {{ "某分类" }} + {{ canteenCategoryOption.find((v: any) => v.id == item.categoryId)?.name }}
-
{{ "¥6.6" }}
+
{{ displayPrice(item.price) }}
@@ -66,7 +71,12 @@ fit="cover" @click="delteData(item.tid)" /> -
{{ item.name }}
+
+ {{ item.name }} + | + {{ canteenCategoryOption.find((v: any) => v.id == item.categoryId)?.name }} +
+
{{ displayPrice(item.price) }}
@@ -80,8 +90,10 @@ From b807e927440c3f312dcce65857aad57a43fad04b Mon Sep 17 00:00:00 2001 From: ctw <> Date: Tue, 14 Jan 2025 09:13:05 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=AF=8F=E6=97=A5?= =?UTF-8?q?=E8=8F=9C=E5=93=81=E6=97=B6=E5=8F=AF=E5=88=A0=E9=99=A4=E8=8F=9C?= =?UTF-8?q?=E5=93=81=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/canteen/canteenDailyMenu/form.vue | 32 +++++++++++++++----- src/views/canteen/canteenDailyMenu/index.vue | 1 + 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/views/canteen/canteenDailyMenu/form.vue b/src/views/canteen/canteenDailyMenu/form.vue index 433ca34..43787f4 100644 --- a/src/views/canteen/canteenDailyMenu/form.vue +++ b/src/views/canteen/canteenDailyMenu/form.vue @@ -32,8 +32,20 @@

预览图

-
-
+
+
+ + +
{{ item.name }} @@ -142,13 +154,14 @@ const dataFormRef = ref() const visible = ref(false) const queryRef = ref() const selectObjs = ref([]) as any // 表格多选的数据 -const selectedList = ref([]) +const selectedFood = ref([]) const loading = ref(false) const selectDialogVisible = ref(false) // 选择菜品对话框开关 const { spu_status } = useDict("spu_status") const categoryOptions = ref([]) // 商品分类选项 const imageBaseUrl = import.meta.env.VITE_IMAGE_BASE_PATH const dataRules = ref({}) // 定义校验规则 +const hoverIndex = ref(-1) // 预览图片hover的索引 // 提交表单数据 const form = reactive({ @@ -159,7 +172,7 @@ const form = reactive({ }) // 选择的菜品的id数组 const spuIds = computed(() => { - return selectedList.value?.map((item: any) => item.id) + return selectedFood.value?.map((item: any) => item.id) }) const state: BasicTableProps = reactive({ @@ -191,7 +204,7 @@ const openDialog = (id: string, time?: string, hourType?: number, merchantId?: n // 重置表单数据 dataFormRef.value?.resetFields() selectObjs.value = [] - selectedList.value = [] + selectedFood.value = [] state.dataList = [] // 获取canteenDailyMenu信息 @@ -235,15 +248,20 @@ const handleClickSelect = async () => { } } +// 移除预览 +const removeSelectedItem = (id: string) => { + selectedFood.value = selectedFood.value.filter((item: any) => item.id !== id) +} + // 选择菜品点击确认 const handleSelectDialogConfirm = () => { selectDialogVisible.value = false - selectedList.value = selectObjs.value + selectedFood.value = selectObjs.value } // 提交 const onSubmit = async () => { - if (selectedList.value.length <= 0) { + if (selectedFood.value.length <= 0) { useMessage().warning("请选择菜品") return } diff --git a/src/views/canteen/canteenDailyMenu/index.vue b/src/views/canteen/canteenDailyMenu/index.vue index 73abfa2..4572eb5 100644 --- a/src/views/canteen/canteenDailyMenu/index.vue +++ b/src/views/canteen/canteenDailyMenu/index.vue @@ -254,6 +254,7 @@ onMounted(async () => { margin-left: 20px; &_item { + position: relative; display: flex; flex-direction: column; justify-content: space-between;