<view class="page">
  <view class="address-list" wx:if="{{addressList.length > 0}}">
    <view class="address-item card" wx:for="{{addressList}}" wx:key="id">
      <view class="card-body">
        <view class="flex-row gap-16">
          <radio class="default-radio" checked="{{item.is_default}}" bindtap="onSetDefault" data-id="{{item.id}}" />
          <view class="flex-1">
            <view class="flex-row gap-16">
              <text class="addr-name">{{item.name}}</text>
              <text class="addr-phone">{{item.phone}}</text>
              <text class="tag tag-primary" wx:if="{{item.is_default}}">默认</text>
            </view>
            <view class="addr-detail">{{item.province}}{{item.city}}{{item.district}}{{item.detail}}</view>
          </view>
        </view>
        <view class="address-actions flex-row" style="justify-content:flex-end;gap:24rpx;margin-top:12rpx">
          <text class="action-btn" bindtap="onEdit" data-id="{{item.id}}" data-address="{{item}}">编辑</text>
          <text class="action-btn danger" bindtap="onDelete" data-id="{{item.id}}">删除</text>
        </view>
      </view>
    </view>
  </view>

  <empty-state
    wx:elif="{{!loading}}"
    icon="📍"
    text="还没有收货地址"
    showBtn="{{true}}"
    btnText="添加地址"
    bind:action="onAdd"
  />

  <!-- 底部添加按钮 -->
  <view class="bottom-bar safe-bottom">
    <button class="btn-primary btn-block" bindtap="onAdd">+ 添加新地址</button>
  </view>
</view>
