<view class="page">
  <!-- 积分总览 -->
  <view class="header">
    <view class="r1">当前积分</view>
    <view class="r2">{{balance}}</view>
    <view class="r3">累计获得 {{total}} 分 · 100积分抵1元 · 消费送积分</view>
  </view>

  <!-- 积分明细 -->
  <view class="logs">
    <view class="sec-title">积分明细</view>
    <block wx:if="{{logs.length}}">
      <view class="log-item" wx:for="{{logs}}" wx:key="id">
        <view class="left">
          <view class="name">{{typeText(item.change_type)}}</view>
          <view class="desc">{{item.remark || item.ref_no || ''}}</view>
        </view>
        <view class="right {{item.change_amount < 0 ? 'minus' : 'plus'}}">{{item.change_amount > 0 ? '+' : ''}}{{item.change_amount}}</view>
      </view>
    </block>
    <view wx:else>
      <empty-state text="暂无积分记录" />
    </view>
  </view>
</view>
