<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">
	<table class="table list-table">
		<colgroup>
			<col width="35px" />
			<col width="165px" />
			<col width="80px" />
			<col width="80px" />
			<col width="80px" />
			<col width="80px" />
			<col width="80px" />
			<col width="90px" />
			<col />
			<col width="90px" />
			<col width="120px" />
		</colgroup>
		<caption>

			<a href="{url:/order/order_edit}" class="btn btn-default">
				<i class='fa fa-plus'></i>添加订单
			</a>

			<a href="javascript:selectAll('id[]')" class="btn btn-default">
				<i class='fa fa-check'></i>全选
			</a>

			<div class="btn-group">
				<button type="button" class="btn btn-default">批量操作</button>
				<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
					<span class="caret"></span>
					<span class="sr-only"></span>
				</button>
				<ul class="dropdown-menu" role="menu">
					<li><a href="javascript:void(0);" onclick="delModel({'form':'orderForm',name:'id[]'})">批量删除</a></li>
					<li><a href="javascript:void(0);" onclick="delModel({'form':'orderForm','name':'id[]','msg':'发货和打印选择的订单数据？','link':'{url:/order/expresswaybill_template}'});">批量发货和打印快递单</a></li>
					<li class="divider"></li>
					<li><a href="{url:/order/order_report/?$search}" target="_blank">导出Excel</a></li>
				</ul>
			</div>

			<a href="{url:/order/print_template}" class="btn btn-default">
				<i class='fa fa-file-archive-o'></i>打印模板
			</a>

			<a href="{url:/order/order_recycle_list}" class="btn btn-default">
				<i class='fa fa-trash'></i>回收站
			</a>

			<a href="javascript:searchOrder({'submit':filterResult,'data':'{$search}'});" class="btn btn-default">
				<i class='fa fa-search'></i>检索
			</a>

			<a href="javascript:void(art.dialog.open('{url:/order/order_code_check}',{title:'验证码核销',id:'order_code_check'}));" class="btn btn-default">
				<i class='fa fa-ticket'></i> 验证码核销
			</a>
		</caption>
		<thead>
			<tr>
				<th></th>
				<th>订单号</th>
				<th>收货人</th>
				<th>支付状态</th>
				<th>发货状态</th>
				<th>订单状态</th>
				<th>打印</th>
				<th>支付方式</th>
				<th>用户名</th>
				<th>下单时间</th>
				<th>操作</th>
			</tr>
		</thead>
        <form name="orderForm" id="orderForm" action="{url:/order/order_del}" method="post">
		<tbody>
			{foreach:items = $this->orderHandle->find()}
			<tr>
				<td><input name="id[]" type="checkbox" value="{$item['id']}" /></td>
				<td title="{$item['order_no']}" name="orderStatusColor{$item['status']}">{$item['order_no']}</td>
				<td title="{$item['accept_name']}">{$item['accept_name']}</td>
				<td name="payStatusColor{$item['pay_status']}">{echo:Order_Class::getOrderPayStatusText($item)}</td>
				<td name="disStatusColor{$item['distribution_status']}">{echo:Order_Class::getOrderDistributionStatusText($item)}</td>
				<td>{echo:order_class::orderStatusText(order_class::getOrderStatus($item))}</td>
				<td>
					<a href="{url:/order/shop_template/id/$item['id']}" target="_blank"><span class="badge bg-red" title="购物清单打印">购</span></a>
					<a href="{url:/order/pick_template/id/$item['id']}" target="_blank"><span class="badge bg-green" title="配货单打印">配</span></a>
					<a href="{url:/order/expresswaybill_template/id/$item['id']}" target="_blank"><span class="badge bg-blue" title="发货和快递单打印">递</span></a>
				</td>
				<td>{$item['payment_name']}</td>
				<td>
					{if:$item['user_id'] == 0}
					游客
					{else:}
                    {set:$user = Api::run('getMemberInfo',$item["user_id"])}
					{$user['username']}
					{/if}
				</td>
				<td title="{$item['create_time']}">{$item['create_time']}</td>
				<td>
					<a href="{url:/order/order_show/id/$item['id']}"><i class='operator fa fa-eye' title="查看订单"></i></a>
					{if:Order_class::getOrderStatus($item) < 3}
					<a href="{url:/order/order_edit/id/$item['id']}"><i class='operator fa fa-edit'></i></a>
					{/if}
					<a href="javascript:void(0)" onclick="delModel({link:'{url:/order/order_del/id/$item['id']}'})"><i class='operator fa fa-close'></i></a>

					{if:$item['seller_id']}
					<a href="{url:/site/home/id/$item['seller_id']}" target="_blank"><i class='operator fa fa-user' title='商家订单'></i></a>
					{/if}
				</td>
			</tr>
			{/foreach}
		</tbody>
		</form>
	</table>
</div>
{$this->orderHandle->getPageBar()}


<script type='text/javascript'>
//检索商品
function filterResult(iframeWin)
{
	var searchForm   = iframeWin.document.body;
	var searchString = $(searchForm).find("form").serialize();
	var jumpUrl      = creatUrl("/order/order_list/"+searchString);
	window.location.href = jumpUrl;
}

//DOM加载结束
$(function(){
	//高亮色彩
	$('[name="payStatusColor1"]').addClass('text-green');
	$('[name="disStatusColor1"]').addClass('text-green');
	$('[name="orderStatusColor3"]').addClass('text-red');
	$('[name="orderStatusColor4"]').addClass('text-red');
	$('[name="orderStatusColor5"]').addClass('text-green');
});
</script>