<?php
	session_start();
	require_once("../Wx.Config.php");	//只加载一次
	//判断是否登录系统		
	if($_SESSION["main_viplogined"]!="1" |$_SESSION["main_vipno"]=="")
	{
		//没有登录开始启动登录
		header('location:login.php?stext=');
		exit;
	}
	
	header("Content-type:text/html;charset=gb2312");
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="gb2312">	
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
	<meta name="apple-mobile-web-app-capable" content="1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=0">
	<meta name="apple-touch-fullscreen" content="1">

	<title>微信会员</title>

	<link rel="stylesheet" href="css/mycss.css"> 
	<script src="jsp4/jquery.js"></script>
	
	<!--<link rel="stylesheet" href="jsp5/jquery.mobile-1.4.5.min.css">-->
	<!--<script src="jsp4/jquery.mobile-1.4.3.min.js"></script>-->
	<script src="jsp5/jquery.mobile-1.4.5.min.js"></script>
	<link rel="stylesheet" href="jsp5/jquery.mobile-1.4.5.min.css">
	
	<script language="JavaScript"> 
		//不允许进行后退
		javascript:window.history.forward(0); 
	</script>
</head>

<script>	
	//隐藏维信右上角菜单
	function onBridgeReady(){
		WeixinJSBridge.call('hideOptionMenu');
	}

	if (typeof WeixinJSBridge == "undefined")
	{
		if( document.addEventListener )
		{
			document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
		}
		else if (document.attachEvent)
		{
			document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
			document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
		}
	}
	else
	{
		onBridgeReady();
	}
</script>


<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<!--第一个页面的内容实现---------------------------->
<section data-role="page" id="mdipage1">
	<header data-role="header" data-position="fixed" data-tap-toggle="false" style="border-top-width:0px;border-bottom-width:0px;">
        <table width="100%" height="52" border="0" cellpadding="0" cellspacing="0" bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
		   	<tr>
				<td height="52" width="20"></td>
				<td height="52" align="center" valign="middle">
	                <span style="color:<?php echo WxMainConfig::colHeadTextColor;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:19px;text-shadow:none;">邮寄地址信息</span>
               	</td>
				<td height="52" width="20"></td>
		  	</tr>
		</table>
	</header>
    
	<article data-role="none">
    	<?php
        	//得到当前会员的默认地址和姓名
			require_once("db/db.php");	
			require_once("common/common.php");
			
			//得到当前会员的消费金额信息
			$strselvipno=$_SESSION["main_vipno"];
			
			$strselvipname = $_SESSION["main_vipname"];
			$strselvipaddress = '';
			
			$sql = sprintf("SELECT Sub_Name,Sub_Addres FROM VIP_Item Where Sub_No='%s'",$strselvipno);
		
			$result = querySql($sql);
			if($row = fetch_array($result))
			{
				//如果有会员号
				$strselvipname = trim($row['Sub_Name']);
				$strselvipaddress = trim($row['Sub_Addres']);
			}
			freeResult($result);
			closeDb();
					
		?>
					
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
			<tr>
				<td height="5" width="15"></td>
				<td height="5" align="left"></td>
				<td height="5" width="15"></td>
			</tr>
		
        	<tr>
				<td height="30" width="15"></td>
				<td height="30" align="left">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="60" align="right">
                            	<span style="color: #999999;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;">姓名：</span>
                            </td>
							<td align="left">
                            	<input id="mytext1" name="mytext" value="<?php echo $strselvipname;?>" type="text" placeholder='请输入姓名' autocomplete="off" data-clear-btn="true"  />
							</td>
						</tr>
					</table>
				</td>
				<td height="30" width="15"></td>
			</tr>
			
            <tr>
				<td height="30" width="15"></td>
				<td height="30" align="left">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="60" align="right">
                            	<span style="color: #999999;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;">地址：</span>
                            </td>
							<td align="left">
                            	<textarea cols="20" rows="3" name="mytext2" id="mytext2" type="text"  placeholder='请输入详细邮寄地址' autocomplete="on" data-mini="true"><?php echo $strselvipaddress;?></textarea>
							</td>
						</tr>
					</table>
				</td>
				<td height="30" width="15"></td>
			</tr>
            
            
			<tr>
				<td height="6" width="15"></td>
				<td height="6" align="left"></td>
				<td height="6" width="15"></td>
			</tr>
			
			<tr>
				<td height="1" width="15"></td>
				<td height="1" align="left" bgcolor="#F2E2E2"></td>
				<td height="1" width="15"></td>
			</tr>
        
			<tr>
				<td height="10" width="15"></td>
				<td height="10" align="left"></td>
				<td height="10" width="15"></td>
			</tr>
			
			<tr>
				<td height="8" width="15"></td>
				<td height="8" align="center">
                	<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="50%" align="center">
                            	<div data-rel="back" onClick="bmtReturnBK()" style="border-radius:5px;width:80%; height:38px; background-color:#D7AA28;">
                                   	<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                                       	<tr><td width="100%" height="100%" align="center">
                                        	<span style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">返 回</span>                            	
                                    	</td></tr>
                               		</table>
                             	</div>
                            </td>
							<td width="50%" align="center">
                            	<div data-rel="back" onClick="bmtSaveModify()" style="border-radius:5px;width:80%; height:38px; background-color:<?php echo WxMainConfig::colHeadBkColor;?>;">
                                   	<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                                       	<tr><td width="100%" height="100%" align="center">
                                        	<span style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">提交修改</span>                            	
                                    	</td></tr>
                               		</table>
                             	</div>
							</td>
						</tr>
					</table>
                
				</td>
				<td height="8" width="15"></td>
			</tr>
		
			
			<tr>
				<td height="6" width="15"></td>
				<td height="6" align="left"></td>
				<td height="6" width="15"></td>
			</tr>
		</table>
	
		
		<script type="text/javascript">
			function bmtSaveModify()
			{
				var strnewname = $("#mytext1").val();
				var strnewaddres = document.getElementById("mytext2").value;
				 
				//alert(strnewaddres);
				
				var strurl="vipsaveaddr.php?selname=" + strnewname + "&seladdres=" + strnewaddres;
				var strret="";
				//用ajax的“同步方式”调用一般处理程序
				$.ajax({
					url: strurl ,
					async: false,//改为同步方式
					type: "POST",
					//data: {selname:strnewname, seladdres: strnewaddres },
					success: function (RetData) 
					{
						strret = RetData;
					}
				});
				if(strret.length>0)
				{
					//得到新的数量值
					window.location="vipmain.php";
				}
			};
			
			
			function bmtReturnBK()
			{
				window.location="vipmain.php";	
			};
			
		</script>
		
		<script>
		//禁止页面上下滑动,整个页面都不能滑动了
		document.addEventListener('touchmove', function(e) {
			e.preventDefault();
		});
	</script>
	</article>
</section>

</body>
	
</html>