...
|
...
|
@@ -47,22 +47,20 @@ |
|
|
<image src="../../static/image/right_icon.png" mode=""></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 服务位置区域 -->
|
|
|
<view class="serviceWrap">
|
|
|
<view class="title">
|
|
|
<view class="infoItem" @click="showChooseAddress = true">
|
|
|
<view class="infoLeft">
|
|
|
家乡
|
|
|
</view>
|
|
|
<view class="content">
|
|
|
<u-steps @chooseAddress="chooseAddress" :direction="direction" :current="current" :list="steps" :mode="mode" :icon="icon"></u-steps>
|
|
|
<!-- <view class="left">
|
|
|
<text class="alertTxt" :class="{active:param.address != '请选择服务位置'}">{{param.address}}</text>
|
|
|
<view class="infoCenter">
|
|
|
|
|
|
</view>
|
|
|
<view class="infoRight">
|
|
|
<text class="alertTxt" :class="{active:param.address != '请选择家乡'}">{{param.address}}</text>
|
|
|
<image src="../../static/image/right_icon.png" mode=""></image>
|
|
|
</view>
|
|
|
<view class="right">
|
|
|
<image @click="chooseLocation" src="../../static/image/my/icon_faqi@2x.png" mode=""></image>
|
|
|
</view> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 服务位置区域 -->
|
|
|
<!-- 服务内容区域 -->
|
|
|
<!-- <view class="serviceWrap">
|
|
|
<view class="title">
|
...
|
...
|
@@ -132,48 +130,28 @@ |
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<u-select :default-value="defaultValue" :value-name="'ID'" :label-name="'Name'" :mode="selectMode" v-model="show" :list="addressList" @confirm="confirmAddress" @cancel="cancel"></u-select>
|
|
|
<!-- 选择家乡弹框 -->
|
|
|
<choose-address v-if="showChooseAddress" @close="showChooseAddress = false" @confirm="confirmAddress"></choose-address>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
var amapFile = require('../../static/js/amap-wx.js');
|
|
|
import chooseAddress from '@/components/chooseAddress.vue'
|
|
|
import {mapState} from "vuex"
|
|
|
export default{
|
|
|
data(){
|
|
|
return{
|
|
|
//列选择开始
|
|
|
show: false,
|
|
|
defaultValue: [0],
|
|
|
selectMode: 'single-column', // single-column, mutil-column, mutil-column-auto
|
|
|
addressList: [],
|
|
|
//列选择结束
|
|
|
|
|
|
//步骤条开始
|
|
|
steps: [{
|
|
|
name: '请选择省份'
|
|
|
}, {
|
|
|
name: '请选择市'
|
|
|
}, {
|
|
|
name: '请选择区(县)'
|
|
|
}, {
|
|
|
name: '请选择镇'
|
|
|
}, {
|
|
|
name: '请选择村'
|
|
|
}, ],
|
|
|
current: -1,
|
|
|
icon: 'map-fill',
|
|
|
mode: 'dot',
|
|
|
direction: 'column',
|
|
|
//步骤条结束
|
|
|
showChooseAddress:false,
|
|
|
nicknameFocus:false,
|
|
|
userInfo:{},
|
|
|
param:{
|
|
|
area_id:'',
|
|
|
phone:'',
|
|
|
province:'',
|
|
|
city:'',
|
|
|
county:'',
|
|
|
address:'请选择服务位置',
|
|
|
address:'请选择家乡',
|
|
|
longitude:'',
|
|
|
latitude:'',
|
|
|
stop_money:'',
|
...
|
...
|
@@ -185,6 +163,9 @@ |
|
|
computed:{
|
|
|
...mapState(["userinfo"])
|
|
|
},
|
|
|
components:{
|
|
|
chooseAddress
|
|
|
},
|
|
|
created() {
|
|
|
uni.$on('bAvatarCropper', path => {
|
|
|
// this.userInfo.bg_image = path;
|
...
|
...
|
@@ -226,17 +207,6 @@ |
|
|
getData(){
|
|
|
let areaIds = []
|
|
|
let areaNames = []
|
|
|
let stepsTemp =[{
|
|
|
name: '请选择省份'
|
|
|
}, {
|
|
|
name: '请选择市'
|
|
|
}, {
|
|
|
name: '请选择区(县)'
|
|
|
}, {
|
|
|
name: '请选择镇'
|
|
|
}, {
|
|
|
name: '请选择村'
|
|
|
}]
|
|
|
//获取用户信息
|
|
|
this.$request('/user/info').then((res)=>{
|
|
|
let avatar = res.data.avatar
|
...
|
...
|
@@ -251,17 +221,14 @@ |
|
|
if(this.userInfo.area_id != ''){
|
|
|
areaIds = Object.keys(this.userInfo.area_arr)
|
|
|
areaNames = Object.values(this.userInfo.area_arr)
|
|
|
for(let i = 0; i < areaIds.length; i ++){
|
|
|
stepsTemp[i].id = areaIds[i]
|
|
|
stepsTemp[i].name = areaNames[i]
|
|
|
}
|
|
|
this.steps = stepsTemp
|
|
|
this.param.area_id = areaIds[areaIds.length - 1]
|
|
|
this.param.address = areaNames.join('')
|
|
|
}
|
|
|
this.param.phone = this.userInfo.phone != '' ? this.userInfo.phone : this.userInfo.mobile
|
|
|
this.param.province = this.userInfo.form_province
|
|
|
this.param.city = this.userInfo.form_city
|
|
|
this.param.county = this.userInfo.form_county
|
|
|
this.param.address = this.userInfo.form_address
|
|
|
// this.param.address = this.userInfo.form_address
|
|
|
this.param.longitude = this.userInfo.form_longitude
|
|
|
this.param.latitude = this.userInfo.form_latitude
|
|
|
this.param.stop_money = this.userInfo.form_stop_money
|
...
|
...
|
@@ -277,47 +244,10 @@ |
|
|
})
|
|
|
|
|
|
},
|
|
|
chooseAddress(e){
|
|
|
let area_id
|
|
|
if(e > 0 && this.steps[e-1].id == undefined){
|
|
|
return
|
|
|
}
|
|
|
if(e > 0){
|
|
|
area_id = this.steps[e-1].id
|
|
|
}
|
|
|
this.$request('/common/area',{area_id:area_id}).then((res)=>{
|
|
|
this.addressList = res.data
|
|
|
this.current = e
|
|
|
this.show = true
|
|
|
})
|
|
|
},
|
|
|
confirmAddress(e) {
|
|
|
let Name = ''
|
|
|
let ID = ''
|
|
|
let stepsTemp = [{
|
|
|
name: '请选择省份'
|
|
|
}, {
|
|
|
name: '请选择市'
|
|
|
}, {
|
|
|
name: '请选择区(县)'
|
|
|
}, {
|
|
|
name: '请选择镇'
|
|
|
}, {
|
|
|
name: '请选择村'
|
|
|
}, ]
|
|
|
e.map((val, index) => {
|
|
|
Name += Name == '' ? val.label : '-' + val.label;
|
|
|
ID += ID == '' ? val.value : '-' + val.value;
|
|
|
})
|
|
|
for(let i = 0; i <= this.current; i ++){
|
|
|
if(this.steps[i].id == undefined || i == this.current){
|
|
|
stepsTemp[i].id = ID
|
|
|
stepsTemp[i].name = Name
|
|
|
}else{
|
|
|
stepsTemp[i] = this.steps[i]
|
|
|
}
|
|
|
}
|
|
|
this.steps = stepsTemp
|
|
|
this.param.address = e.address
|
|
|
this.param.area_id = e.area_id
|
|
|
this.showChooseAddress = false
|
|
|
},
|
|
|
//选择头像
|
|
|
chooseImage(imgType){
|
...
|
...
|
@@ -445,8 +375,6 @@ |
|
|
|
|
|
},
|
|
|
confirm(){
|
|
|
let area_id
|
|
|
let areaName
|
|
|
if(this.userInfo.nickname == ''){
|
|
|
uni.showToast({
|
|
|
title:'请输入姓名',
|
...
|
...
|
@@ -462,41 +390,17 @@ |
|
|
return
|
|
|
}
|
|
|
if(!this.check.telphone(this.param.phone)){return;}
|
|
|
if(this.steps[0].id == undefined){
|
|
|
uni.showToast({
|
|
|
title:'请选择省份',
|
|
|
icon:'none'
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
if(this.steps[1].id == undefined){
|
|
|
if(this.param.address == '请选择家乡'){
|
|
|
uni.showToast({
|
|
|
title:'请选择市',
|
|
|
title:'请选择家乡',
|
|
|
icon:'none'
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
if(this.steps[2].id == undefined){
|
|
|
uni.showToast({
|
|
|
title:'请选择区(县)',
|
|
|
icon:'none'
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
if(this.steps[4].id != undefined){
|
|
|
area_id = this.steps[4].id
|
|
|
areaName = this.steps[0].name + this.steps[1].name + this.steps[2].name + this.steps[3].name + this.steps[4].name
|
|
|
}else if(this.steps[3].id != undefined){
|
|
|
area_id = this.steps[3].id
|
|
|
areaName = this.steps[0].name + this.steps[1].name + this.steps[2].name + this.steps[3].name
|
|
|
}else{
|
|
|
area_id = this.steps[2].id
|
|
|
areaName = this.steps[0].name + this.steps[1].name + this.steps[2].name
|
|
|
}
|
|
|
|
|
|
var myAmapFun = new amapFile.AMapWX({key:'a8c52aaa1ccef354745fb14886b7d633'});
|
|
|
myAmapFun.getInputtips({
|
|
|
keywords: areaName,
|
|
|
keywords: this.param.address,
|
|
|
location: '',
|
|
|
success: (data)=>{
|
|
|
this.userInfo.latitude = data.tips[0].location.split(',')[1]
|
...
|
...
|
@@ -509,7 +413,7 @@ |
|
|
let timUserInfo = JSON.parse(uni.getStorageSync('userInfo'))
|
|
|
timUserInfo.img = this.imgUrl + this.userInfo.avatar
|
|
|
uni.setStorageSync('userInfo',JSON.stringify(timUserInfo))
|
|
|
this.$request('/user_hometown_check/add',{area_id:area_id}).then((res)=>{
|
|
|
this.$request('/user_hometown_check/add',this.param).then((res)=>{
|
|
|
if(res.code == 1){
|
|
|
this.$href('checkWait')
|
|
|
setTimeout(()=>{
|
...
|
...
|
@@ -630,6 +534,15 @@ |
|
|
}
|
|
|
}
|
|
|
.infoRight{
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
.alertTxt{
|
|
|
color: #c8c9cc;
|
|
|
font-weight: 300;
|
|
|
}
|
|
|
.alertTxt.active{
|
|
|
color: #323232;
|
|
|
}
|
|
|
image{width: 32rpx;height: 32rpx;}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -770,4 +683,5 @@ |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
</style> |
...
|
...
|
|