From de530d2dfeea80a3b6ad3df6ab4799f611f2c70a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=96=87=E5=8F=AF?= <1041367524@qq.com> Date: Mon, 9 May 2022 17:47:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=99=90=E8=B4=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/sales/product.js | 4 ++++ src/views/sales/product/form/step1.vue | 17 +++-------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/store/modules/sales/product.js b/src/store/modules/sales/product.js index 42b33cb..4fc5787 100644 --- a/src/store/modules/sales/product.js +++ b/src/store/modules/sales/product.js @@ -98,6 +98,10 @@ const actions = { }, save: async ({ dispatch }, data) => { let save = data.id ? api.update : api.create; + data = _.cloneDeep(data); + if (data.limit === 0) { + delete data.singleBuyLimit; + } let res = await save(data); if (res) { ElMessage.success('保存成功'); diff --git a/src/views/sales/product/form/step1.vue b/src/views/sales/product/form/step1.vue index 04e6c26..4806708 100644 --- a/src/views/sales/product/form/step1.vue +++ b/src/views/sales/product/form/step1.vue @@ -27,11 +27,11 @@ - + - + @@ -66,7 +66,7 @@ name: null, remark: null, isRecommend: false, - singleBuyLimit: 0, + singleBuyLimit: 1, limit: 0, postage: 0, remoteAreaPostage: 10, @@ -85,17 +85,6 @@ detail: [{ required: true, message: '商品详情不能为空' }], }, }); - watch( - () => state.form.limit, - (value) => { - if (value) { - state.form.singleBuyLimit = 10; - } else { - state.form.singleBuyLimit = 0; - } - }, - { immediate: true } - ); const opts = computed(() => store.state.product.opts); if (!unref(opts).init) { store.dispatch('product/load');