diff --git a/components/ShowShopList/ShowShopList.vue b/components/ShowShopList/ShowShopList.vue index bbc908d..5d49c33 100644 --- a/components/ShowShopList/ShowShopList.vue +++ b/components/ShowShopList/ShowShopList.vue @@ -1,7 +1,8 @@ @@ -71,6 +72,9 @@ }, methods: { + hanldeUpdate(shopid) { + this.$emit('updateItem', shopid) + }, handleDel(shopid) { console.log("删除了商铺", shopid); this.$emit('delItem', shopid) diff --git a/components/ShowShopListItem/ShowShopListItem.vue b/components/ShowShopListItem/ShowShopListItem.vue index bd58683..99f7dd5 100644 --- a/components/ShowShopListItem/ShowShopListItem.vue +++ b/components/ShowShopListItem/ShowShopListItem.vue @@ -150,6 +150,7 @@ handleEdit(shopid) { // TODO 完成页面跳转 console.log("点击了编辑ID为", shopid); + this.$emit('updateItem', shopid) }, handleDel(shopid) { // 需完善删除请求 diff --git a/pages/publish/publishAddress/publishAddress.vue b/pages/publish/publishAddress/publishAddress.vue index 7df2dc4..603912f 100644 --- a/pages/publish/publishAddress/publishAddress.vue +++ b/pages/publish/publishAddress/publishAddress.vue @@ -7,7 +7,7 @@ - {{form.region}} + {{form.region}} 请选择所属区域 @@ -18,7 +18,7 @@ - {{form.business}} + {{form.business}} 请选择行业 @@ -28,7 +28,7 @@ {{form.commercialForm}} + v-if="form.commercialForm">{{form.commercialForm}} 请选择业态 @@ -160,6 +160,28 @@ } }, methods: { + getDetail(type, id) { + console.log('type, id', type, id); + this.$api.getShopDetail(type, id).then(res => { + console.log(',re', res); + const data = res.data.data + if (res.data.code == 1) { + this.form = { + title: data.tt, + region: data.area1, + business: data.trade1, + commercialForm: data.trade2, + area: data.mianji, + transferFee: data.zhuanrangfei, + rent: data.zujin, + contactPerson: data.lianxiren, + phone: data.mobile, + details: data.content, + id: id + } + } + }) + }, preview(e) { console.log('预览', e); }, @@ -170,11 +192,14 @@ }, submit() { this.$refs.uForm.validate().then(res => { - console.log("提交表单信息:", this.form) + console.log("提交表单信息:", this.form, this.form.id) this.$api.publishAddress(this.form).then(res => { console.log('发布找店地址', res); if (res.data.code == 1) { - uni.$u.toast('发布成功') + uni.$u.toast(res.data.msg) + uni.reLaunch({ + url: '/pages/my/my' + }) } else { uni.$u.toast(res.data.msg) } @@ -229,7 +254,16 @@ this.$refs.uForm.setRules(this.rules) }, - onLoad() { + onLoad(options) { + console.log('修改找店地址', options); + if (options.item) { + console.log('修改'); + if (options.id) { + this.getDetail(2, options.id) + } + } else { + console.log('发布'); + } this.getRegionList() this.$api.getClassList().then(res => { // console.log(res.data.data.length); diff --git a/pages/publish/publishInvestment/publishInvestment.vue b/pages/publish/publishInvestment/publishInvestment.vue index ee9e852..ab8c8bf 100644 --- a/pages/publish/publishInvestment/publishInvestment.vue +++ b/pages/publish/publishInvestment/publishInvestment.vue @@ -215,7 +215,7 @@ if (this.fileList1.length > 0) { this.fileList1.map(item => { const url = item.url - temp.push(url.replace(this.imgUrl + '/', '')) + temp.push(url.replace(this.$api.imgUrl, '')) }) } if (this.form.latitude && this.form.longitude) { @@ -232,7 +232,10 @@ this.$api.publishInvestment(data).then(res => { console.log(res); if (res.data.code == 1) { - uni.$u.toast('发布成功') + uni.$u.toast(res.data.msg) + uni.reLaunch({ + url: '/pages/my/my' + }) } else { uni.$u.toast(res.data.msg) } @@ -305,12 +308,58 @@ this.show1 = false this.form.region = e.value[0] }, + getDetail(type, id) { + console.log('type, id', type, id); + this.$api.getShopDetail(type, id).then(res => { + console.log(',re', res); + const data = res.data.data + if (res.data.code == 1) { + this.form = { + title: data.tt, + region: data.area1, + address: data.adress, + business: data.trade1, + area: data.mianji, + rent: data.zujin, + phone: data.mobile, + contactPerson: data.lianxiren, + details: data.content, + // images: data.pics, + id: id, + longitude: data.lng, + latitude: data.lat, + } + var arr = []; + var arr1 = []; + let obj = {} + arr = data.pics.split(",") + arr.map(item => { + obj = this.$api.imgUrl + item + arr1.push(obj) + }) + data.pics = arr1 + this.fileList1 = data.pics.map(item => { + return { + url: item + } + }) + } + }) + }, }, onReady() { this.$refs.uForm.setRules(this.rules) }, - onLoad() { + onLoad(options) { + if (options.item) { + console.log('修改'); + if (options.id) { + this.getDetail(4, options.id) + } + } else { + console.log('发布'); + } this.getRegionList() this.$api.getClassList().then(res => { // console.log(res.data.data.length); diff --git a/pages/publish/publishRent/publishRent.vue b/pages/publish/publishRent/publishRent.vue index 16cc9d1..756df31 100644 --- a/pages/publish/publishRent/publishRent.vue +++ b/pages/publish/publishRent/publishRent.vue @@ -230,7 +230,7 @@ if (this.fileList1.length > 0) { this.fileList1.map(item => { const url = item.url - temp.push(url.replace(this.imgUrl + '/', '')) + temp.push(url.replace(this.$api.imgUrl, '')) }) } if (this.form.latitude && this.form.longitude) { @@ -247,7 +247,10 @@ this.$api.publishRent(data).then(res => { console.log('发布店铺出租', res); if (res.data.code == 1) { - uni.$u.toast('发布成功') + uni.$u.toast(res.data.msg) + uni.reLaunch({ + url: '/pages/my/my' + }) } else { uni.$u.toast(res.data.msg) } @@ -319,12 +322,61 @@ this.show1 = false this.form.region = e.value[0] }, + getDetail(type, id) { + console.log('type, id', type, id); + this.$api.getShopDetail(type, id).then(res => { + console.log(',re', res); + const data = res.data.data + if (res.data.code == 1) { + this.form = { + title: data.tt, + region: data.area1, + address: data.adress, + business: data.trade1, + commercial: data.trade2, + area: data.mianji, + rent: data.zujin, + transferFee: data.zhuanrangfei, + mobile: data.mobile, + content: data.content, + // images: data.pics, + id: id, + contact: data.lianxiren, + longitude: data.lng, + latitude: data.lat, + } + var arr = []; + var arr1 = []; + let obj = {} + arr = data.pics.split(",") + arr.map(item => { + obj = this.$api.imgUrl + item + arr1.push(obj) + }) + data.pics = arr1 + this.fileList1 = data.pics.map(item => { + return { + url: item + } + }) + } + }) + }, }, onReady() { this.$refs.uForm.setRules(this.rules) }, - onLoad() { + onLoad(options) { + console.log('修改出租', options); + if (options.item) { + console.log('修改'); + if (options.id) { + this.getDetail(3, options.id) + } + } else { + console.log('发布'); + } this.$api.getClassList().then(res => { // console.log(res.data.data.length); this.Classcolumns = res.data.data.map((item) => { diff --git a/pages/publish/publishTransfer/publishTransfer.vue b/pages/publish/publishTransfer/publishTransfer.vue index adc855e..d626b1e 100644 --- a/pages/publish/publishTransfer/publishTransfer.vue +++ b/pages/publish/publishTransfer/publishTransfer.vue @@ -15,7 +15,7 @@ - {{form.region}} + {{form.region}} 请选择所属区域 @@ -29,7 +29,7 @@ - {{form.business}} + {{form.business}} 请选择店铺行业 @@ -38,7 +38,7 @@ :columns="[Classcolumns]" v-model="form.business" @confirm="tradeConfirm"> - {{form.commercial}} + {{form.commercial}} 请选择店铺业态 @@ -235,7 +235,9 @@ if (this.fileList1.length > 0) { this.fileList1.map(item => { const url = item.url - temp.push(url.replace(this.imgUrl + '/', '')) + console.log('url', url, this.$api.imgUrl); + temp.push(url.replace(this.$api.imgUrl, '')) + }) } console.log('images---', temp.join(',')); @@ -249,12 +251,14 @@ ...this.form, images: temp.join(',') } - console.log('提交表单信息', data); - // console.log("提交表单信息:" + JSON.stringify(this.form)) + console.log('提交表单信息', data, this.form); this.$api.publishTransfer(data).then(res => { console.log('发布店铺转让', res); if (res.data.code == 1) { - uni.$u.toast('发布成功') + uni.$u.toast(res.data.msg) + uni.reLaunch({ + url: '/pages/my/my' + }) } else { uni.$u.toast(res.data.msg) } @@ -300,6 +304,7 @@ uni.$u.toast('请先选择区域') return false } + var that = this uni.request({ url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + that.form.region + value + '&key=' + @@ -339,11 +344,60 @@ this.show1 = false this.form.region = e.value[0] }, + getDetail(type, id) { + console.log('type, id', type, id); + this.$api.getShopDetail(type, id).then(res => { + console.log(',re', res); + const data = res.data.data + if (res.data.code == 1) { + this.form = { + title: data.tt, + region: data.area1, + address: data.adress, + business: data.trade1, + commercial: data.trade2, + area: data.mianji, + rent: data.zujin, + transferFee: data.zhuanrangfei, + mobile: data.mobile, + content: data.content, + // images: data.pics, + id: id, + contact: data.lianxiren, + longitude: data.lng, + latitude: data.lat, + } + var arr = []; + var arr1 = []; + let obj = {} + arr = data.pics.split(",") + arr.map(item => { + obj = this.$api.imgUrl + item + arr1.push(obj) + }) + data.pics = arr1 + this.fileList1 = data.pics.map(item => { + return { + url: item + } + }) + } + }) + }, }, onReady() { this.$refs.uForm.setRules(this.rules) }, - onLoad() { + onLoad(options) { + console.log('修改转让', options); + if (options.item) { + console.log('修改'); + if (options.id) { + this.getDetail(1, options.id) + } + } else { + console.log('发布'); + } this.getRegionList() this.$api.getClassList().then(res => { // console.log(res.data.data.length); diff --git a/pages/published/published.vue b/pages/published/published.vue index bd6e40a..9cac92c 100644 --- a/pages/published/published.vue +++ b/pages/published/published.vue @@ -8,15 +8,15 @@ - + + @delItem="handleDel" @updateItem="handleUpdate2"> + @delItem="handleDel" @updateItem="handleUpdate3"> + @delItem="handleDel" @updateItem="handleUpdate4"> @@ -49,12 +49,33 @@ } }, methods: { - handleUpdate(searchid) { + handleUpdate1(searchid) { console.log('页面更新'); - // uni.navigateTo({ - // url: '/pages/publishAddress/publishAddress?item=update_item' + '&index=' + - // tabCurrent - // }) + uni.navigateTo({ + url: '/pages/publish/publishTransfer/publishTransfer?item=' + 1 + '&id=' + + searchid + }) + }, + handleUpdate2(searchid) { + console.log('页面更新'); + uni.navigateTo({ + url: '/pages/publish/publishAddress/publishAddress?item=' + 2 + '&id=' + + searchid + }) + }, + handleUpdate3(searchid) { + console.log('页面更新'); + uni.navigateTo({ + url: '/pages/publish/publishInvestment/publishInvestment?item=' + 3 + '&id=' + + searchid + }) + }, + handleUpdate4(searchid) { + console.log('页面更新'); + uni.navigateTo({ + url: '/pages/publish/publishRent/publishRent?item=' + 4 + '&id=' + + searchid + }) }, handleDel(shopid) { console.log('页面删除', this.listId + 1, shopid); @@ -116,6 +137,8 @@ } }, onLoad: function(option) { + console.log('option', option.listId); + this.listId = option.listId wx.setNavigationBarTitle({ title: option.titletext })