<?php include $this->admin_tpl('meta', 'admin');?>
<title>在线充值 - YzmCMS内容管理系统</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 会员管理 <span class="c-gray en">&gt;</span> 账单管理 <span class="c-gray en">&gt;</span> 在线充值 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
  <div class="sub_menu"><a href="<?php echo U('pay');?>">入账记录</a> <a href="<?php echo U('pay_spend');?>">消费记录</a> <a href="<?php echo U('recharge');?>"  class="on">在线充值</a></div>
 <div class="formdoby_normal"> 
	<form method="post" action="" onsubmit="return checkall()">
		<ul>
			 <li><label>充值类型：</label>
			 	<label class="label_radio"><input name="type" type="radio" value="2" checked> 金钱</label>
			 	<label class="label_radio"><input name="type" type="radio" value="1" > 积分</label>
			 </li>
			 <li>
			 	<label>用户名：</label>
			 	<input type="text" class="input" name="username" id="username" value="">
			 	<span class="userinfo f-12 ml-5"></span>
			 </li> 
			 <li><label>充值额度：</label>
			 <label class="label_radio"><input name="unit" type="radio" value="1" checked> 增加</label>
			 <label class="label_radio"><input name="unit" type="radio" value="0" > 减少</label>
			 <input type="text" class="input" name="money" id="money" value="" style="width:70px"> <span style="color:#888">输入修改数量（金钱或积分）</span>
			 </li> 
			 <li><label>备注说明：</label><textarea class="textarea" name="remarks" style="width:600px"></textarea></li>
			 <li><label>提醒操作：</label><input name="sendemail" value="1" type="checkbox"> 发送e-mail通知会员 <span style="color:#888">（需填写邮箱配置）</span></li>					 
			 <li style="margin:20px 0px;" >
			 	<input class="dosubmit w_120 btn-primary radius" name="dosubmit" type="submit" value="提交">
			 	<input class="btn w_120 btn-default radius h35" type="reset" value="重置">
			 </li> 
		</ul>
		
	</form>
  </div>
</div>
<?php include $this->admin_tpl('footer', 'admin');?>
<script type="text/javascript">
$(function(){
   $("#username").blur(function(){
	  checkname();
   });	
   
   $("#money").blur(function(){
	  checkmoney();
   });   
})

function checkname(){
	var res = false;
	if($("#username").val() != ''){
		$.ajax({   
			type: "post",   
			url: "<?php echo U('member/member/public_memberinfo');?>",   
			dataType: "json",
			async: false,	
			data: "username="+$('#username').val(), 			
			success: function(msg){  
				if(msg.status){
					res = true;
					$(".userinfo").html('用户邮箱：'+msg.data.email+'，余额：<em class="c-red">'+msg.data.amount+'</em>，积分：<em class="c-green">'+msg.data.point+'</em>');	  
				}else{
					$(".userinfo").html('<span class="c-red">'+msg.message+'</span>');	
					layer.msg(msg.message, {icon:2});  
				}				 
			} 
		});
		return res;
	}else{
		$(".userinfo").html('<span class="c-red">用户名不能为空！</span>');
		layer.msg('用户名不能为空！', {icon:2});  
		return res;
	}		   
}

function checkmoney(){
	if($("#money").val() != ''){
		if(!isNaN($("#money").val())){
			return true;				  
		}else{
			layer.msg('充值额度只能为数字！', {icon:2});	
			return false;
		}
	}else{
		layer.msg('充值额度不能为空！', {icon:2});
		return false;
	}		   
}

function checkall(){
    if(!checkname() || !checkmoney()){
		return false;
	}

	if($("textarea[name='remarks']").val() == ''){
		layer.msg('备注说明不能为空！', {icon:2});
		return false;
	}	
	return true;
}
</script>

</body>
</html>