From 62f19c9e4f6d654f8822838512b917c5d6ad1fed Mon Sep 17 00:00:00 2001 From: ctw <> Date: Mon, 13 Jan 2025 18:21:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E5=B8=82=E7=9B=B8=E5=85=B3=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=B8=85=E9=99=A4=E7=A9=BA=E5=AD=97=E7=AC=A6=E8=BE=93?= =?UTF-8?q?=E5=85=A5=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=95=B0=E5=AD=97=E8=BE=93?= =?UTF-8?q?=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 @@