{% extends 'shop/member/member.html' %}

{% load shoptags %}

{% block member_title %}我的余额{% endblock %}

{% block member %}
<div class="box is-radiusless is-shadowless">
    <div class="columns pl-6 pr-6 pt-3">
        <div class="column">
            <p class=" has-text-grey-light">账户可用余额</p>
            <h1 class="is-size-4">¥ {{ request.user.baykeuser.balance }}</h1> 
        </div>
        <div class="column">
            <p class=" has-text-grey-light">累计充值</p>
            <h1 class=" is-size-4">¥ {{ add_sum_amount }}</h1>
        </div>
        <div class="column">
            <p class=" has-text-grey-light">累计消费</p>
            <h1 class=" is-size-4">¥ {{ minus_sum_amount }}</h1>
        </div>
    </div>
    <div class=" dropdown-divider"></div>

    <div class="table-container pl-4 pr-4">
        <table class="table is-fullwidth is-hoverable">
            <tbody>
                <thead>
                    <th>序号</th>
                    <th>收支状态</th>
                    <th>收支金额</th>
                    <th>收支渠道</th>
                    <th>时间</th>
                </thead>
                {% for balance in balance_list %}
                <tr>
                    <td>{{ forloop.counter }}</td>
                    <td class="{% if balance.change_status == 1 %}  has-text-success-dark {% else %} has-text-danger-dark {% endif %}">
                        {{ balance.get_change_status_display }}
                    </td>
                    <td class="{% if balance.change_status == 1 %}  has-text-success-dark {% else %} has-text-danger-dark {% endif %}">
                        {% if balance.change_status == 1 %}  + {% else %} - {% endif %}{{ balance.amount }}
                    </td>
                    <td class="{% if balance.change_status == 1 %}  has-text-success-dark {% else %} has-text-danger-dark {% endif %}">
                        {{ balance.get_change_way_display }}
                    </td>
                    <td class="{% if balance.change_status == 1 %}  has-text-success-dark {% else %} has-text-danger-dark {% endif %}">
                        {{ balance.add_date }}
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endblock %}