作者 徐强

提交

  1 +<template>
  2 + <view class="chooseHomeWrap">
  3 + <view class="chooseHome">
  4 + <view class="addressWrap">
  5 + <view class="address">
  6 + {{chAddressName}}
  7 + </view>
  8 + </view>
  9 + <view class="changeAddress">
  10 + <view class="addressItem" @click="changeChAddress(0)" v-if="chAddress.length >= 0">
  11 + 省级
  12 + <view class="addressLine" v-if="chAddressIndex == 0"></view>
  13 + </view>
  14 + <view class="addressItem" @click="changeChAddress(1)" v-if="chAddress.length >= 1">
  15 +
  16 + <view class="addressLine" v-if="chAddressIndex == 1"></view>
  17 + </view>
  18 + <view class="addressItem" @click="changeChAddress(2)" v-if="chAddress.length >= 2">
  19 + 区县
  20 + <view class="addressLine" v-if="chAddressIndex == 2"></view>
  21 + </view>
  22 + <view class="addressItem" @click="changeChAddress(3)" v-if="chAddress.length >= 3">
  23 +
  24 + <view class="addressLine" v-if="chAddressIndex == 3"></view>
  25 + </view>
  26 + <view class="addressItem" @click="changeChAddress(4)" v-if="chAddress.length >= 4">
  27 +
  28 + <view class="addressLine" v-if="chAddressIndex == 4"></view>
  29 + </view>
  30 + </view>
  31 + <scroll-view scroll-y class="addressList">
  32 + <view class="addressName" v-for="(item,index) in addressList" :key="index" @click="clickAddress(index)">
  33 + {{item.Name}}
  34 + </view>
  35 + </scroll-view>
  36 + <view class="bottomBtn">
  37 + <view class="btn" @click="$emit('close')">
  38 + 取消
  39 + </view>
  40 + <view class="btn active" @click="confirm">
  41 + 确定
  42 + </view>
  43 + </view>
  44 + </view>
  45 + </view>
  46 +</template>
  47 +
  48 +<script>
  49 + export default {
  50 + name:"chooseAddress",
  51 + data() {
  52 + return {
  53 + chAddressIndex:0,
  54 + chAddress:[],
  55 + chAddressName:'',
  56 + addressList:[]
  57 + };
  58 + },
  59 + mounted() {
  60 + this.$request('/common/area').then((res)=>{
  61 + this.addressList = res.data
  62 + })
  63 + },
  64 + methods:{
  65 + changeChAddress(index){
  66 + let area_id = ''
  67 + this.chAddressIndex = index
  68 + if(index > 0){
  69 + area_id = this.chAddress[index-1].id
  70 + this.$request('/common/area',{area_id:area_id}).then((res)=>{
  71 + this.addressList = res.data
  72 + })
  73 + }else{
  74 + this.$request('/common/area').then((res)=>{
  75 + this.addressList = res.data
  76 + })
  77 + }
  78 +
  79 +
  80 + },
  81 + clickAddress(index){
  82 + if(this.chAddressIndex < this.chAddress.length - 1){
  83 + for(let i = this.chAddress.length - 1; i > this.chAddressIndex; i--){
  84 + this.chAddress.splice(i,1)
  85 + }
  86 + }
  87 + let ID = this.addressList[index].ID
  88 + this.chAddress[this.chAddressIndex] = {
  89 + id:ID,
  90 + name:this.addressList[index].Name,
  91 + }
  92 + this.chAddressName = this.chAddress.map((obj)=>{return obj.name}).join("");
  93 + if(this.chAddressIndex < 4){
  94 + this.addressList = []
  95 + this.chAddressIndex++
  96 + this.$request('/common/area',{area_id:ID}).then((res)=>{
  97 + this.addressList = res.data
  98 + })
  99 + }
  100 + },
  101 + confirm(){
  102 + if(this.chAddress.length < 3){
  103 + uni.showToast({
  104 + title:'请选择至区县',
  105 + icon:'none'
  106 + })
  107 + return
  108 + }
  109 + this.$emit('confirm',{address:this.chAddressName,area_id:this.chAddress[this.chAddress.length-1].id})
  110 + }
  111 + }
  112 + }
  113 +</script>
  114 +
  115 +<style lang="scss">
  116 + // 选择家乡弹框区域
  117 + .chooseHomeWrap{
  118 + position: fixed;
  119 + top: 0;
  120 + bottom: 0;
  121 + left: 0;
  122 + right: 0;
  123 + background: rgba(0,0,0,0.5);
  124 + display: flex;
  125 + align-items: flex-end;
  126 + .chooseHome{
  127 + width: 750rpx;
  128 + height: 1200rpx;
  129 + background: #fff;
  130 + border-radius: 30rpx 30rpx 0 0;
  131 + padding: 32rpx 0;
  132 + .addressWrap{
  133 + padding: 0 32rpx;
  134 + .address{
  135 + background: #f3f3f3;
  136 + padding: 32rpx;
  137 + height: 32rpx;
  138 + border-radius: 30rpx;
  139 + line-height: 32rpx;
  140 + color: #9c9c9c;
  141 + font-size: 28rpx;
  142 + }
  143 + }
  144 + .changeAddress{
  145 + height: 90rpx;
  146 + border-bottom: 2rpx solid #ededed;
  147 + display: flex;
  148 + align-items: center;
  149 + font-size: 28rpx;
  150 + color: #585858;
  151 + .addressItem{
  152 + width: 150rpx;
  153 + line-height: 90rpx;
  154 + text-align: center;
  155 + position: relative;
  156 + .addressLine{
  157 + position: absolute;
  158 + width: 36rpx;
  159 + height: 8rpx;
  160 + background: #35655f;
  161 + border-radius: 18rpx;
  162 + bottom: 10rpx;
  163 + left: 57rpx;
  164 + }
  165 + }
  166 + }
  167 + .addressList{
  168 + padding: 0 32rpx;
  169 + height: calc(1200rpx - 64rpx - 92rpx - 100rpx);
  170 + .addressName{
  171 + height: 60rpx;
  172 + line-height: 60rpx;
  173 + font-size: 28rpx;
  174 + }
  175 + }
  176 + .bottomBtn{
  177 + height: 100rpx;
  178 + padding: 0 32rpx;
  179 + display: flex;
  180 + align-items: center;
  181 + justify-content: space-between;
  182 + .btn{
  183 + height: 80rpx;
  184 + width: 333rpx;
  185 + background: #9c9c9c;
  186 + text-align: center;
  187 + line-height: 80rpx;
  188 + border-radius: 10rpx;
  189 + color: #fff;
  190 + font-size: 28rpx;
  191 + }
  192 + .btn.active{
  193 + background: #35655f;
  194 + }
  195 + }
  196 + }
  197 + }
  198 +</style>
