account/points

Điểm thưởng và lịch sử tích/tiêu điểm.

Ngoài những biến dưới đây, slot này còn nhận toàn bộ biến toàn cục.

Biến của trang

Biến Kiểu Mô tả Từ phiên bản
balance integer Số điểm hiện có. 1.0
ledger PointEntry[] Lịch sử biến động điểm. 1.0
has_more boolean Còn trang tiếp theo hay không. 1.0
next_cursor string | null Con trỏ để tải trang kế; null khi đã hết. 1.0

Mã đầy đủ

Toàn bộ tệp account/points.html của bộ giao diện mặc định. Chép về templates/<bộ giao diện của bạn>/account/points.html rồi sửa theo ý muốn.

<div class="container page-content">
  <h1 class="page-title">Điểm thưởng</h1>
  <div class="account-layout">
    {% assign active_page = 'points' %}
    {% include 'account/_sidebar' %}
    <div class="account-main">
      <div class="points-balance">
        <span class="points-balance__value">{{ balance }}</span>
        <span class="points-balance__label">điểm</span>
      </div>

      {% if ledger %}
        <h2 class="account-section__title">Lịch sử điểm</h2>
        <table class="data-table">
          <thead>
            <tr><th>Loại</th><th>Thay đổi</th><th>Số dư sau</th><th>Ghi chú</th><th>Ngày</th></tr>
          </thead>
          <tbody>
            {% for entry in ledger %}
              <tr>
                <td>{{ entry.event_type }}</td>
                <td class="{% if entry.delta > 0 %}text--green{% else %}text--red{% endif %}">
                  {% if entry.delta > 0 %}+{% endif %}{{ entry.delta }}
                </td>
                <td>{{ entry.balance_after }}</td>
                <td>{{ entry.note | default: '—' }}</td>
                <td>{{ entry.created_at | date: '%d/%m/%Y' }}</td>
              </tr>
            {% endfor %}
          </tbody>
        </table>
        {% if has_more %}
          <a href="/tai-khoan/diem-thuong?cursor={{ next_cursor }}" class="btn btn--outline">Xem thêm</a>
        {% endif %}
      {% else %}
        <p class="empty-state">Chưa có giao dịch điểm nào.</p>
      {% endif %}
    </div>
  </div>
</div>