<%@ page language="java" import="java.util.*,com.letousky.lottery.action.IdentityBindAction,com.letousky.lottery.action.ShowUserAction" pageEncoding="UTF-8"%>
<%
	String nikeName = java.net.URLDecoder.decode(request.getParameter("nikeName"));
	String[] params = new String[]{request.getParameter("u")};
	String userisBind = new IdentityBindAction().isBind(params);
	String bankisBind = new IdentityBindAction().isBankBind(params);
	String[] userInfo =  new ShowUserAction().userInfoShowNew(request);
	String[] uAry=(String[])session.getAttribute("userAry");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>彩票中国--我的账户--会员中心</title>
    
	<meta http-equiv="pragma" content="no-cache"/>

	<meta http-equiv="cache-control" content="no-cache"/>
	<meta http-equiv="expires" content="0"/>    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
	<meta http-equiv="description" content="This is my page"/>
	<link href="<%=request.getContextPath()%>/letoula/useraccount/css/touzhu.css" rel="stylesheet" type="text/css" />
  </head>
  
  <body>
  	<div class='buy_rec'>
  		<b class='e_draw'></b>
  		<ul class='my_cos'>
  			<li><a href="atm.jsp?nikeName=<%=nikeName%>&u=<%=request.getParameter("u")%>" class='cur'>提款现金</a></li>
  			<li><a href="atm_record.jsp?nikeName=<%=nikeName%>&u=<%=request.getParameter("u")%>" >提款记录</a></li>
  		</ul>
  	</div>

  	
	<div class='rge_box'>
		<%if("0000".equals(userisBind)){%>
			<div class='r_level'>
				<b class='e_mark'></b>
				温馨提示：您还没有绑定身份证！您需要绑定身份证后才能提款！<font color='red'>注：您绑定的身份信息需与实名认证的信息一致</font>
			</div>
			<div class='selt_lc'>
				<span class='lc1'></span>
				<span class='lc2'></span>
			</div>
			<div class='selt_bank'>
				<table>
	  				<tr>
	  					<td style="font:12px Arial;">为什么要绑定身份证？</td>
	  					<td style="font:12px Arial;color:#ff0000;">绑定身份证能够保证您的资金安全。提现所使用的银行卡，必须是使用绑定的身份证开设的。</td>
	  				</tr>
					<tr>
						<td align="right"><font color="#FF0000">*</font>真实姓名:</td>
						<td><input type="text" id='name'/></td>
	  				</tr>
	  				<tr height="40">
	  					<td align="right"><font color="#FF0000">*</font>身份证号码:</td>
	  					<td>
	  						<input type="text" id='identityNum' onkeyup="CarCheck(this)"/>
						</td>
					</tr>
					<tr height="40">
	  					<td align="right"><font color="#FF0000">*</font>确认身份证号码:</td>
	  					<td>
	  						<input type="text" id='confirmIdentityNum' onkeyup="CarCheck(this)"/>
						</td>
					</tr>
	  				<tr>
	  					<td></td>
	  					<td align='left'><a href="#" class='bind_btt' onClick="javascript:identityBind()">确认绑定</a></td>
	  				</tr>
	  			</table>
			</div>
		<%}else if("0000".equals(bankisBind)){%>
			<div class='r_level'>
				<b class='e_mark'></b>
				温馨提示：您还没有绑定银行卡！您需要绑定银行卡后才能提款！<font color='red'>注：您绑定的银行卡信息需与实名认证的信息一致</font>
			</div>
			<div class='selt_lc2'>
			</div>
			<div class='selt_bank'>
				<table>
					<tr>
						<td align="right" style="font:14px Arial;color:#333;">开卡银行名称:</td>
						<td>
							<select id='bank'>
								  <option value="0">请选择银行</option>
						  		  <option value="工商银行">工商银行</option>
						  		  <option value="招商银行">招商银行</option>
						  		  <option value="中国银行">中国银行</option>
						  		  <option value="交通银行">交通银行</option>
						  		  <option value="建设银行">建设银行</option>
						  		  <option value="中信银行">中信银行</option>
						  		  <option value="兴业银行">兴业银行</option>
						  		  <option value="光大银行">光大银行</option>
						  		  <option value="华夏银行">华夏银行</option>
						  		  <option value="中国民生银行">中国民生银行</option>
						  		  <option value="中国农业银行">中国农业银行</option>
						  		  <option value="农村信用合作社">农村信用合作社</option>
						  		  <option value="农村商业银行">农村商业银行</option>
						  		  <option value="农村合作银行">农村合作银行</option>
						  		  <option value="城市商业银行">城市商业银行</option>
						  		  <option value="城市信用合作社">城市信用合作社</option>
						  		  <option value="国家开发银行">国家开发银行</option>
						  		  <option value="中国进出口银行">中国进出口银行</option>
						  		  <option value="恒丰银行">恒丰银行</option>
						  		  <option value="平安银行">平安银行</option>
						  		  <option value="渤海银行">渤海银行</option>
						  		  <option value="广东发展银行">广东发展银行</option>
						  		  <option value="深圳发展银行">深圳发展银行</option>
						  		  <option value="广州市商业银行">广州市商业银行</option>
						  		  <option value="珠海南通银行">珠海南通银行</option>
						  		  <option value="北京银行">北京银行</option>
						  		  <option value="天津银行">天津银行</option>
						  		  <option value="上海浦东发展银行">上海浦东发展银行</option>
						  		  <option value="上海银行">上海银行</option>
						  		  <option value="浙商银行">浙商银行</option>
						  		  <option value="浙江商业银行">浙江商业银行</option>
						  		  <option value="宁波国际银行">宁波国际银行</option>
						  		  <option value="宁波银行">宁波银行</option>
						  		  <option value="温州银行">温州银行</option>
						  		  <option value="南京银行">南京银行</option>
						  		  <option value="常熟农村商业银行">常熟农村商业银行</option>
						  		  <option value="福建亚洲银行">福建亚洲银行</option>
						  		  <option value="福建兴业银行">福建兴业银行</option>
						  		  <option value="徽商银行">徽商银行</option>
						  		  <option value="厦门国际银行">厦门国际银行</option>
						  		  <option value="青岛市商业银行">青岛市商业银行</option>
						  		  <option value="济南市商业银行">济南市商业银行</option>
						  		  <option value="重庆银行">重庆银行</option>
						  		  <option value="成都市商业银行">成都市商业银行</option>
						  		  <option value="哈尔滨银行">哈尔滨银行</option>
						  		  <option value="包头市商业银行">包头市商业银行</option>
						  		  <option value="南昌市商业银行">南昌市商业银行</option>
						  		  <option value="贵阳商业银行">贵阳商业银行</option>
						  		  <option value="兰州市商业银行">兰州市商业银行</option> 
							</select>
						</td>
	  				</tr>
					<tr height="40">
	  					<td align="right" style="font:14px Arial;color:#333;">银行账户名:</td>
	  					<td>
	  						<input type="text" id='bankName'/> 
						</td>
					</tr>
					<tr height="40">
	  					<td align="right">银行卡号:</td>
	  					<td>
	  						<input type="text" id='bankCard' onkeyup="this.value=this.value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1');"/>
						</td>
					</tr>
	  				<tr>
	  					<td></td>
	  					<td align='left'><a href="#" class='bind_btt' onClick="javascript:bankBind()">确认绑定</a></td>
	  				</tr>
	  			</table>
			</div>
			
		<%}else{%>
		<div class='r_level'>
			<b class='e_mark'></b>
			温馨提示：<%=nikeName%>，为确保您的提款能及时安全到账，请如实填写以下信息！<font color='red'> 提款收取百分之一的手续费，200元封顶！</font><br/>
			<%if("0000".equals(bankisBind)){ 
				out.print("您还没有进行过实名认证，为了您的资金与账户安全，建议 <a href='#'>立即认证</a>");
			}%>
		</div>
		<form action="atm_check.jsp" id='checkForm' method="post">
		
		<div class='selt_bank'>
			<ul class='tk_u'>
				<li>
					<span class='dud125 fxn'>真名姓名：</span>
					<span class='sp_r'>
						<input type='text' name='trueName' class='gray' id='trueName'/>
						<input type='hidden' name='z_name' id='z_name' value='<%=userInfo[4]%>' />
					</span>
				</li>
				<li>
					<span class='dud125 fxn'>开户银行名称：</span>
					<span class='sp_r'>
						<%=userInfo[2]%>
						<input type='hidden' name='nikeName' value='<%=nikeName%>' />
					</span>
				</li>
				<li>
					<span class='dud125 fxn'>银行卡号：</span>
					<span class='sp_r'>
						<%=userInfo[3].substring(0,10)%> ******
						<font color='gray' style='font-size:12px;'>(如需修改银行卡号，请联系客服：0755—33274310)</font>
					</span>
				</li>
				<li>
					<span class='dud125 fxn'>当前可提现金额：</span>
					<span class='sp_r'>
						<font color='red'><%=uAry[11]%></font>元
						<input type='hidden' name='tpr' value='<%=uAry[11]%>' />
					</span>
				</li>
				<li>
					<span class='dud125 fxn'>提现金额：</span>
					<span class='sp_r'>
						<input type='text' name='txMoney' class='gray' id='txMoney'/>
					</span>
				</li>
			</ul>
		</div>
		</form>
		<div class='add_bank_btn'>
			<a href="javascript:check()" class='btn_Dora_b star_btn'>下一步</a>
		</div>
		<%}%>
	</div>

