From 7e247648201b208cfb5a5901803f784b7dbda948 Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期三, 31 七月 2024 01:54:17 +0800 Subject: [PATCH] 1 --- pages/user/address/address.vue | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-) diff --git a/pages/user/address/address.vue b/pages/user/address/address.vue index 21b77d1..5deb06e 100644 --- a/pages/user/address/address.vue +++ b/pages/user/address/address.vue @@ -129,7 +129,9 @@ // import qqmapwx from '@/plugins/qqmap-wx-jssdk.min.js'; // const lockey = 'VUHBZ-2AMLP-B7AD7-VUQZ7-D4TW5-MFFVN'; //使用在腾讯位置服务申请的key // const chooseLocation = requirePlugin('chooseLocation'); - + import { + mapState + } from 'vuex' export default { async onPullDownRefresh() { this.page.current = 0 @@ -186,7 +188,14 @@ this.submitForm.province = '' this.submitForm.city = '' this.submitForm.region = '' - if (e.detail.value.length <= 3) { + if (e.detail.value.length == 2) { + if (!!e.detail.value[0]) + this.submitForm.province = e.detail.value[0].value + if (!!e.detail.value[0]) + this.submitForm.city = e.detail.value[0].value + if (!!e.detail.value[1]) + this.submitForm.region = e.detail.value[1].value + } else if (e.detail.value.length <= 3) { if (!!e.detail.value[0]) this.submitForm.province = e.detail.value[0].value if (!!e.detail.value[1]) @@ -209,9 +218,13 @@ } }, async init_area() { - const res = await this.$http.request('get', '/api/pub/china/area/json') - this.regionDataPlus = res.data && JSON.parse(res.data.replaceAll('code', 'value').replaceAll('name', - 'text')) || [] + if (this.regionDataPlus && this.regionDataPlus.length > 0) { + const res = await this.$http.request('get', '/api/pub/china/area/json') + this.regionDataPlus = res.data && JSON.parse(res.data.replaceAll('code', 'value').replaceAll( + 'name', + 'text')) || [] + } + }, chooseLocation() { //前往接口挑选位置 @@ -347,8 +360,10 @@ this.$message.hideLoading() } else { this.submitForm = { - name: this.currentInfo && this.currentInfo.nickName || '', - tel: this.currentInfo && this.currentInfo.tel || '', + // name: this.currentInfo && this.currentInfo.nickName || '', + // tel: this.currentInfo && this.currentInfo.tel || '', + name: '', + tel: '', address: '', isDefault: false, province: '', -- Gitblit v1.9.3