@@ -47,22 +47,20 @@ @@ -47,22 +47,20 @@
47 <image src="../../static/image/right_icon.png" mode=""></image> 47 <image src="../../static/image/right_icon.png" mode=""></image>
48 </view> 48 </view>
49 </view> 49 </view>
50 - </view>  
51 - <!-- 服务位置区域 -->  
52 - <view class="serviceWrap">  
53 - <view class="title">  
54 - 家乡  
55 - </view>  
56 - <view class="content">  
57 - <u-steps @chooseAddress="chooseAddress" :direction="direction" :current="current" :list="steps" :mode="mode" :icon="icon"></u-steps>  
58 - <!-- <view class="left">  
59 - <text class="alertTxt" :class="{active:param.address != '请选择服务位置'}">{{param.address}}</text> 50 + <view class="infoItem" @click="showChooseAddress = true">
  51 + <view class="infoLeft">
  52 + 家乡
  53 + </view>
  54 + <view class="infoCenter">
  55 +
  56 + </view>
  57 + <view class="infoRight">
  58 + <text class="alertTxt" :class="{active:param.address != '请选择家乡'}">{{param.address}}</text>
  59 + <image src="../../static/image/right_icon.png" mode=""></image>
60 </view> 60 </view>
61 - <view class="right">  
62 - <image @click="chooseLocation" src="../../static/image/my/icon_faqi@2x.png" mode=""></image>  
63 - </view> -->  
64 </view> 61 </view>
65 </view> 62 </view>
  63 + <!-- 服务位置区域 -->
