<!-- pages/assess-score/assess-score.wxml -->
<view class="root-page">
  <view class="scroll-container" scroll-y="true" bindscrolltolower="onReachBottom">
    <view class="list">
      <block wx:for="{{recordList}}" wx:key="jilu_id">
        <view class="card">
          <!-- 用户信息行 -->
          <view class="user-row">
            <image class="avatar" src="{{item.shenqingren_avatar}}" mode="aspectFill" />
            <view class="info">
              <text class="uid">UID {{item.shenqingren_id}}</text>
              <text class="time">{{item.create_time}}</text>
            </view>
            <view class="contact-btn" bindtap="contactDashou" data-item="{{item}}">联系</view>
          </view>

          <!-- 详情区 -->
          <view class="detail-grid">
            <view class="detail-item">
              <text class="label">板块</text>
              <text class="value">{{item.bankuai_mingcheng}}</text>
            </view>
            <view class="detail-item">
              <text class="label">标签</text>
              <chenghao-tag mingcheng="{{item.chenghao_mingcheng}}" texiaoJson="{{item.chenghao_texiao_json}}" />
              <text wx:if="{{item.is_jinpai}}" class="jinpai-note">(开启金牌)</text>
            </view>
            <view class="detail-item">
              <text class="label">规则</text>
              <text class="value rule-content">{{item.guize_neirong}}</text>
            </view>
             <!-- 🆕 添加被考核人游戏昵称 -->
            <view class="detail-item" wx:if="{{item.dashou_youxi_id}}">
                <text class="label">接单员游戏昵称</text>
                <text class="value">{{item.dashou_youxi_id}}</text>
            </view>
            <view class="detail-item" wx:if="{{item.dashou_beizhu}}">
              <text class="label">备注</text>
              <text class="value">{{item.dashou_beizhu}}</text>
            </view>
            <view class="detail-item">
              <text class="label">次数</text>
              <text class="value">{{item.cishu}}</text>
            </view>
            <view class="detail-item">
              <text class="label">待收考核费</text>
              <text class="value amount">¥{{item.daishou_fei}}</text>
            </view>
          </view>

          <!-- 上次失败原因 -->
          <view wx:if="{{item.last_fail_reason}}" class="fail-box">
            <text class="fail-label">上次拒绝原因：</text>
            <text class="fail-text">{{item.last_fail_reason}}</text>
          </view>

          <!-- 游戏昵称修改 -->
          <view class="nick-row">
            <text class="label">我的游戏昵称</text>
            <input class="nick-input" data-id="{{item.jilu_id}}" value="{{item.shenheguan_youxi_id}}" bindinput="onNickInput" placeholder="输入昵称" />
            <view class="save-nick-btn" data-id="{{item.jilu_id}}" bindtap="modifyNick">保存</view>
          </view>

          <!-- 操作按钮 -->
          <view class="action-row">
            <view class="action-btn agree" data-item="{{item}}" bindtap="openAgreeModal">合格</view>
            <view class="action-btn reject" data-item="{{item}}" bindtap="openRejectModal">不合格</view>
            <view class="action-btn transfer" data-item="{{item}}" bindtap="openTransferModal">转移</view>
          </view>
        </view>
      </block>
      <view wx:if="{{isLoading}}" class="loading">加载中...</view>
      <view wx:if="{{!hasMore && recordList.length > 0}}" class="no-more">—— 已加载全部 ——</view>
      <view wx:if="{{!isLoading && recordList.length === 0}}" class="empty">暂无待考核记录</view>
    </view>
  </view>
</view>

<!-- 通过确认弹窗 -->
<view wx:if="{{showAgreeModal}}" class="modal-mask" bindtap="closeAllModals">
  <view class="modal-box" catchtap="noop">
    <view class="modal-header">确认通过考核</view>
    <view class="modal-body">通过后，该用户将获得对应标签，请认真审核后操作。</view>
    <view class="countdown-text" wx:if="{{counting}}">{{countdown}}秒后可确认</view>
    <view class="modal-footer">
      <view class="btn cancel" bindtap="closeAllModals">取消</view>
      <view class="btn confirm {{counting ? 'disabled' : ''}}" bindtap="{{counting ? '' : 'executeAction'}}" data-action="agree">确认通过</view>
    </view>
  </view>
</view>

<!-- 拒绝弹窗 -->
<view wx:if="{{showRejectModal}}" class="modal-mask" bindtap="closeAllModals">
  <view class="modal-box" catchtap="noop">
    <view class="modal-header">拒绝通过</view>
    <textarea class="reason-input" value="{{rejectReason}}" bindinput="onRejectInput" placeholder="请填写拒绝原因" maxlength="200"></textarea>
    <view class="countdown-text" wx:if="{{counting}}">{{countdown}}秒后可确认</view>
    <view class="modal-footer">
      <view class="btn cancel" bindtap="closeAllModals">取消</view>
      <view class="btn confirm {{counting ? 'disabled' : ''}}" bindtap="{{counting ? '' : 'executeAction'}}" data-action="reject">确认拒绝</view>
    </view>
  </view>
</view>

<!-- 转移弹窗 -->
<view wx:if="{{showTransferModal}}" class="modal-mask" bindtap="closeAllModals">
  <view class="modal-box" catchtap="noop">
    <view class="modal-header">确认转移考核</view>
    <view class="modal-body">转移后，您将无法继续考核此订单，可在考核中心重新接待。</view>
    <view class="countdown-text" wx:if="{{counting}}">{{countdown}}秒后可确认</view>
    <view class="modal-footer">
      <view class="btn cancel" bindtap="closeAllModals">取消</view>
      <view class="btn confirm {{counting ? 'disabled' : ''}}" bindtap="{{counting ? '' : 'executeAction'}}" data-action="transfer">确认转移</view>
    </view>
  </view>
</view>

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