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 @@ - - + + + + + {{ + item.name }} + + 本地上传 + + + + + + + + + + + 取 消 + 确 定 + + + + + + + - + - + @@ -78,15 +94,24 @@ export default { typedata: '', showUpload: false, page: 1, - total: 0 + total: 0, + activedata: '681' } }, mounted() { this.getType() }, methods: { - changeEvent() { + uplocation() { + this.activedata = -1 this.page = 1 + this.dataImages = [] + this.total = 0 + this.getList() + }, + changeEvent(id) { + this.page = 1 + this.activedata = id this.getList() }, handleCurrentChange(i) { @@ -167,11 +192,10 @@ export default { }, async getList() { let obj = { - category: this.value, + category: this.activedata == -1 ? '' : this.activedata, page: this.page, - size: 20, + size: this.activedata == -1 ? 17:18, store_id: localStorage.getItem("shopId"), - } const res = await getcommonpicture(obj); this.dataImages = res.data @@ -190,4 +214,15 @@ export default { } } } - \ No newline at end of file + + \ No newline at end of file diff --git a/src/views/product/components/imageComponent.vue b/src/views/product/components/imageComponent.vue index 0a2d88d..86fe119 100644 --- a/src/views/product/components/imageComponent.vue +++ b/src/views/product/components/imageComponent.vue @@ -1,37 +1,96 @@ - + + + + + - + + + + + + + + +