<div class="opwindow">
	<form name="theform2" id="theform2" method="post" action="{echo \befen\get_url()}">
	<div class="layui-form layui-row">
		<div class="layui-form-item">
			<div class="layui-col layui-col-md12">
				<label>所属商户</label>
				<div class="layui-input-inline" style="width:100%;">
					<input type="text" name="merchant_name" id="merchant_name" class="layui-input" value="" placeholder="商户名称">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-col layui-col-md6">
				<label>门店名称</label>
				<input type="text" name="store_name" id="store_name" class="layui-input layui-input-wdith" value="" placeholder="请输入门店名称">
			</div>
			<div class="layui-col layui-col-md6">
				<label>门店状态</label>
				<select name="store_status" id="store_status" class="layui-select">
					<!--{loop model('Store')->getStatus() $key $val}-->
					<option value="{$key}" <!--{if $key == 1}-->selected<!--{/if}-->>{$val}</option>
					<!--{/loop}-->
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-col layui-col-md6">
				<label>负责人姓名</label>
				<input type="text" name="per_name" id="per_name" class="layui-input layui-input-wdith" value="" placeholder="负责人姓名">
			</div>
			<div class="layui-col layui-col-md6">
				<label>负责人电话</label>
				<input type="text" name="per_phone" id="per_phone" class="layui-input layui-input-wdith" value="" placeholder="负责人电话" lay-verify="required|phone|number">
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-col layui-col-md12" style="text-align:right;">
				<button type="submit" name="submit2" value="submit2" id="submit2" class="layui-btn">提交</button>
			</div>
		</div>
	</div>
	</form>
</div>
<script type="text/javascript">
init_Form();
$("#submit2").click(function(){
	if(!$("#theform2 input[name=merchant_id]").val()) {
		showTips("#theform2 input[name=merchant_name]", '请选择商户');
		return false;
	}
	if($("#theform2 #store_name").val() == "") {
		showTips("#theform2 #store_name", $("#theform2 #store_name").attr("placeholder"));
		return false;
	}
	if($("#theform2 #per_name").val() == "") {
		showTips("#theform2 #per_name", $("#theform2 #per_name").attr("placeholder"));
		return false;
	}
	if($("#theform2 #per_phone").val() == "") {
		showTips("#theform2 #per_phone", $("#theform2 #per_phone").attr("placeholder"));
		return false;
	}
	ajaxSubmit(this, "", "#theform2");
});
$('#theform2 input[name=merchant_name]').autoComplete({
	url: "{echo url('merchant/index')}",
	field: "",
	value: "{echo isset($value['merchant_name']) ? $value['merchant_name'] : input('param.merchant_name')}",
	name_hidden: "merchant_id",
	value_hidden: "{echo isset($value['merchant_id']) ? $value['merchant_id'] : input('param.merchant_id')}",
});
</script>
