梁航:发布接口绑定
This commit is contained in:
@@ -2,53 +2,58 @@
|
|||||||
<view class="form">
|
<view class="form">
|
||||||
<u-form :model="form" ref="uForm">
|
<u-form :model="form" ref="uForm">
|
||||||
<u-form-item label="标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
|
<u-form-item label="标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
|
||||||
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class" border="none"></u-input>
|
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class"
|
||||||
|
border="none"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region" label-width="auto">
|
<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.length>0">{{form.region}}</text>
|
||||||
<text @click="show1 = true" class="checktext" v-else>请选择所属区域</text>
|
<text @click="show1 = true" class="checktext" v-else>请选择所属区域</text>
|
||||||
|
|
||||||
<view class="arrow-icon">
|
<view class="arrow-icon">
|
||||||
<u-icon name="arrow-right" size="30px" @click="show1 = true"></u-icon>
|
<u-icon name="arrow-right" size="30px" @click="show1 = true"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<u-picker :columns="regionColumns" :show="show1" :closeOnClickOverlay="true" @close="show1 = false"
|
<u-picker :columns="regionColumns" :show="show1" :closeOnClickOverlay="true" @close="show1 = false"
|
||||||
v-model="form.region" @confirm="regionConfirm"></u-picker>
|
v-model="form.region" @confirm="regionConfirm"></u-picker>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="行业" label-position="top" border-bottom="true" class="picker" label-width="auto" prop="trade" >
|
<u-form-item label="地址" label-position="top" border-bottom="true" prop="address" label-width="auto">
|
||||||
<text @click="show2 = true" class="checkedtext" v-if="form.trade.length>0">{{form.trade}}</text>
|
<u-input v-model="form.address" placeholder="请输入地址" placeholder-class="input-class" border="none"
|
||||||
|
@change="changeAddress"></u-input>
|
||||||
|
</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="checktext" v-else>请选择行业</text>
|
<text @click="show2 = true" class="checktext" v-else>请选择行业</text>
|
||||||
<view class="arrow-icon">
|
<view class="arrow-icon">
|
||||||
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
|
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false" :columns="[Classcolumns]"
|
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false"
|
||||||
v-model="form.trade" @confirm="tradeConfirm"></u-picker>
|
:columns="[Classcolumns]" v-model="form.business" @confirm="tradeConfirm"></u-picker>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="业态" label-position="top" border-bottom="true" label-width="auto" prop="karma">
|
<u-form-item label="业态" label-position="top" border-bottom="true" label-width="auto" prop="commercial">
|
||||||
<text @click="show3 = true" class="checkedtext" v-if="form.karma.length>0">{{form.karma}}</text>
|
<text @click="show3 = true" class="checkedtext" v-if="form.commercial.length>0">{{form.commercial}}</text>
|
||||||
<text @click="show3 = true" class="checktext" v-else>请选择业态</text>
|
<text @click="show3 = true" class="checktext" v-else>请选择业态</text>
|
||||||
<view class="arrow-icon">
|
<view class="arrow-icon">
|
||||||
<u-icon name="arrow-right" size="30px" @click="show3 = true"></u-icon>
|
<u-icon name="arrow-right" size="30px" @click="show3 = true"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<u-picker mode="region" :show="show3" :closeOnClickOverlay="true" @close="show3 = false" :columns="[Karmacolumns]"
|
<u-picker mode="region" :show="show3" :closeOnClickOverlay="true" @close="show3 = false"
|
||||||
v-model="form.karma" @confirm="karmaConfirm"></u-picker>
|
: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="size">
|
<u-form-item label="预计投资" label-position="top" border-bottom="true" label-width="auto" prop="transferFee">
|
||||||
<u-input v-model="form.size" placeholder="请输入面积" placeholder-class="input-class" border="none"></u-input>
|
<u-input v-model="form.transferFee" placeholder="请输入预计投资" placeholder-class="input-class"
|
||||||
|
border="none"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="租金(元/月)" label-position="top" border-bottom="true" label-width="auto" prop="rent">
|
<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-input v-model="form.rent" placeholder="请输入店铺租金" placeholder-class="input-class" border="none"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="预计投资" label-position="top" border-bottom="true" label-width="auto" prop="sell">
|
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="contact">
|
||||||
<u-input v-model="form.sell" placeholder="请输入预计投资" placeholder-class="input-class" border="none"></u-input>
|
<u-input v-model="form.contact" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="name">
|
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="mobile">
|
||||||
<u-input v-model="form.name" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
|
<u-input v-model="form.mobile" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="call">
|
<u-form-item label="详情介绍" label-position="top" border-bottom="true" label-width="auto" prop="content">
|
||||||
<u-input v-model="form.call" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
|
<u-input v-model="form.content" 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="introduce">
|
|
||||||
<u-input v-model="form.introduce" placeholder="请输入介绍详情" placeholder-class="input-class" border="none"></u-input>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</u-form>
|
</u-form>
|
||||||
<view class="bug-figure"></view>
|
<view class="bug-figure"></view>
|
||||||
@@ -62,31 +67,31 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
imageLength: '0',
|
||||||
|
fileList1: [],
|
||||||
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
|
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
|
||||||
ShopInfomation: {
|
|
||||||
city: '',
|
|
||||||
area: '',
|
|
||||||
count: 0,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
form: {
|
form: {
|
||||||
title: '',
|
title: '',
|
||||||
region: '',
|
region: '',
|
||||||
place: '',
|
address: '',
|
||||||
trade: '',
|
business: '',
|
||||||
karma: '',
|
commercial: '',
|
||||||
size: '',
|
transferFee:'',
|
||||||
rent: '',
|
rent: '',
|
||||||
sell: '',
|
contact:'',
|
||||||
name: '',
|
mobile: '',
|
||||||
call: '',
|
content: '',
|
||||||
introduce: ''
|
// images: [],
|
||||||
|
longitude: '',
|
||||||
|
latitude: '',
|
||||||
|
id: '',
|
||||||
|
|
||||||
},
|
},
|
||||||
Classcolumns: [],
|
Classcolumns: [],
|
||||||
ClassCheckId:'',
|
ClassCheckId: '',
|
||||||
Karmacolumns: [],
|
Karmacolumns: [],
|
||||||
pid:[],
|
pid: [],
|
||||||
show1: false,
|
show1: false,
|
||||||
show2: false,
|
show2: false,
|
||||||
show3: false,
|
show3: false,
|
||||||
@@ -96,37 +101,37 @@
|
|||||||
message: '请输入标题',
|
message: '请输入标题',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'trade': [{
|
'business': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择行业',
|
message: '请选择行业',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change']
|
||||||
}],
|
}],
|
||||||
'region': [{
|
'region': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择地区',
|
message: '请选择地区',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change']
|
||||||
}],
|
}],
|
||||||
'karma': [{
|
'commercial': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择业态',
|
message: '请选择业态',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change']
|
||||||
}],
|
}],
|
||||||
'name': [{
|
'transferFee': [{
|
||||||
required: true,
|
|
||||||
message: '请输入姓名',
|
|
||||||
trigger: ['change', 'blur']
|
|
||||||
}],
|
|
||||||
'sell': [{
|
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入转让金',
|
message: '请输入转让金',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'introduce': [{
|
'contact': [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入姓名',
|
||||||
|
trigger: ['change', 'blur']
|
||||||
|
}],
|
||||||
|
'content': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入介绍',
|
message: '请输入介绍',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'size': [{
|
'area': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入面积',
|
message: '请输入面积',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
@@ -136,72 +141,154 @@
|
|||||||
message: '请输入租金',
|
message: '请输入租金',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'place': [{
|
'address': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入地址',
|
message: '请输入地址',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'call':[{
|
'mobile': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入电话号码',
|
message: '请输入电话号码',
|
||||||
},
|
|
||||||
{
|
|
||||||
validator: (rule, value, callback) => {
|
|
||||||
if(value) {
|
|
||||||
return this.$u.test.mobile(value);
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
message: '号码不正确',
|
{
|
||||||
trigger: ['change','blur'],
|
validator: (rule, value, callback) => {
|
||||||
}]
|
if (value) {
|
||||||
|
return this.$u.test.mobile(value);
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
message: '号码不正确',
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 删除图片
|
||||||
|
deletePic(event) {
|
||||||
|
this[`fileList${event.name}`].splice(event.index, 1)
|
||||||
|
},
|
||||||
|
preview(e) {
|
||||||
|
console.log('预览', e);
|
||||||
|
},
|
||||||
|
// 新增图片
|
||||||
|
async afterRead(event) {
|
||||||
|
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||||
|
let lists = [].concat(event.file)
|
||||||
|
let fileListLen = this[`fileList${event.name}`].length
|
||||||
|
lists.map((item) => {
|
||||||
|
this[`fileList${event.name}`].push({
|
||||||
|
...item,
|
||||||
|
status: 'uploading',
|
||||||
|
message: '上传中'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
for (let i = 0; i < lists.length; i++) {
|
||||||
|
console.log('lists[i].url', lists[i].url);
|
||||||
|
const result = await this.uploadFilePromise(lists[i].url)
|
||||||
|
console.log('result', result);
|
||||||
|
let item = this[`fileList${event.name}`][fileListLen]
|
||||||
|
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
||||||
|
status: 'success',
|
||||||
|
message: '',
|
||||||
|
url: result
|
||||||
|
}))
|
||||||
|
fileListLen++
|
||||||
|
this.imageLength = fileListLen
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uploadFilePromise(filePath) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const token = uni.getStorageSync('loginToken')
|
||||||
|
const a = uni.uploadFile({
|
||||||
|
url: this.$api.uploadImgUrl,
|
||||||
|
filePath: filePath,
|
||||||
|
name: 'file',
|
||||||
|
header: {
|
||||||
|
"Content-Type": "multipart/form-data",
|
||||||
|
'Authorization': token
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
resolve(JSON.parse(res.data).data.url)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
handleSearchAddress() {
|
handleSearchAddress() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/publish/chooseAddress/chooseAddress'
|
url: '/pages/publish/chooseAddress/chooseAddress'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
submit() {
|
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 => {
|
this.$refs.uForm.validate().then(res => {
|
||||||
console.log("提交表单信息:" + JSON.stringify(this.form))
|
console.log("提交表单信息:" + JSON.stringify(this.form))
|
||||||
uni.$u.toast('发布成功')
|
uni.$u.toast('发布成功')
|
||||||
// 调用服务端入表接口W
|
this.$api.publishRent(this.form).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
}).catch(errors => {
|
}).catch(errors => {
|
||||||
console.log("失败信息:" + JSON.stringify(errors))
|
console.log("失败信息:" + JSON.stringify(errors))
|
||||||
// uni.$u.toast('校验失败')
|
// uni.$u.toast('校验失败')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
tradeConfirm(e){
|
changeAddress(e) {
|
||||||
|
// console.log('changeAddress', e);
|
||||||
|
this.getAddressList(e)
|
||||||
|
},
|
||||||
|
getAddressList(value) {
|
||||||
|
var that = this
|
||||||
|
uni.request({
|
||||||
|
url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + 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
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
console.log('请求区域失败:', err);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
tradeConfirm(e) {
|
||||||
this.show2 = false
|
this.show2 = false
|
||||||
this.form.trade = e.value[0]
|
this.form.business = e.value[0]
|
||||||
this.ClassCheckId = this.pid[e.indexs[0]]
|
this.ClassCheckId = this.pid[e.indexs[0]]
|
||||||
this.$api.getClassList(this.ClassCheckId).then(res => {
|
this.$api.getClassList(this.ClassCheckId).then(res => {
|
||||||
// console.log(res);
|
// console.log(res);
|
||||||
this.Karmacolumns = res.data.data.map((item) => {
|
this.Karmacolumns = res.data.data.map((item) => {
|
||||||
return item = item.name
|
return item = item.name
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
karmaConfirm(e){
|
karmaConfirm(e) {
|
||||||
this.show3 = false
|
this.show3 = false
|
||||||
this.form.karma = e.value[0]
|
this.form.commercial = e.value[0]
|
||||||
},
|
},
|
||||||
regionConfirm(e){
|
regionConfirm(e) {
|
||||||
this.show1 = false
|
this.show1 = false
|
||||||
this.form.region = e.value[0]
|
this.form.region = e.value[0]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onReady() {
|
onReady() {
|
||||||
this.$refs.uForm.setRules(this.rules)
|
this.$refs.uForm.setRules(this.rules)
|
||||||
|
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.$api.getClassList().then(res =>{
|
this.$api.getClassList().then(res => {
|
||||||
// console.log(res.data.data.length);
|
// console.log(res.data.data.length);
|
||||||
this.Classcolumns = res.data.data.map((item) => {
|
this.Classcolumns = res.data.data.map((item) => {
|
||||||
return item = item.name
|
return item = item.name
|
||||||
@@ -209,15 +296,15 @@
|
|||||||
this.pid = res.data.data.map((item) => {
|
this.pid = res.data.data.map((item) => {
|
||||||
return item = item.id
|
return item = item.id
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
computed:{
|
computed: {
|
||||||
isChecked(index){
|
isChecked(index) {
|
||||||
if(index.length > 0)
|
if (index.length > 0)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -244,7 +331,11 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: #F8F8F8;
|
background-color: #F8F8F8;
|
||||||
height: 300rpx;
|
|
||||||
|
// height: 300rpx;
|
||||||
|
.count {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
// margin-right: 20px;
|
// margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,12 +358,14 @@
|
|||||||
font-weight: 1px;
|
font-weight: 1px;
|
||||||
color: #c1c4c7;
|
color: #c1c4c7;
|
||||||
}
|
}
|
||||||
.checkedtext{
|
|
||||||
|
.checkedtext {
|
||||||
margin-top: 5rpx;
|
margin-top: 5rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 1px;
|
font-weight: 1px;
|
||||||
border-style: none;
|
border-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.picker {
|
.picker {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
@@ -2,52 +2,50 @@
|
|||||||
<view class="form">
|
<view class="form">
|
||||||
<u-form :model="form" ref="uForm">
|
<u-form :model="form" ref="uForm">
|
||||||
<view class="upload">
|
<view class="upload">
|
||||||
<u-upload max-count="5" upload-icon="photo"></u-upload>
|
<view style="padding-left: 20rpx;margin-top: 20rpx;">
|
||||||
<text class="count">发布房源图片({{ShopInfomation.count}}/5)</text>
|
<u-upload :fileList="fileList1" :auto-upload="false" @afterRead="afterRead" @delete="deletePic" name="1"
|
||||||
|
multiple :maxCount="5" :on-preview="preview"></u-upload>
|
||||||
|
</view>
|
||||||
|
<!-- <u-upload max-count="5" upload-icon="photo"></u-upload> -->
|
||||||
|
<text class="count">发布房源图片({{imageLength}}/5)</text>
|
||||||
</view>
|
</view>
|
||||||
<u-form-item label="标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
|
<u-form-item label="项目标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
|
||||||
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class" border="none"></u-input>
|
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class"
|
||||||
|
border="none"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="地址" label-position="top" border-bottom="true" prop="place" label-width="auto">
|
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region"
|
||||||
<u-input v-model="form.place" placeholder="请输入店铺地址" placeholder-class="input-class" border="none"
|
label-width="auto">
|
||||||
@change="changeAddress"></u-input>
|
|
||||||
</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.length>0">{{form.region}}</text>
|
||||||
<text @click="show1 = true" class="checktext" v-else>请选择所属区域</text>
|
<text @click="show1 = true" class="checktext" v-else>请选择所属区域</text>
|
||||||
|
|
||||||
<view class="arrow-icon">
|
<view class="arrow-icon">
|
||||||
<u-icon name="arrow-right" size="30px" @click="show1 = true"></u-icon>
|
<u-icon name="arrow-right" size="30px" @click="show1 = true"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<u-picker :columns="regionColumns" :show="show1" :closeOnClickOverlay="true" @close="show1 = false"
|
<u-picker :columns="regionColumns" :show="show1" :closeOnClickOverlay="true" @close="show1 = false"
|
||||||
v-model="form.region" @confirm="regionConfirm"></u-picker>
|
v-model="form.region" @confirm="regionConfirm"></u-picker>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="行业" label-position="top" border-bottom="true" class="picker" label-width="auto" prop="trade" >
|
<u-form-item label="项目地址" label-position="top" border-bottom="true" prop="address" label-width="auto">
|
||||||
<text @click="show2 = true" class="checkedtext" v-if="form.trade.length>0">{{form.trade}}</text>
|
<u-input v-model="form.address" placeholder="请输入店铺地址" placeholder-class="input-class" border="none"
|
||||||
<text @click="show2 = true" class="checktext" v-else>请选择行业</text>
|
@change="changeAddress"></u-input>
|
||||||
|
</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="checktext" v-else>请选择项目行业</text>
|
||||||
<view class="arrow-icon">
|
<view class="arrow-icon">
|
||||||
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
|
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false" :columns="[Classcolumns]"
|
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false"
|
||||||
v-model="form.trade" @confirm="tradeConfirm"></u-picker>
|
:columns="[Classcolumns]" v-model="form.business" @confirm="tradeConfirm"></u-picker>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="业态" label-position="top" border-bottom="true" label-width="auto" prop="karma">
|
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="contact">
|
||||||
<text @click="show3 = true" class="checkedtext" v-if="form.karma.length>0">{{form.karma}}</text>
|
<u-input v-model="form.contact" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
|
||||||
<text @click="show3 = true" class="checktext" v-else>请选择业态</text>
|
|
||||||
<view class="arrow-icon">
|
|
||||||
<u-icon name="arrow-right" size="30px" @click="show3 = true"></u-icon>
|
|
||||||
</view>
|
|
||||||
<u-picker mode="region" :show="show3" :closeOnClickOverlay="true" @close="show3 = false" :columns="[Karmacolumns]"
|
|
||||||
v-model="form.karma" @confirm="karmaConfirm"></u-picker>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="name">
|
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="mobile">
|
||||||
<u-input v-model="form.name" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
|
<u-input v-model="form.mobile" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="手机号码" label-position="top" border-bottom="true" label-width="auto" prop="call">
|
<u-form-item label="详情介绍" label-position="top" border-bottom="true" label-width="auto" prop="content">
|
||||||
<u-input v-model="form.call" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
|
<u-input v-model="form.content" 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="introduce">
|
|
||||||
<u-input v-model="form.introduce" placeholder="请输入介绍详情" placeholder-class="input-class" border="none"></u-input>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</u-form>
|
</u-form>
|
||||||
<view class="bug-figure"></view>
|
<view class="bug-figure"></view>
|
||||||
@@ -61,31 +59,28 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
imageLength: '0',
|
||||||
|
fileList1: [],
|
||||||
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
|
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
|
||||||
ShopInfomation: {
|
|
||||||
city: '',
|
|
||||||
area: '',
|
|
||||||
count: 0,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
form: {
|
form: {
|
||||||
title: '',
|
title: '',
|
||||||
region: '',
|
region: '',
|
||||||
place: '',
|
address: '',
|
||||||
trade: '',
|
business: '',
|
||||||
karma: '',
|
mobile: '',
|
||||||
size: '',
|
contact:'',
|
||||||
rent: '',
|
content: '',
|
||||||
sell: '',
|
images: [],
|
||||||
name: '',
|
longitude: '',
|
||||||
call: '',
|
latitude: '',
|
||||||
introduce: ''
|
id: '',
|
||||||
|
|
||||||
},
|
},
|
||||||
Classcolumns: [],
|
Classcolumns: [],
|
||||||
ClassCheckId:'',
|
ClassCheckId: '',
|
||||||
Karmacolumns: [],
|
Karmacolumns: [],
|
||||||
pid:[],
|
pid: [],
|
||||||
show1: false,
|
show1: false,
|
||||||
show2: false,
|
show2: false,
|
||||||
show3: false,
|
show3: false,
|
||||||
@@ -95,76 +90,127 @@
|
|||||||
message: '请输入标题',
|
message: '请输入标题',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'trade': [{
|
'business': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择行业',
|
message: '请选择行业',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change']
|
||||||
}],
|
}],
|
||||||
'region': [{
|
'region': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择地区',
|
message: '请选择地区',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change']
|
||||||
}],
|
}],
|
||||||
'karma': [{
|
'contact': [{
|
||||||
required: true,
|
|
||||||
message: '请选择业态',
|
|
||||||
trigger: ['change', 'blur']
|
|
||||||
}],
|
|
||||||
'name': [{
|
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入姓名',
|
message: '请输入姓名',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'sell': [{
|
'content': [{
|
||||||
required: true,
|
|
||||||
message: '请输入转让金',
|
|
||||||
trigger: ['change', 'blur']
|
|
||||||
}],
|
|
||||||
'introduce': [{
|
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入介绍',
|
message: '请输入介绍',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'size': [{
|
'address': [{
|
||||||
required: true,
|
|
||||||
message: '请输入面积',
|
|
||||||
trigger: ['change', 'blur']
|
|
||||||
}],
|
|
||||||
'rent': [{
|
|
||||||
required: true,
|
|
||||||
message: '请输入租金',
|
|
||||||
trigger: ['change', 'blur']
|
|
||||||
}],
|
|
||||||
'place': [{
|
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入地址',
|
message: '请输入地址',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'call':[{
|
'mobile': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入电话号码',
|
message: '请输入电话号码',
|
||||||
},
|
|
||||||
{
|
|
||||||
validator: (rule, value, callback) => {
|
|
||||||
if(value) {
|
|
||||||
return this.$u.test.mobile(value);
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
message: '号码不正确',
|
{
|
||||||
trigger: ['change','blur'],
|
validator: (rule, value, callback) => {
|
||||||
}]
|
if (value) {
|
||||||
|
return this.$u.test.mobile(value);
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
message: '号码不正确',
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 删除图片
|
||||||
|
deletePic(event) {
|
||||||
|
this[`fileList${event.name}`].splice(event.index, 1)
|
||||||
|
},
|
||||||
|
preview(e) {
|
||||||
|
console.log('预览', e);
|
||||||
|
},
|
||||||
|
// 新增图片
|
||||||
|
async afterRead(event) {
|
||||||
|
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||||
|
let lists = [].concat(event.file)
|
||||||
|
let fileListLen = this[`fileList${event.name}`].length
|
||||||
|
lists.map((item) => {
|
||||||
|
this[`fileList${event.name}`].push({
|
||||||
|
...item,
|
||||||
|
status: 'uploading',
|
||||||
|
message: '上传中'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
for (let i = 0; i < lists.length; i++) {
|
||||||
|
console.log('lists[i].url', lists[i].url);
|
||||||
|
const result = await this.uploadFilePromise(lists[i].url)
|
||||||
|
console.log('result', result);
|
||||||
|
let item = this[`fileList${event.name}`][fileListLen]
|
||||||
|
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
||||||
|
status: 'success',
|
||||||
|
message: '',
|
||||||
|
url: result
|
||||||
|
}))
|
||||||
|
fileListLen++
|
||||||
|
this.imageLength = fileListLen
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uploadFilePromise(filePath) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const token = uni.getStorageSync('loginToken')
|
||||||
|
const a = uni.uploadFile({
|
||||||
|
url: this.$api.uploadImgUrl,
|
||||||
|
filePath: filePath,
|
||||||
|
name: 'file',
|
||||||
|
header: {
|
||||||
|
"Content-Type": "multipart/form-data",
|
||||||
|
'Authorization': token
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
resolve(JSON.parse(res.data).data.url)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
handleSearchAddress() {
|
handleSearchAddress() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/publish/chooseAddress/chooseAddress'
|
url: '/pages/publish/chooseAddress/chooseAddress'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
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);
|
||||||
|
})
|
||||||
|
}).catch(errors => {
|
||||||
|
console.log("失败信息:" + JSON.stringify(errors))
|
||||||
|
// uni.$u.toast('校验失败')
|
||||||
|
})
|
||||||
|
},
|
||||||
changeAddress(e) {
|
changeAddress(e) {
|
||||||
// console.log('changeAddress', e);
|
// console.log('changeAddress', e);
|
||||||
this.getAddressList(e)
|
this.getAddressList(e)
|
||||||
@@ -176,50 +222,42 @@
|
|||||||
that.$api.key,
|
that.$api.key,
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log('diz', res.data.result.location);
|
console.log('diz', res.data.result.location);
|
||||||
console.log('lat', res.data.result.location.lat);
|
// console.log('lat', res.data.result.location.lat);
|
||||||
console.log('lng', res.data.result.location.lng);
|
that.form.latitude = res.data.result.location.lat
|
||||||
|
// console.log('lng', res.data.result.location.lng);
|
||||||
|
that.form.longitude = res.data.result.location.lng
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
console.log('请求区域失败:', err);
|
console.log('请求区域失败:', err);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
submit() {
|
tradeConfirm(e) {
|
||||||
this.$refs.uForm.validate().then(res => {
|
|
||||||
console.log("提交表单信息:" + JSON.stringify(this.form))
|
|
||||||
uni.$u.toast('发布成功')
|
|
||||||
// 调用服务端入表接口W
|
|
||||||
}).catch(errors => {
|
|
||||||
console.log("失败信息:" + JSON.stringify(errors))
|
|
||||||
// uni.$u.toast('校验失败')
|
|
||||||
})
|
|
||||||
},
|
|
||||||
tradeConfirm(e){
|
|
||||||
this.show2 = false
|
this.show2 = false
|
||||||
this.form.trade = e.value[0]
|
this.form.business = e.value[0]
|
||||||
this.ClassCheckId = this.pid[e.indexs[0]]
|
this.ClassCheckId = this.pid[e.indexs[0]]
|
||||||
this.$api.getClassList(this.ClassCheckId).then(res => {
|
this.$api.getClassList(this.ClassCheckId).then(res => {
|
||||||
// console.log(res);
|
// console.log(res);
|
||||||
this.Karmacolumns = res.data.data.map((item) => {
|
this.Karmacolumns = res.data.data.map((item) => {
|
||||||
return item = item.name
|
return item = item.name
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
karmaConfirm(e){
|
karmaConfirm(e) {
|
||||||
this.show3 = false
|
this.show3 = false
|
||||||
this.form.karma = e.value[0]
|
this.form.commercial = e.value[0]
|
||||||
},
|
},
|
||||||
regionConfirm(e){
|
regionConfirm(e) {
|
||||||
this.show1 = false
|
this.show1 = false
|
||||||
this.form.region = e.value[0]
|
this.form.region = e.value[0]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onReady() {
|
onReady() {
|
||||||
this.$refs.uForm.setRules(this.rules)
|
this.$refs.uForm.setRules(this.rules)
|
||||||
|
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.$api.getClassList().then(res =>{
|
this.$api.getClassList().then(res => {
|
||||||
// console.log(res.data.data.length);
|
// console.log(res.data.data.length);
|
||||||
this.Classcolumns = res.data.data.map((item) => {
|
this.Classcolumns = res.data.data.map((item) => {
|
||||||
return item = item.name
|
return item = item.name
|
||||||
@@ -227,15 +265,15 @@
|
|||||||
this.pid = res.data.data.map((item) => {
|
this.pid = res.data.data.map((item) => {
|
||||||
return item = item.id
|
return item = item.id
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
computed:{
|
computed: {
|
||||||
isChecked(index){
|
isChecked(index) {
|
||||||
if(index.length > 0)
|
if (index.length > 0)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -262,7 +300,11 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: #F8F8F8;
|
background-color: #F8F8F8;
|
||||||
height: 300rpx;
|
|
||||||
|
// height: 300rpx;
|
||||||
|
.count {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
// margin-right: 20px;
|
// margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,12 +327,14 @@
|
|||||||
font-weight: 1px;
|
font-weight: 1px;
|
||||||
color: #c1c4c7;
|
color: #c1c4c7;
|
||||||
}
|
}
|
||||||
.checkedtext{
|
|
||||||
|
.checkedtext {
|
||||||
margin-top: 5rpx;
|
margin-top: 5rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 1px;
|
font-weight: 1px;
|
||||||
border-style: none;
|
border-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.picker {
|
.picker {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
@@ -2,54 +2,71 @@
|
|||||||
<view class="form">
|
<view class="form">
|
||||||
<u-form :model="form" ref="uForm">
|
<u-form :model="form" ref="uForm">
|
||||||
<view class="upload">
|
<view class="upload">
|
||||||
<u-upload max-count="5" upload-icon="photo"></u-upload>
|
<view style="padding-left: 20rpx;margin-top: 20rpx;">
|
||||||
<text class="count">发布店铺图片({{ShopInfomation.count}}/5)</text>
|
<u-upload :fileList="fileList1" :auto-upload="false" @afterRead="afterRead" @delete="deletePic" name="1"
|
||||||
|
multiple :maxCount="5" :on-preview="preview"></u-upload>
|
||||||
|
</view>
|
||||||
|
<!-- <u-upload max-count="5" upload-icon="photo"></u-upload> -->
|
||||||
|
<text class="count">发布房源图片({{imageLength}}/5)</text>
|
||||||
</view>
|
</view>
|
||||||
|
<u-form-item label="标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
|
||||||
<u-form-item label="标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
|
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class"
|
||||||
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class" border="none"></u-input>
|
border="none"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region" label-width="auto">
|
<u-form-item label="区域" label-position="top" border-bottom="true" right-icon="arrow-right" prop="region"
|
||||||
<text @click="show1 = true" class="checkedtext" v-if="form.region.length>0">{{form.region}}</text>
|
label-width="auto">
|
||||||
<text @click="show1 = true" class="checktext" v-else>请选择所属区域</text>
|
<text @click="show1 = true" class="checkedtext" v-if="form.region.length>0">{{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>
|
<view class="arrow-icon">
|
||||||
</view>
|
<u-icon name="arrow-right" size="30px" @click="show1 = true"></u-icon>
|
||||||
<u-picker :columns="regionColumns" :show="show1" :closeOnClickOverlay="true" @close="show1 = false"
|
</view>
|
||||||
v-model="form.region" @confirm="regionConfirm"></u-picker>
|
<u-picker :columns="regionColumns" :show="show1" :closeOnClickOverlay="true" @close="show1 = false"
|
||||||
</u-form-item>
|
v-model="form.region" @confirm="regionConfirm"></u-picker>
|
||||||
<u-form-item label="地址" label-position="top" border-bottom="true" prop="place" label-width="auto">
|
</u-form-item>
|
||||||
<u-input v-model="form.place" placeholder="请输入店铺地址" placeholder-class="input-class" border="none"></u-input>
|
<u-form-item label="地址" label-position="top" border-bottom="true" prop="address" label-width="auto">
|
||||||
</u-form-item>
|
<u-input v-model="form.address" placeholder="请输入店铺地址" placeholder-class="input-class" border="none"
|
||||||
<u-form-item label="适合行业" label-position="top" border-bottom="true" class="picker" label-width="auto" prop="trade" >
|
@change="changeAddress"></u-input>
|
||||||
<text @click="show2 = true" class="checkedtext" v-if="form.trade.length>0">{{form.trade}}</text>
|
</u-form-item>
|
||||||
<text @click="show2 = true" class="checktext" v-else>请选择店铺行业</text>
|
<u-form-item label="适合行业" label-position="top" border-bottom="true" class="picker" label-width="auto"
|
||||||
<view class="arrow-icon">
|
prop="business">
|
||||||
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
|
<text @click="show2 = true" class="checkedtext" v-if="form.business.length>0">{{form.business}}</text>
|
||||||
</view>
|
<text @click="show2 = true" class="checktext" v-else>请选择店铺行业</text>
|
||||||
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false" :columns="[Classcolumns]"
|
<view class="arrow-icon">
|
||||||
v-model="form.trade" @confirm="tradeConfirm"></u-picker>
|
<u-icon name="arrow-right" size="30px" @click="show2 = true"></u-icon>
|
||||||
</u-form-item>
|
</view>
|
||||||
<u-form-item label="面积" label-position="top" border-bottom="true" label-width="auto" prop="size">
|
<u-picker mode="region" :show="show2" :closeOnClickOverlay="true" @close="show2 = false"
|
||||||
<u-input v-model="form.size" placeholder="请输入店铺面积" placeholder-class="input-class" border="none"></u-input>
|
:columns="[Classcolumns]" v-model="form.business" @confirm="tradeConfirm"></u-picker>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="租金(元/月)" label-position="top" border-bottom="true" label-width="auto" prop="rent">
|
<u-form-item label="业态" label-position="top" border-bottom="true" label-width="auto" prop="commercial">
|
||||||
<u-input v-model="form.rent" placeholder="请输入店铺租金" placeholder-class="input-class" border="none"></u-input>
|
<text @click="show3 = true" class="checkedtext" v-if="form.commercial.length>0">{{form.commercial}}</text>
|
||||||
</u-form-item>
|
<text @click="show3 = true" class="checktext" v-else>请选择店铺业态</text>
|
||||||
<u-form-item label="详情" label-position="top" border-bottom="true" label-width="auto" prop="introduce">
|
<view class="arrow-icon">
|
||||||
<u-input v-model="form.introduce" placeholder="请输入详情" placeholder-class="input-class" border="none"></u-input>
|
<u-icon name="arrow-right" size="30px" @click="show3 = true"></u-icon>
|
||||||
</u-form-item>
|
</view>
|
||||||
<u-form-item label="联系人" label-position="top" border-bottom="true" label-width="auto" prop="name">
|
<u-picker mode="region" :show="show3" :closeOnClickOverlay="true" @close="show3 = false"
|
||||||
<u-input v-model="form.name" placeholder="请输入联系人姓名" placeholder-class="input-class" border="none"></u-input>
|
: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="call">
|
<u-form-item label="面积" label-position="top" border-bottom="true" label-width="auto" prop="area">
|
||||||
<u-input v-model="form.call" placeholder="请输入联系人手机号码" placeholder-class="input-class" border="none"></u-input>
|
<u-input v-model="form.area" placeholder="请输入店铺面积" placeholder-class="input-class" border="none"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</u-form>
|
<u-form-item label="租金(元/月)" label-position="top" border-bottom="true" label-width="auto" prop="rent">
|
||||||
<view class="bug-figure"></view>
|
<u-input v-model="form.rent" placeholder="请输入店铺租金" placeholder-class="input-class" border="none"></u-input>
|
||||||
<u-button @click="submit" color="linear-gradient(to right, #E86262, #CC3333)" :size="normal" shape="circle" class="submit-btn">发布</u-button>
|
</u-form-item>
|
||||||
<view class="bug-figure"></view>
|
<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>
|
||||||
|
<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>
|
||||||
|
<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>
|
||||||
|
</u-form>
|
||||||
|
<view class="bug-figure"></view>
|
||||||
|
<u-button @click="submit" color="linear-gradient(to right, #E86262, #CC3333)" :size="normal" shape="circle"
|
||||||
|
class="submit-btn">发布</u-button>
|
||||||
|
<view class="bug-figure"></view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -57,56 +74,66 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
regionColumns:[JSON.parse(uni.getStorageSync('regionList'))]||[],
|
imageLength: '0',
|
||||||
ShopInfomation:{
|
fileList1: [],
|
||||||
city:'',
|
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
|
||||||
area:'',
|
|
||||||
count:0,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
form: {
|
form: {
|
||||||
title: '',
|
title: '',
|
||||||
region: '',
|
region: '',
|
||||||
place: '',
|
address: '',
|
||||||
trade: '',
|
business: '',
|
||||||
size: '',
|
commercial: '',
|
||||||
|
area: '',
|
||||||
rent: '',
|
rent: '',
|
||||||
name: '',
|
contact:'',
|
||||||
call: '',
|
mobile: '',
|
||||||
introduce: ''
|
content: '',
|
||||||
|
images: [],
|
||||||
|
longitude: '',
|
||||||
|
latitude: '',
|
||||||
|
id: '',
|
||||||
|
|
||||||
},
|
},
|
||||||
Classcolumns:[],
|
Classcolumns: [],
|
||||||
show1:false,
|
ClassCheckId: '',
|
||||||
show2:false,
|
Karmacolumns: [],
|
||||||
show3:false,
|
pid: [],
|
||||||
|
show1: false,
|
||||||
|
show2: false,
|
||||||
|
show3: false,
|
||||||
rules: {
|
rules: {
|
||||||
'title': [{
|
'title': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入标题',
|
message: '请输入标题',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'trade': [{
|
'business': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择行业',
|
message: '请选择行业',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change']
|
||||||
}],
|
}],
|
||||||
'region': [{
|
'region': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择地区',
|
message: '请选择地区',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change']
|
||||||
}],
|
}],
|
||||||
'name': [{
|
'commercial': [{
|
||||||
|
required: true,
|
||||||
|
message: '请选择业态',
|
||||||
|
trigger: ['change']
|
||||||
|
}],
|
||||||
|
'contact': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入姓名',
|
message: '请输入姓名',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'introduce': [{
|
'content': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入介绍',
|
message: '请输入介绍',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'size': [{
|
'area': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入面积',
|
message: '请输入面积',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
@@ -116,123 +143,239 @@
|
|||||||
message: '请输入租金',
|
message: '请输入租金',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'place': [{
|
'address': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入地址',
|
message: '请输入地址',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}],
|
}],
|
||||||
'call':[{
|
'mobile': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入电话号码',
|
message: '请输入电话号码',
|
||||||
},
|
|
||||||
{
|
|
||||||
validator: (rule, value, callback) => {
|
|
||||||
if(value) {
|
|
||||||
return this.$u.test.mobile(value);
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
message: '号码不正确',
|
{
|
||||||
trigger: ['change','blur'],
|
validator: (rule, value, callback) => {
|
||||||
}]
|
if (value) {
|
||||||
|
return this.$u.test.mobile(value);
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
message: '号码不正确',
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
confirmArea(e) {
|
// 删除图片
|
||||||
this.ShopInfomation.city = e.value[0]
|
deletePic(event) {
|
||||||
this.ShopInfomation.area = e.value[1]
|
this[`fileList${event.name}`].splice(event.index, 1)
|
||||||
this.show1 = false
|
},
|
||||||
|
preview(e) {
|
||||||
|
console.log('预览', e);
|
||||||
|
},
|
||||||
|
// 新增图片
|
||||||
|
async afterRead(event) {
|
||||||
|
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||||
|
let lists = [].concat(event.file)
|
||||||
|
let fileListLen = this[`fileList${event.name}`].length
|
||||||
|
lists.map((item) => {
|
||||||
|
this[`fileList${event.name}`].push({
|
||||||
|
...item,
|
||||||
|
status: 'uploading',
|
||||||
|
message: '上传中'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
for (let i = 0; i < lists.length; i++) {
|
||||||
|
console.log('lists[i].url', lists[i].url);
|
||||||
|
const result = await this.uploadFilePromise(lists[i].url)
|
||||||
|
console.log('result', result);
|
||||||
|
let item = this[`fileList${event.name}`][fileListLen]
|
||||||
|
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
||||||
|
status: 'success',
|
||||||
|
message: '',
|
||||||
|
url: result
|
||||||
|
}))
|
||||||
|
fileListLen++
|
||||||
|
this.imageLength = fileListLen
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uploadFilePromise(filePath) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const token = uni.getStorageSync('loginToken')
|
||||||
|
const a = uni.uploadFile({
|
||||||
|
url: this.$api.uploadImgUrl,
|
||||||
|
filePath: filePath,
|
||||||
|
name: 'file',
|
||||||
|
header: {
|
||||||
|
"Content-Type": "multipart/form-data",
|
||||||
|
'Authorization': token
|
||||||
},
|
},
|
||||||
|
success: (res) => {
|
||||||
|
resolve(JSON.parse(res.data).data.url)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleSearchAddress() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/publish/chooseAddress/chooseAddress'
|
||||||
|
})
|
||||||
|
},
|
||||||
submit() {
|
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 => {
|
this.$refs.uForm.validate().then(res => {
|
||||||
console.log("提交表单信息:" + JSON.stringify(this.form))
|
console.log("提交表单信息:" + JSON.stringify(this.form))
|
||||||
uni.$u.toast('发布成功')
|
uni.$u.toast('发布成功')
|
||||||
// 调用服务端入表接口W
|
this.$api.publishRent(this.form).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
}).catch(errors => {
|
}).catch(errors => {
|
||||||
console.log("失败信息:" + JSON.stringify(errors))
|
console.log("失败信息:" + JSON.stringify(errors))
|
||||||
// uni.$u.toast('校验失败')
|
// uni.$u.toast('校验失败')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
tradeConfirm(e){
|
changeAddress(e) {
|
||||||
this.show2 = false
|
// console.log('changeAddress', e);
|
||||||
this.form.trade = e.value[0]
|
this.getAddressList(e)
|
||||||
},
|
},
|
||||||
regionConfirm(e){
|
getAddressList(value) {
|
||||||
|
var that = this
|
||||||
|
uni.request({
|
||||||
|
url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + 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
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
console.log('请求区域失败:', err);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
tradeConfirm(e) {
|
||||||
|
this.show2 = false
|
||||||
|
this.form.business = e.value[0]
|
||||||
|
this.ClassCheckId = this.pid[e.indexs[0]]
|
||||||
|
this.$api.getClassList(this.ClassCheckId).then(res => {
|
||||||
|
// console.log(res);
|
||||||
|
this.Karmacolumns = res.data.data.map((item) => {
|
||||||
|
return item = item.name
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
karmaConfirm(e) {
|
||||||
|
this.show3 = false
|
||||||
|
this.form.commercial = e.value[0]
|
||||||
|
},
|
||||||
|
regionConfirm(e) {
|
||||||
this.show1 = false
|
this.show1 = false
|
||||||
this.form.region = e.value[0]
|
this.form.region = e.value[0]
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
onReady() {
|
||||||
|
this.$refs.uForm.setRules(this.rules)
|
||||||
|
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.$api.getClassList().then(res =>{
|
this.$api.getClassList().then(res => {
|
||||||
// console.log(res.data.data.length);
|
// console.log(res.data.data.length);
|
||||||
this.Classcolumns = res.data.data.map((item) => {
|
this.Classcolumns = res.data.data.map((item) => {
|
||||||
return item = item.name
|
return item = item.name
|
||||||
})
|
})
|
||||||
|
this.pid = res.data.data.map((item) => {
|
||||||
|
return item = item.id
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onReady() {
|
computed: {
|
||||||
this.$refs.uForm.setRules(this.rules)
|
isChecked(index) {
|
||||||
|
if (index.length > 0)
|
||||||
},
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.count{
|
.count {}
|
||||||
|
|
||||||
}
|
.form {
|
||||||
.form{
|
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
.input-class{
|
|
||||||
|
.input-class {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight:1px;
|
font-weight: 1px;
|
||||||
border-style: none;
|
border-style: none;
|
||||||
|
|
||||||
}
|
}
|
||||||
.upload{
|
|
||||||
|
.upload {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: #F8F8F8;
|
background-color: #F8F8F8;
|
||||||
height: 300rpx;
|
|
||||||
|
// height: 300rpx;
|
||||||
|
.count {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
// margin-right: 20px;
|
// margin-right: 20px;
|
||||||
}
|
}
|
||||||
.submit-btn{
|
|
||||||
|
.submit-btn {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
}
|
}
|
||||||
.bug-figure{
|
|
||||||
|
.bug-figure {
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
}
|
}
|
||||||
.checkbox1{
|
|
||||||
|
.checkbox1 {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
.checktext{
|
|
||||||
|
.checktext {
|
||||||
margin-top: 5rpx;
|
margin-top: 5rpx;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight:1px;
|
font-weight: 1px;
|
||||||
color: #c1c4c7;
|
color: #c1c4c7;
|
||||||
}
|
}
|
||||||
.checkedtext{
|
|
||||||
|
.checkedtext {
|
||||||
margin-top: 5rpx;
|
margin-top: 5rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 1px;
|
font-weight: 1px;
|
||||||
border-style: none;
|
border-style: none;
|
||||||
}
|
}
|
||||||
.picker{
|
|
||||||
|
.picker {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
.arrow-icon{
|
|
||||||
|
.arrow-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 10rpx;
|
right: 10rpx;
|
||||||
transform: translateY(-20rpx);
|
transform: translateY(-20rpx);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -7,9 +7,8 @@
|
|||||||
multiple :maxCount="5" :on-preview="preview"></u-upload>
|
multiple :maxCount="5" :on-preview="preview"></u-upload>
|
||||||
</view>
|
</view>
|
||||||
<!-- <u-upload max-count="5" upload-icon="photo"></u-upload> -->
|
<!-- <u-upload max-count="5" upload-icon="photo"></u-upload> -->
|
||||||
<text class="count">发布房源图片({{imageLength}}/5})</text>
|
<text class="count">发布房源图片({{imageLength}}/5)</text>
|
||||||
</view>
|
</view>
|
||||||
</u-form-item>
|
|
||||||
<u-form-item label="标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
|
<u-form-item label="标题" label-position="top" border-bottom="true" prop="title" label-width="auto">
|
||||||
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class"
|
<u-input v-model="form.title" placeholder="请输入标题以便吸引人的注意哦" placeholder-class="input-class"
|
||||||
border="none"></u-input>
|
border="none"></u-input>
|
||||||
@@ -92,13 +91,14 @@
|
|||||||
area: '',
|
area: '',
|
||||||
rent: '',
|
rent: '',
|
||||||
transferFee: '',
|
transferFee: '',
|
||||||
|
contact:'',
|
||||||
mobile: '',
|
mobile: '',
|
||||||
content: '',
|
content: '',
|
||||||
images: [],
|
images: [],
|
||||||
longitude: '',
|
longitude: '',
|
||||||
latitude: '',
|
latitude: '',
|
||||||
id: '',
|
id: '',
|
||||||
|
|
||||||
},
|
},
|
||||||
Classcolumns: [],
|
Classcolumns: [],
|
||||||
ClassCheckId: '',
|
ClassCheckId: '',
|
||||||
|
|||||||
@@ -260,6 +260,27 @@ const apiService = {
|
|||||||
resolve(service.post(url, data))
|
resolve(service.post(url, data))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
//发布店铺出租
|
||||||
|
publishRent(data){
|
||||||
|
const url = `/shop/rent/`
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
resolve(service.post(url, data))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//发布找店地址
|
||||||
|
publishAddress(data){
|
||||||
|
const url = `/shop/selection/`
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
resolve(service.post(url, data))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//发布项目招商
|
||||||
|
publishInvestment(data){
|
||||||
|
const url = `/shop/investment/`
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
resolve(service.post(url, data))
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
export {
|
export {
|
||||||
apiService,
|
apiService,
|
||||||
|
|||||||
Reference in New Issue
Block a user