1
xuxueyang
2024-07-31 fba19090a86a4821fd70c301a5a0cd1e4b7f3244
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
@@ -141,6 +143,14 @@
         this.source = options.source || ''
         this.listApi = '/api/address/list'
         await this.getList()
      },
      computed: {
         ...mapState({
            address: state => {
               return state.defaultaddress || {}
            },
         }),
      },
      data() {
@@ -178,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])
@@ -201,9 +218,15 @@
            }
         },
         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) {
            }else{
               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() {
            //前往接口挑选位置
@@ -311,7 +334,7 @@
            this.$message.hideLoading()
            if (code === 0) {
               this.$message.showToast('删除成功')
               if (item.isDefault) {
               if (this.address.id === item.id) {
                  //要清空地址了
                  this.$store.commit('setDefaultAddress', {})
               }
@@ -339,8 +362,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: '',