邓洁 : 发布店铺出租,项目招商接口

This commit is contained in:
邓洁
2023-11-18 23:44:06 +08:00
parent 90a0ab46cb
commit 8feccdd6eb
2 changed files with 149 additions and 57 deletions

View File

@@ -26,7 +26,7 @@
</u-form-item>
<u-form-item label="地址" label-position="top" border-bottom="true" prop="address" label-width="auto">
<u-input v-model="form.address" placeholder="请输入店铺地址" placeholder-class="input-class" border="none"
@change="changeAddress"></u-input>
@focus="changeAddressFocus" @blur="changeAddress"></u-input>
</u-form-item>
<u-form-item label="适合行业" label-position="top" border-bottom="true" class="picker" label-width="auto"
prop="business">
@@ -38,15 +38,15 @@
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false"
: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="show3 = true" class="checkedtext" v-if="form.commercial.length>0">{{form.commercial}}</text>
<text @click="show3 = true" class="checktext" v-else>请选择店铺业态</text>
<!-- <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="checktext" v-else>请选择店铺业态</text>
<view class="arrow-icon">
<u-icon name="arrow-right" size="30px" @click="show3 = true"></u-icon>
<u-icon name="arrow-right" size="30px" @click="chooseCommercial"></u-icon>
</view>
<u-picker mode="region" :show="show3" :closeOnClickOverlay="true" @close="show3 = false"
:columns="[Karmacolumns]" v-model="form.commercial" @confirm="karmaConfirm"></u-picker>
</u-form-item>
</u-form-item> -->
<u-form-item label="面积" label-position="top" border-bottom="true" label-width="auto" prop="area">
<u-input v-model="form.area" placeholder="请输入店铺面积" placeholder-class="input-class" border="none"></u-input>
</u-form-item>
@@ -86,7 +86,7 @@
commercial: '',
area: '',
rent: '',
contact:'',
contact: '',
mobile: '',
content: '',
images: [],
@@ -225,40 +225,75 @@
})
},
submit() {
const temp = []
if (this.fileList1.length > 0) {
this.fileList1.map(item => {
const url = item.url
temp.push(url.replace(this.imgUrl + '/', ''))
})
}
console.log('images---', temp.join(','));
this.$refs.uForm.validate().then(res => {
console.log("提交表单信息:" + JSON.stringify(this.form))
uni.$u.toast('发布成功')
this.$api.publishRent(this.form).then(res => {
console.log(res);
const temp = []
if (this.fileList1.length > 0) {
this.fileList1.map(item => {
const url = item.url
temp.push(url.replace(this.imgUrl + '/', ''))
})
}
if (this.form.latitude && this.form.longitude) {
console.log('经纬度都存在');
} else {
uni.$u.toast('请输入准确地址')
return false
}
let data = {
...this.form,
images: temp.join(',')
}
console.log("提交表单信息:", data)
this.$api.publishRent(data).then(res => {
console.log('发布店铺出租', res);
if (res.data.code == 1) {
uni.$u.toast('发布成功')
} else {
uni.$u.toast(res.data.msg)
}
})
}).catch(errors => {
console.log("失败信息:" + JSON.stringify(errors))
// uni.$u.toast('校验失败')
})
},
chooseCommercial() {
if (!this.form.business) {
uni.$u.toast('请先选择行业')
return false
} else {
this.show3 = true
}
},
changeAddressFocus() {
if (!this.form.region) {
uni.$u.toast('请先选择区域')
return false
}
},
changeAddress(e) {
// console.log('changeAddress', e);
this.getAddressList(e)
},
getAddressList(value) {
if (!this.form.region) {
uni.$u.toast('请先选择区域')
return false
}
var that = this
uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + value + '&key=' +
url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + that.form.region + value + '&key=' +
that.$api.key,
success(res) {
console.log('diz', res.data.result.location);
// console.log('lat', res.data.result.location.lat);
that.form.latitude = res.data.result.location.lat
// console.log('lng', res.data.result.location.lng);
that.form.longitude = res.data.result.location.lng
if (res.data.message == "query ok") {
// console.log('lat', res.data.result.location.lat);
that.form.latitude = res.data.result.location.lat
// console.log('lng', res.data.result.location.lng);
that.form.longitude = res.data.result.location.lng
} else {
uni.$u.toast('请输入准确地址')
}
},
fail(err) {
console.log('请求区域失败:', err);
@@ -338,6 +373,7 @@
.count {
margin-bottom: 30px;
}
// margin-right: 20px;
}