{$layout}

<div v-if="bills.length > 0" style="margin-top: 1em">
  <p>
    未支付账单总额：{{unpaidAmount}}元，账号总余额为：{{accountTotal}}元。<a href="/finance/charge"><span class="red"
        v-if="unpaidAmount > accountTotal">您的余额已不足以支付账单，请及时充值。</span></a>
  </p>
  <div class="margin"></div>
</div>

<form class="ui form" method="get" action="/finance/bills">
  <div class="ui fields inline">
    <div class="ui field">
      <b-select v-model="paidFlag" :options="[
        {label:'[支付状态]', value:'-1'},
        {label:'未支付', value:'0'},
        {label:'已支付', value:'1'},
      ]"></b-select>
      <!-- <select class="ui dropdown selectable" name="paidFlag" v-model="paidFlag">
        <option value="-1">[支付状态]</option>
        <option value="0">未支付</option>
        <option value="1">已支付</option>
      </select> -->
    </div>
    <div class="ui field">
      <button class="ui button" type="submit">搜索</button>
    </div>
  </div>
</form>

<!-- <p class="comment" v-if="bills.length == 0">暂时还没有账单。</p> -->
<b-empty v-if="bills.length == 0">暂时还没有账单。</b-empty>

<table class="ui table selectable celled" v-if="bills.length > 0">
  <thead>
    <tr>
      <th>账单编号</th>
      <th style="width: 6em">结算周期</th>
      <th style="width: 6em">月份</th>
      <th style="width: 8em">日期</th>
      <th style="width: 8em">项目</th>
      <th style="width: 8em">金额</th>
      <th style="width: 6em">已支付</th>
      <th class="one op">操作</th>
    </tr>
  </thead>
  <tr v-for="bill in bills">
    <td>
      <a :href="'/finance/bills/bill?code=' + bill.code">{{bill.code}}</a>
      <div v-if="bill.isOverdue">
        <span class="ui red basic small">逾期</span>
      </div>
    </td>
    <td>{{bill.pricePeriodName}}</td>
    <td>{{bill.month}}</td>
    <td>
      <span v-if="bill.pricePeriod == 'daily'">
        <span v-if="bill.dayFrom == bill.dayTo">{{bill.dayFrom}}</span>
        <span v-else>{{bill.dayFrom}} - {{bill.dayTo}}</span>
      </span>
    </td>
    <td>{{bill.typeName}}</td>
    <td>
      <span :class="{disabled: bill.amount == 0}">¥{{bill.amount}}元</span>
      <span class="grey small" v-if="!bill.canPay"><br />预估</span>
    </td>
    <td>
      <span class="green" v-if="bill.isPaid">Y</span>
      <span v-else class="disabled">N</span>
    </td>
    <td>
      <a href="" v-if="!bill.isPaid && bill.canPay" @click.prevent="payBill(bill.id)">支付</a>
      <span v-if="bill.isPaid" class="disabled" title="已支付，无需重复支付">支付</span>
    </td>
  </tr>
</table>

<div class="page" v-html="page"></div>