邓洁 : 发布店铺出租,项目招商接口
This commit is contained in:
@@ -25,8 +25,8 @@
|
||||
v-model="form.region" @confirm="regionConfirm"></u-picker>
|
||||
</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>
|
||||
<u-input v-model="form.address" placeholder="请输入项目地址" placeholder-class="input-class" border="none"
|
||||
@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,14 +38,21 @@
|
||||
<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="contact">
|
||||
<u-input v-model="form.contact" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
|
||||
<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>
|
||||
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="mobile">
|
||||
<u-input v-model="form.mobile" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
|
||||
<u-form-item label="租金(元/月)" label-position="top" border-bottom="true" label-width="auto" prop="rent">
|
||||
<u-input v-model="form.rent" placeholder="请输入店铺租金" placeholder-class="input-class" border="none"></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="详情介绍" label-position="top" border-bottom="true" label-width="auto" prop="content">
|
||||
<u-input v-model="form.content" placeholder="请输入介绍详情" placeholder-class="input-class" border="none"></u-input>
|
||||
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="contactPerson">
|
||||
<u-input v-model="form.contactPerson" placeholder="请输入联系人姓名" placeholder-class="input-class"
|
||||
border="none"></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="phone">
|
||||
<u-input v-model="form.phone" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="详情介绍" label-position="top" border-bottom="true" label-width="auto" prop="details">
|
||||
<u-input v-model="form.details" placeholder="请输入介绍详情" placeholder-class="input-class" border="none"></u-input>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
<view class="bug-figure"></view>
|
||||
@@ -59,18 +66,19 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
imageLength: '0',
|
||||
imageLength: 0,
|
||||
fileList1: [],
|
||||
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
|
||||
|
||||
regionColumns: [],
|
||||
form: {
|
||||
title: '',
|
||||
region: '',
|
||||
address: '',
|
||||
business: '',
|
||||
mobile: '',
|
||||
contact:'',
|
||||
content: '',
|
||||
area: '',
|
||||
rent: '',
|
||||
phone: '',
|
||||
contactPerson: '',
|
||||
details: '',
|
||||
images: [],
|
||||
longitude: '',
|
||||
latitude: '',
|
||||
@@ -100,12 +108,22 @@
|
||||
message: '请选择地区',
|
||||
trigger: ['change']
|
||||
}],
|
||||
'contact': [{
|
||||
'area': [{
|
||||
required: true,
|
||||
message: '请输入面积',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
'rent': [{
|
||||
required: true,
|
||||
message: '请输入租金',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
'contactPerson': [{
|
||||
required: true,
|
||||
message: '请输入姓名',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
'content': [{
|
||||
'details': [{
|
||||
required: true,
|
||||
message: '请输入介绍',
|
||||
trigger: ['change', 'blur']
|
||||
@@ -115,7 +133,7 @@
|
||||
message: '请输入地址',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
'mobile': [{
|
||||
'phone': [{
|
||||
required: true,
|
||||
message: '请输入电话号码',
|
||||
},
|
||||
@@ -192,40 +210,76 @@
|
||||
})
|
||||
},
|
||||
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.publishInvestment(this.form).then(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.publishInvestment(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('校验失败')
|
||||
})
|
||||
},
|
||||
changeAddressFocus() {
|
||||
if (!this.form.region) {
|
||||
uni.$u.toast('请先选择区域')
|
||||
return false
|
||||
}
|
||||
},
|
||||
changeAddress(e) {
|
||||
// console.log('changeAddress', e);
|
||||
this.getAddressList(e)
|
||||
},
|
||||
getRegionList() {
|
||||
var that = this
|
||||
uni.request({
|
||||
url: 'https://apis.map.qq.com/ws/district/v1/getchildren?id=' + uni.getStorageSync('city_code') + '&key=' +
|
||||
that.$api.key,
|
||||
success(res) {
|
||||
that.regionColumns = [res.data.result[0].map(item => item.fullname)]
|
||||
},
|
||||
fail(err) {
|
||||
console.log('请求区域失败:', err);
|
||||
}
|
||||
})
|
||||
},
|
||||
getAddressList(value) {
|
||||
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);
|
||||
@@ -257,6 +311,7 @@
|
||||
|
||||
},
|
||||
onLoad() {
|
||||
this.getRegionList()
|
||||
this.$api.getClassList().then(res => {
|
||||
// console.log(res.data.data.length);
|
||||
this.Classcolumns = res.data.data.map((item) => {
|
||||
@@ -305,6 +360,7 @@
|
||||
.count {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
// margin-right: 20px;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user