<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="{$value[merchant_name]}" placeholder="商户名称">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-col layui-col-md12">
				<label>商户编号</label>
				<input type="text" name="sub_mch_no" id="sub_mch_no" class="layui-input" value="{$value[sub_mch_no]}" placeholder="请输入商户编号">
			</div>
		</div>
		<div class="layui-form-item" style="display:none;">
			<div class="layui-col layui-col-md12">
				<label>交易费率</label>
				<input type="text" name="trade_rates" id="trade_rates" class="layui-input" value="{$value[trade_rates]}" placeholder="请输入交易费率">
			</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 #sub_mch_no").val() == "") {
		showTips("#theform2 #sub_mch_no", $("#theform2 #sub_mch_no").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')}",
}, function(o, _self, _target){
	_self.attr("readonly", "readonly").addClass("layui-disabled");
});
</script>
