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 86e056d..70baa71 100644 --- a/src/views/supermarketerp/components/select-dialog.vue +++ b/src/views/supermarketerp/components/select-dialog.vue @@ -26,7 +26,7 @@ :reserve-selection="true" @selection-change="handleSelectionChange" > - + 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 @@ - + 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,