<!-- pages/kaohe_jilu/kaohe_jilu.wxml -->
<view class="page-root">
  <!-- 顶部筛选区 -->
  <view class="filter-bar">
    <!-- 板块筛选 -->
    <scroll-view class="module-scroll" scroll-x enhanced show-scrollbar="{{false}}">
      <view class="module-container">
        <view class="filter-item {{xuanzhongBankuaiId === 0 ? 'active' : ''}}"
              data-id="{{0}}" bindtap="selectModule">
          <text>全部板块</text>
        </view>
        <block wx:for="{{moduleList}}" wx:key="bankuai_id">
          <view class="filter-item {{xuanzhongBankuaiId === item.bankuai_id ? 'active' : ''}}"
                data-id="{{item.bankuai_id}}" bindtap="selectModule">
            <text>{{item.mingcheng}}</text>
          </view>
        </block>
      </view>
    </scroll-view>
    <!-- 状态筛选 -->
    <view class="status-row">
      <view class="status-item {{statusFilter === 0 ? 'active' : ''}}" data-status="{{0}}" bindtap="selectStatus">全部</view>
      <view class="status-item {{statusFilter === 1 ? 'active' : ''}}" data-status="{{1}}" bindtap="selectStatus">审核中</view>
      <view class="status-item {{statusFilter === 2 ? 'active' : ''}}" data-status="{{2}}" bindtap="selectStatus">已通过</view>
      <view class="status-item {{statusFilter === 3 ? 'active' : ''}}" data-status="{{3}}" bindtap="selectStatus">未通过</view>
    </view>
  </view>

  <!-- 列表区域 -->
  <view class="list-container">
    <scroll-view class="list-scroll" scroll-y enhanced show-scrollbar="{{false}}"
                 bindscrolltolower="onReachBottom">
      <view class="record-list">
        <view wx:if="{{!isLoading && recordList.length === 0}}" class="empty-tip">暂无考核记录</view>

        <block wx:for="{{recordList}}" wx:key="jilu_id">
          <view class="card">
            <!-- 头部信息 -->
            <view class="card-header">
              <image class="avatar" src="{{item.shenqingren_avatar}}" mode="aspectFill" />
              <view class="user-info">
                <text class="nickname">{{item.shenqingren_nicheng || '用户'}}</text>
                <text class="uid">UID {{item.shenqingren_id}}</text>
              </view>
              <view class="status-tag status-{{item.zhuangtai}}">
                {{item.zhuangtai == 0 ? '审核中' : (item.zhuangtai == 1 ? '已通过' : (item.zhuangtai == 2 ? '未通过' : '待审核'))}}
              </view>
            </view>

            <!-- 摘要信息 -->
            <view class="card-summary">
              <view class="summary-item">
                <text class="label">板块</text>
                <text class="value">{{item.bankuai_mingcheng}}</text>
              </view>
              <view class="summary-item">
                <text class="label">标签</text>
                <chenghao-tag mingcheng="{{item.chenghao_mingcheng}}" texiaoJson="{{item.chenghao_texiao_json}}" />
              </view>
              <view class="summary-item">
                <text class="label">次数</text>
                <text class="value">{{item.cishu}}次</text>
              </view>
              <view class="summary-item">
                <text class="label">总费用</text>
                <text class="value">¥{{item.total_fee}}</text>
              </view>
            </view>

            <!-- 操作行 -->
            <view class="card-actions">
              <view class="expand-btn" data-id="{{item.jilu_id}}" bindtap="toggleExpand">
                {{expandedIds.indexOf(item.jilu_id) > -1 ? '收起详情' : '展开详情'}}
              </view>
              <view wx:if="{{item.zhuangtai == 0}}" class="judge-btn" data-item="{{item}}" bindtap="goJudge">
                去评判
              </view>
            </view>

            <!-- 展开的详细内容 -->
            <view class="card-detail" wx:if="{{expandedIds.indexOf(item.jilu_id) > -1}}">
              <view class="detail-section" wx:if="{{item.guize_neirong}}">
                <text class="detail-title">考核规则</text>
                <text class="detail-text">{{item.guize_neirong}}</text>
              </view>
              <view class="detail-section">
                <text class="detail-title">缴纳记录</text>
                <view wx:for="{{item.fee_list}}" wx:key="cishu" class="fee-row">
                  <text>第{{item.cishu}}次：¥{{item.jine}}</text>
                </view>
                <text wx:if="{{!item.fee_list || item.fee_list.length === 0}}" class="detail-empty">暂无缴纳记录</text>
              </view>
              <view class="detail-section">
                <text class="detail-title">拒绝记录</text>
                <view wx:for="{{item.reject_list}}" wx:key="cishu" class="reject-row">
                  <view class="reject-item">
                    <text class="reject-time">{{item.create_time}}</text>
                    <text class="reject-reason">第{{item.cishu}}次拒绝：{{item.yuanyin}}</text>
                  </view>
                </view>
                <text wx:if="{{!item.reject_list || item.reject_list.length === 0}}" class="detail-empty">暂无拒绝记录</text>
              </view>
              <view class="detail-section">
                <text class="detail-title">其他信息</text>
                <view class="info-grid">
                  <text>打手游戏ID：{{item.dashou_youxi_id || '无'}}</text>
                  <text>打手备注：{{item.dashou_beizhu || '无'}}</text>
                  <text>审核官游戏ID：{{item.shenheguan_youxi_id || '无'}}</text>
                  <text>创建时间：{{item.create_time}}</text>
                  <text>更新时间：{{item.update_time}}</text>
                </view>
              </view>
            </view>
          </view>
        </block>

        <view wx:if="{{isLoadingMore}}" class="loading-more">加载更多...</view>
        <view wx:if="{{!hasMore && recordList.length > 0}}" class="no-more">—— 没有更多了 ——</view>
      </view>
    </scroll-view>
  </view>

  <!-- 加载遮罩 -->
  <view wx:if="{{isLoading && recordList.length === 0}}" class="loading-mask">
    <view class="loading-spinner"></view>
    <text>加载中...</text>
  </view>
</view>

<global-notification id="global-notification" />