diff --git a/pkg_join/views/shop.vue b/pkg_join/views/shop.vue index 9f4118e..14ddaeb 100644 --- a/pkg_join/views/shop.vue +++ b/pkg_join/views/shop.vue @@ -520,16 +520,27 @@ export default { } if (data.hotelInfo) { - this.pics = []; - this.form = data.hotelInfo; - let temp = this.form.pics.split(","); - if (temp.length > 0) { - temp.map(item => { - if (item.length > 0) { + // 店铺图片 + this.pics = [] + this.form = data.hotelInfo + const picsTemp = this.form.pics.split(",") + if (picsTemp.length > 0) { + picsTemp.map(item => { + if (item) { this.pics.push({url: item}) } }) } + // 商家资质 + this.quaPics = [] + const quaPicsTemp = this.form.qualification.split(",") + if (quaPicsTemp.length > 0) { + quaPicsTemp.map(item => { + if (item) { + this.quaPics.push({url: item}) + } + }) + } this.indexType = this.columnsType.findIndex(item => item.id === this.form.type) if (this.indexType !== -1) { this.form.typeText = this.columnsType[this.indexType].name @@ -673,17 +684,25 @@ export default { }, save() { - this.form.pics = ""; - this.pics.map(item => { - this.form.pics += (item.url + ","); - }) - this.form.pics = this.form.pics.substring(0, this.form.pics.length - 1); + this.form.pics = '' + const picsLength = this.pics.length + if (picsLength > 0) { + const tempArr = [] + this.pics.map(item => { + item.url && tempArr.push(item.url) + }) + this.form.pics = tempArr.join(',') + } - this.form.qualification = ""; - this.quaPics.map(item => { - this.form.qualification += (item.url + ","); - }) - this.form.qualification = this.form.qualification.substring(0, this.form.qualification.length - 1); + this.form.qualification = '' + const quaPicsLength = this.quaPics.length + if (quaPicsLength > 0) { + const tempArr = [] + this.quaPics.map(item => { + item.url && tempArr.push(item.url) + }) + this.form.qualification = tempArr.join(',') + } const postData = Object.assign({}, this.form) if (postData.coverType === 2) { postData.cover = postData.coverVideo diff --git a/pkg_join/views/supplier.vue b/pkg_join/views/supplier.vue index 8a3980f..fcf671f 100644 --- a/pkg_join/views/supplier.vue +++ b/pkg_join/views/supplier.vue @@ -711,17 +711,27 @@ export default { } if (data.hotelInfo) { - this.pics = []; - this.form = data.hotelInfo; - let temp = this.form.pics.split(","); - if (temp.length > 0) { - this.pics = []; - temp.map(item => { - if (item.length > 0) { + // 店铺图片 + this.pics = [] + this.form = data.hotelInfo + const picsTemp = this.form.pics.split(",") + if (picsTemp.length > 0) { + picsTemp.map(item => { + if (item) { this.pics.push({url: item}) } }) } + // 商家资质 + this.quaPics = [] + const quaPicsTemp = this.form.qualification.split(",") + if (quaPicsTemp.length > 0) { + quaPicsTemp.map(item => { + if (item) { + this.quaPics.push({url: item}) + } + }) + } this.indexType = this.columnsType.findIndex(item => item.id === this.form.type); this.form.typeText = this.columnsType[this.indexType].name; this.form.position = this.$forceToDecimal(this.form.longitude, 6) + ',' + this.$forceToDecimal(this.form.latitude, 6); @@ -925,15 +935,25 @@ export default { }, save() { - this.form.pics = ""; - this.pics.map(item => { - this.form.pics += (item.url + ","); - }) + this.form.pics = '' + const picsLength = this.pics.length + if (picsLength > 0) { + const tempArr = [] + this.pics.map(item => { + item.url && tempArr.push(item.url) + }) + this.form.pics = tempArr.join(',') + } - this.formSupplier.qualification = ""; - this.quaPics.map(item => { - this.formSupplier.qualification += (item.url + ","); - }) + this.formSupplier.qualification = '' + const quaPicsLength = this.quaPics.length + if (quaPicsLength > 0) { + const tempArr = [] + this.quaPics.map(item => { + item.url && tempArr.push(item.url) + }) + this.formSupplier.qualification = tempArr.join(',') + } const postData = Object.assign({}, this.form) if (postData.coverType === 2) { postData.cover = postData.coverVideo