<!-- pages/notes/notes.wxml — 备注记录 -->
<wxs src="../../utils/format.wxs" module="fmt" />

<!-- 错误态 -->
<view class="page-error" wx:if="{{pageState === 'error'}}">
  <view class="error-content">
    <text class="error-icon">😵</text>
    <text class="error-text">加载失败，请重试</text>
    <view class="retry-btn" hover-class="retry-btn--hover" bindtap="onRetry">
      <text class="retry-btn-text">重新加载</text>
    </view>
  </view>
</view>

<!-- 空数据态 -->
<view class="page-empty-wrap" wx:elif="{{pageState === 'empty'}}">
  <view class="page-empty">
    <t-empty description="暂无备注记录" />
  </view>
</view>

<!-- 正常态 -->
<view class="page-normal" wx:elif="{{pageState === 'normal'}}">
  <!-- 备注列表 -->
  <view class="note-list">
    <view
      class="note-card"
      wx:for="{{notes}}"
      wx:key="id"
    >
      <text class="note-content">{{fmt.safe(item.content)}}</text>
      <view class="note-bottom">
        <text class="note-tag {{item.tagType === 'coach' ? 'tag-coach' : 'tag-customer'}}">{{fmt.safe(item.tagLabel)}}</text>
        <view class="note-bottom-right">
          <view class="note-delete-btn" catchtap="onDeleteNote" data-id="{{item.id}}" hover-class="note-delete-btn--hover">
            <t-icon name="delete" size="16px" color="#a6a6a6" />
          </view>
          <text class="note-time">{{fmt.safe(item.timeLabel)}}</text>
        </view>
      </view>
    </view>
  </view>

  <!-- 底部提示 -->
  <view class="list-footer" wx:if="{{isLoadingMore}}">
    <t-loading theme="circular" size="32rpx" />
    <text class="footer-text">加载中...</text>
  </view>
  <view class="list-footer" wx:elif="{{!hasMore}}">
    <text class="footer-text">— 没有更多了 —</text>
  </view>

  <!-- AI 悬浮按钮 -->
  <ai-float-button />
</view>

<dev-fab />
