{js:my97date}
{set:$search = IReq::get('search') ? IFilter::act(IReq::get('search'),'strict') : array();}

<div class="headbar">
	<div class="position"><span>统计</span><span>></span><span>商户数据统计</span><span>></span><span>商户订单结算</span></div>
	<div class="operating">
		<div class="search f_l">
			<form name="searchOrderGoods" action="{url:/}" method="get">
				<input type='hidden' name='controller' value='market' />
				<input type='hidden' name='action' value='order_goods_list' />
				从 <input type="text" name='search[create_time>=]' value='' class="Wdate" pattern='date' alt='' onFocus="WdatePicker()" empty /> 到 <input type="text" name='search[create_time<=]' value='' empty pattern='date' class="Wdate" onFocus="WdatePicker()" />

				<select class="auto" name="search[is_checkout=]">
					<option value="" selected="selected">结算状态</option>
					<option value="0">未结算</option>
					<option value="1">已结算</option>
				</select>
				<button class="btn" type="submit"><span class="sch">搜 索</span></button>
			</form>
		</div>
	</div>
</div>
<div class="content">
	<table class="list_table">
		<colgroup>
			<col width="140px" />
			<col width="120px" />
			<col width="130px" />
			<col width="120px" />
			<col width="120px" />
			<col width="120px" />
			<col width="120px" />
			<col width="80px" />
			<col width="80px" />
		</colgroup>

		<thead>
			<tr>
				<th>订单号</th>
				<th>商户</th>
				<th>下单时间</th>
				<th>订单金额</th>
				<th>平台促销活动</th>
				<th>退款金额</th>
				<th>分销佣金金额</th>
				<th>结算状态</th>
				<th>操作</th>
			</tr>
		</thead>

		<tbody>
			{set:$where = ''}
			{foreach:items=$search}
				{if:$item !== ""}{set:$where .= " and ".$key."'".$item."'"}{/if}
			{/foreach}

			{set:
				$page = (isset($_GET['page'])&&(intval($_GET['page'])>0))?intval($_GET['page']):1;
				$orderGoodsQuery = CountSum::getSellerGoodsFeeQuery();
				$orderGoodsQuery->page  = $page;
				$orderGoodsQuery->where = $orderGoodsQuery->getWhere().$where;
			}

			{foreach:items  = $orderGoodsQuery->find()}
			{set:$countData = CountSum::countSellerOrderFee(array($item))}
			<tr>
				<td>{$item['order_no']}</td>
				<td>{query:name=seller where=id eq $item[seller_id] item=$sellerRow}{$sellerRow['true_name']}{/query}</td>
				<td>{$item['create_time']}</td>
				<td>￥{$countData['orderAmountPrice']}</td>
				<td>￥{$countData['platformFee']}</td>
				<td>￥{$countData['refundFee']}</td>
				<td>￥{$countData['commissionFee']}</td>
				<td>
					{if:$item['is_checkout'] == 1}
					<label class="green">已结算</label>
					{else:}
					<label class="orange">未结算</label>
					{/if}
				</td>
				<td>
					<a href="{url:/order/order_show/id/$item[id]}">
						<img class="operator" src="{skin:images/admin/icon_check.gif}" alt="查看" title="查看" />
					</a>
				</td>
			</tr>
			{/foreach}
		</tbody>
	</table>
</div>
{$orderGoodsQuery->getPageBar()}

<script type="text/javascript">
//表单回填
var formObj = new Form('searchOrderGoods');
{foreach:items=$search}
formObj.setValue("search[{$key}]","{$item}");
{/foreach}
</script>