<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<title>{echo admin_title()}</title>
<!--header-->
{template _:header}
</head>
<body>
<div class="layui-layout layui-layout-admin">
<!--top-->
{template _main_top}
<!--nav-->
{template _main_nav}
	<div class="position"><h1>商户列表</h1></div>
	<div class="layui-body admin-body">
		<div class="admin-content">
			<div class="searcher">
				<form name="sch_form" id="sch_form" method="get" action="{echo \befen\get_url()}">
					<div class="layui-input-inline"><input type="text" name="agent_name" id="agent_name" class="layui-input" value="{echo input('param.agent_name')}" placeholder="代理编号或名称"></div>
					<div class="layui-input-inline"><input type="text" name="merchant_name" id="merchant_name" class="layui-input" value="{echo input('param.merchant_name')}" placeholder="商户编号或名称"></div>
					<div class="layui-input-inline layui-left-margin"><button type="submit" id="search" class="layui-btn">查询</button></div>
					<div class="layui-input-inline layui-left-margin"><button type="submit" name="action" value="export" class="layui-btn">导出</button></div>
				</form>
				<div class="clear"></div>
			</div>
			<form name="theform" id="theform" method="post" action="{echo \befen\get_url()}">
			<table class="layui-table">
				<thead>
					<tr>
						<th>商户名称</th>
						<th>商户编号</th>
						<th>代理名称</th>
						<th>代理编号</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<!--{loop $list $key $val}-->
					<tr id="">
						<td>{$val[merchant_name]}</td>
						<td>{$val[merchant_no]}</td>
						<td>{$val[agent_name]}</td>
						<td>{$val[agent_no]}</td>
						<td class="op"><span class="layui-badge layui-bg-status-{$val[check_status]}">{echo model('Merchant')->getCheckStatus($val['check_status'])}</span></td>
						<td class="op">
							<a op="detail" lay-url="{echo url('merchant/detail', ['merchant_id' => $val['merchant_id']])}" class="layui-btn layui-btn-xs layui-btn-normal">查看/修改商户资料</a>
						</td>
					</tr>
					<!--{/loop}-->
				</tbody>
			</table>
			</form>
			<div class="listpages">{$pagenav}</div>
		</div>
	</div>
</div>
<!--footer-->
{template _:footer}
<script type="text/javascript">
$(".layui-add").click(function(){
	showWindow('添加商户', '{echo url('merchant/add')}', '800px');
});
$("a[op=detail]").click(function(){
	showWindow('查看/修改商户资料', $(this).attr('lay-url'), '800px');
});
$('#sch_form input[name=agent_name]').autoComplete({
	url: "{echo url('agent/index')}",
	field: "agent_no",
	value: "{echo input('param.agent_name')}",
	name_hidden: "agent_id",
	value_hidden: "{echo input('param.agent_id')}",
}, function(o, _self, _target){

});
$('#sch_form input[name=merchant_name]').autoComplete({
	url: "{echo url('merchant/check')}",
	field: "merchant_no",
	value: "{echo input('param.merchant_name')}",
	name_hidden: "merchant_id",
	value_hidden: "{echo input('param.merchant_id')}",
}, function(o, _self, _target){

});
</script>
</body>
</html>