<!--提示层-->
<div class="tips_m" style="width:375px; " id="blk2">
    <div class="tips_b">
         <div class="tips_box">
         	<div class="tips_title">
                 <h2>温馨提示</h2>
                 <span class="closes"><a href="javascript:seaDetails('blk2','h')" id="close1">关闭</a></span>
             </div>
             <p>
             	<b class='def'></b>
             	<strong class='errorMsg'></strong>
             </p>
             <p><input type='button' class='btn_Dora_b' id='yclass_alert_ok' onclick=seaDetails('blk2','h') value='关 闭' /></p>
            
         </div>
    </div>
</div>  

  </body>
  </html>
  <script type='text/javascript' src='<%=request.getContextPath()%>/letoula/js/plugin/library.js'></script>
<script type='text/javascript'>
	
	function check(){
		
		var t_pr = '<%=uAry[11]%>';
		var z_name=$('#z_name').val();
		var money = document.getElementById('txMoney').value;
		var t_name= document.getElementById('trueName').value;
		
		if(t_name.length <= 0){
			
			seaDetails('blk2','s','请输入您的真实姓名！');
			return;
		}else if(money.length <= 0){
			seaDetails('blk2','s','请输入您要提取的金额！');
			return;
		}else if(isNaN(money)){
			seaDetails('blk2','s','您输入的金额不是数字，请重新输入！');
			return;
		}else if(z_name != t_name){
			seaDetails('blk2','s','您输入的不是真实姓名，请重新输入！');
			return;
		}else if(parseFloat(money) < 0.1){
			seaDetails('blk2','s','提取金额至少0.1元以上！');
			return;
			
		}else if(parseFloat(t_pr) < parseFloat(money)){
			
			seaDetails('blk2','s','提取金额不能大于您的账户余额！');
			return;
		}else{
			document.getElementById('checkForm').submit();
		}
		
		
	}
	
