{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('/Admin/Bill/bill_check',['ob_no'=>$Think.get.ob_no])}"><span>{$Think.lang.nc_exdport}审核</span></a>
                    <?php }elseif ($bill_info['ob_state'] == BILL_STATE_SYSTEM_CHECK){?>
                    <a class="btns" href="{:url('/Admin/Bill/bill_pay',['ob_no'=>$Think.get.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('/Admin/Bill/bill_print',['ob_no'=>$Think.get.ob_no])}"><span>{$Think.lang.ds_export}打印</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_refund_order"><span>{$Think.lang.ds_export}导出退单明细</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($refund_list) && !empty($refund_list)){?>
      <?php foreach($refund_list as $refund_info){?>
      <tr class="hover">
        <td class="align-center"><?php echo $refund_info['refund_sn'];?></td>
        <td class="align-center"><?php echo $refund_info['order_sn'];?></td>
        <td class="align-center"><?php echo $refund_info['refund_amount'];?></td>
        <td class="align-center"><?php echo dsPriceFormat($refund_info['commis_amount']);?></td>
        <td class="align-center"><?php echo str_replace(array(1,2), array('退款 ','退货'),$refund_info['refund_type']);?></td>
        <td class="align-center"><?php echo date('Y-m-d',$refund_info['admin_time']);?></td>
        <td class="align-center"><?php echo $refund_info['buyer_name'];?></rd>
        <td>
        <?php if ($refund_info['refund_type'] == 1) {?>
        <a href="{:url('refund/view',['refund_id'=>$refund_info.refund_id])}">{$Think.lang.ds_view}</a>
        <?php } else {?>
        <a href="{:url('return/view',['return_id'=>$refund_info.refund_id])}">{$Think.lang.ds_view}</a>
        <?php } ?>
        </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> 
