<view class="page-container">
  <view class="stats-card">
    <view class="stats-title">金额罚单汇总</view>
    <view class="money-row">
      <view class="money-item">
        <text class="money-num">¥{{ stats.fakuan.total_jine }}</text>
        <text class="money-label">总金额</text>
      </view>
      <view class="money-item">
        <text class="money-num orange">¥{{ stats.fakuan.daijiaona_jine }}</text>
        <text class="money-label">待缴纳</text>
      </view>
      <view class="money-item">
        <text class="money-num green">¥{{ stats.fakuan.yijiaona_jine }}</text>
        <text class="money-label">已缴纳</text>
      </view>
    </view>
    <view class="money-row sub">
      <text>申诉中 ¥{{ stats.fakuan.shensuzhong_jine }}</text>
      <text>已驳回 ¥{{ stats.fakuan.yibohui_jine }}</text>
      <text>实际到账 ¥{{ stats.fakuan.shijidaozhang_jine }}</text>
    </view>
    <view class="stats-title jifen-title">积分处罚汇总</view>
    <view class="money-row">
      <view class="money-item">
        <text class="money-num">{{ stats.jifen.total_jifen }}</text>
        <text class="money-label">总积分</text>
      </view>
      <view class="money-item">
        <text class="money-num orange">{{ stats.jifen.daichuli_jifen }}</text>
        <text class="money-label">待处理</text>
      </view>
      <view class="money-item">
        <text class="money-num green">{{ stats.jifen.yichuli_jifen }}</text>
        <text class="money-label">已处理</text>
      </view>
    </view>
  </view>

  <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>
    <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>
  </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 wx:if="{{ activeTab === 'fakuan' }}" class="list-area">
    <merchant-fakuan-list
      status="{{ activeFakuanStatus }}"
      searchDingdan="{{ searchDingdan }}"
      trigger="{{ trigger.fakuan }}"
      bind:changed="onPenaltyChanged"
    />
  </view>
  <view wx:else class="list-area">
    <merchant-jifen-list status="{{ activeJifenStatus }}" trigger="{{ trigger.jifen }}" />
  </view>
</view>
