<!-- 打手端个人中心 - 逍遥梦布局，逻辑/事件不变 -->

<!-- 未注册 -->
<block wx:if="{{!isDashou && !isGuanshi && !isZuzhang && !isKaoheguan}}">
  <view class="user-page unreg-page">
    <view class="page-header">
      <view class="status-bar" style="height:{{statusBar}}px"></view>
      <view class="nav-bar" style="height:{{navBar - statusBar}}px"><text class="nav-title">我的</text></view>
    </view>
    <view class="unreg-area">
      <view class="panel shadow unreg-card">
        <text class="unreg-title">接单员认证</text>
        <input class="unreg-input" type="text" placeholder="输入邀请码" maxlength="100" value="{{inviteCode}}" bindinput="onInviteCodeInput" placeholder-class="ph" />
        <view class="btn-bg unreg-btn" bindtap="onRegister"><text class="unreg-btn-text">立即注册</text></view>
        <view class="unreg-btn-secondary" bindtap="quickRegisterAsPlatform"><text>平台直签注册</text></view>
        <view class="unreg-link" bindtap="switchToNormal"><text>返回点单端</text></view>
        <view class="unreg-link" bindtap="clearCache"><text>退出登录</text></view>
      </view>
    </view>
    <tab-bar/>
  </view>
</block>

