<page-plugin isAuth="{{authInfo['SF_FINANCE_INCOME_VIEW']}}" loading="{{loading}}"
  is-login="{{isLogin}}" bind:handleLogin="handleLogin">
  <search-popup placeholder="输入单据编号" bind:change="searchChange" bind:ok="searchOk"
    bind:reset="searchReset" value="{{params.bill_no}}" data-key="bill_no">
    <view slot="content">
      <search-input label="销售单号" value="{{params.rel_bill_no}}" data-key="rel_bill_no"
        bind:change="searchChange" />
      <search-input label="收入账户" value="{{params.account_name}}" data-key="account_name"
        bind:change="searchChange" />
      <search-input label="往来单位" value="{{params.crm_name}}" data-key="crm_name"
        bind:change="searchChange" />

      <option-cell-plugin title="单据状态" value="{{params.state || ''}}" bind:change="searchChange"
        mode="radio" options="{{states}}" data-key="state" />

      <date-picker-plugin title="单据开始日期" value="{{params.bill_dateL}}" data-key="bill_dateL"
        bind:confirm="searchChange" />
      <date-picker-plugin title="单据结束日期" value="{{params.bill_dateU}}" data-key="bill_dateU"
        bind:confirm="searchChange" />
      <!-- <date-picker-plugin title="创建开始日期" value="{{params.create_dateL}}" data-key="create_dateL"
        bind:confirm="searchChange" />
      <date-picker-plugin title="创建结束日期" value="{{params.create_dateU}}" data-key="create_dateU"
        bind:confirm="searchChange" /> -->
    </view>
  </search-popup>

  <count-plugin count="{{count}}">
    <!-- <sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" /> -->
  </count-plugin>

  <empty-plugin wx:if="{{list.length == 0}}" />
  <card-plugin wx:for="{{ list }}" wx:key="head_id">
    <view slot="header">{{ item.bill_no }}</view>
    <view slot="content">
      <card-item-plugin label="关联销售单" value="{{item.rel_bill_no}}" />
      <card-item-plugin label="单据日期" value="{{item.bill_date}}" />
      <card-item-plugin label="操作员">
        <view slot="value">
          {{item.creator_name}}
          <text wx:if="{{item.creator_nick_name}}">({{item.creator_nick_name}})</text>
        </view>
      </card-item-plugin>
      <card-item-plugin label="往来单位" value="{{item.crm_name}}" />
      <card-item-plugin label="收入账户" value="{{item.account_name}}" />
      <card-item-plugin label="收入金额" value="{{item.total_amount}}" />
      <card-item-plugin label="状态" value="{{item.state_name}}" />
      <card-item-plugin label="备注" value="{{item.comments}}" />
      <card-item-plugin label="创建日期" value="{{item.create_date}}" />
    </view>
    <view slot="footer" class="card-plugin-footer">
      <t-button size="small" theme="primary" bind:tap="onOrderDetail" data-index="{{index}}">详情
      </t-button>
      <t-button wx:if="{{authInfo['SF_FINANCE_INCOME_DEL']}}" size="small" theme="danger"
        bind:tap="onOrderDel" data-index="{{index}}">删除</t-button>
      <t-button wx:if="{{item.total_att}}" size="small" bind:tap="onViewAttachment"
        data-index="{{index}}">附件({{item.total_att}})</t-button>
    </view>
  </card-plugin>
  <pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
    total="{{count}}" bind:change="paginationChange" />
</page-plugin>