Merge pull request '邓洁 : 发布找店地址接口' (#77) from dj into master
Reviewed-on: http://git.feashow.cn/odjbin/city-store-transfer/pulls/77
This commit is contained in:
@@ -16,10 +16,6 @@
|
||||
<u-picker :columns="regionColumns" :show="show1" :closeOnClickOverlay="true" @close="show1 = false"
|
||||
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-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>
|
||||
@@ -30,14 +26,18 @@
|
||||
<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="commercialForm">
|
||||
<text @click="choosecommercialForm" class="checkedtext"
|
||||
v-if="form.commercialForm.length>0">{{form.commercialForm}}</text>
|
||||
<text @click="choosecommercialForm" 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="choosecommercialForm"></u-icon>
|
||||
</view>
|
||||
<u-picker mode="region" :show="show3" :closeOnClickOverlay="true" @close="show3 = false"
|
||||
:columns="[Karmacolumns]" v-model="form.commercial" @confirm="karmaConfirm"></u-picker>
|
||||
:columns="[Karmacolumns]" v-model="form.commercialForm" @confirm="karmaConfirm"></u-picker>
|
||||
</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>
|
||||
<u-form-item label="预计投资" label-position="top" border-bottom="true" label-width="auto" prop="transferFee">
|
||||
<u-input v-model="form.transferFee" placeholder="请输入预计投资" placeholder-class="input-class"
|
||||
@@ -46,14 +46,15 @@
|
||||
<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="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="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="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="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="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="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>
|
||||
@@ -67,26 +68,19 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
imageLength: '0',
|
||||
fileList1: [],
|
||||
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
|
||||
|
||||
regionColumns: [],
|
||||
form: {
|
||||
title: '',
|
||||
region: '',
|
||||
address: '',
|
||||
business: '',
|
||||
commercial: '',
|
||||
transferFee:'',
|
||||
commercialForm: '',
|
||||
area: '',
|
||||
transferFee: '',
|
||||
rent: '',
|
||||
contact:'',
|
||||
mobile: '',
|
||||
content: '',
|
||||
// images: [],
|
||||
longitude: '',
|
||||
latitude: '',
|
||||
contactPerson: '',
|
||||
phone: '',
|
||||
details: '',
|
||||
id: '',
|
||||
|
||||
},
|
||||
Classcolumns: [],
|
||||
ClassCheckId: '',
|
||||
@@ -111,22 +105,27 @@
|
||||
message: '请选择地区',
|
||||
trigger: ['change']
|
||||
}],
|
||||
'commercial': [{
|
||||
'commercialForm': [{
|
||||
required: true,
|
||||
message: '请选择业态',
|
||||
trigger: ['change']
|
||||
}],
|
||||
'area': [{
|
||||
required: true,
|
||||
message: '请输入面积',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
'transferFee': [{
|
||||
required: true,
|
||||
message: '请输入转让金',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
'contact': [{
|
||||
'contactPerson': [{
|
||||
required: true,
|
||||
message: '请输入姓名',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
'content': [{
|
||||
'details': [{
|
||||
required: true,
|
||||
message: '请输入介绍',
|
||||
trigger: ['change', 'blur']
|
||||
@@ -141,12 +140,7 @@
|
||||
message: '请输入租金',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
'address': [{
|
||||
required: true,
|
||||
message: '请输入地址',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
'mobile': [{
|
||||
'phone': [{
|
||||
required: true,
|
||||
message: '请输入电话号码',
|
||||
},
|
||||
@@ -162,101 +156,49 @@
|
||||
trigger: ['change', 'blur'],
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
}
|
||||
},
|
||||
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() {
|
||||
uni.navigateTo({
|
||||
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('发布成功')
|
||||
console.log("提交表单信息:", this.form)
|
||||
this.$api.publishAddress(this.form).then(res => {
|
||||
console.log(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))
|
||||
console.log("失败信息:", JSON.stringify(errors))
|
||||
// uni.$u.toast('校验失败')
|
||||
})
|
||||
},
|
||||
changeAddress(e) {
|
||||
// console.log('changeAddress', e);
|
||||
this.getAddressList(e)
|
||||
choosecommercialForm() {
|
||||
if (!this.form.business) {
|
||||
uni.$u.toast('请先选择行业')
|
||||
return false
|
||||
} else {
|
||||
this.show3 = true
|
||||
}
|
||||
},
|
||||
getAddressList(value) {
|
||||
getRegionList() {
|
||||
var that = this
|
||||
uni.request({
|
||||
url: 'https://apis.map.qq.com/ws/geocoder/v1/?address=' + value + '&key=' +
|
||||
url: 'https://apis.map.qq.com/ws/district/v1/getchildren?id=' + uni.getStorageSync('city_code') + '&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
|
||||
that.regionColumns = [res.data.result[0].map(item => item.fullname)]
|
||||
},
|
||||
fail(err) {
|
||||
console.log('请求区域失败:', err);
|
||||
@@ -276,7 +218,7 @@
|
||||
},
|
||||
karmaConfirm(e) {
|
||||
this.show3 = false
|
||||
this.form.commercial = e.value[0]
|
||||
this.form.commercialForm = e.value[0]
|
||||
},
|
||||
regionConfirm(e) {
|
||||
this.show1 = false
|
||||
@@ -288,6 +230,7 @@
|
||||
|
||||
},
|
||||
onLoad() {
|
||||
this.getRegionList()
|
||||
this.$api.getClassList().then(res => {
|
||||
// console.log(res.data.data.length);
|
||||
this.Classcolumns = res.data.data.map((item) => {
|
||||
@@ -336,6 +279,7 @@
|
||||
.count {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
// margin-right: 20px;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user