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 @@