<?php
	session_start();
	require_once("../Wx.Config.php");	//只加载一次
	
	ini_set('session.gc_maxlifetime', 99999999); //设置时间 永不过期
	
	include 'loginauto.php';
	
	//得到购物车号
	$strdefcartid=trim($_REQUEST['cartid']);
	if(strlen($strdefcartid)>16)
	{
		$_SESSION["main_defcarttempid"] = $strdefcartid;
	}
	$strdefcartid = trim($_SESSION["main_defcarttempid"]);
	if(strlen($strdefcartid) < 16)
	{
		header('Location: loadpage.php');
	}
	
	$strDefItemTypeID=trim($_REQUEST['itmtyid']);
?>

<!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 src="http://hotel.yuanxusoft.cn/open/js/jweixin-1.0.0.js"></script>
	  
    
	<script language="JavaScript"> 
		//不允许进行后退
		javascript:window.history.forward(0); 
	</script>
	
	<style type="text/css">     
		.clear{overflow:hidden; clear:both; width:0px; height:0px; }     
		.imgbox{width:640px; margin:0 auto; text-align:center; }     
		ul{padding:0px; margin:0px;}     
		ul li{float:left; list-style:none; }     
		ul li.select{display:block;}     
		.imgnum span{border-radius:12px; font:normal normal bold 12px/15px 微软雅黑; color:#FFF; margin-left:6px; padding:3px 6px 3px 6px; background-color:#F90; cursor:pointer;}
		.imgnum span.onselect{background-color:#F00;}     
		.imgnum{text-align:center; float:right; margin:-32px 30px; position:relative;}   
	</style>
	
</head>

<?php

	
	//加载系统参数信息
	require_once("db/db.php");	
	require_once("common/common.php");
	
	$fltintegralcashrate = 0;
		
	$sql=sprintf("SELECT IntegralCashRate from VIP_Config");
	$result = querySql($sql);
	
	if($row = fetch_array($result))
	{
		$fltintegralcashrate = $row['IntegralCashRate'];
	}
	freeResult($result);	//释放数据库
	
	//得到当前购物车数量
	$strCartCount = '';
	$sql=sprintf("SELECT SUM(Item_Count)AS SumCount FROM WX_Temp_List Where CartTempID='%s' And DListNo=0",$strdefcartid);
	$result = querySql($sql);
	if($row = fetch_array($result))
	{
		$strCartCount  = $row['SumCount'];
	}
	freeResult($result);	//释放数据库
	
	if(strlen($strDefItemTypeID)>0)
	{
		$sql = sprintf("SELECT Item_Name FROM TR_Basic_Item Where Item_Type='微信商城类型' And Item_Text='%s' Order By Item_Type ASC",$strDefItemTypeID);
		$result = querySql($sql);
		if($row = fetch_array($result))
		{
			$strDefItemType  = $row['Item_Name'];
		}
		freeResult($result);	//释放数据库
	}
	
	$intNumLeft = 4;
	if($strCartCount=='')
	{
		$strCartImg='images/cart1.png';
	}
	else
	{
		$strCartImg='images/cart2.png';

		
		if($strCartCount>9)
		{
			$intNumLeft=0;
		}
	}
	
	$intBannerHeight = 190;
	$intItemImgHeight = 150;
?>

<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">		
<!--第一个页面的内容实现---------------------------->
<section data-role="page" id="page1" style="background-color:#F8F5F5;">	
	<!--
	<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="52" align="center">
					<a target="_blank" data-transition="flip" href="index2.php?dlistno=<?php echo $strselDListNo;?>">
						<div>
							<img src="images\seld.png" width="21" height="15" border="0" style="margin-top:3px;">
						</div>
					</a>
				</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="52" valign="middle">
					<div id="MyCart" width="45" height="45" style="width:45px; height:45px; background-image:url(<?php echo $strCartImg;?>);">
						<div id="MyNumDiv" style="width:30px;height:40px;padding-top:3px;padding-left:<?php echo $intNumLeft;?>px;">
							<span id="spansumg" style="color:#fff;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:15px;text-shadow:none; margin-left:10px;"><?php echo $strCartCount;?></span> 
						</div>
					</div>
										
				</td>
		  	</tr>
		</table>
	</header>
	-->
	
	<article data-role="none">
		<div class="imgbox" style="width:100%;height:<?php echo $intBannerHeight;?>px;align:center;">       
			<ul id="banner_img">         
				<li>
					<img width="100%" style="height:<?php echo $intBannerHeight;?>px;" border="0" src="images/b1.png"/>
					<div style="margin-top:-30px;margin-left:10px;" align="left">
						<span style="color: #F3EDED;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-decoration: none;text-shadow:none;">中餐厅这副图的具体描述文字1</span>
					</div>
				</li>
				<li>
					<img width="100%" style="height:<?php echo $intBannerHeight;?>px;" border="0" src="images/b2.png"/>
					<div style="margin-top:-30px;margin-left:10px;" align="left">
						<span style="color: #F3EDED;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-decoration: none;text-shadow:none;">中餐厅这副图的具体描述文字2</span>
					</div>
				</li>
				<li>
					<img width="100%" style="height:<?php echo $intBannerHeight;?>px;" border="0" src="images/b3.png"/>
					<div style="margin-top:-30px;margin-left:10px;" align="left">
						<span style="color: #F3EDED;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-decoration: none;text-shadow:none;">中餐厅这副图的具体描述文字3</span>
					</div>
				</li>
				<li>
					<img width="100%" style="height:<?php echo $intBannerHeight;?>px;" border="0" src="images/b4.png"/>
					<div style="margin-top:-30px;margin-left:10px;" align="left">
						<span style="color: #F3EDED;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-decoration: none;text-shadow:none;">中餐厅这副图的具体描述文字4</span>
					</div>
				</li>
			</ul>   
			<div class="clear"></div>   
			
		</div> 
	
		<script type="text/javascript">      
			var time = "";      
			var index = 1;      
			$(function () 
			{        
				showimg(index);        //鼠标移入移出        
				$(".imgnum span").hover(function () 
				{         
					clearTimeout(time);         
					var icon=$(this).text();         
					$(".imgnum span").removeClass("onselect").eq(icon-1).addClass("onselect");         
					$("#banner_img li").hide().stop(true,true).eq(icon-1).fadeIn("slow");        
				}, function () 
				{         
					index=$(this).text()> 3 ? 1 :parseInt($(this).text())+1;         
					time = setTimeout("showimg(" + index + ")", 3000);        
				});      
			});         
				
			function showimg(num) 
			{        
				index = num;        
				$(".imgnum span").removeClass("onselect").eq(index-1).addClass("onselect");
				$("#banner_img li").hide().stop(true,true).eq(index-1).fadeIn("slow");
				index = index + 1 > 4 ? 1 : index + 1; 
				time = setTimeout("showimg(" + index + ")", 3000);
			}   
		</script> 
		
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F8F5F5">
            <tr bgcolor="#FFFFFF">
				<td height="56" colspan="3" valign="middle">
					<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
						<tr>
							<td height="100%" width="25%" align="center">
								<div onClick="bmtSelIType('01')" style="width:60px;height:50px;">
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td width="100%" height="32" align="center">
												<img src="images\hotel.png" width="32" height="30" border="0" style="margin-top:0px;">
											</td>
										</tr>
										<tr>
											<td width="100%" height="16" align="center">
												<div style="margin-top:-10px;">
												<span style="color: #818181;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">客房</span> 
												</div>
											</td>
										</tr>
										<tr>
											<td width="100%" height="2" align="center">
												<?php if($strDefItemTypeID=='01') { ?>
												<div style="width:40px;height:2px; background-color:#B89497;"></div>
												<?php } ?>
											</td>
										</tr>
									</table>
									
								</div>
							</td>
							<td height="100%" width="25%" align="center">
								<div onClick="bmtSelIType('02')" style="width:60px;height:50px;">
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td width="100%" height="32" align="center">
												<img src="images\cate.png" width="32" height="25" border="0" style="margin-top:5px;">
											</td>
										</tr>
										<tr>
											<td width="100%" height="16" align="center">
												<div style="margin-top:-10px;">
												<span style="color: #818181;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">餐厅</span> 
												</div>
											</td>
										</tr>
										<tr>
											<td width="100%" height="2" align="center">
												<?php if($strDefItemTypeID=='02') { ?>
												<div style="width:40px;height:2px; background-color:#B89497;"></div>
												<?php } ?>
											</td>
										</tr>
									</table>
									
								</div>
							</td>
							<td height="100%" width="25%" align="center">
								<div onClick="bmtSelIType('03')" style="width:60px;height:50px;">
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td width="100%" height="32" align="center">
												<img src="images\ktv.png" width="32" height="29" border="0" style="margin-top:0px;">
											</td>
										</tr>
										<tr>
											<td width="100%" height="16" align="center">
												<div style="margin-top:-10px;">
												<span style="color: #818181;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">KTV</span> 
												</div>
											</td>
										</tr>
										<tr>
											<td width="100%" height="2" align="center">
												<?php if($strDefItemTypeID=='03') { ?>
												<div style="width:40px;height:2px; background-color:#B89497;"></div>
												<?php } ?>
											</td>
										</tr>
									</table>
									
								</div>
							</td>
							<td height="100%" width="25%" align="center">
								<div onClick="bmtSelIType('')" style="width:60px;height:50px;">
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td width="100%" height="32" align="center">
												<img src="images\all.png" width="30" height="29" border="0" style="margin-top:0px;">
											</td>
										</tr>
										<tr>
											<td width="100%" height="16" align="center">
												<div style="margin-top:-10px;">
												<span style="color: #818181;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">所有</span> 
												</div>
											</td>
										</tr>
										<tr>
											<td width="100%" height="2" align="center">
												<?php if(strlen($strDefItemTypeID)<1) { ?>
												<div style="width:40px;height:2px; background-color:#B89497;"></div>
												<?php } ?>
											</td>
										</tr>
									</table>
									
								</div>
							</td>
						</tr>
					</table>
				</td>
			</tr>
                <?php 
						
					if(strlen($strDefItemType)>0)
					{
						$sql = sprintf("SELECT ItemNo,ItemName,ItemUnite,ItemPrice,Remarks,wximage,wxitemtype FROM CGS_Item_List Where wxmall>0 And wxitemtype='%s' Order By wxitemtype ASC",$strDefItemType);
					}
					else
					{
						$sql = sprintf("SELECT ItemNo,ItemName,ItemUnite,ItemPrice,Remarks,wximage,wxitemtype FROM CGS_Item_List Where wxmall>0 Order By wxitemtype ASC");
					}
					$result = querySql($sql);
	
					while($row = fetch_array($result))
					{
						$stritemno1 = "";
						$stritemname1 = "";
						$stritemunite1 = "";
						$stritemtype1 = "";
						$stritemimg1 = "";
						$stritemprice1 = "";
						$striteminteg1 = "";
						
						$stritemno2 = "";
						$stritemname2 = "";
						$stritemunite2 = "";
						$stritemtype2 = "";
						$stritemimg2 = "";
						$stritemprice2 = "";
						$striteminteg2 = "";
						//-------------------------------------------------------
						$stritemno = $row['ItemNo'];
						$stritemname = $row['ItemName'];
						$fltprice = $row['ItemPrice'];
						$stritemunite = trim($row['ItemUnite']);
						//$strremarks = trim($row['Remarks']);
						$stritemimg = trim($row['wximage']);
						$stritemtype = trim($row['wxitemtype']);
						
						$stritemimg = 'mall_images/'.$stritemimg ;
						
						//处理数据转换和显示
						$fltintegralval =  round($fltprice * $fltintegralcashrate,0);
					
						$stritemprice =  number_format($fltprice,1);
						$striteminteg =  number_format($fltintegralval,0);
						$stritemprice = str_replace(',','',$stritemprice);
						$striteminteg = str_replace(',','',$striteminteg);
					
						if(strlen($stritemunite)>0)
							$stritemunite ='/'.$stritemunite;
						
						$stritemno1 = $stritemno;
						$stritemname1 = $stritemname;
						$stritemunite1 = $stritemunite;
						$stritemtype1 = $stritemtype;
						$stritemimg1 = $stritemimg;
						$stritemprice1 = $stritemprice;
						$striteminteg1 = $striteminteg;
					
						if($row = fetch_array($result))
						{
							$stritemno = $row['ItemNo'];
							$stritemname = $row['ItemName'];
							$fltprice = $row['ItemPrice'];
							$stritemunite = trim($row['ItemUnite']);
							//$strremarks = trim($row['Remarks']);
							$stritemimg = trim($row['wximage']);
							$stritemtype = trim($row['wxitemtype']);
							
							$stritemimg = 'mall_images/'.$stritemimg ;
							
							//处理数据转换和显示
							$fltintegralval =  round($fltprice * $fltintegralcashrate,0);
						
							$stritemprice =  number_format($fltprice,1);
							$striteminteg =  number_format($fltintegralval,0);
							$stritemprice = str_replace(',','',$stritemprice);
							$striteminteg = str_replace(',','',$striteminteg);
						
							if(strlen($stritemunite)>0)
								$stritemunite ='/'.$stritemunite;
																			
							$stritemno2 = $stritemno;
							$stritemname2 = $stritemname;
							$stritemunite2 = $stritemunite;
							$stritemtype2 = $stritemtype;
							$stritemimg2 = $stritemimg;
							$stritemprice2 = $stritemprice;
							$striteminteg2 = $striteminteg;
						
						}
						
					
				?>

                <tr><td height="4" colspan="3"></td></tr>
                <tr>
					<td height="15" width="5"></td>
					<td height="15" align="left">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td height="10" width="49%">
									<div onClick="bmtSelItem('<?php echo $stritemno1;?>')" style="background-color:#FFFFFF;box-shadow:1px 1px 4px #DFCFCF;">
										<table width="100%" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td height="<?php echo $intItemImgHeight?>" width="100%">
													<IMG src="<?php echo $stritemimg1; ?>" width="100%" height="100%" border="0" style="border-radius:0px;border-width:0px;">
												</td>
											</tr>	
											
											<tr>
												<td height="24" width="100%" align="left">
													<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;margin-left:6px;"><?php echo $stritemname1; ?></span> 
												</td>
											</tr>
											
											<tr>
												<td height="24" width="100%" align="center">
													<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                                                    	<tr>
                                                        	<td width="54%" height="100%">
                                                            	<span style="color: #996600;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;margin-left:5px;">￥<?php echo $stritemprice1; ?></span> 
                                                            </td>
                                                            
                                                            <td width="13" height="100%">
	                                                            <img src="images\jfimg.png" width="12" height="15" border="0" style="margin-top:3px;">
                                                            </td>
                                                            <td height="100%" align="left">
	                                                            <span style="color: #996600;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;"><?php echo $striteminteg1; ?></span> 
                                                            </td>
                                                        </tr>
                                                    </table>		
												</td>
											</tr>
											
											<tr>
												<td height="4" width="100%" align="left"></td>
											</tr>
										</table>
									</div>
								</td>
								<td height="10" width="6"></td>
								<td height="10" >
									<?php if(strlen($stritemname2)>0) { ?>
									<div onClick="bmtSelItem('<?php echo $stritemno2;?>')" style="background-color:#FFFFFF;box-shadow:0px 0px 3px #DFCFCF;">
										<table width="100%" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td height="<?php echo $intItemImgHeight?>" width="100%">
													<IMG src="<?php echo $stritemimg2; ?>" width="100%" height="100%" border="0" style="border-radius:0px;border-width:0px;">
												</td>
											</tr>	
											<tr>
												<td height="24" width="100%" align="left">
													<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;margin-left:6px;"><?php echo $stritemname2; ?></span> 
												</td>
											</tr>
											<tr>
												<td height="24" width="100%" align="left">
													<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                                                    	<tr>
                                                        	<td width="54%" height="100%">
                                                            	<span style="color: #996600;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;margin-left:5px;">￥<?php echo $stritemprice2; ?></span> 
                                                            </td>
                                                            
                                                            <td width="13" height="100%">
	                                                            <img src="images\jfimg.png" width="12" height="15" border="0" style="margin-top:3px;">
                                                            </td>
                                                            <td height="100%">
	                                                            <span style="color: #996600;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;"><?php echo $striteminteg2; ?></span> 
                                                            </td>
                                                        </tr>
                                                    </table>		
												</td>
											</tr>
											
											<tr>
												<td height="4" width="100%" align="left"></td>
											</tr>
										</table>
									</div>
									<?php } ?>
								</td>
							</tr>
						</table>
					</td>
					<td height="15" width="5"></td>
				</tr>
				
                <tr><td height="2" colspan="3"></td></tr>
                               
                <?php	
						
					}
					freeResult($result);	//释放数据库
					closeDb();				//关闭数据库
				?>
                
			<tr>
				<td height="6" width="5"></td>
				<td height="6" align="left"></td>
				<td height="6" width="5"></td>
			</tr>
			
			<tr>
				<td height="8" width="5"></td>
				<td height="8" align="center">
					<span style="color: #CCB2B4;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">客官！到底啦～</span>
				</td>
				<td height="8" width="5"></td>
			</tr>
			
			<tr>
				<td height="6" width="5"></td>
				<td height="6" align="left"></td>
				<td height="6" width="5"></td>
			</tr>
		</table>
		
		<script type="text/javascript">
				
			//相应提交按钮事件处理部分
			function bmtSelItem(strItemNo)
			{	
				window.location="itemview.php?itmno=" + strItemNo;										
			}
			
			function bmtSelIType(strtypeid)
			{	
				window.location="index.php?itmtyid=" + strtypeid;										
			}
		
		</script>
	</article>
	
	<footer data-role="footer" data-position="fixed" data-tap-toggle="false" style="border-top:0px solid #F2E2E2;border-bottom:1px solid #F2E2E2;border-left:1px solid #F2E2E2;border-right:1px solid #F2E2E2;">
		<table width="100%" height="10" border="0" cellpadding="0" cellspacing="0">
			<tr height="100%" valign="top">
				<td width="25%">					
					<a class="ui-btn ui-icon-home ui-btn-icon-top" data-transition="slide" target="_blank" href="#" style="width:100%;height:10px;margin:0px auto 0px auto;color:#666666;">首页</a>
				</td>
				<td width="25%">					
					<a class="ui-btn ui-icon-bullets ui-btn-icon-top" data-transition="slide" target="_blank" href="orderlist.php?bstat=0" style="width:100%;height:10px;margin:0px auto 0px auto;color:#666666">我的订单</a>
				</td>
				<td width="25%">
					<a class="ui-btn ui-icon-shop ui-btn-icon-top" data-transition="slide" target="_blank" href="cartlist.php" style="width:100%;height:10px;margin:0px auto 0px auto;color:#666666">购物车</a>
				</td>
				<td width="25%">
					<a class="ui-btn ui-icon-user ui-btn-icon-top" data-transition="slide" target="_blank" href="vipmain.php" style="width:100%;height:10px;margin:0px auto 0px auto;color:#666666">我的账户</a>
				</td>
			</tr>
		</table>						
	</footer>
    
       
	
</section>



</body>
	
</html>