//身份 绑定
function identityBind(){
	var name=$('#name').val();
	var identityNum=$('#identityNum').val();
	var confirmIdentityNum=$('#confirmIdentityNum').val();
	if(name.length <= 0){
		seaDetails('blk2','s','您好，请输入姓名！');
		return;
	}
	else if(identityNum.length <= 0 || identityNum.length < 15){
		seaDetails('blk2','s','您好，请输入正确的身份证号码！');
		return;
	}
	else if(confirmIdentityNum!=identityNum){
		seaDetails('blk2','s',"您好，两次输入的身份证号码不一致！");
		return;
	}
	name=encodeURI(name);
	
	$.getJSON("../../data/identityBind.jsp?r="+Math.random(),{name:name,identityNum:identityNum},function(items){
		if(items.items[0].strs=="0000"){
			location.reload();
		}else{
			seaDetails('blk2','s','绑定身份失败，请联系本站客服！');
		}
	});
}

//银行卡绑定
function bankBind(){
	var bank=$('#bank').val();
	var bankName=$('#bankName').val();
	var bankCard=$('#bankCard').val();
	bank=encodeURI(bank);
	bankName=encodeURI(bankName);
	if(bank.length <= 0){
		seaDetails('blk2','s','您好，请选择您银行卡的开户支行！');
		return;
	}else if(bankName.length <= 0){
		seaDetails('blk2','s','您好，请输入您银行卡开户的账户名！');
		return;
	}else if(bankCard.length <= 0){
		seaDetails('blk2','s','您好，请输入正确的银行卡帐号！');
		return;
	}
	$.getJSON("../../data/bankBind.jsp?r="+Math.random(),{bank:bank,bankName:bankName,bankCard:bankCard},function(items){
		if(items.items[0].strs=="0000"){
			location.reload();
		}else{
			seaDetails('blk2','s','绑定银行卡失败，请联系本站客服！');
		}
	});
}
	
function seaDetails(nd,sh,txt){
		var off_top=document.documentElement.scrollTop;
		var off_left=document.documentElement.scrollLeft; 
        document.getElementById(nd).style.top=(off_top+50)+"px";
        document.getElementById(nd).style.left=(document.body.clientWidth-500)+"px";
        $('.errorMsg').text(txt);
		sh == 's' ? $('#bd,#'+nd+'').show() : $('#bd,#'+nd+'').hide();
}
function CarCheck(_this)
{
	if(_this.value > 20){
		
		_this.value = _this.value.substring(0,20);
		return;
	}else if(isNaN(_this.value)){
		
		if(_this.value.substring(_this.value.length-1,_this.value.length).toLowerCase() != 'x'){
			
			_this.value = _this.value.substring(0,_this.value.length-1);
			return;
		}
		
	}
}
</script>