<view class="adc-address">
  <form
    onSubmit="saveAddress"
    class="address-form"
    onReset="onReset"
  >
    <view class="adc-address-info">
      <view class="adc-info-item">
        <text class="label">联系人</text>
        <input
          value="{{addressInfo.name}}"
          name="name"
          maxlength="10"
          class="inp"
          enableNative="{{false}}"
          type="text"
          placeholder="联系人姓名"
        />
        <text
          catchTap="chooseContact"
          class="txt-btn"
        >+通讯录</text>
      </view>
      <view class="adc-info-item">
        <text class="label">手机号</text>
        <input
          value="{{addressInfo.mobile}}"
          name="mobile"
          class="inp"
          enableNative="{{false}}"
          type="number"
          maxlength="11"
          placeholder="联系人手机号"
        />
      </view>
      <view
        catchTap="chooseRegion"
        class="adc-info-text"
        style="aligin-item: center;"
      >
        <text class="label">收货地址</text>
        <input
          a:if="{{addressInfo.region.length === 0}}"
          name="region"
          class="text"
          enableNative="{{false}}"
          disabled
          type="text"
          placeholder="请选择收货地址"
        />
        <view
          class="text"
          a:if="{{addressInfo.region.length > 0}}"
        >{{addressInfo.region.join('-') + addressInfo.address}}</view>
      </view>
      <view class="adc-info-text">
        <text class="label">门牌号</text>
        <textarea
          class="text"
          maxlength="{{maxLen}}"
          name="addressNumber"
          value="{{addressInfo.addressNumber}}"
          enableNative="{{false}}"
          auto-height
          placeholder="详细地址,例如:8楼888号"
        />
        </view>
    </view>

    <view a:if="{{isShowDefault}}" class="adc-info-item adc-default">
      <text>设置为默认地址</text>
      <switch class="adc-switch-btn" checked="{{addressInfo.isDefault}}" name="isDefault" checked
              onChange="defaultChange"/>
    </view>

    <slot></slot>

    <button formType="submit" style="background-color: {{btnBgColor ? btnBgColor : ''}};margin-top: {{btnMarginTop}}"
            class="adc-address-save-btn">保存
    </button>
  </form>
</view>