diff --git a/src/views/product/add_shop.vue b/src/views/product/add_shop.vue index a9f3046..78769d1 100644 --- a/src/views/product/add_shop.vue +++ b/src/views/product/add_shop.vue @@ -45,9 +45,19 @@ - +
+
+ + +
+
+ + +
+
+
注:第一张图为商品封面图,图片尺寸为750×750
- 选择图片 +
@@ -470,6 +480,7 @@ export default { usageRules: "" } }, + imgList: [], rules: { typeEnum: [ { @@ -552,20 +563,22 @@ export default { }, methods: { successEvent(d) { - if (this.$refs.uploadImg.fileList.length < 9) { - d.forEach(item => { - item.uid = item.id - item.url = item.url - this.form.images.push(item.url); - }) - this.$refs.uploadImg.fileList.push(...d) - console.log(this.$refs.uploadImg.fileList, '调试1') - } else { - this.$notify.error({ - title: '错误', - message: '最多选择9张图片' - }); - } + this.form.images.push(d[0].url); + this.imgList.push(d[0]) + // if (this.$refs.uploadImg.fileList.length < 9) { + // d.forEach(item => { + // item.uid = item.id + // item.url = item.url + // this.form.images.push(item.url); + // }) + // this.$refs.uploadImg.fileList.push(...d) + // console.log(this.$refs.uploadImg.fileList, '调试1') + // } else { + // this.$notify.error({ + // title: '错误', + // message: '最多选择9张图片' + // }); + // } }, priceFormat(item, key) { const messageheight = 48; @@ -587,6 +600,10 @@ export default { } }) }, + deleteEvent(d) { + let index = this.imgList.findIndex(ele => ele.url == d.url) + this.imgList.splice(index, 1); + }, // 删除分组商品 delGoods(goods, index, $index) { goods.splice(index, 1); @@ -635,14 +652,18 @@ export default { ); this.specTableHeaders = JSON.parse(res.specTableHeaders); this.selectSpec = JSON.parse(res.selectSpec); - + console.log(res, '调试11111') // 初始化上传图片 - this.$refs.uploadImg.fileList = res.images.map(item => { + // this.$refs.uploadImg.fileList = res.images.map(item => { + // return { + // url: item + // }; + // }); + this.imgList = res.images.map(item => { return { url: item }; }); - this.form = res; if (res.typeEnum == "sku") { let skuList = [...res.skuList]; @@ -745,7 +766,7 @@ export default { }, // 删除突破按 uploadRemove(arr) { - + this.form.images = arr; }, // 选择规格属性 @@ -939,6 +960,18 @@ export default { diff --git a/src/views/product/components/addImages.vue b/src/views/product/components/addImages.vue index 872ea0b..b8b0e90 100644 --- a/src/views/product/components/addImages.vue +++ b/src/views/product/components/addImages.vue @@ -1,7 +1,32 @@