<?php include $this->admin_tpl('meta', 'admin');?>
<title>微信支付配置 - YzmCMS内容管理系统</title>
</head>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)">
		<ul>
			 <li><label>支付方式</label> 微信</li>
			 <li><label><span class="c-red">*</span>AppID</label><input type="text" class="input" required name="config[app_id]" value="<?php echo $config['app_id'];?>" style="width:200px"></li>
			 <li><label><span class="c-red">*</span>AppSecret</label><input type="text" class="input" required name="config[app_secret]" value="<?php echo $config['app_secret'];?>" style="width:400px"></li>
			 <li><label><span class="c-red">*</span>商户ID(MCHID)</label><input type="text" class="input" required name="config[mch_id]" value="<?php echo $config['mch_id'];?>" style="width:200px"></li>
			 <li><label><span class="c-red">*</span>商户秘钥(KEY)</label><input type="text" class="input" required name="config[key]" value="<?php echo $config['key'];?>" style="width:400px"></li>
			 <li><label><span class="c-red">*</span>状态</label>
			 <span class="span_input">
			 	<label class="label_radio"><input name="enabled" type="radio" value="0" <?php if($data['enabled'] == 0) echo 'checked';?>> 启用</label>
			 	<label class="label_radio"><input name="enabled" type="radio" value="1" <?php if($data['enabled'] == 1) echo 'checked';?>> 禁用</label>
			 </span>
			 </li>
			 <li>
			 	<input type="hidden" name="dosubmit" value="1">
			 	<input type="hidden" name="id" value="<?php echo $data['id'];?>">
			    <input class="dosubmit w_120 btn-primary radius" type="submit" value="提交">
			    <input class="btn w_120 btn-default radius" type="button" value="取消" onclick="yzmcms_close()">
			 </li>
		</ul>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer', 'admin');?>
<script type="text/javascript">

	function dosub(obj){
		 if(<?php echo !is_dir(YZMPHP_PATH.'common/plugin/wxpay') ? 'true' : 'false';?>){
			 layer.alert('微信支付插件需到官网付费下载后使用！');
			 return false;
		 }
		 
        $.ajax({
            type: 'POST',
            url: '<?php echo U('edit');?>', 
            data: $(obj).serialize(),
		    dataType: "json", 
            success: function (msg) {
				if(msg.status == 1){
					layer.msg(msg.message, {icon:1, time:800}, function(){
						parent.location.reload();
					});
			    }else{
					layer.msg(msg.message, {icon:2});
				}
            }
        })		 
		return false;			 
	}
	
</script> 

</body>
</html>