<view class="page-container">
  <!-- 背景网格 -->
  <view class="bg-grid"></view>
  <view class="bg-energy"></view>
  
  <!-- 顶部：金牌标识 + 刷新按钮 -->
  <view class="top-bar">
    <view class="jinpai-badge">
      <image class="jinpai-icon fire-icon" src="{{icons.jinpai}}" mode="aspectFit"></image>
      <text class="jinpai-title">金牌选手</text>
    </view>
    <view class="refresh-btn" bindtap="refreshJinpaiInfo">
      <image class="refresh-icon" src="{{icons.refresh}}" mode="aspectFit"></image>
      <text class="refresh-text">刷新</text>
    </view>
  </view>
  
  <!-- 用户信息区域 -->
  <view class="user-section">
    <view class="avatar-wrap" bindtap="previewAvatar">
      <image class="avatar" src="{{avatarUrl}}" mode="aspectFill"></image>
      <view class="avatar-ring"></view>
    </view>
    <view class="user-info">
      <view class="name-row">
        <text class="nickname">{{dashouNicheng}}</text>
        <view class="status-tag {{zaixianZhuangtai == 1 ? 'online' : 'offline'}}">
          {{zaixianZhuangtai == 1 ? '在线' : '离线'}}
        </view>
      </view>
      <view class="uid-row" bindtap="copyUid">
        <text class="uid-label">UID</text>
        <text class="uid-value">{{uid}}</text>
        <image class="copy-icon" src="{{icons.copy}}" mode="aspectFit"></image>
      </view>
      <view class="order-status">
        <text class="status-label">接单状态：</text>
        <text class="status-value {{dashouzhuangtai == '1' ? 'active' : ''}}">
          {{dashouzhuangtai == '1' ? '可接单' : '暂停接单'}}
        </text>
      </view>
    </view>
  </view>
  

  <!-- 🆕 称号标签展示区 -->
<view class="badge-area" wx:if="{{chenghaoList.length > 0}}">
  <scroll-view class="badge-scroll" scroll-y="true" enable-flex>
    <view class="badge-grid">
      <view class="badge-item" wx:for="{{chenghaoList}}" wx:key="index">
        <chenghao-tag 
          mingcheng="{{item.mingcheng}}" 
          texiaoJson="{{item.texiao_json}}" 
        />
      </view>
    </view>
  </scroll-view>
