<!-- pages/shenhedating/shenhedating.wxml -->
<view class="shenhe-page">
  <!-- 模块选择区（固定，不可滑动） -->
  <view class="module-quyu">
    <scroll-view class="module-scroll" scroll-x enhanced show-scrollbar="{{false}}" scroll-y="{{false}}">
      <view class="module-container">
        <view
          class="module-item {{xuanzhongBankuaiId === 0 ? 'module-active' : ''}}"
          data-id="{{0}}"
          bindtap="selectModule"
        >
          <text class="module-name">全部</text>
        </view>
        <block wx:for="{{moduleList}}" wx:key="bankuai_id">
          <view
            class="module-item {{xuanzhongBankuaiId === item.bankuai_id ? 'module-active' : ''}}"
            data-id="{{item.bankuai_id}}"
            bindtap="selectModule"
          >
            <text class="module-name">{{item.mingcheng}}</text>
            <text wx:if="{{item.count > 0}}" class="module-count">{{item.count}}</text>
          </view>
        </block>
      </view>
    </scroll-view>
  </view>

  <!-- 列表区域（撑满剩余高度，自己内部滚动） -->
  <view class="record-container">
    <scroll-view
      class="record-scroll"
      scroll-y enhanced show-scrollbar="{{false}}"
      refresher-enabled="{{true}}"
      refresher-threshold="80"
      refresher-default-style="white"
      refresher-background="#0b0c12"
      refresher-triggered="{{scrollViewRefreshing}}"
      bindrefresherrefresh="onPullDownRefresh"
      bindscrolltolower="onReachBottom"
    >
      <view class="refresher-container" slot="refresher">
        <text wx:if="{{scrollViewRefreshing}}" class="refreshing-text">⚡️ 正在刷新...</text>
        <text wx:else class="pull-down-text">▼ 下拉刷新</text>
      </view>

      <view class="record-list">
        <view wx:if="{{!moduleList.length}}" class="empty-tip">模块加载中...</view>
        <view wx:elif="{{recordList.length === 0 && !isLoading}}" class="empty-tip">当前暂无待审核记录</view>

        <block wx:for="{{recordList}}" wx:key="jilu_id">
          <view class="record-card">
            <!-- 用户信息 -->
            <view class="user-row">
              <image class="user-avatar" src="{{item.shenqingren_avatar}}" mode="aspectFill" />
              <view class="user-info">
                <text class="user-uid">UID {{item.shenqingren_id}}</text>
                <text class="user-time">{{item.create_time}}</text>
              </view>
            </view>

            <!-- 板块 -->
            <view class="detail-row">
              <text class="detail-label">所属板块</text>
              <text class="detail-value">{{item.bankuai_mingcheng}}</text>
            </view>

            <!-- 标签 -->
            <view class="detail-row" wx:if="{{item.chenghao_mingcheng}}">
              <text class="detail-label">考核标签</text>
              <chenghao-tag
                mingcheng="{{item.chenghao_mingcheng}}"
                texiaoJson="{{item.chenghao_texiao_json}}"
              />
            </view>

            <!-- 规则 -->
            <view class="rule-row" wx:if="{{item.guize_neirong}}">
              <view class="rule-header">
                <text class="rule-label">审核规则</text>
                <text wx:if="{{item.guize_neirong.length > 50}}" class="rule-more" data-content="{{item.guize_neirong}}" bindtap="showRuleDetail">详情</text>
              </view>
              <view class="rule-content" data-content="{{item.guize_neirong}}" bindtap="showRuleDetail">
                <text class="rule-text">{{item.guize_neirong.length > 50 ? item.guize_neirong.substring(0, 50) + '...' : item.guize_neirong}}</text>
              </view>
            </view>

            <!-- 备注 -->
            <view class="beizhu-row" wx:if="{{item.dashou_beizhu}}">
              <view class="beizhu-header">
                <text class="beizhu-label">备注</text>
                <text wx:if="{{item.dashou_beizhu.length > 40}}" class="beizhu-more" data-content="{{item.dashou_beizhu}}" bindtap="showBeizhuDetail">详情</text>
              </view>
              <view class="beizhu-content" data-content="{{item.dashou_beizhu}}" bindtap="showBeizhuDetail">
                <text class="beizhu-text">{{item.dashou_beizhu.length > 40 ? item.dashou_beizhu.substring(0, 40) + '...' : item.dashou_beizhu}}</text>
              </view>
            </view>

            <!-- 本次考核费用与要求 -->
            <view class="fee-row">
              <text class="fee-label">本次考核费用：</text>
              <text wx:if="{{item.kaohe_feiyong === 0}}" class="fee-value free">免费</text>
              <text wx:else class="fee-value">{{item.kaohe_feiyong}}元</text>
              <text wx:if="{{item.kaohe_feiyong === 0}}" class="fee-require">（任何考核官可接）</text>
              <text wx:else class="fee-require">（需认证考核官）</text>
            </view>

            <!-- 按钮 -->
            <view class="card-footer">
                <view class="shoushen-btn" data-jiluid="{{item.jilu_id}}" data-bankuaiid="{{item.bankuai_id}}" bindtap="onShouShen">
                <text class="btn-text">审核</text>
              </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 wx:if="{{isLoading && recordList.length === 0}}" class="loading-mask">
      <view class="loading-spinner"></view>
      <text>加载中...</text>
    </view>
  </view>

  <!-- 规则详情弹窗 -->
  <view wx:if="{{showRuleModal}}" class="modal-mask" bindtap="hideRuleDetail">
    <view class="modal-content" catchtap="noop">
      <view class="modal-header"><text>审核规则</text><view class="modal-close" bindtap="hideRuleDetail">×</view></view>
      <scroll-view class="modal-body" scroll-y><text class="rule-full">{{currentRuleContent}}</text></scroll-view>
    </view>
  </view>
  <!-- 备注详情弹窗 -->
  <view wx:if="{{showBeizhuModal}}" class="modal-mask" bindtap="hideBeizhuDetail">
    <view class="modal-content" catchtap="noop">
      <view class="modal-header"><text>备注</text><view class="modal-close" bindtap="hideBeizhuDetail">×</view></view>
      <scroll-view class="modal-body" scroll-y><text class="rule-full">{{currentBeizhuContent}}</text></scroll-view>
    </view>
  </view>

  <global-notification id="global-notification" />
  <popup-notice id="popupNotice" />
</view>