From d79c7e582da3fc4ac30823e466daaf90a16282f1 Mon Sep 17 00:00:00 2001 From: weiwei Date: Mon, 9 Jun 2025 17:39:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B6=85=E5=B8=82=E5=95=86=E6=88=B7?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/supermarket/smSpu/form.vue | 11 +++++++++-- src/views/supermarketerp/components/select-dialog.vue | 2 +- src/views/supermarketerp/supermarketBrand/form.vue | 2 +- src/views/supermarketerp/supermarketCategory/form.vue | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/views/supermarket/smSpu/form.vue b/src/views/supermarket/smSpu/form.vue index 0fb2ae3..548fa9b 100644 --- a/src/views/supermarket/smSpu/form.vue +++ b/src/views/supermarket/smSpu/form.vue @@ -2,6 +2,12 @@ + + + + + + (false) // 提交表单数据 const form = reactive({ + merchantId: "", id: "", erpSpuId: "", description: "

", @@ -152,8 +159,8 @@ const form = reactive({ // 定义校验规则 const dataRules = ref({ - erpSpuId: [{ required: true, message: "强选择库存商品", trigger: "change" }], - // sliderPicUrls: [{ required: true, message: "请上传轮播图", trigger: "blur" }], + merchantId: [{ required: true, message: "请选择商户", trigger: "blur" }], + erpSpuId: [{ required: true, message: "请选择库存商品", trigger: "change" }], }) // 打开弹窗 diff --git a/src/views/supermarketerp/components/select-dialog.vue b/src/views/supermarketerp/components/select-dialog.vue index 817b7dd..999621e 100644 --- a/src/views/supermarketerp/components/select-dialog.vue +++ b/src/views/supermarketerp/components/select-dialog.vue @@ -27,7 +27,7 @@ @row-click="rowClick" :row-style="{ cursor: 'pointer' }" > - + diff --git a/src/views/supermarketerp/supermarketBrand/form.vue b/src/views/supermarketerp/supermarketBrand/form.vue index 2f078d8..e12dbbb 100644 --- a/src/views/supermarketerp/supermarketBrand/form.vue +++ b/src/views/supermarketerp/supermarketBrand/form.vue @@ -4,7 +4,7 @@ - + diff --git a/src/views/supermarketerp/supermarketCategory/form.vue b/src/views/supermarketerp/supermarketCategory/form.vue index e45d9a9..fe3c32d 100644 --- a/src/views/supermarketerp/supermarketCategory/form.vue +++ b/src/views/supermarketerp/supermarketCategory/form.vue @@ -4,7 +4,7 @@ - + From 84f92965a2e48cdee4665fd97408da4f6cb4afce Mon Sep 17 00:00:00 2001 From: weiwei Date: Mon, 9 Jun 2025 18:42:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supermarketerp/supermarketSpu/form.vue | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/views/supermarketerp/supermarketSpu/form.vue b/src/views/supermarketerp/supermarketSpu/form.vue index abbcadb..cf71250 100644 --- a/src/views/supermarketerp/supermarketSpu/form.vue +++ b/src/views/supermarketerp/supermarketSpu/form.vue @@ -86,6 +86,18 @@ const form = reactive({ promotionPrice: 0, costPrice: 0, }) + +// 表单金额转为单位分 +const formatedMoney = computed(() => { + return { + grossMargin: storePrice(form.grossMargin), + purchasePrice: storePrice(form.purchasePrice), + retailPrice: storePrice(form.retailPrice), + promotionPrice: storePrice(form.promotionPrice), + costPrice: storePrice(form.costPrice), + } +}) + // 定义校验规则 const dataRules = { productNature: [{ required: true, message: "请选择商品性质", trigger: "blur" }], @@ -149,6 +161,10 @@ const getsupermarketSpuData = async (id: string) => { Object.assign(form, { ...res.data, grossMargin: parseFloat(displayPrice(res.data.grossMargin, "")), + retailPrice: parseFloat(displayPrice(res.data.retailPrice, "")), + promotionPrice: parseFloat(displayPrice(res.data.promotionPrice, "")), + purchasePrice: parseFloat(displayPrice(res.data.purchasePrice, "")), + costPrice: parseFloat(displayPrice(res.data.costPrice, "")), }) } } catch (error: any) { @@ -168,6 +184,8 @@ const resetForm = () => { // 第一步的下一步 const addPackageUnitNextStep = () => { currentTabPaneIndex.value++ + if (form.id) return + const row = { id: nanoid(5), barCode: form.barCode, @@ -250,6 +268,7 @@ const onSubmit = async () => { loading.value = true const _pa = { ...form, + ...formatedMoney.value, grossMargin: storePrice(form.grossMargin), smErpAuxiliaryCodeEntityList, smErpUnitEntityList,