From d77c11e64afea02c5de52e13bb8df374bfb389fb Mon Sep 17 00:00:00 2001 From: 陶杰 <1378534974@qq.com> Date: 星期二, 31 十二月 2024 10:35:55 +0800 Subject: [PATCH] 1.微信登录 --- pages/user/address/address.vue | 32 ++++++++++++++++++++++++-------- 1 files changed, 24 insertions(+), 8 deletions(-) diff --git a/pages/user/address/address.vue b/pages/user/address/address.vue index 21a8e14..cee367b 100644 --- a/pages/user/address/address.vue +++ b/pages/user/address/address.vue @@ -77,6 +77,9 @@ <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> </view> @@ -436,13 +439,16 @@ } }, 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( @@ -450,7 +456,7 @@ 'text')) || [] this.$storage.setItem('cache_area', JSON.stringify(this.regionDataPlus)) } - } + // } }, chooseLocation() { @@ -529,6 +535,7 @@ this.$store.commit('setDefaultAddress', { ...item }) + } }, err => { @@ -543,11 +550,20 @@ }) }, 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) { -- Gitblit v1.9.3