<?php
	session_start();
	require_once("../Wx.Config.php");	//只加载一次
	$strselDListNo=trim($_REQUEST['dlistno']);
	if(strlen($strselDListNo)>0)
	{
		$_SESSION["main_posChainDListNo"]=$strselDListNo;
	}
	else
	{
		$strselDListNo=trim($_SESSION["main_posChainDListNo"]);
	}
	if(strlen($strselDListNo)<1)
	{
		$strselDListNo='0';
	}
?>

<!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://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	  
    
	<script language="JavaScript"> 
		//不允许进行后退
		//javascript:window.history.forward(0); 
	</script>
	
</head>

<?php

	//加载系统参数信息
	require_once("db/db.php");	
	require_once("common/common.php");
	//设置统一语言格式
	header("Content-type: text/html; charset=gb2312"); 
?>

<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">		
<!--第一个页面的内容实现---------------------------->
<section data-role="page" id="page1">
	<header data-role="header" data-position="fixed" data-tap-toggle="false" style="border-top-width:0px;border-bottom-width:0px;">
        <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0" bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
		   	<tr>
				<td height="52" width="40"></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" valign="middle"></td>
		  	</tr>
		</table>
	</header>
	
	<article data-role="none">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                
                <?php 
					$intRowIndex = 0;
					$strolditemtype ='';
					
					$sql = sprintf("SELECT a.ListNo,a.ItemNo,a.ItemName,a.ItemUnite,a.ItemPrice,a.Remarks,a.wximage,b.TypeName
									FROM TCP_Item_List a,TCP_Item_Type b Where a.TypeListNo=b.ListNo And a.wxmall>0 And b.DListNo=%s Order By b.TypeName ASC",$strselDListNo);

					$result = querySql($sql);
	
					while($row = fetch_array($result))
					{
						$lngListNo = $row['ListNo'];
						$stritemno = $row['ItemNo'];
						$stritemname = $row['ItemName'];
						$fltprice = $row['ItemPrice'];
						$stritemunite = trim($row['ItemUnite']);
						$strremarks = trim($row['Remarks']);
						$stritemimg = trim($row['wximage']);
						$stritemtype = trim($row['TypeName']);
						
						$stritemimg = 'mall_images/'.$stritemimg ;
										
						$stritemprice =  number_format($fltprice,1);
						$stritemprice = str_replace(',','',$stritemprice);
					
						if(strlen($stritemunite)>0)
							$stritemunite ='/'.$stritemunite;
					
						$strremarks2 = $strremarks;
						if(strlen($strremarks)>26)
						{
							$strremarks	=  mb_substr($strremarks,0,26,'gb2312').'...';
						}
						
						if($stritemtype!=$strolditemtype)
						{
				?>
				<tr bgcolor="#F4EFEF">
					<td height="28" width="5"></td>
					<td height="28" align="center">
						<span style="color: #535353;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-decoration: none;"><?php echo $stritemtype; ?></span> 
					</td>
					<td height="28" width="5"></td>
				</tr>
				<tr>
					<td height="1" colspan="3" align="left" bgcolor="#F2E2E2"></td>
				</tr>
				<?php 
							$strolditemtype = $stritemtype;
						} 
				?>
                <tr><td height="5" 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="90" width="130"><a href="#"><IMG src="<?php echo $stritemimg; ?>" width="130" height="90" border="0" style="border-radius:3px;"></a></td>
								<td height="90" width="10"></td>
								<td height="90">
									<!---显示商品信息：图片，项目名称，单价，对应积分，项目说明 -->
									
										<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
											<tr><td height="25"> 
													<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:15px;"><?php echo $stritemname; ?></span> 
											</td></tr>
                                            
											<tr><td height="20"> 
                                            		<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                                                    	<tr>
                                                        	<td width="100" height="100%">
                                                            	<span style="color: #996600;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;">￥<?php echo $stritemprice.$stritemunite; ?></span> 
                                                            </td>
                                                            <td height="100%">
	                                                            <span style="color: #996600;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;"><?php echo $striteminteg; ?></span> 
                                                            </td>
                                                        </tr>
                                                    </table>		
													
											</td></tr>
											
                                            <tr><td height="45" valign="top">
													<span style="color: #999999;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;"><?php echo $strremarks; ?></span> 
											</td></tr>
										</table>
                                    
								</td>
								
								<td height="90" width="140" valign="middle" align="center">
									
										<div align="center" onClick="SaveItemImg(<?php echo $lngListNo;?>)" style="width:90px;height:30px;border-radius:4px; background-color:#D7AA28;">	
											<div align="center"  style="width:90px;height:28px; padding-top:4px; border-radius:4px;">		
												<span style="color: #fff;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;">设置图片</span> 
											</div>
										</div>
									
								</td>
							</tr>
						</table>
					</td>
					<td height="15" width="5"></td>
				</tr>
				
                <tr><td height="1" colspan="3"></td></tr>
                
				<tr>
					<td height="1" width="5"></td>
					<td height="1" align="left" bgcolor="#F2E2E2"></td>
					<td height="1" width="5"></td>
				</tr>
                
                <?php	
						$intRowIndex = $intRowIndex + 1;
					}
					freeResult($result);	//释放数据库
					closeDb();				//关闭数据库
				?>
                
                
			<tr>
				<td height="8" width="5"></td>
				<td height="8" align="left"></td>
				<td height="8" width="5"></td>
			</tr>
		</table>
	</article>
	
    <script type="text/javascript">
	
		function SaveItemImg(selitemlist)
		{		
			window.location="itemimgsave.php?itmno=" + selitemlist + "&retv=";
		}
		/*
		function myView(strImgID) 
		{
			var r= new FileReader();
			var strFileName = 'xFile' + strImgID;
			
			f=document.getElementById(strFileName).files[0];
			r.readAsDataURL(f);
			r.onload=function  (e) 
			{
				var imgSize = f.size;
				
				//alert(imgSize);
				//在此处我们限制图片大小为200KB
				if(imgSize>200*1024)
				{
					alert('上传的图片的大于200KB,请重新选择');
					return false;
				}
				var imgName = 'show' + strImgID;
				document.getElementById(imgName).src=this.result;
				
				//显示上传按钮
				var DivButID = '#bmpUpImg' + strImgID;
				$(DivButID).show();
				
			};
			
		}
		
		//相应提交按钮事件处理部分
		function SaveItemImg(strImgID,selitemno)
		{		
			//开始保存图片路径
			var strret;
			//用ajax的“同步方式”调用一般处理程序
			$.ajax({
				url: "Fileupload.php?imgid=" + strImgID + "&itmno=" + selitemno ,
				async: false,//改为同步方式
				type: "POST",
				//data: {doid:1, rmid: "strRoomNo" },
				success: function (RetData) 
				{
					strret = RetData;
				}
			});
			alert(strret);
						
		}
		*/
		
	</script>
	
    
	
</section>

</body>
	
</html>