{js:my97date}
<div class="breadcrumbs" id="breadcrumbs">
	<ul class="breadcrumb">
		<li>
			<i class="home-icon fa fa-home"></i>
			<a href="#">统计</a>
		</li>
		<li>
			<a href="#">商户数据统计</a>
		</li>
		<li class="active">货款明细列表</li>
	</ul>
</div>

<div class="content">
	{if:$this->bill}
    <div class="alert alert-info">
        {$this->bill['log']}
    </div>
	{/if}

	<table class="table list-table">
		<colgroup>
			<col  />
			<col width="170px" />
			<col width="120px" />
			<col width="90px" />
			<col width="90px" />
			<col width="90px" />
			{if:class_exists("commission")}
			<col width="90px" />
			{/if}
			<col width="90px" />
			<col width="80px" />
			<col width="80px" />
		</colgroup>

		{if:!$this->bill}
		<caption>
			<form name="searchOrderGoods" action="{url:/}" method="get" class="form-inline">
				<input type='hidden' name='controller' value='market' />
				<input type='hidden' name='action' value='order_goods_list' />

				<div class="input-group">
					<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
					<input type="text" name='search[start_time]' value='' class="form-control" pattern='date' onFocus="WdatePicker()" empty placeholder="起始时间" />
				</div>

				<div class="input-group">
					<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
					<input type="text" name='search[end_time]' value='' class="form-control" pattern='date' onFocus="WdatePicker()" empty placeholder="结束时间" />
				</div>

				<select class="form-control" name="search[is_checkout]">
					<option value="" selected="selected">结算状态</option>
					<option value="0">未结算</option>
					<option value="1">已结算</option>
				</select>

				<select class="form-control" name="search[seller_id]">
					<option value="">选择商家</option>
					{query:name=seller where=is_del eq 0}
					<option value="{$item['id']}">{$item['true_name']}</option>
					{/query}
				</select>

				<button class="btn btn-default" type="submit">
                    <i class="fa fa-search"></i> 搜索
                </button>
			</form>
		</div>
		</caption>
		{/if}

		<thead>
			<tr>
				<th>商户</th>
				<th>订单号</th>
				<th>完成时间</th>
				<th>订单完成额</th>
				<th>平台促销额</th>
				<th>平台手续费</th>
				{if:class_exists("commission")}
				<th>分销佣金额</th>
				{/if}
				<th>应结算金额</th>
				<th>结算状态</th>
				<th>操作</th>
			</tr>
		</thead>

		<tbody>
			{foreach:items=$this->query->find()}
			{set:$countData = CountSum::countSellerOrderFee([$item])}
			<tr>
				<td>
				{set:$sellerRow = Api::run('getSellerInfo',$item["seller_id"])}
                {$sellerRow['true_name']}
				</td>
				<td>{$item['order_no']}</td>
				<td>{$item['completion_time']}</td>
				<td>￥{echo:$countData['orderAmountPrice'] - $countData['refundFee']}</td>
				<td>￥{$countData['platformFee']}</td>
				<td>￥{$countData['commission']}</td>
				{if:class_exists("commission")}
				<td>￥{$countData['commissionFee']}</td>
				{/if}
				<td>￥{$countData['countFee']}</td>
				<td>
					{if:$item['is_checkout'] == 1}
					<span class="text-green">已结算</span>
					{else:}
					<span class="text-red">未结算</span>
					{/if}
				</td>
				<td>
					<a href="{url:/order/order_show/id/$item['id']}" title="订单详情">
						<i class='operator fa fa-eye'></i>
					</a>

                    <a href="javascript:servicefee({$item['id']});" title="订单手续费明细">
						<i class='operator fa fa-list'></i>
					</a>
				</td>
			</tr>
			{/foreach}
		</tbody>
	</table>
</div>
{$this->query->getPageBar()}

<script type="text/javascript">
//表单回填
var searchData = {echo:JSON::encode(IReq::get('search'))};
for(var index in searchData)
{
	$('[name="search['+index+']"]').val(searchData[index]);
}

//订单手续费明细
function servicefee(order_id)
{
	var urlVal = "{url:/market/order_goods_servicefee_list/id/@order_id@}";
	urlVal = urlVal.replace("@order_id@",order_id);
	art.dialog.open(urlVal,{title:'商户订单手续费明细',width:'80%',height:'500px'});
}
</script>