<view class="container">
  <scroll-view scroll-y class="scroll" bindscrolltolower="loadMore">
    <view wx:if="{{ loading && list.length === 0 }}" class="tip">加载中...</view>
    <block wx:for="{{ list }}" wx:key="id">
      <view class="card" bindtap="openDetail" data-item="{{ item }}">
        <view class="card-head">
          <text class="time">{{ item.display_time }}</text>
          <text class="tag {{ item.status_class }}">{{ item.display_status }}</text>
        </view>
        <text class="info">扣分：{{ item.jifen }} 积分</text>
        <text class="info">理由：{{ item.cfliyou }}</text>
        <text class="info link" wx:if="{{ item.dingdan_id }}">订单：{{ item.dingdan_id }}</text>
      </view>
    </block>
    <view wx:if="{{ !hasMore && list.length > 0 }}" class="tip">—— 没有更多了 ——</view>
    <view wx:if="{{ !loading && list.length === 0 }}" class="empty">暂无积分处罚记录</view>
  </scroll-view>

  <view wx:if="{{ showDetail }}" class="modal-mask">
    <view class="modal-panel">
      <view class="modal-head">
        <text class="modal-title">积分处罚详情</text>
        <view class="modal-close" bindtap="closeDetail">✕</view>
      </view>
      <scroll-view scroll-y class="modal-body">
        <view class="row"><text class="lbl">扣分</text><text class="val strong">{{ detailItem.jifen }} 积分</text></view>
        <view class="row"><text class="lbl">状态</text><text class="tag {{ detailItem.status_class }}">{{ detailItem.display_status }}</text></view>
        <view class="row"><text class="lbl">处罚理由</text><text class="val">{{ detailItem.cfliyou }}</text></view>
        <view class="row" wx:if="{{ detailItem.dingdan_id }}">
          <text class="lbl">关联订单</text>
          <text class="val link" bindtap="goOrder" data-id="{{ detailItem.dingdan_id }}">{{ detailItem.dingdan_id }} ›</text>
        </view>
        <view class="row" wx:if="{{ detailItem.ssliyou }}"><text class="lbl">申诉理由</text><text class="val">{{ detailItem.ssliyou }}</text></view>
        <view wx:if="{{ detailItem.full_zhengju.length }}" class="section">
          <text class="sec-title">商家证据图</text>
          <view class="img-grid">
            <block wx:for="{{ detailItem.full_zhengju }}" wx:key="*this">
              <view class="img-box" bindtap="previewImage" data-url="{{ item }}">
                <image class="img" src="{{ item }}" mode="aspectFill"/>
              </view>
            </block>
          </view>
        </view>
        <view wx:if="{{ detailItem.full_shensu.length }}" class="section">
          <text class="sec-title">打手申诉图</text>
          <view class="img-grid">
            <block wx:for="{{ detailItem.full_shensu }}" wx:key="*this">
              <view class="img-box" bindtap="previewImage" data-url="{{ item }}">
                <image class="img" src="{{ item }}" mode="aspectFill"/>
              </view>
            </block>
          </view>
        </view>
      </scroll-view>
      <view class="modal-foot">
        <view class="pbtn default" bindtap="closeDetail">关闭</view>
      </view>
    </view>
  </view>
</view>
