<view class="points-history-page">
  <!-- 头部导航 -->
  <view class="header">
    <view class="nav-bar">
      <button class="back-btn" bindtap="goBack">
        ← 返回
      </button>
      <view class="page-title">积分明细</view>
      <view class="placeholder"></view>
    </view>
  </view>

  <!-- 积分总览 -->
  <view class="points-overview">
    <view class="points-total">
      <view class="points-label">当前积分</view>
      <view class="points-value">{{memberInfo.points}}</view>
    </view>
    <view class="points-note">积分有效期为获得后1年</view>
  </view>

  <!-- 筛选选项 -->
  <view class="filter-tabs">
    <view class="tab-item {{filterType === 'all' ? 'active' : ''}}" 
          bindtap="filterHistory" data-type="all">
      全部
    </view>
    <view class="tab-item {{filterType === 'earn' ? 'active' : ''}}" 
          bindtap="filterHistory" data-type="earn">
      获得
    </view>
    <view class="tab-item {{filterType === 'exchange' ? 'active' : ''}}" 
          bindtap="filterHistory" data-type="exchange">
      兑换
    </view>
    <view class="tab-item {{filterType === 'upgrade' ? 'active' : ''}}" 
          bindtap="filterHistory" data-type="upgrade">
      升级
    </view>
  </view>

  <!-- 积分历史列表 -->
  <view class="history-list">
    <block wx:for="{{filteredHistory}}" wx:key="index">
      <view class="history-item">
        <view class="item-icon">
          <text wx:if="{{item.type === 'earn'}}">💰</text>
          <text wx:elif="{{item.type === 'exchange'}}">🎁</text>
          <text wx:elif="{{item.type === 'upgrade'}}">🎉</text>
        </view>
        
        <view class="item-content">
          <view class="item-title">{{item.description}}</view>
          <view class="item-date">{{item.date.split('T')[0]}} {{item.date.split('T')[1].split('.')[0]}}</view>
        </view>
        
        <view class="item-points">
          <text wx:if="{{item.type === 'earn'}}" class="points-earn">+{{item.amount}}</text>
          <text wx:elif="{{item.type === 'exchange'}}" class="points-exchange">{{item.amount}}</text>
          <text wx:elif="{{item.type === 'upgrade'}}" class="points-upgrade">升级</text>
        </view>
      </view>
    </block>

    <!-- 空状态 -->
    <view wx:if="{{filteredHistory.length === 0}}" class="empty-history">
      <view class="empty-icon">📊</view>
      <view class="empty-text">暂无积分记录</view>
      <view class="empty-desc">
        {{filterType === 'all' ? '您还没有任何积分记录' : 
          filterType === 'earn' ? '您还没有获得过积分' :
          filterType === 'exchange' ? '您还没有兑换过商品' :
          '您还没有会员升级记录'}}
      </view>
    </view>
  </view>
</view>

