From d99fb079c0ca30c21b3e1546e4992aea8004c997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=95=BE?= <1144797966@qq.com> Date: Sun, 1 Sep 2024 17:56:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=95=86=E5=93=81=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=9D=E5=A7=8B=E5=8C=96=E4=B8=BAundefined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/product/add_shop.vue | 46 +++++++++++++++++++++++++--------- src/views/product/index.vue | 1 + 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/views/product/add_shop.vue b/src/views/product/add_shop.vue index a0c6356..bd8a360 100644 --- a/src/views/product/add_shop.vue +++ b/src/views/product/add_shop.vue @@ -103,8 +103,9 @@ @@ -214,10 +215,9 @@ @@ -427,15 +427,15 @@ export default { selectSpec: [], selectSpecResult: false, defaultSku: { - salePrice: 0, - memberPrice: 0, - costPrice: 0, - originPrice: 0, - stockNumber: 0, - firstShared: 0, + salePrice: undefined, + memberPrice: undefined, + costPrice: undefined, + originPrice: undefined, + stockNumber: undefined, + firstShared: undefined, barCode: `${localStorage.getItem("shopId")}${dayjs().valueOf()}`, isGrounding: 1, - productId: this.$route.query.goods_id, + productId: this.$route.query.goods_id ? this.$route.query.goods_id : '', shopId: localStorage.getItem("shopId"), suit: 0 }, @@ -690,8 +690,30 @@ export default { console.log(error); } }, + // 提交 submitHandle() { + console.log(this.form.skuList) + const hasUndefined = this.form.skuList.some(obj => { + for (const key in obj) { + if (obj[key] === undefined) { + return true; // 如果找到undefined,立即停止搜索并返回true + } + } + return false; // 如果没有找到undefined,返回false + }); + // 停止执行下面的数据 + if (hasUndefined) { + this.$message({ + message: '请完善规格属性的参数!', + type: 'warning' + }); + return false; + } + + this.imgList.forEach(ele => { + arr.push(ele.url) + }) let arr = [] this.imgList.forEach(ele => { arr.push(ele.url) diff --git a/src/views/product/index.vue b/src/views/product/index.vue index b476b85..c7ecd5a 100644 --- a/src/views/product/index.vue +++ b/src/views/product/index.vue @@ -52,6 +52,7 @@