<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->
<!--{if $a == "run"}-->
<div class="oemarry_layout">
  <div class="oe_top_nav"><i></i>财务管理->订单结算</div>
  <div class="oe_content">
	
	<form id="serform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
	<div class="oe_txtwrap">
	  订单号：<input type="text" name="sordersn" id="sordersn" class="input-150" value="<!--{$sordersn}-->" />&nbsp;
	  店铺名称：<input type="text" name="sshopname" id="sshopname" class="input-150" value="<!--{$sshopname}-->" />&nbsp;
	  买家会员：<input type="text" name="susername" id="susername" class="input-150" value="<!--{$susername}-->" />&nbsp;
	  订单状态：
	  <select name="sflag" id="sflag">
	  <option value="">--</option>
	  <option value="1"<!--{if $sflag == '1'}--> selected<!--{/if}-->>待付款</option>
	  <option value="2"<!--{if $sflag == '2'}--> selected<!--{/if}-->>已付款</option>
	  <option value="3"<!--{if $sflag == '3'}--> selected<!--{/if}-->>已退款</option>
	  <option value="4"<!--{if $sflag == '4'}--> selected<!--{/if}-->>完成交易</option>
	  <option value="-1"<!--{if $sflag == '-1'}--> selected<!--{/if}-->>取消订单</option>
	  </select>&nbsp;
	  <br />
	  结算状态：
	  <select name="ssettle" id="ssettle">
	  <option value="">--</option>
	  <option value="1"<!--{if $ssettle == '1'}--> selected<!--{/if}-->>已结算</option>
	  <option value="2"<!--{if $ssettle == '2'}--> selected<!--{/if}-->>未结算</option>
	  </select>&nbsp;
	  订单完成时间范围：
	  <select name="stime" id="stime">
	    <option value="">--</option>
		<option value="3"<!--{if $stime == "3"}--> selected<!--{/if}-->>3天</option>
		<option value="7"<!--{if $stime == "7"}--> selected<!--{/if}-->>一周</option>
		<option value="30"<!--{if $stime == "30"}--> selected<!--{/if}-->>一个月</option>
		<option value="90"<!--{if $stime == "90"}--> selected<!--{/if}-->>三个月</option>
		<option value="180"<!--{if $stime == "180"}--> selected<!--{/if}-->>半年</option>
		<option value="365"<!--{if $stime == "365"}--> selected<!--{/if}-->>一年</option>
	  </select>&nbsp;
	  <select name="srange" id="srange">
	    <option value="">范围</option>
		<option value="down"<!--{if $srange == "down"}--> selected<!--{/if}-->>以内</option>
		<option value="up"<!--{if $srange == "up"}--> selected<!--{/if}-->>以上</option>
	  </select>
	  &nbsp;&nbsp;
	  
	  订单完成时间：<input readonly="only" type="text" name="sdate" id="sdate" class="input-100" value="<!--{$sdate}-->" /> 至 <input readonly="only" type="text" name="edate" id="edate" class="input-100" value="<!--{$edate}-->" />
	  <script type="text/javascript">
	  $(function(){
		laydate({
			elem: '#sdate',
			format: 'YYYY-MM-DD',
			choose: function(datas){}
		});

		laydate({
			elem: '#edate',
			format: 'YYYY-MM-DD',
			choose: function(datas){}
		});
	  });
	  </script>
	  &nbsp;&nbsp;<input type="submit" name="btn_search" id="btn_search" class="button_2" value="搜索" />
	</div>
	</form>

    <div class="oe_tools_bar clearfix">
      <a class="icon-checkbox-unchecked" href="javascript:;" id="selAll" onclick="oemarrySelectAll(this, 'selall');">全选/反选</a>
      <a class="icon-remove-2" onclick="oemarryDialogFormConfirm('myform');">结算</a>
    </div>
    
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&a=settle" method="post">
    <table class="oe_table_list table_cs">
	  <tr>
	    <th width="14%">订单</th>
	    <th width="12%">店铺(卖家)</th>
		<th width="7%">实付金额</th>
		<th width="7%">退款金额</th>
		<th width="7%">可结算金额</th>
		<th width="7%">订单状态</th>
		<th width="7%">交易完成</th>
		<th width="7%">结算状态</th>
		<th width="7%">实际结算</th>
		<th width="7%">佣金</th>
		<th width="8%">结算时间</th>
		<th>操作</th>
	  </tr>
	  <!--{if empty($order)}-->
	  <tr>
	    <td class="text_center" colspan="12">没有符合条件的信息</td>
	  </tr>
	  <!--{else}-->
	  <!--{foreach $order as $volist}-->
	  <tr>
	    <td>
		  <!--{if $volist.orderstatus == "10" && $volist.issettle == '0'}-->
		  <input type="checkbox" name="id[]" id="id[]" class="selall" value="<!--{$volist.orderid}-->" />
		  <!--{/if}-->
		  <!--{$volist.ordersn}--><br />
		  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;¥<!--{doubleval($volist.amount)}-->
		</td>
	    <td><a href="javascript:;" f="detail" data-mod="shop" data-id="<!--{$volist.shopid}-->"><!--{$volist.shopname}--></a></td>
		<td>¥<!--{doubleval($volist.payamount)}--></td>
		<td>¥<!--{doubleval($volist.refundamount)}--></td>
		<td>¥<!--{doubleval($volist.payamount-$volist.refundamount)}--></td>
		<td class="text_center">
		  <!--{if $volist.orderstatus == '-1'}-->
		  取消订单
		  <!--{elseif $volist.orderstatus == '1'}-->
		  待付款
		  <!--{elseif $volist.orderstatus == '2'}-->
		  已付款
		  <!--{elseif $volist.orderstatus == '3'}-->
		  已退款
		  <!--{elseif $volist.orderstatus == '10'}-->
		  订单完成
		  <!--{else}-->
		  待确定
		  <!--{/if}-->
		</td>
		<td class="text_center">
		  <!--{if $volist.receivetime > 0}-->
		  <!--{$volist.receivetime|date_format:"%Y-%m-%d"}--><br />
		  <!--{$volist.receivetime|date_format:"%H:%M:%S"}-->
		  <!--{else}-->
		  --
		  <!--{/if}-->
		</td>
		<td class="text_center">
		  <!--{if $volist.issettle == '1'}-->
		  已结算
		  <!--{else}-->
		  未结算
		  <!--{/if}-->
		</td>
		<td>¥<!--{doubleval($volist.settleamount)}--></td>
		<td>¥<!--{doubleval($volist.commission)}--></td>
		<td class="text_center">
		  <!--{if $volist.settletime > 0}-->
		  <!--{$volist.settletime|date_format:"%Y-%m-%d"}--><br />
		  <!--{$volist.settletime|date_format:"%H:%M:%S"}-->
		  <!--{else}-->
		  --
		  <!--{/if}-->
		</td>
		<td class="text_center">
		  <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=view&id=<!--{$volist.orderid}-->&<!--{$comeurl}-->" class="oe_ico_blue">查看</a>
		  
		  <!--{if $volist.orderstatus == "10"}-->
		    <!--{if $volist.issettle == '1'}-->
			<a href="javascript:;" class="oe_ico_orange">已结算</a>
			<!--{else}-->
		    <a href="javascript:;" onclick="oemarryDialogUrlConfirm('<!--{$oefile}-->&c=<!--{$c}-->&a=settle&id[]=<!--{$volist.orderid}-->&<!--{$comeurl}-->');" class="oe_ico_green">结算</a>
			<!--{/if}-->
		  <!--{else}-->
		    <a href="javascript:;" class="oe_ico_gray">待结算</a>
		  <!--{/if}-->
		</td>
	  </tr>
	  <!--{/foreach}-->
	  <!--{/if}-->
	</table>
	</form>
	<div class="oe_page_box"><!--{$showpage}--></div>
  </div>
