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,