MrShi
2026-06-05 00a7a61df86db969f2ba61c508d02ba4709ce3d4
small-program/pages/new-address/new-address.vue
@@ -10,7 +10,7 @@
         <view class="list-item">
            <view class="list-item-label">联系电话</view>
            <view class="list-item-input">
               <input type="text" placeholder="请输入联系电话" v-model="form.phone" />
               <input type="text" placeholder="请输入联系电话" v-model="form.phone" maxlength="11" />
            </view>
         </view>
         <view class="list-item" @click="show = true">
@@ -89,6 +89,7 @@
      onLoad() {
         const item = uni.getStorageSync('addr');
         if (item) {
            console.log(item,"============================")
            this.type = 2
            uni.setNavigationBarTitle({
               title: '编辑收货地址'
@@ -98,7 +99,9 @@
            this.form.phone = item.phone
            this.form.addr = item.addr
            this.form.areaId = item.areaId
            this.form.areaName = item.areaDetail
            this.form.latitude=item.latitude
            this.form.longitude = item.longitude
            this.form.areaName = (item.provinceName||'') + (item.cityName||'')+(item.districtName||'')
            this.form.isDefault = Number(item.isDefault)
            uni.removeStorageSync('addr');
         }
@@ -108,7 +111,8 @@
         chooseLocation() {
            uni.chooseLocation({
               success: (res) => {
                  this.form.addr = res.name
                  console.log(res,"============================")
                  this.form.addr = res.address
                  this.form.latitude = res.latitude
                  this.form.longitude = res.longitude
               },
@@ -142,6 +146,13 @@
               title: '联系电话不能为空!',
               icon: 'none'
            })
            const phoneReg = /^1\d{10}$/
            if (!phoneReg.test(this.form.phone)) {
               return uni.showToast({
                  title: '请输入正确的手机号格式',
                  icon: 'none'
               })
            }
            if (!this.form.areaName) return uni.showToast({
               title: '所在地区不能为空!',
               icon: 'none'