</div>
<!--{/if}-->

<!--{if $a == 'view'}-->
<div class="oemarry_layout">
  <div class="oe_top_title">
	订单管理->查看/管理订单
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->">&lt;&lt;返回列表</a></span>
  </div>
  <div class="oe_content">
    <h6>订单信息</h6>
    <table class="oe_table_wrap">
	  <tr>
	    <th width="13%">订单编号：<span class="f_red"></span></th>
		<td width="37%"><!--{$order.ordersn}--> (ID:<!--{$order.orderid}-->)</td>
		<th width="13%">创建时间：<span class="f_red"></span></th>
		<td width="37%"><!--{$order.addtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
	  </tr>
	  <tr>
	    <th>卖家：<span class="f_red"></span></th>
		<td><!--{$order.shopname}--></td>
		<th>买家：<span class="f_red"></span></th>
		<td><!--{$order.username}--></td>
	  </tr>
	  <tr>
	    <th>订单总额：<span class="f_red"></span></th>
		<td>¥<!--{$order.amount}--></td>
		<th>商品价格：<span class="f_red"></span></th>
		<td>¥<!--{$order.goodstotal}--></td>
	  </tr>
	  <tr>
		<th>快递费：<span class="f_red"></span></th>
		<td>¥<!--{$order.shipfee}--></td>
		<th>优惠金额：<span class="f_red"></span></th>
		<td>¥<!--{$order.discount}--></td>
	  </tr>
	  <tr>
		<th>实际付款：<span class="f_red"></span></th>
		<td>¥<!--{$order.payamount}--></td>
		<th>付款时间：<span class="f_red"></span></th>
		<td><!--{if $order.paytime > 0}--><!--{$order.paytime|date_format:"%Y-%m-%d %H:%M:%S"}--><!--{else}-->--<!--{/if}--></td>
	  </tr>
	  <tr>
		<th>订单状态：<span class="f_red"></span></th>
		<td>
		  <!--{if $order.orderstatus == '-1'}-->
		  取消订单
		  <!--{elseif $order.orderstatus == '1'}-->
		  待付款
		  <!--{elseif $order.orderstatus == '2'}-->
		  已付款
		  <!--{elseif $order.orderstatus == '3'}-->
		  已退款
		  <!--{elseif $order.orderstatus == '10'}-->
		  订单完成
		  <!--{else}-->
		  待确定
		  <!--{/if}-->
		</td>
		<th>发货状态：<span class="f_red"></span></th>
		<td>
		  <!--{if $order.shipstatus == '1'}-->
		  已付款，待发货
		  <!--{elseif $order.shipstatus == '2'}-->
		  已发货，待收货
		  <!--{elseif $order.shipstatus == '3'}-->
		  已确认收货
		  <!--{else}-->
		  未付款
		  <!--{/if}-->
		</td>
	  </tr>
	</table>

	<h6>结算状态</h6>
	<table class="oe_table_wrap">
	  <tr>
	    <th>订单完成时间：</th>
		<td colspan="3">
		  <!--{if $order.receivetime > 0}-->
		  <!--{$order.receivetime|date_format:"%Y-%m-%d %H:%M:%S"}-->
		  <!--{else}-->
		  --
		  <!--{/if}-->
		</td>
	  </tr>
	  <tr>
	    <th width="15%">可结算金额：</th>
		<td width="35%">¥<!--{doubleval($order.payamount-$order.refundamount)}--></td>
		<th width="15%">结算状态：</th>
		<td width="35%">
		  <!--{if $order.issettle == '1'}-->
		  已结算
		  <!--{else}-->
		  未结算
		  <!--{/if}-->
		</td>
	  </tr>
	  <tr>
	    <th>实际结算：</th>
		<td>¥<!--{doubleval($order.settleamount)}--></td>
		<th>佣金：</th>
		<td>¥<!--{doubleval($order.commission)}--></td>
	  </tr>
	  <tr>
	    <th>结算时间：</th>
		<td>
		  <!--{if $order.settletime > 0}-->
		  <!--{$order.settletime|date_format:"%Y-%m-%d %H:%M:%S"}-->
		  <!--{else}-->
		  --
		  <!--{/if}-->
		</td>
		<th>结算人：</th>
		<td><!--{if empty($order.settleadmin)}-->--<!--{else}--><!--{$order.settleadmin}--><!--{/if}--></td>
	  </tr>
	  <tr>
	    <th>结算备注：</th>
		<td colspan="3"><!--{if empty($order.settleremarks)}-->--<!--{else}--><!--{$order.settleremarks}--><!--{/if}--></td>
	  </tr>
	</table>

	<h6>发货/收货信息</h6>
    <table class="oe_table_wrap">
	  <tr>
	    <th width="13%">收货联系人：<span class="f_red"></span></th>
		<td width="37%"><!--{$order.consignee}--></td>
		<th width="13%">收货人手机：<span class="f_red"></span></th>
		<td width="37%"><!--{$order.mobile}--></td>
	  </tr>
	  <tr>
	    <th>收货地址：<span class="f_red"></span></th>
		<td><!--{$order.address}--></td>
		<th>最佳收货时间段：<span class="f_red"></span></th>
		<td><!--{$order.besttime}--></td>
	  </tr>
	  <tr>
	    <th>收货时间：</th>
		<td colspan="3">
		  <!--{if $order.receivetime > 0}--><!--{$order.receivetime|date_format:"%Y-%m-%d %H:%M:%S"}--><!--{else}-->--<!--{/if}-->
		</td>
	  </tr>

	  <tr>
	    <th>发货方式：<span class="f_red"></span></th>
		<td><!--{if empty($order.shipname)}-->--<!--{else}--><!--{$order.shipname}--><!--{/if}--></td>
		<th>发货单号：<span class="f_red"></span></th>
		<td><!--{if empty($order.shipno)}-->--<!--{else}--><!--{$order.shipno}--><!--{/if}--></td>
	  </tr>
	  <tr>
	    <th>发货时间：<span class="f_red"></span></th>
		<td colspan="3"><!--{if $order.shiptime > 0}--><!--{$order.shiptime|date_format:"%Y-%m-%d %H:%M:%S"}--><!--{else}-->--<!--{/if}--></td>
	  </tr>
	</table>

  </div>
</div>
<!--{/if}-->


</body>
</html>