| | |
| | | </view> |
| | | </view> |
| | | <view class="m-t-12 "> |
| | | <view class="desc-gray">我的收获地址</view> |
| | | <view class="desc-gray">我的收货地址</view> |
| | | |
| | | </view> |
| | | <no-data v-if="!list||list.length==0" style="width: 100%;"></no-data> |
| | |
| | | </view> |
| | | <view class="desc del t-green m-l-10" v-if="source==='select'" @click="selectAddress(item)"> |
| | | 选择此地址 |
| | | </view> |
| | | <view class="desc del t-green m-l-10" v-if="source==='home'" @click="selectAddress(item)"> |
| | | 按此地址定位 |
| | | </view> |
| | | </view> |
| | | |
| | |
| | | // that.search_flow = (location.name || '') |
| | | that.$store.commit('setAddressDesc', (location.name || location.address || '')) |
| | | that.$forceUpdate() |
| | | that.backpage() |
| | | } |
| | | |
| | | // if (!that.submitForm.province && location.provinceName) { |
| | |
| | | // }; |
| | | const { |
| | | code,data |
| | | } = that.$http.request('get', '/api/pub/customer/home/address/parse', { |
| | | } = await that.$http.request('get', '/api/pub/customer/home/address/parse', { |
| | | data: {}, |
| | | params: { |
| | | // https://apis.map.qq.com/ws/geocoder/v1/?location=39.984154,116.307490&key=[你的key]&get_poi=1 |
| | |
| | | }) |
| | | console.log('定位成功:', data); |
| | | if(data){ |
| | | var address = data.address || '' |
| | | var address = data.result&&data.result.address || '' |
| | | |
| | | that.$store.commit('setAddressDesc', (address || '')) |
| | | that.$forceUpdate() |
| | | |
| | | that.backpage() |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | }, |
| | | async init_area() { |
| | | if (this.regionDataPlus && this.regionDataPlus.length > 0) { |
| | | // debugger; |
| | | // if (this.regionDataPlus && this.regionDataPlus.length > 0) { |
| | | |
| | | } else { |
| | | var a = this.$storage.getItem('cache_area') |
| | | // } else { |
| | | // var a = this.$storage.getItem('cache_area') |
| | | var a =false |
| | | if (a) { |
| | | this.regionDataPlus = JSON.parse(a) || [] |
| | | } else { |
| | | await this.$http.request('get', '/api/pub/china/area/json/refresh') |
| | | const res = await this.$http.request('get', '/api/pub/china/area/json') |
| | | // console.log('area', JSON.parse(res.data)) |
| | | this.regionDataPlus = res.data && JSON.parse(res.data.replaceAll('code', 'value').replaceAll( |
| | |
| | | 'text')) || [] |
| | | this.$storage.setItem('cache_area', JSON.stringify(this.regionDataPlus)) |
| | | } |
| | | } |
| | | // } |
| | | |
| | | }, |
| | | chooseLocation() { |
| | |
| | | this.$store.commit('setDefaultAddress', { |
| | | ...item |
| | | }) |
| | | |
| | | |
| | | } |
| | | }, err => { |
| | |
| | | }) |
| | | }, |
| | | async selectAddress(item) { |
| | | await this.$message.confirm('确定选择此地址作为收货地址吗') |
| | | //携带,然后返回 |
| | | this.$store.commit('setDefaultAddress', { |
| | | ...item |
| | | }) |
| | | |
| | | if(this.source==='home'){ |
| | | this.$store.commit('setAddressDesc', '') |
| | | this.$store.commit('setDefaultAddress', { |
| | | ...item |
| | | }) |
| | | }else{ |
| | | await this.$message.confirm('确定选择此地址作为收货地址吗') |
| | | this.$store.commit('setDefaultAddress', { |
| | | ...item |
| | | }) |
| | | |
| | | } |
| | | this.backpage() |
| | | }, |
| | | async deleteAddress(item) { |