Merge pull request '邓洁 : 编辑接口' (#88) from dj into master

Reviewed-on: http://git.feashow.cn/odjbin/city-store-transfer/pulls/88
This commit is contained in:
odjbin
2023-11-19 14:28:00 +00:00
7 changed files with 248 additions and 31 deletions

View File

@@ -1,7 +1,8 @@
<template>
<view>
<ShowShopListItem v-for="item in shopInfoList" :key="shopid" :shopInfo="item" :is-adshow="isADshow"
:adlinkPath="adlinkPath" :show-style="showStyle" :is-edit="isEdit" @delItem="handleDel"></ShowShopListItem>
:adlinkPath="adlinkPath" :show-style="showStyle" :is-edit="isEdit" @delItem="handleDel"
@updateItem="hanldeUpdate"></ShowShopListItem>
</view>
</template>
@@ -71,6 +72,9 @@
},
methods: {
hanldeUpdate(shopid) {
this.$emit('updateItem', shopid)
},
handleDel(shopid) {
console.log("删除了商铺", shopid);
this.$emit('delItem', shopid)

View File

@@ -150,6 +150,7 @@
handleEdit(shopid) {
// TODO 完成页面跳转
console.log("点击了编辑ID为", shopid);
this.$emit('updateItem', shopid)
},
handleDel(shopid) {
// 需完善删除请求

View File

@@ -7,7 +7,7 @@
</u-form-item>
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region"
label-width="auto">
<text @click="show1 = true" class="checkedtext" v-if="form.region.length>0">{{form.region}}</text>
<text @click="show1 = true" class="checkedtext" v-if="form.region">{{form.region}}</text>
<text @click="show1 = true" class="checktext" v-else>请选择所属区域</text>
<view class="arrow-icon">
@@ -18,7 +18,7 @@
</u-form-item>
<u-form-item label="行业" label-position="top" border-bottom="true" class="picker" label-width="auto"
prop="business">
<text @click="show2 = true" class="checkedtext" v-if="form.business.length>0">{{form.business}}</text>
<text @click="show2 = true" class="checkedtext" v-if="form.business">{{form.business}}</text>
<text @click="show2 = true" class="checktext" v-else>请选择行业</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
@@ -28,7 +28,7 @@
</u-form-item>
<u-form-item label="业态" label-position="top" border-bottom="true" label-width="auto" prop="commercialForm">
<text @click="choosecommercialForm" class="checkedtext"
v-if="form.commercialForm.length>0">{{form.commercialForm}}</text>
v-if="form.commercialForm">{{form.commercialForm}}</text>
<text @click="choosecommercialForm" class="checktext" v-else>请选择业态</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="choosecommercialForm"></u-icon>
@@ -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);

View File

@@ -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);

View File

@@ -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) => {

View File

@@ -15,7 +15,7 @@
</u-form-item>
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region"
label-width="auto">
<text @click="show1 = true" class="checkedtext" v-if="form.region.length>0">{{form.region}}</text>
<text @click="show1 = true" class="checkedtext" v-if="form.region">{{form.region}}</text>
<text @click="show1 = true" class="checktext" v-else>请选择所属区域</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show1 = true"></u-icon>
@@ -29,7 +29,7 @@
</u-form-item>
<u-form-item label="行业" label-position="top" border-bottom="true" class="picker" label-width="auto"
prop="business">
<text @click="show2 = true" class="checkedtext" v-if="form.business.length>0">{{form.business}}</text>
<text @click="show2 = true" class="checkedtext" v-if="form.business">{{form.business}}</text>
<text @click="show2 = true" class="checktext" v-else>请选择店铺行业</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
@@ -38,7 +38,7 @@
:columns="[Classcolumns]" v-model="form.business" @confirm="tradeConfirm"></u-picker>
</u-form-item>
<u-form-item label="业态" label-position="top" border-bottom="true" label-width="auto" prop="commercial">
<text @click="chooseCommercial" class="checkedtext" v-if="form.commercial.length>0">{{form.commercial}}</text>
<text @click="chooseCommercial" class="checkedtext" v-if="form.commercial">{{form.commercial}}</text>
<text @click="chooseCommercial" class="checktext" v-else>请选择店铺业态</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="chooseCommercial"></u-icon>
@@ -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);

View File

@@ -8,15 +8,15 @@
</view>
</view>
<view class="content">
<ShowShopList v-if="listId == 0" :isEdit="true" :showStyle="1" :shopInfoList="searchInfoList"
@delItem="handleDel"></ShowShopList>
<ShowShopList v-if="listId == 0" :isEdit="true" :showStyle="1" :shopInfoList="searchInfoList" @delItem="handleDel"
@updateItem="handleUpdate1"></ShowShopList>
<SearchShopList v-if="listId == 1" :searchInfoList="searchInfoList" :is-edit="true" :showStyle="1"
@delItem="handleDel" @updateItem="handleUpdate">
@delItem="handleDel" @updateItem="handleUpdate2">
</SearchShopList>
<ShowShopList v-if="listId == 3" :is-edit="true" :showStyle="2" :shopInfoList="searchInfoList"
@delItem="handleDel"></ShowShopList>
@delItem="handleDel" @updateItem="handleUpdate3"></ShowShopList>
<ShowShopList v-if="listId == 2" :is-edit="true" :showStyle="2" :shopInfoList="searchInfoList"
@delItem="handleDel"></ShowShopList>
@delItem="handleDel" @updateItem="handleUpdate4"></ShowShopList>
<ShowShopList v-if="listId == 4" :showStyle="0" :shopInfoList="matchList"></ShowShopList>
</view>
</view>
@@ -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
})