<view class="address-container">
  <!-- 表单区域 -->
  <form bindsubmit="formSubmit">
    <!-- 收货人 -->
    <view class="form-item">
      <label class="form-label required">联系人</label>
      <input 
        class="form-input" 
        name="receiver" 
        placeholder="请输入收货人姓名" 
        value="{{formData.receiver}}"
        bindinput="handleInput"
        data-key="receiver"
      />
    </view>
    
    <!-- 手机号码 -->
    <view class="form-item">
      <label class="form-label required">手机号码</label>
      <input 
        class="form-input" 
        name="phone" 
        placeholder="请输入手机号码" 
        type="number"
        value="{{formData.phone}}"
        bindinput="handleInput"
        data-key="phone"
        maxlength="11"
      />
    </view>
    
    <!-- 省市区选择 -->
    <!-- <view class="form-item">
  <label class="form-label required">所在地区</label>
  <picker 
    mode="region" 
    bindchange="handlePickerChange" 
    value="{{regionValue}}"
    custom-item="{{customItem}}"
  >
    <view class="area-picker">
    
      <text class="area-text">{{regionValue[0]}}，{{regionValue[1]}}，{{regionValue[2]}}</text>
      <icon class="right-icon" type="right" size="16" color="#999" />
    </view>
  </picker>
</view> -->

    
    <!-- 详细地址 -->
   <!-- 详细地址（新增地图入口） -->
<view class="form-item">
  <label class="form-label required">详细地址</label>
  <view class="detail-address-wrapper" bindtap="navigateToMapSelect">
    <input 
      class="form-input" 
      name="addressDetails" 
      placeholder="街道、门牌号等（可点击地图选择）" 
      value="{{formData.addressDetails}}"
      bindinput="handleInput"
      data-key="addressDetails"
      disabled="false"
    />
    <!-- <button 
      class="map-btn" 
      size="mini"
    > -->
      <!-- <image src="/images/map-icon.png" class="map-icon" /> -->
      <t-icon name="location" size="40rpx" data-name="location"/>

    <!-- </button> -->
  </view>
  <!-- 选中的POI名称提示 -->
  <!-- <view class="poi-tip" wx:if="{{formData.poiName}}">
    已选择：{{formData.poiName}}
  </view> -->
</view>
    
    <!-- 邮政编码 -->
    <!-- <view class="form-item">
      <label class="form-label">邮政编码</label>
      <input 
        class="form-input" 
        name="zipCode" 
        placeholder="选填" 
        type="number"
        value="{{formData.zipCode}}"
        bindinput="handleInput1"
        data-key="zipCode"
        maxlength="100"
      />
    </view> -->
    
    <!-- 默认地址开关 -->
    <view class="form-item switch-item">
      <label class="form-label">默认地址</label>
      <switch 
        checked="{{formData.isDefault}}"
        bindchange="handleSwitchChange"
      />
    </view>
    
    <!-- 提交按钮 -->
    <button 
    type="primary"
      form-type="submit" 
      class="submit-btn"
      disabled="{{!formData.receiver || !formData.phone || !formData.province || !formData.city || !formData.district || !formData.addressDetails}}"
    >
      保存地址
    </button>
  </form>

  <!-- 遮罩层 -->
  <view 
    wx:if="{{showAreaPicker}}"
    class="mask"
    bindtap="closeAreaPicker"
  ></view>
</view>