</view>
  
  <!-- 核心资产卡 -->
  <view class="asset-card">
    <view class="asset-left">
      <text class="asset-label">可提现金额</text>
      <view class="asset-value-group">
        <text class="asset-number">{{yongjin}}</text>
        <text class="asset-unit">元</text>
      </view>
    </view>
    <view class="asset-right" bindtap="goToWithdraw">
      <image class="withdraw-icon" src="{{icons.tixian}}" mode="aspectFit"></image>
      <text class="withdraw-text">立即提现</text>
      <view class="withdraw-glow"></view>
    </view>
  </view>
  
  <!-- 辅助数据网格 -->
  <view class="stats-grid">
    <view class="stat-item">
      <text class="stat-label">总赚取</text>
      <text class="stat-value">{{zonge}}元</text>
    </view>
    <view class="stat-item">
      <text class="stat-label">保证金</text>
      <text class="stat-value">{{yajin}}元</text>
    </view>
    <view class="stat-item">
      <text class="stat-label">积分</text>
      <text class="stat-value">{{jinfen}}</text>
    </view>
    <view class="stat-item">
      <text class="stat-label">接单总量</text>
      <text class="stat-value">{{jiedanZongliang}}</text>
    </view>
    <view class="stat-item">
      <text class="stat-label">成交总量</text>
      <text class="stat-value">{{chengjiaoliang}}</text>
    </view>
    <view class="stat-item">
      <text class="stat-label">今日接单</text>
      <text class="stat-value">{{jinriJiedan}}元</text>
    </view>
  </view>
  
  <!-- 图形化数据区域 -->
  <view class="graphic-panel">
    <view class="chart-item">
      <text class="chart-title">成交率</text>
      <view class="ring-chart" style="--progress-angle: {{chengjiaoAngle}}deg;">
        <view class="ring-progress"></view>
        <view class="ring-inner">{{chengjiaoRate}}</view>
      </view>
    </view>
    <view class="chart-item">
      <text class="chart-title">最近提现占比</text>
      <view class="progress-container" style="--progress-width: {{tixianProgress}}%;">
        <view class="progress-bar flow-bar"></view>
        <text class="progress-label">{{tixianProgress}}%</text>
      </view>
      <view class="progress-stats">
        <text>最近提现：{{zuijinTixian}}元</text>
        <text>今日赚取：{{jinriJiedan}}元</text>
      </view>
    </view>
  </view>

  <!-- ========== 联系管事（新增） ========== -->
  <view class="inviter-capsule" wx:if="{{inviterCache && inviterCache.uid}}">
    <view class="capsule-body" bindtap="contactInviter">
      <image class="capsule-avatar" src="{{inviterCache.avatar}}" mode="aspectFill" />
      <view class="capsule-info">
        <text class="capsule-name">{{inviterCache.nicheng || '我的管事'}}</text>
        <text class="capsule-uid">ID: {{inviterCache.uid}}</text>
      </view>
    </view>
    <view class="capsule-contact" bindtap="contactInviter">联系我的邀请人</view>
  </view>
  <view class="inviter-capsule" wx:else bindtap="contactInviter">
    <view class="capsule-body">
      <image class="capsule-avatar" src="/images/default-avatar.png" mode="aspectFill" />
      <view class="capsule-info">
        <text class="capsule-name">我的管事</text>
        <text class="capsule-uid">点击联系</text>
      </view>
    </view>
    <view class="capsule-contact">联系我的邀请人</view>
  </view>

  <!-- 功能按钮区域 -->
  <view class="function-panel">
    <view class="function-grid">
      <view class="func-item" bindtap="goToReceiveOrder">
        <image class="func-icon super-glow" src="{{icons.qiangdan}}" mode="aspectFit"></image>
        <text class="func-label">抢单大厅</text>
      </view>
      <view class="func-item" bindtap="goToRecharge">
        <image class="func-icon super-glow" src="{{icons.chongzhi}}" mode="aspectFit"></image>
        <text class="func-label">充值会员保证金</text>
      </view>
      <view class="func-item" bindtap="goToMyOrders">
        <image class="func-icon super-glow" src="{{icons.dingdan}}" mode="aspectFit"></image>
        <text class="func-label">我的订单</text>
      </view>
      <view class="func-item" bindtap="goToMyPunishment">
        <image class="func-icon super-glow" src="{{icons.chufa}}" mode="aspectFit"></image>
        <text class="func-label">我的处罚</text>
      </view>
      <view class="func-item" bindtap="goToRanking">
        <image class="func-icon super-glow" src="{{icons.paihang}}" mode="aspectFit"></image>
        <text class="func-label">排行榜</text>
      </view>
      <view class="func-item" bindtap="goToModifyInfo">
        <image class="func-icon super-glow" src="{{icons.xiugai}}" mode="aspectFit"></image>
        <text class="func-label">修改资料</text>
      </view>
      <view class="func-item" bindtap="goToRules">
        <image class="func-icon super-glow" src="{{icons.guize}}" mode="aspectFit"></image>
        <text class="func-label">用户规则</text>
      </view>
      <view class="func-item" bindtap="goToKaohe">
        <image class="func-icon super-glow" src="{{icons.kaohe}}" mode="aspectFit"></image>
        <text class="func-label">考核金牌</text>
      </view>
    </view>
  </view>
  
  <global-notification id="global-notification" />
  <tab-bar />
  <popup-notice id="popupNotice" />
</view>

<view class="loading-mask" wx:if="{{isLoading}}">
  <view class="loading-core"></view>
</view>