{include file="public/header" /}
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>

<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>结算管理</h3>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
    
  <div class="fixed-empty"></div>
  <form method="get" action="" name="formSearch" id="formSearch">
    <table class="search-form">
      <tbody>
        <tr>
          <th>店铺ID/名称</th>
          <td><input class="txt-short" type="text" value="{$Think.get.query_store}" name="query_store" id="query_store"/></td>
          <th>账单状态</th>
          <td>
          <select name="bill_state">
          <option>{$Think.lang.ds_please_choose}</option>
          <option {if condition="$Think.get.bill_state eq BILL_STATE_CREATE"}selected{/if} value="<?php echo BILL_STATE_CREATE;?>">已出账</option>
          <option {if condition="$Think.get.bill_state eq BILL_STATE_STORE_COFIRM"}selected{/if} value="<?php echo BILL_STATE_STORE_COFIRM;?>">商家已确认</option>
          <option {if condition="$Think.get.bill_state eq BILL_STATE_SYSTEM_CHECK"}selected{/if} value="<?php echo BILL_STATE_SYSTEM_CHECK?>">平台已审核</option>
          <option {if condition="$Think.get.bill_state eq BILL_STATE_SUCCESS"}selected{/if} value="<?php echo BILL_STATE_SUCCESS?>">结算完成</option>
          </select>
          </td>
          <td><a href="javascript:document.formSearch.submit();" class="btn-search " title="{$Think.lang.ds_query}"></a>
          </td>
        </tr>
      </tbody>
    </table>
  </form>
  
  <div class="explanation" id="explanation">
      <div class="title" id="checkZoom">
          <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
          <span id="explanationZoom" title="收起提示" class="arrow"></span>
      </div>
      <ul>
          <li>此处列出了详细的店铺账单信息，点击查看可以查看详细的订单信息、退单信息和店铺费用信息</li>
          <li>账单处理流程为：系统出账 > 商家确认 > 平台审核 > 财务支付(完成结算) 4个环节，其中平台审核和财务支付需要平台介入，请予以关注</li>
      </ul>
  </div>
  
  
  
  
  <div style="text-align:right;"><a class="btns" href="index.php?<?php echo $_SERVER['QUERY_STRING'];?>&op=export_bill"><span>{$Think.lang.ds_export}CSV</span></a></div>
  <table class="ds-default-table">
    <thead>
      <tr class="thead">
        <th>账单编号</th>
        <th class="align-center">开始日期</th>
        <th class="align-center">结束日期</th>
        <th class="align-center">订单金额</th>
        <th class="align-center">运费</th>
        <th class="align-center">佣金金额</th>
        <th class="align-center">退款金额</th>
        <th class="align-center">退还佣金</th>
        <th class="align-center">店铺费用</th>
        <th class="align-center">本期应结</th>
        <th class="align-center">出账日期</th>
        <th class="align-center">账单状态</th>
        <th class="align-center">店铺</th>
        <th class="align-center">{$Think.lang.ds_handle}</th>
      </tr>
    </thead>
    <tbody>
      <?php if(count($bill_list)>0){?>
      <?php foreach($bill_list as $bill_info){?>
      <tr class="hover">
        <td><?php echo $bill_info['ob_no'];?></td>
        <td class="nowrap align-center"><?php echo date('Y-m-d',$bill_info['ob_start_date']);?></td>
        <td class="nowrap align-center"><?php echo date('Y-m-d',$bill_info['ob_end_date']);?></td>
        <td class="align-center"><?php echo $bill_info['ob_order_totals'];?></td>
        <td class="align-center"><?php echo $bill_info['ob_shipping_totals'];?></td>
        <td class="align-center"><?php echo $bill_info['ob_commis_totals'];?></td>        
        <td class="align-center"><?php echo $bill_info['ob_order_return_totals'];?></td>        
        <td class="align-center"><?php echo $bill_info['ob_commis_return_totals'];?></td>       
        <td class="align-center"><?php echo $bill_info['ob_store_cost_totals'];?></td>       
        <td class="align-center"><?php echo $bill_info['ob_result_totals'];?></td>
        <td class="align-center"><?php echo date('Y-m-d',$bill_info['ob_create_date']);?></td>
        <td class="align-center"><?php echo billState($bill_info['ob_state']);?></td>
        <td class="align-center"><?php echo $bill_info['ob_store_name'].'<br/>id:'.$bill_info['ob_store_id'];?></td>
        <td class="align-center">
        <a href="{:url('/Admin/Bill/show_bill',['ob_no'=>$bill_info.ob_no])}">{$Think.lang.ds_view}</a>
        </td>
      </tr>
      <?php }?>
      <?php }else{?>
      <tr class="no_data">
        <td colspan="15">{$Think.lang.ds_no_record}</td>
      </tr>
      <?php }?>
    </tbody>
    <tfoot>
      <tr class="tfoot">
        <td colspan="15" id="dataFuncs">{$show_page}</td>
      </tr>
    </tfoot>
  </table>
</div>
<script type="text/javascript">
$(function(){
    $('#bill_month').datepicker({dateFormat:'yy-mm'});
});
</script> 