<!-- 已注册 -->
<block wx:else>
  <view class="user-page xym-user">
    <view class="page-header">
      <view class="status-bar" style="height:{{statusBar}}px"></view>
      <view class="nav-bar" style="height:{{navBar - statusBar}}px">
        <text class="nav-title">我的</text>
      </view>
    </view>

    <scroll-view
      class="content"
      scroll-y
      enhanced
      show-scrollbar="{{false}}"
      refresher-enabled="{{true}}"
      refresher-threshold="80"
      refresher-default-style="black"
      refresher-background="#fff8e1"
      refresher-triggered="{{scrollViewRefreshing}}"
      bindrefresherrefresh="onPullDownRefresh"
    >
      <view class="user-info flexb">
        <view class="flex">
          <image class="avatar" src="{{avatarUrl || imgUrls.avatarDefault}}" mode="aspectFill" bindtap="previewAvatar"/>
          <view class="user-text-col">
            <view class="nickname-row">
              <text class="nickname">{{dashouNicheng || '接单员'}}</text>
              <view class="deposit-tag" wx:if="{{yajin && yajin != '0' && yajin != '0.00'}}">保证金</view>
              <view class="role-tags">
                <text class="role-tag">接单员</text>
                <text class="role-tag" wx:if="{{isGuanshi}}">管事</text>
                <text class="role-tag" wx:if="{{isZuzhang}}">组长</text>
                <!-- 临时隐藏考核身份标签，恢复时取消注释 -->
                <!-- <text class="role-tag" wx:if="{{isKaoheguan}}">考核</text> -->
              </view>
            </view>
            <view class="sn-row flex" bindtap="copyUid">
              <text class="sn">ID: {{uid || '--'}}</text>
              <image class="copy-ico" src="{{imgUrls.iconCopy}}" mode="aspectFit"/>
            </view>
          </view>
        </view>
        <view class="user-header-actions">
          <image class="header-action-ico" src="{{imgUrls.iconRefresh}}" mode="aspectFit" bindtap="onTapRefresh"/>
          <image class="setting-ico" src="{{imgUrls.iconEdit}}" mode="aspectFit" bindtap="goToModifyInfo"/>
        </view>
      </view>

      <view class="badge-zone" wx:if="{{chenghaoList.length > 0 || (isGuanshi && guanshiChenghaoList.length > 0) || identityTagList.length > 0}}">
        <scroll-view scroll-x class="badge-scroll" wx:if="{{chenghaoList.length > 0}}">
          <view class="badge-tag-wrap" wx:for="{{chenghaoList}}" wx:key="index">
            <chenghao-tag mingcheng="{{item.mingcheng}}" texiaoJson="{{item.texiao_json}}"/>
          </view>
        </scroll-view>
        <scroll-view scroll-x class="badge-scroll" wx:if="{{isGuanshi && guanshiChenghaoList.length > 0}}">
          <view class="badge-tag-wrap" wx:for="{{guanshiChenghaoList}}" wx:key="index">
            <chenghao-tag mingcheng="{{item.mingcheng}}" texiaoJson="{{item.texiao_json}}"/>
          </view>
        </scroll-view>
        <scroll-view scroll-x class="badge-scroll identity-tag-scroll" wx:if="{{identityTagList.length > 0}}">
          <view class="badge-tag-wrap" wx:for="{{identityTagList}}" wx:key="id">
            <chenghao-tag mingcheng="{{item.mingcheng}}" texiaoJson="{{item.texiao_json}}"/>
          </view>
        </scroll-view>
      </view>

      <view class="wallet-card flexb">
        <view bindtap="goToWalletDetail">
          <view class="w-label">我的佣金(元)</view>
          <view class="w-num">¥{{totalAssets}}</view>
          <view class="w-sub">可提现 ¥{{yongjin || '0.00'}} · 查看</view>
        </view>
        <view class="wallet-btns flex">
          <view class="btn-outline" catchtap="goToRecharge">充值</view>
          <view class="btn-outline" catchtap="goToTotalWithdraw">去提现</view>
        </view>
      </view>

      <view class="banner-row flex" wx:if="{{showRechargeBanners}}">
        <image wx:if="{{imgUrls.bannerVip}}" class="banner-img" src="{{imgUrls.bannerVip}}" mode="widthFix" bindtap="goToRechargeMember"/>
        <image wx:if="{{imgUrls.bannerDeposit}}" class="banner-img" src="{{imgUrls.bannerDeposit}}" mode="widthFix" bindtap="goToRechargeDeposit"/>
      </view>
      <view class="recharge-text-row flex" wx:else>
        <view class="recharge-text-btn" catchtap="goToRechargeMember">充值会员</view>
        <view class="recharge-text-btn" catchtap="goToRechargeDeposit">充值保证金</view>
      </view>

      <view class="qiepian-wrap" bindtap="onQiepianTap">
        <image class="qiepian-banner" src="{{qiepianBanner}}" mode="widthFix"/>
      </view>

      <view class="freeze-row flexa">
        <view class="freeze-col flexmc">
          <text class="freeze-num">{{jinfen || '0'}}</text>
          <text class="freeze-lbl">积分</text>
        </view>
        <view class="freeze-col flexmc">
          <text class="freeze-num">{{yajin || '0.00'}}</text>
          <text class="freeze-lbl">保证金</text>
        </view>
        <view class="freeze-col flexmc">
          <text class="freeze-num">{{yongjin || '0.00'}}</text>
          <text class="freeze-lbl">佣金</text>
        </view>
      </view>

      <view wx:if="{{pendingPenaltyCount > 0}}" class="tip-bar flexb" bindtap="goToMyPunishment">
        <view class="flex">
          <image class="tip-ico" src="{{penaltyTipIcon}}" mode="aspectFit"/>
          <text>你有{{pendingPenaltyCount}}条罚单待处理, 前往处理</text>
        </view>
        <text class="tip-arrow">›</text>
      </view>

      <view class="my-box shadow order-nav-box">
        <view class="panel-title flexb" bindtap="goToAllOrders">
          <text class="lg">我的订单</text>
          <text class="muted">全部订单 ›</text>
        </view>
        <view class="order-nav">
          <view wx:for="{{orderNavXym}}" wx:key="name" class="nav-item" data-status="{{item.statusKey}}" bindtap="goToOrdersWithStatus">
            <view class="icon-wrap">
              <view wx:if="{{item.showBadge && item.badge > 0}}" class="nav-badge">{{item.badge}}</view>
              <image class="nav-icon" src="{{item.icon}}" mode="aspectFit"/>
            </view>
            <text class="sm">{{item.name}}</text>
          </view>
        </view>
      </view>

      <view class="my-box shadow trade-box">
        <view class="section-hd">交易明细</view>
        <view class="trade-list">
          <view wx:for="{{tradeNavXym}}" wx:key="name" class="trade-item" data-type="{{item.type}}" bindtap="goToTradeNav">
            <image class="trade-icon" src="{{item.icon}}" mode="aspectFit"/>
            <text class="sm">{{item.name}}</text>
          </view>
        </view>
      </view>

      <view class="my-box shadow invite-box">
        <view class="section-hd">好友邀请</view>
        <view class="invite-row">
          <view wx:for="{{inviteNavXym}}" wx:key="name" class="invite-item" data-action="{{item.action}}" bindtap="onInviteNavTap">
            <image class="invite-icon" src="{{item.icon}}" mode="aspectFit"/>
            <text class="sm">{{item.name}}</text>
          </view>
        </view>
      </view>

      <view class="my-box shadow more-box">
        <view class="section-hd">更多功能</view>
        <view class="func-list">
          <view
            wx:for="{{moreFuncList}}"
            wx:key="action"
            class="func-item-xym"
            bindtap="onMoreFuncTap"
            data-action="{{item.action}}"
            data-auth-type="{{item.authType}}"
            data-rank-type="{{item.rankType}}"
          >
            <view class="func-icon-wrap"><image class="func-icon-xym" src="{{item.icon}}" mode="aspectFit"/></view>
            <text class="func-txt-xym">{{item.name}}</text>
          </view>
        </view>
      </view>

      <view class="load-tip">— 已加载全部 —</view>
      <view class="content-bottom"></view>
    </scroll-view>

    <view class="follow-kuaishou {{followClass}}" bindtap="toggleFollowKuaishou">
      <image class="ks-icon" src="{{ksIcon}}" mode="aspectFit"/>
      <text wx:if="{{followExpanded}}" class="ks-text" catchtap="goToGuanzhuKs">关注快手</text>
    </view>

    <tab-bar/>
  </view>
</block>

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

<global-notification id="global-notification"/>
<popup-notice id="popupNotice"/>
<pindao-modal
  visible="{{pindaoVisible}}"
  title="{{pindaoTitle}}"
  channelNo="{{pindaoChannelNo}}"
  images="{{pindaoImages}}"
  bind:close="closePindaoModal"
/>
