<!-- pages/penalty/penalty.wxml -->
<view class="page-container">
  <!-- 统计卡片 -->
  <view class="stats-card">
    <view class="stats-number-row">
      <view class="number-block">
        <text class="big-num green">{{ stats.fakuan.daijiaona }}</text>
        <text class="num-label">待缴罚款</text>
      </view>
      <view class="number-block">
        <text class="big-num orange">{{ stats.jifen.daichuli }}</text>
        <text class="num-label">待处理积分</text>
      </view>
    </view>
    <view class="stats-detail-row">
      <text>罚款：已缴{{ stats.fakuan.yijiaona }} · 申诉中{{ stats.fakuan.shensuzhong }} · 成功{{ stats.fakuan.yibohui }}</text>
      <text>积分：已处理{{ stats.jifen.yichuli }}</text>
    </view>
  </view>

  <!-- 主Tab -->
  <view class="tab-row">
    <view class="tab-item {{ activeTab === 'fakuan' ? 'active' : '' }}" bindtap="switchMainTab" data-tab="fakuan">
       罚款
    </view>
    <view class="tab-item {{ activeTab === 'jifen' ? 'active' : '' }}" bindtap="switchMainTab" data-tab="jifen">
       积分处罚
    </view>
  </view>

  <!-- 子状态标签（横向滑动） -->
  <block wx:if="{{ activeTab === 'fakuan' }}">
    <scroll-view class="sub-tabs" scroll-x enable-flex>
      <view class="sub-tag {{ activeFakuanStatus === 1 ? 'sub-active' : '' }}" bindtap="switchFakuanStatus" data-status="1">待缴纳 {{ stats.fakuan.daijiaona }}</view>
      <view class="sub-tag {{ activeFakuanStatus === 3 ? 'sub-active' : '' }}" bindtap="switchFakuanStatus" data-status="3">申诉中 {{ stats.fakuan.shensuzhong }}</view>
      <view class="sub-tag {{ activeFakuanStatus === 2 ? 'sub-active' : '' }}" bindtap="switchFakuanStatus" data-status="2">已缴纳 {{ stats.fakuan.yijiaona }}</view>
      <view class="sub-tag {{ activeFakuanStatus === 4 ? 'sub-active' : '' }}" bindtap="switchFakuanStatus" data-status="4">申诉成功 {{ stats.fakuan.yibohui }}</view>
    </scroll-view>
  </block>
  <block wx:else>
    <scroll-view class="sub-tabs" scroll-x enable-flex>
      <view class="sub-tag {{ activeJifenStatus === 0 ? 'sub-active' : '' }}" bindtap="switchJifenStatus" data-status="0">待处理 {{ stats.jifen.daichuli }}</view>
      <view class="sub-tag {{ activeJifenStatus === 1 ? 'sub-active' : '' }}" bindtap="switchJifenStatus" data-status="1">已处理 {{ stats.jifen.yichuli }}</view>
    </scroll-view>
  </block>

  <!-- 搜索栏 -->
  <view class="search-bar">
    <input class="search-input" placeholder="输入订单号搜索" value="{{ searchDingdan }}" bindinput="onSearchInput" bindconfirm="onSearchConfirm" confirm-type="search"/>
    <view class="search-btn" bindtap="onSearchConfirm">搜索</view>
    <view wx:if="{{ searchDingdan }}" class="clear-btn" bindtap="clearSearch">✕</view>
  </view>

  <!-- 列表区域（动态显示对应组件） -->
  <view wx:if="{{ activeTab === 'fakuan' }}" class="list-area">
    <fakuan-list
      status="{{ activeFakuanStatus }}"
      searchDingdan="{{ searchDingdan }}"
      trigger="{{ trigger.fakuan }}"
    />
  </view>
  <view wx:else class="list-area">
    <jifen-list
      status="{{ activeJifenStatus }}"
      trigger="{{ trigger.jifen }}"
    />
  </view>
</view>