{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>  
    <table class="search-form">
        <tbody>
            <tr><td>店铺 - <?php echo $bill_info['ob_store_name'];?>（ID：<?php echo $bill_info['ob_store_id'];?>） <?php echo $bill_info['os_month'];?> 期 结算单&emsp;
                    <?php if ($bill_info['ob_state'] == BILL_STATE_STORE_COFIRM){?>
                    <a class="btns" onclick="if (confirm('审核后将无法撤销，进入下一步付款环节，确认审核吗?')) {return true;} else {return false;}" href="{:url('bill/bill_check',['ob_no'=>$Request.param.ob_no])}"><span>{$Think.lang.nc_exdport}审核</span></a>
                    <?php }elseif ($bill_info['ob_state'] == BILL_STATE_SYSTEM_CHECK){?>
                    <a class="btns" href="{:url('bill/bill_pay',['ob_no'=>$Request.param.ob_no])}"><span>{$Think.lang.nc_exdport}付款完成</span></a>
                    <?php }elseif ($bill_info['ob_state'] == BILL_STATE_SUCCESS){?>
                    <a class="btns" target="_blank" href="{:url('bill/bill_print',['ob_no'=>$Request.param.ob_no])}"><span>{$Think.lang.nc_exposrt}打印</span></a>
                    <?php }?>
                </td></tr>
            <tr><td>{$Think.lang.order_time_from}结算单号{$Think.lang.ds_colon}<?php echo $bill_info['ob_no'];?></td></tr>
            <tr><td>起止日期{$Think.lang.ds_colon}<?php echo date('Y-m-d',$bill_info['ob_start_date']);?> &nbsp;至&nbsp; <?php echo date('Y-m-d',$bill_info['ob_end_date']);?>
                </td></tr><tr>
                <td>出账日期{$Think.lang.ds_colon}<?php echo date('Y-m-d',$bill_info['ob_create_date']);?></td></tr><tr>
                <td>平台应付金额：<?php echo $bill_info['ob_result_totals'];?> = <?php echo $bill_info['ob_order_totals'];?> (订单金额) - <?php echo $bill_info['ob_commis_totals'];?> (佣金金额) - <?php echo $bill_info['ob_order_return_totals'];?> (退单金额) + <?php echo $bill_info['ob_commis_return_totals'];?> (退还佣金) - <?php echo $bill_info['ob_store_cost_totals'];?> (店铺促销费用)</td>
            </tr>
            <tr><td>结算状态：<?php echo billState($bill_info['ob_state']);?>
                    <?php if ($bill_info['ob_state'] == BILL_STATE_SUCCESS){?>
                    &emsp;结算日期{$Think.lang.ds_colon}<?php echo date('Y-m-d',$bill_info['ob_pay_date']);?>，结算备注{$Think.lang.ds_colon}<?php echo $bill_info['ob_pay_content'];?>
                    <?php }?>
                </td></tr>
        </tbody>
    </table>

    <form method="get" action="" name="formSearch" id="formSearch">
        <table class="search-form">
            <tbody>
                <tr>
                    <th><label for="add_time_from">订单类型</label></th>
                    <td>
                        <select name="query_type" class="querySelect">
                            <option value="order" {if condition="$Think.get.query_type eq 'order'"}selected{/if}>订单列表</option>
                            <option value="refund" {if condition="$Think.get.query_type eq 'refund'"}selected{/if}>退单列表</option>
                            <option value="cost" {if condition="$Think.get.query_type eq 'cost'"}selected{/if}>店铺费用</option>
                        </select>
                    </td>
                    <th><label for="add_time_from">成交时间</label></th>
                    <td><input class="txt date" type="text" value="{$Think.get.query_start_date}" id="query_start_date" name="query_start_date">
                        <label>~</label>
                        <input class="txt date" type="text" value="{$Think.get.query_end_date}" id="query_end_date" name="query_end_date"/></td>       
                    <td><a href="javascript:document.formSearch.submit();" class="btn-search " title="{$Think.lang.ds_query}"></a></a>
                        <a class="btns" href="index.php?<?php echo $_SERVER['QUERY_STRING'];?>&op=export_order"><span>{$Think.lang.nc_exposrt}导出订单明细</span></a>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
<table class="ds-default-table">
    <thead>
      <tr class="thead">
        <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>{$Think.lang.ds_handle}</th>
      </tr>
    </thead>
    <tbody>
      <?php if(is_array($order_list) && !empty($order_list)){?>
      <?php foreach($order_list as $order_info){?>
      <tr class="hover">
        <td class="align-center"><?php echo $order_info['order_sn'];?></td>
        <td class="align-center"><?php echo $order_info['order_amount'];?></td>
        <td class="align-center"><?php echo $order_info['shipping_fee'];?></td>
        <td class="align-center"><?php echo dsPriceFormat($commis_list[$order_info['order_id']]['commis_amount']);?></td>
        <td class="align-center"><?php echo date('Y-m-d',$order_info['add_time']);?></td>
        <td class="align-center"><?php echo date('Y-m-d',$order_info['finnshed_time']);?></td>
        <td class="align-center"><?php echo $order_info['buyer_name'];?></rd>
        <td>
        <a href="{:url('order/show_order',['order_id'=>$order_info.order_id])}>">{$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() {
              $('#query_start_date').datepicker({dateFormat: 'yy-mm-dd', minDate: "<?php echo date('Y-m-d',$bill_info['ob_start_date']);?>", maxDate: "<?php echo date('Y-m-d',$bill_info['ob_end_date']);?>"});
              $('#query_end_date').datepicker({dateFormat: 'yy-mm-dd', minDate: "<?php echo date('Y-m-d',$bill_info['ob_start_date']);?>", maxDate: "<?php echo date('Y-m-d',$bill_info['ob_end_date']);?>"});
          });
</script> 
