梁航:合并及数字键盘
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<view class="upload">
|
||||
<view style="padding-left: 20rpx;margin-top: 20rpx;">
|
||||
<u-upload :fileList="fileList1" :auto-upload="false" @afterRead="afterRead" @delete="deletePic" name="1"
|
||||
multiple :maxCount="5" :on-preview="preview"></u-upload>
|
||||
multiple :maxCount="5"></u-upload>
|
||||
</view>
|
||||
<!-- <u-upload max-count="5" upload-icon="photo"></u-upload> -->
|
||||
<text class="count">发布房源图片({{imageLength}}/5})</text>
|
||||
@@ -15,9 +15,8 @@
|
||||
</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>
|
||||
</view>
|
||||
@@ -26,11 +25,11 @@
|
||||
</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">
|
||||
<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>
|
||||
@@ -39,10 +38,10 @@
|
||||
: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>
|
||||
<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="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>
|
||||
@@ -77,9 +76,9 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
imageLength: '0',
|
||||
imageLength: 0,
|
||||
fileList1: [],
|
||||
regionColumns: [JSON.parse(uni.getStorageSync('regionList'))] || [],
|
||||
regionColumns: [],
|
||||
|
||||
form: {
|
||||
title: '',
|
||||
@@ -197,9 +196,7 @@
|
||||
})
|
||||
})
|
||||
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',
|
||||
@@ -233,40 +230,95 @@
|
||||
})
|
||||
},
|
||||
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.publishTransfer(this.form).then(res => {
|
||||
console.log(res);
|
||||
const temp = []
|
||||
if (this.fileList1.length > 0) {
|
||||
this.fileList1.map(item => {
|
||||
const url = item.url
|
||||
console.log('url', url, this.$api.imgUrl);
|
||||
temp.push(url.replace(this.$api.imgUrl, ''))
|
||||
|
||||
})
|
||||
}
|
||||
console.log('images---', temp.join(','));
|
||||
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.form);
|
||||
this.$api.publishTransfer(data).then(res => {
|
||||
console.log('发布店铺转让', res);
|
||||
if (res.data.code == 1) {
|
||||
uni.$u.toast(res.data.msg)
|
||||
uni.reLaunch({
|
||||
url: '/pages/my/my'
|
||||
})
|
||||
} 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) {
|
||||
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);
|
||||
}
|
||||
})
|
||||
},
|
||||
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=' + that.form.region + value + '&key=' +
|
||||
that.$api.key,
|
||||
success(res) {
|
||||
console.log('地址转经纬度', res.data);
|
||||
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);
|
||||
@@ -292,12 +344,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(1, options.id)
|
||||
}
|
||||
} else {
|
||||
console.log('发布');
|
||||
}
|
||||
this.getRegionList()
|
||||
this.$api.getClassList().then(res => {
|
||||
// console.log(res.data.data.length);
|
||||
this.Classcolumns = res.data.data.map((item) => {
|
||||
|
||||
Reference in New Issue
Block a user