66 <!-- 服务内容区域 --> 64 <!-- 服务内容区域 -->
67 <!-- <view class="serviceWrap"> 65 <!-- <view class="serviceWrap">
68 <view class="title"> 66 <view class="title">
@@ -132,48 +130,28 @@ @@ -132,48 +130,28 @@
132 </view> 130 </view>
133 </view> 131 </view>
134 </view> 132 </view>
135 - <u-select :default-value="defaultValue" :value-name="'ID'" :label-name="'Name'" :mode="selectMode" v-model="show" :list="addressList" @confirm="confirmAddress" @cancel="cancel"></u-select> 133 + <!-- 选择家乡弹框 -->
  134 + <choose-address v-if="showChooseAddress" @close="showChooseAddress = false" @confirm="confirmAddress"></choose-address>
136 </view> 135 </view>
137 </template> 136 </template>
138 137
139 <script> 138 <script>
140 var amapFile = require('../../static/js/amap-wx.js'); 139 var amapFile = require('../../static/js/amap-wx.js');
  140 + import chooseAddress from '@/components/chooseAddress.vue'
141 import {mapState} from "vuex" 141 import {mapState} from "vuex"
142 export default{ 142 export default{
143 data(){ 143 data(){
144 return{ 144 return{
145 - //列选择开始  
146 - show: false,  
147 - defaultValue: [0],  
148 - selectMode: 'single-column', // single-column, mutil-column, mutil-column-auto  
149 - addressList: [],  
150 - //列选择结束  
151 -  
152 - //步骤条开始  
153 - steps: [{  
154 - name: '请选择省份'  
155 - }, {  
156 - name: '请选择市'  
157 - }, {  
158 - name: '请选择区(县)'  
159 - }, {  
160 - name: '请选择镇'  
161 - }, {  
162 - name: '请选择村'  
163 - }, ],  
164 - current: -1,  
165 - icon: 'map-fill',  
166 - mode: 'dot',  
167 - direction: 'column',  
168 - //步骤条结束 145 + showChooseAddress:false,
169 nicknameFocus:false, 146 nicknameFocus:false,
170 userInfo:{}, 147 userInfo:{},
171 param:{ 148 param:{
  149 + area_id:'',
172 phone:'', 150 phone:'',
173 province:'', 151 province:'',
174 city:'', 152 city:'',
175 county:'', 153 county:'',
176 - address:'请选择服务位置', 154 + address:'请选择家乡',
177 longitude:'', 155 longitude:'',
178 latitude:'', 156 latitude:'',
179 stop_money:'', 157 stop_money:'',
@@ -185,6 +163,9 @@ @@ -185,6 +163,9 @@
185 computed:{ 163 computed:{
186 ...mapState(["userinfo"]) 164 ...mapState(["userinfo"])
187 }, 165 },
  166 + components:{
  167 + chooseAddress
  168 + },
188 created() { 169 created() {
189 uni.$on('bAvatarCropper', path => { 170 uni.$on('bAvatarCropper', path => {
190 // this.userInfo.bg_image = path; 171 // this.userInfo.bg_image = path;
@@ -226,17 +207,6 @@ @@ -226,17 +207,6 @@
226 getData(){ 207 getData(){
227 let areaIds = [] 208 let areaIds = []
228 let areaNames = [] 209 let areaNames = []
229 - let stepsTemp =[{  
230 - name: '请选择省份'  
231 - }, {  
232 - name: '请选择市'  
233 - }, {  
234 - name: '请选择区(县)'  
235 - }, {  
236 - name: '请选择镇'  
237 - }, {  
238 - name: '请选择村'  
239 - }]  
240 //获取用户信息 210 //获取用户信息
241 this.$request('/user/info').then((res)=>{ 211 this.$request('/user/info').then((res)=>{
242 let avatar = res.data.avatar 212 let avatar = res.data.avatar
@@ -251,17 +221,14 @@ @@ -251,17 +221,14 @@
251 if(this.userInfo.area_id != ''){ 221 if(this.userInfo.area_id != ''){
252 areaIds = Object.keys(this.userInfo.area_arr) 222 areaIds = Object.keys(this.userInfo.area_arr)
253 areaNames = Object.values(this.userInfo.area_arr) 223 areaNames = Object.values(this.userInfo.area_arr)
254 - for(let i = 0; i < areaIds.length; i ++){  
255 - stepsTemp[i].id = areaIds[i]  
256 - stepsTemp[i].name = areaNames[i]  
257 - }  
258 - this.steps = stepsTemp 224 + this.param.area_id = areaIds[areaIds.length - 1]
  225 + this.param.address = areaNames.join('')
259 } 226 }
260 this.param.phone = this.userInfo.phone != '' ? this.userInfo.phone : this.userInfo.mobile 227 this.param.phone = this.userInfo.phone != '' ? this.userInfo.phone : this.userInfo.mobile
261 this.param.province = this.userInfo.form_province 228 this.param.province = this.userInfo.form_province
262 this.param.city = this.userInfo.form_city 229 this.param.city = this.userInfo.form_city
263 this.param.county = this.userInfo.form_county 230 this.param.county = this.userInfo.form_county
264 - this.param.address = this.userInfo.form_address 231 + // this.param.address = this.userInfo.form_address
265 this.param.longitude = this.userInfo.form_longitude 232 this.param.longitude = this.userInfo.form_longitude
266 this.param.latitude = this.userInfo.form_latitude 233 this.param.latitude = this.userInfo.form_latitude
267 this.param.stop_money = this.userInfo.form_stop_money 234 this.param.stop_money = this.userInfo.form_stop_money
@@ -277,47 +244,10 @@ @@ -277,47 +244,10 @@
277 }) 244 })
278 245
279 }, 246 },
280 - chooseAddress(e){  
281 - let area_id  
282 - if(e > 0 && this.steps[e-1].id == undefined){  
283 - return  
284 - }  
285 - if(e > 0){  
286 - area_id = this.steps[e-1].id  
287 - }  
288 - this.$request('/common/area',{area_id:area_id}).then((res)=>{  
289 - this.addressList = res.data  
290 - this.current = e  
291 - this.show = true  
292 - })  
293 - },  
294 confirmAddress(e) { 247 confirmAddress(e) {
295 - let Name = ''  
296 - let ID = ''  
297 - let stepsTemp = [{  
298 - name: '请选择省份'  
299 - }, {  
300 - name: '请选择市'  
301 - }, {  
302 - name: '请选择区(县)'  
303 - }, {  
304 - name: '请选择镇'  
305 - }, {  
306 - name: '请选择村'  
307 - }, ]  
308 - e.map((val, index) => {  
309 - Name += Name == '' ? val.label : '-' + val.label;  
310 - ID += ID == '' ? val.value : '-' + val.value;  
311 - })  
312 - for(let i = 0; i <= this.current; i ++){  
313 - if(this.steps[i].id == undefined || i == this.current){  
314 - stepsTemp[i].id = ID  
315 - stepsTemp[i].name = Name  
316 - }else{  
317 - stepsTemp[i] = this.steps[i]  
318 - }  
319 - }  
320 - this.steps = stepsTemp 248 + this.param.address = e.address
  249 + this.param.area_id = e.area_id
  250 + this.showChooseAddress = false
321 }, 251 },
322 //选择头像 252 //选择头像
323 chooseImage(imgType){ 253 chooseImage(imgType){
@@ -445,8 +375,6 @@ @@ -445,8 +375,6 @@
445 375
446 }, 376 },
447 confirm(){ 377 confirm(){
448 - let area_id  
449 - let areaName  
450 if(this.userInfo.nickname == ''){ 378 if(this.userInfo.nickname == ''){
451 uni.showToast({ 379 uni.showToast({
452 title:'请输入姓名', 380 title:'请输入姓名',
@@ -462,41 +390,17 @@ @@ -462,41 +390,17 @@
462 return 390 return
463 } 391 }
464 if(!this.check.telphone(this.param.phone)){return;} 392 if(!this.check.telphone(this.param.phone)){return;}
465 - if(this.steps[0].id == undefined){  
466 - uni.showToast({  
467 - title:'请选择省份',  
468 - icon:'none'  
469 - })  
470 - return  
471 - }  
472 - if(this.steps[1].id == undefined){  
473 - uni.showToast({  
474 - title:'请选择市',  
475 - icon:'none'  
476 - })  
477 - return  
478 - }  
479 - if(this.steps[2].id == undefined){ 393 + if(this.param.address == '请选择家乡'){
480 uni.showToast({ 394 uni.showToast({
481 - title:'请选择区(县)', 395 + title:'请选择家乡',
482 icon:'none' 396 icon:'none'
483 }) 397 })
484 return 398 return
485 } 399 }
486 - if(this.steps[4].id != undefined){  
487 - area_id = this.steps[4].id  
488 - areaName = this.steps[0].name + this.steps[1].name + this.steps[2].name + this.steps[3].name + this.steps[4].name  
489 - }else if(this.steps[3].id != undefined){  
490 - area_id = this.steps[3].id  
491 - areaName = this.steps[0].name + this.steps[1].name + this.steps[2].name + this.steps[3].name  
492 - }else{  
493 - area_id = this.steps[2].id  
494 - areaName = this.steps[0].name + this.steps[1].name + this.steps[2].name  
495 - }  
496 400
497 var myAmapFun = new amapFile.AMapWX({key:'a8c52aaa1ccef354745fb14886b7d633'}); 401 var myAmapFun = new amapFile.AMapWX({key:'a8c52aaa1ccef354745fb14886b7d633'});
498 myAmapFun.getInputtips({ 402 myAmapFun.getInputtips({
499 - keywords: areaName, 403 + keywords: this.param.address,
500 location: '', 404 location: '',
501 success: (data)=>{ 405 success: (data)=>{
502 this.userInfo.latitude = data.tips[0].location.split(',')[1] 406 this.userInfo.latitude = data.tips[0].location.split(',')[1]
@@ -509,7 +413,7 @@ @@ -509,7 +413,7 @@
509 let timUserInfo = JSON.parse(uni.getStorageSync('userInfo')) 413 let timUserInfo = JSON.parse(uni.getStorageSync('userInfo'))
510 timUserInfo.img = this.imgUrl + this.userInfo.avatar 414 timUserInfo.img = this.imgUrl + this.userInfo.avatar
511 uni.setStorageSync('userInfo',JSON.stringify(timUserInfo)) 415 uni.setStorageSync('userInfo',JSON.stringify(timUserInfo))
512 - this.$request('/user_hometown_check/add',{area_id:area_id}).then((res)=>{ 416 + this.$request('/user_hometown_check/add',this.param).then((res)=>{
513 if(res.code == 1){ 417 if(res.code == 1){
514 this.$href('checkWait') 418 this.$href('checkWait')
515 setTimeout(()=>{ 419 setTimeout(()=>{
@@ -630,6 +534,15 @@ @@ -630,6 +534,15 @@
630 } 534 }
631 } 535 }
632 .infoRight{ 536 .infoRight{
  537 + display: flex;
  538 + align-items: center;
  539 + .alertTxt{
  540 + color: #c8c9cc;
  541 + font-weight: 300;
  542 + }
  543 + .alertTxt.active{
  544 + color: #323232;
  545 + }
633 image{width: 32rpx;height: 32rpx;} 546 image{width: 32rpx;height: 32rpx;}
634 } 547 }
635 } 548 }
@@ -770,4 +683,5 @@ @@ -770,4 +683,5 @@
770 } 683 }
771 } 684 }
772 } 685 }
  686 +
773 </style> 687 </style>
@@ -47,19 +47,17 @@ @@ -47,19 +47,17 @@
47 <image src="../../static/image/right_icon.png" mode=""></image> 47 <image src="../../static/image/right_icon.png" mode=""></image>
48 </view> 48 </view>
49 </view> 49 </view>
50 - </view>  
51 - <view class="serviceWrap">  
52 - <view class="title">  
53 - 家乡  
54 - </view>  
55 - <view class="content">  
56 - <u-steps @chooseAddress="chooseAddress" :direction="direction" :current="current" :list="steps" :mode="mode" :icon="icon"></u-steps>  
57 - <!-- <view class="left">  
58 - <text class="alertTxt" :class="{active:param.address != '请选择服务位置'}">{{param.address}}</text> 50 + <view class="infoItem" @click="showChooseAddress = true">
  51 + <view class="infoLeft">
  52 + 家乡
  53 + </view>
  54 + <view class="infoCenter">
  55 +
  56 + </view>
  57 + <view class="infoRight">
  58 + <text class="alertTxt" :class="{active:param.address != ''}">{{userInfo.address}}</text>
  59 + <image src="../../static/image/right_icon.png" mode=""></image>
59 </view> 60 </view>
60 - <view class="right">  
61 - <image @click="chooseLocation" src="../../static/image/my/icon_faqi@2x.png" mode=""></image>  
62 - </view> -->  
63 </view> 61 </view>
64 </view> 62 </view>
65 <view class="otherInfo"> 63 <view class="otherInfo">
@@ -139,7 +137,8 @@ @@ -139,7 +137,8 @@
139 保存 137 保存
140 </view> 138 </view>
141 </view> 139 </view>
142 - <u-select :default-value="defaultValue" :value-name="'ID'" :label-name="'Name'" :mode="selectMode" v-model="show" :list="addressList" @confirm="confirmAddress" @cancel="cancel"></u-select> 140 + <!-- 选择家乡弹框 -->
  141 + <choose-address v-if="showChooseAddress" @close="showChooseAddress = false" @confirm="confirmAddress"></choose-address>
143 </view> 142 </view>
144 </template> 143 </template>
145 144
@@ -147,35 +146,13 @@ @@ -147,35 +146,13 @@
147 var amapFile = require('../../static/js/amap-wx.js'); 146 var amapFile = require('../../static/js/amap-wx.js');
148 import {mapState} from "vuex" 147 import {mapState} from "vuex"
149 import wPicker from "@/components/w-picker/w-picker.vue" 148 import wPicker from "@/components/w-picker/w-picker.vue"
  149 + import chooseAddress from '@/components/chooseAddress.vue'
150 var apiUrl = 'http://landlord.t.brotop.cn/api' 150 var apiUrl = 'http://landlord.t.brotop.cn/api'
151 // var apiUrl = 'http://app.zhaodizhu.cn/api' 151 // var apiUrl = 'http://app.zhaodizhu.cn/api'
152 export default{ 152 export default{
153 data(){ 153 data(){
154 return{ 154 return{
155 - //列选择开始  
156 - show: false,  
157 - defaultValue: [0],  
158 - selectMode: 'single-column', // single-column, mutil-column, mutil-column-auto  
159 - addressList: [],  
160 - //列选择结束  
161 -  
162 - //步骤条开始  
163 - steps: [{  
164 - name: '请选择省份'  
165 - }, {  
166 - name: '请选择市'  
167 - }, {  
168 - name: '请选择区(县)'  
169 - }, {  
170 - name: '请选择镇'  
171 - }, {  
172 - name: '请选择村'  
173 - }, ],  
174 - current: -1,  
175 - icon: 'map-fill',  
176 - mode: 'dot',  
177 - direction: 'column',  
178 - //步骤条结束 155 + showChooseAddress:false,
179 nicknameFocus:false, 156 nicknameFocus:false,
180 chooseImageStatus:false, 157 chooseImageStatus:false,
181 imgUrl:this.imgUrl, 158 imgUrl:this.imgUrl,
@@ -246,7 +223,8 @@ @@ -246,7 +223,8 @@
246 ...mapState(["userinfo"]) 223 ...mapState(["userinfo"])
247 }, 224 },
248 components:{ 225 components:{
249 - wPicker 226 + wPicker,
  227 + chooseAddress
250 }, 228 },
251 onShow() { 229 onShow() {
252 if(!this.chooseImageStatus){ 230 if(!this.chooseImageStatus){
@@ -257,17 +235,6 @@ @@ -257,17 +235,6 @@
257 getData(){ 235 getData(){
258 let areaIds = [] 236 let areaIds = []
259 let areaNames = [] 237 let areaNames = []
260 - let stepsTemp =[{  
261 - name: '请选择省份'  
262 - }, {  
263 - name: '请选择市'  
264 - }, {  
265 - name: '请选择区(县)'  
266 - }, {  
267 - name: '请选择镇'  
268 - }, {  
269 - name: '请选择村'  
270 - }]  
271 //获取用户信息 238 //获取用户信息
272 this.$request('/user/info').then((res)=>{ 239 this.$request('/user/info').then((res)=>{
273 console.log('用户信息',res) 240 console.log('用户信息',res)
@@ -283,11 +250,8 @@ @@ -283,11 +250,8 @@
283 if(this.userInfo.area_id != ''){ 250 if(this.userInfo.area_id != ''){
284 areaIds = Object.keys(this.userInfo.area_arr) 251 areaIds = Object.keys(this.userInfo.area_arr)
285 areaNames = Object.values(this.userInfo.area_arr) 252 areaNames = Object.values(this.userInfo.area_arr)
286 - for(let i = 0; i < areaIds.length; i ++){  
287 - stepsTemp[i].id = areaIds[i]  
288 - stepsTemp[i].name = areaNames[i]  
289 - }  
290 - this.steps = stepsTemp 253 + this.userInfo.area_id = areaIds[areaIds.length - 1]
  254 + this.userInfo.address = areaNames.join('')
291 } 255 }
292 this.showPersonInfo = true 256 this.showPersonInfo = true
293 }) 257 })
@@ -306,34 +270,6 @@ @@ -306,34 +270,6 @@
306 this.show = true 270 this.show = true
307 }) 271 })
308 }, 272 },
309 - confirmAddress(e) {  
310 - let Name = ''  
311 - let ID = ''  
312 - let stepsTemp = [{  
313 - name: '请选择省份'  
314 - }, {  
315 - name: '请选择市'  
316 - }, {  
317 - name: '请选择区(县)'  
318 - }, {  
319 - name: '请选择镇'  
320 - }, {  
321 - name: '请选择村'  
322 - }, ]  
323 - e.map((val, index) => {  
324 - Name += Name == '' ? val.label : '-' + val.label;  
325 - ID += ID == '' ? val.value : '-' + val.value;  
326 - })  
327 - for(let i = 0; i <= this.current; i ++){  
328 - if(this.steps[i].id == undefined || i == this.current){  
329 - stepsTemp[i].id = ID  
330 - stepsTemp[i].name = Name  
331 - }else{  
332 - stepsTemp[i] = this.steps[i]  
333 - }  
334 - }  
335 - this.steps = stepsTemp  
336 - },  
337 cancel(e) { 273 cancel(e) {
338 console.log(e); 274 console.log(e);
339 }, 275 },
@@ -404,6 +340,11 @@ @@ -404,6 +340,11 @@
404 }) 340 })
405 } 341 }
406 }, 342 },
  343 + confirmAddress(e) {
  344 + this.userInfo.address = e.address
  345 + this.userInfo.area_id = e.area_id
  346 + this.showChooseAddress = false
  347 + },
407 //保存 348 //保存
408 save(){ 349 save(){
409 if(this.userInfo.nickname == ''){ 350 if(this.userInfo.nickname == ''){
@@ -427,73 +368,42 @@ @@ -427,73 +368,42 @@
427 }) 368 })
428 return 369 return
429 } */ 370 } */
430 - if(this.steps[0].id == undefined){  
431 - uni.showToast({  
432 - title:'请选择省份',  
433 - icon:'none'  
434 - })  
435 - return  
436 - }  
437 - if(this.steps[1].id == undefined){  
438 - uni.showToast({  
439 - title:'请选择市',  
440 - icon:'none'  
441 - })  
442 - return  
443 - }  
444 - if(this.steps[2].id == undefined){ 371 + if(this.userInfo.bio.length > 27){
445 uni.showToast({ 372 uni.showToast({
446 - title:'请选择区(县)', 373 + title:'个人描述长度不可超过27个字',
447 icon:'none' 374 icon:'none'
448 }) 375 })
449 return 376 return
450 } 377 }
451 - let areaName  
452 - if(this.steps[4].id != undefined){  
453 - this.userInfo.area_id = this.steps[4].id  
454 - areaName = this.steps[0].name + this.steps[1].name + this.steps[2].name + this.steps[3].name + this.steps[4].name  
455 - }else if(this.steps[3].id != undefined){  
456 - this.userInfo.area_id = this.steps[3].id  
457 - areaName = this.steps[0].name + this.steps[1].name + this.steps[2].name + this.steps[3].name  
458 - }else{  
459 - this.userInfo.area_id = this.steps[2].id  
460 - areaName = this.steps[0].name + this.steps[1].name + this.steps[2].name  
461 - } 378 +
462 379
463 var myAmapFun = new amapFile.AMapWX({key:'a8c52aaa1ccef354745fb14886b7d633'}); 380 var myAmapFun = new amapFile.AMapWX({key:'a8c52aaa1ccef354745fb14886b7d633'});
464 myAmapFun.getInputtips({ 381 myAmapFun.getInputtips({
465 - keywords: areaName, 382 + keywords: this.userInfo.address,
466 location: '', 383 location: '',
467 success: (data)=>{ 384 success: (data)=>{
468 this.userInfo.latitude = data.tips[0].location.split(',')[1] 385 this.userInfo.latitude = data.tips[0].location.split(',')[1]
469 this.userInfo.longitude = data.tips[0].location.split(',')[0] 386 this.userInfo.longitude = data.tips[0].location.split(',')[0]
470 - }  
471 - })  
472 - if(this.userInfo.bio.length > 27){  
473 - uni.showToast({  
474 - title:'个人描述长度不可超过27个字',  
475 - icon:'none'  
476 - })  
477 - return  
478 - }  
479 - console.log('修改会员个人信息参数',this.userInfo)  
480 - this.$request('/user/profile',this.userInfo).then((res)=>{  
481 - if(res.code == 1){  
482 - this.userinfo.avatar = this.imgUrl + this.userInfo.avatar  
483 - uni.setStorageSync('userinfo',JSON.stringify(this.userinfo))  
484 - let timUserInfo = JSON.parse(uni.getStorageSync('userInfo'))  
485 - timUserInfo.img = this.imgUrl + this.userInfo.avatar  
486 - uni.setStorageSync('userInfo',JSON.stringify(timUserInfo))  
487 - this.$href('my',2)  
488 - setTimeout(()=>{  
489 - uni.showToast({  
490 - title:'保存成功'  
491 - })  
492 - },500)  
493 - }else{  
494 - uni.showToast({  
495 - title:res.msg,  
496 - icon:'none' 387 + console.log('修改会员个人信息参数',this.userInfo)
  388 + this.$request('/user/profile',this.userInfo).then((res)=>{
  389 + if(res.code == 1){
  390 + this.userinfo.avatar = this.imgUrl + this.userInfo.avatar
  391 + uni.setStorageSync('userinfo',JSON.stringify(this.userinfo))
  392 + let timUserInfo = JSON.parse(uni.getStorageSync('userInfo'))
  393 + timUserInfo.img = this.imgUrl + this.userInfo.avatar
  394 + uni.setStorageSync('userInfo',JSON.stringify(timUserInfo))
  395 + this.$href('my',2)
  396 + setTimeout(()=>{
  397 + uni.showToast({
  398 + title:'保存成功'
  399 + })
  400 + },500)
  401 + }else{
  402 + uni.showToast({
  403 + title:res.msg,
  404 + icon:'none'
  405 + })
  406 + }
497 }) 407 })
498 } 408 }
499 }) 409 })