<?php
	session_start();
	require_once("../Wx.Config.php");	//只加载一次
	
	$strselcarttempid = trim($_SESSION["main_defcarttempid"]);
	$_SESSION["main_defcarttempid"]="";
	$_SESSION["main_defcarttempid"] = $strselcarttempid;
	
	$strIndexPage = trim($_SESSION["main_defPageIndex"]);
	if(strlen($strIndexPage)<1)
	{
		$strIndexPage = "index.php";
	}
?>

<!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");
	
	$strselDListNo=trim($_SESSION["main_posChainDListNo"]);
	
	//得到当前部门名称
	$intWXIngegPayFlag=0;
	$strSelDepChainNo='';
	
	$sql = sprintf("SELECT Chain_No,wxintegprice FROM TCP_Depart_Inform Where ListNo=%s",$strselDListNo);
	$result = querySql($sql);
	
	if($row = fetch_array($result))
	{
		$intWXIngegPayFlag = $row['wxintegprice'];
		$strSelDepChainNo = $row['Chain_No'];
	}
	freeResult($result);	//释放数据库
	
	$fltintegralcashrate = 0;
	if($intWXIngegPayFlag>0)
	{
		$sql=sprintf("SELECT IntegralCashRate from VIP_Config");
		$result = querySql($sql);
		
		if($row = fetch_array($result))
		{
			$fltintegralcashrate = $row['IntegralCashRate'];
		}
		freeResult($result);	//释放数据库
	}
	
	$fltsumvalue = 0;
	$intsumcount = 0;

?>

<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="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">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                
                <?php 
					//将点单说明获取到临时记录集里
					$intRemarksCount=0;
					$sql = sprintf("SELECT Item_Name From TR_Basic_Item WHERE Item_Type='CP点单说明' AND (Chain_No='%s' OR Chain_No='')",$strSelDepChainNo);
					$resDDZF = querySql($sql);	//点单做法
					while($rowDD = fetch_array($resDDZF))
					{
						$intRemarksCount=$intRemarksCount+1;
					}
					
					
					$intRowIndex = 0;
					
					$sql = sprintf("select ListNo,Item_No,Item_Name,Item_Unite,Remarks,wximage,Item_Price,Item_Count 
						from WX_Temp_List Where CartTempID='%s' And DListNo=%s",$strselcarttempid,$strselDListNo);
					
					$result = querySql($sql);
	
					while($row = fetch_array($result))
					{
						$strlistno = $row['ListNo'];
						$stritemno = $row['Item_No'];
						$stritemname = $row['Item_Name'];
						$fltprice = $row['Item_Price'];
						$stritemunite = trim($row['Item_Unite']);
						$strremarks = trim($row['Remarks']);
						$stritemimg = trim($row['wximage']);
						
						$intitemcount = $row['Item_Count'];;
						
						//合计金额	
						$fltitemvalue = round($fltprice * $intitemcount,1);
						
						$fltsumvalue = $fltsumvalue + $fltitemvalue;
						$intsumcount = $intsumcount + $intitemcount;
						
						$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;
					
						//$strremarks2 = $strremarks;
						if(strlen($strremarks)>28)
						{
							$strremarks	=  mb_substr($strremarks,0,28,'utf-8').'...';
						}
					
					
						$intRowIndex = $intRowIndex + 1;
				?>
                <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="110" width="140"><a href="#"><IMG src="<?php echo $stritemimg; ?>" width="140" height="110" border="0" style="border-radius:3px;"></a></td>
								<td height="110" width="10"></td>
								<td height="110">
                                
                                	<!---显示商品信息：图片，项目名称，单价，对应积分，项目说明 -->
                                    <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:16px;"><?php echo $stritemname; ?></span> 
										</td></tr>
                                            
										<tr><td height="20"> 
											<?php if($intWXIngegPayFlag>0) { ?>
												<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 width="13" height="100%">
															<?php if($striteminteg>0) { ?>
															<img src="images\jfimg.png" width="12" height="15" border="0" style="margin-top:3px;">
															<?php } ?>
														</td>
														<td height="100%">
															<?php if($striteminteg>0) { ?>	                                                    
															<span style="color: #996600;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;"><?php echo $striteminteg; ?></span> 
															 <?php } ?>
														</td>
													</tr>
												 </table>					
											<?php }  else  { ?>
												<span style="color: #996600;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;">￥<?php echo $stritemprice.$stritemunite; ?></span> 
											<?php } ?>
										</td></tr>
										
                                        <tr><td height="40" valign="top">
											<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                                            	<tr>													
													<td width="38" height="38" align="right" valign="middle">
                                                    	 <div >
                                                            <img onClick="bmtRefreshItemCount('<?php echo $intRowIndex;?>',1,'<?php echo $strlistno;?>')" src="images\add9.png" width="26" height="26" border="0" style="margin-top:3px;">
                                                         </div>
                                                    </td>
                                                    <td width="37" height="38" align="center" valign="middle">
                                                    	<span id="myspan<?php echo $intRowIndex;?>" style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;"><?php echo $intitemcount;?></span> 
                                                    </td>
                                                    <td width="38" height="38" align="left" valign="middle">
                                                         <div >
	                                                        <img onClick="bmtRefreshItemCount('<?php echo $intRowIndex;?>',0,'<?php echo $strlistno;?>')" src="images\sub9.png" width="26" height="26" border="0" style="margin-top:3px;">
                                                         </div>
                                                    </td>
                                                    <td height="38" align="center" valign="middle">
													<?php if($intRemarksCount>0) { ?>
														<a data-transition="slide" href="#ShowItemRemarks<?php echo $intRowIndex;?>" data-rel="popup" data-position-to="window" style="width:100%;height:10px;margin:0px auto 0px auto;color:#666666;text-decoration: none;">
															<div data-rel="back" style="border-radius:12px;width:40px; height:24px; 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:13px;text-shadow:none;">做法</span>                            	
																	</td></tr>
																</table>
															</div>
														</a>
					
														<!-- 以下是点击项目弹出的详细信息界面 -->
														<div data-role="popup" id="ShowItemRemarks<?php echo $intRowIndex;?>" data-corners="false">
															<a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a>
															<table width="280" height="450" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
																<tr><td height ="2" colspan="3" align="center"></td></tr>
																<tr><td height ="35" colspan="3" align="center"><span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;"><?php echo $stritemname; ?></span></td></tr>
																<tr><td height ="1" colspan="3" align="center" bgcolor="#F2E2E2"></td></tr>
																											
																 <tr>
																	<td height ="315" width="10"></td>
																	<td height ="315">
																		<div style="width:100%; height:315px;">
																			<table width="100%" height="10" border="0" cellpadding="0" cellspacing="0">
																			<?php 
																				
																				$strSelItemText1='';
																				$strSelItemText2='';
																				$strSelItemText3='';
																				
																				$intSubRowIndex=0;
																				
																				fetch_array_frist($resDDZF);	//重置结果集指针到第一行												
																																								
																				while($rowDD = fetch_array($resDDZF))
																				{
																					$intSubRowIndex = $intSubRowIndex+1;
																					
																					$strSelItemText1 = $rowDD['Item_Name'];
																					
																					if($rowDD = fetch_array($resDDZF))
																					{
																						$strSelItemText2 = $rowDD['Item_Name'];
																						if($rowDD = fetch_array($resDDZF))
																						{
																							$strSelItemText3 = $rowDD['Item_Name'];
																						}
																						else
																						{
																							$strSelItemText3='';
																						}
																					}
																					else
																					{
																						$strSelItemText2='';
																						$strSelItemText3='';
																					}
																					
																					$strHadeSelFlag1='f2f2f2';
																					$strHadeSelFlag2='f2f2f2';
																					$strHadeSelFlag3='f2f2f2';
																				
																					//判断是否已经选择了
																					if(strlen($strremarks)>0)
																					{
																						if(strlen($strSelItemText1)>0)
																						{
																							if (strpos($strremarks, $strSelItemText1) !== false) 
																							{
																								$strHadeSelFlag1='D7AA28';
																							}
																						}
																						if(strlen($strSelItemText2)>0)
																						{
																							if (strpos($strremarks, $strSelItemText2) !== false) 
																							{
																								$strHadeSelFlag2='D7AA28';
																							}
																						}
																						if(strlen($strSelItemText3)>0)
																						{
																							if (strpos($strremarks, $strSelItemText3) !== false) 
																							{
																								$strHadeSelFlag3='D7AA28'; 
																							}
																						}
																					}
																			?>
																				<tr>
																					<td height ="45" width="33%" align="center" >
																						<div id="labItemRemarksSub<?php echo $intSubRowIndex;?>1<?php echo $intRowIndex;?>" onClick="bmtSetItemSubCheck('<?php echo $intSubRowIndex;?>','1','<?php echo $intRowIndex;?>','<?php echo $strSelItemText1;?>')"  style="border-radius:5px; width:95%; height:25px;background-color:#<?php echo $strHadeSelFlag1;?>;padding-top:5px;">
																							<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strSelItemText1;?></span>
																						</div>
																					</td>
																					<td height ="45" width="34%" align="center">
																						<?php if(strlen($strSelItemText2)>0) {?>
																						<div id="labItemRemarksSub<?php echo $intSubRowIndex;?>2<?php echo $intRowIndex;?>" onClick="bmtSetItemSubCheck('<?php echo $intSubRowIndex;?>','2','<?php echo $intRowIndex;?>','<?php echo $strSelItemText2;?>')" style="border-radius:5px; width:95%; height:25px;background-color:#<?php echo $strHadeSelFlag2;?>;padding-top:5px;">
																							<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strSelItemText2;?></span>
																						</div>
																						<?php } ?>
																					</td>
																					<td height ="45" width="33%" align="center">
																						<?php if(strlen($strSelItemText3)>0) {?>
																						<div id="labItemRemarksSub<?php echo $intSubRowIndex;?>3<?php echo $intRowIndex;?>" onClick="bmtSetItemSubCheck('<?php echo $intSubRowIndex;?>','3','<?php echo $intRowIndex;?>','<?php echo $strSelItemText3;?>')" style="border-radius:5px; width:95%; height:25px;background-color:#<?php echo $strHadeSelFlag3;?>;padding-top:5px;">
																							<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strSelItemText3;?></span>
																						</div>
																						<?php } ?>
																					</td>
																				</tr>
																			

																			<?php
																				}
																			?>
																			</table>
																		</div>
																	</td>
																	<td height ="315" width="10"></td>
																</tr>
																
																<tr>
																	<td height ="40" width="10"></td>
																	<td height ="40" align="center" valign="top">
																		<span id="labSubItemRemarks<?php echo $intRowIndex;?>" style="color: #a09090;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;"><?php echo $strremarks; ?></span>
																	</td>
																	<td height ="40" width="10"></td>
																</tr>
																
																<tr>
																	<td height ="40" width="10"></td>
																	<td height ="40" align="center">
																		<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
																			<tr>
																				<td height ="40" width="60%" align="center">
																					<div data-rel="back" onClick="bmtSetItemRemarksFinish(1,<?php echo $strlistno;?>,'<?php echo $intRowIndex;?>')" style="border-radius:19px;width:100px; height:35px; background-color:#c39617;">
																						<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:14px;text-shadow:none;">应用所有</span>                            	
																							</td></tr>
																						</table>
																					</div>
																				</td>
																				
																				<td height ="40" width="40%" align="center">
																					<div data-rel="back" onClick="bmtSetItemRemarksFinish(0,<?php echo $strlistno;?>,'<?php echo $intRowIndex;?>')" style="border-radius:19px;width:90px; height:35px; 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:14px;text-shadow:none;">确认</span>                            	
																							</td></tr>
																						</table>
																					</div>
																				</td>
																			</tr>
																		</table>
																		
																	</td>
																	<td height ="40" width="10"></td>
																</tr>
																
																<tr><td height ="17" colspan="3" align="center"></td></tr>
															
															</table>
														</div>
														<!----------------------------------------------------->	
															
															
															
															
															
															
															
															
															
															
													<?php } ?>
													
													
                                                    </td>
                                                    <td width="38" height="38" align="left" valign="middle">
														<div >
                                                            <img onClick="bmtDeleteOnItem('<?php echo $strlistno;?>')" src="images\del.png" width="24" height="24" border="0" style="margin-top:3px;">
                                                         </div>
                                                    </td>
                                                </tr>
                                            </table>
										</td></tr>
										
										<tr>
											<td height="20">
												<span id="labItemRemarks<?php echo $intRowIndex;?>"  style="color: #a09090;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;"><?php echo $strremarks; ?></span> 
											</td>
										</tr>
										
										<tr><td height="5"></td></tr>
									</table>
                                        
                                        
                                    
								</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	
						
					}
					freeResult($result);	//释放数据库
					freeResult($resDDZF);	//释放数据库
					closeDb();				//关闭数据库
				?>
                
                
			<tr>
				<td height="8" width="5"></td>
				<td height="8" align="left"></td>
				<td height="8" width="5"></td>
			</tr>
		</table>
	</article>
	    
	    
	<footer data-role="footer" data-position="fixed" data-tap-toggle="false" style="border-top:0px solid #F6F5F2;border-bottom:0px solid #F6F5F2;border-left:0px solid #F6F5F2;border-right:0px solid #F6F5F2;">
		<table width="100%" height="45" border="0" cellpadding="0" cellspacing="0" bgcolor="#FAFAFA">
			<tr height="40" valign="top">
				<td colspan="4" style="border-top:1px solid #F7EEEE;" bgcolor="#fff">
					<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                     	<tr>
                        	<td height="40" width="10%" align="right" valign="middle"></td>
                            <td height="40" align="right" valign="middle">
                            	<span id="spansum1" style="color: #E50015;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:15px;">合计：￥<?php echo number_format($fltsumvalue,1);?></span> 
                            </td>
                            <td height="40" width="5" align="right" valign="middle"></td>
                            <td height="40" width="55%" align="right" valign="middle">
                            	<div data-rel="back" onClick="bmtSaveBillFromCart()" style="border-radius:1px;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 id="spansum2" style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;">结算下单(<?php echo number_format($intsumcount,0);?>)</span>
                                 			</td>
                                        </tr>
                                 	</table>
                               	</div>
                            </td>
                    	</tr>
                 	</table>
				</td>

			</tr>
			
			<tr height="100%" valign="middle" align="center">
				<td width="33%" style="border-top:1px solid #F6F5F2;">
					<div onClick="window.location='<?php echo $strIndexPage;?>';"  style="width:100%;height:100%;padding-top:5px;">
						<div style="width:24px;height:20px;">
							<img src="images\p1_a.png" width="20" height="20" border="0">
						</div>
						<span style="color:#747474;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:11px;text-shadow:none;">首页</span>
					</div>
				</td>
				<td width="34%" style="border-top:1px solid #F6F5F2;border-left:0px solid #F6F5F2;">
					<div style="width:100%;height:100%;padding-top:5px;">
						<div style="width:24px;height:20px;">
							<img src="images\p3_b.png" width="20" height="20" border="0">
						</div>
						<span style="color:#747474;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:11px;text-shadow:none;padding-left:4px;">已点单</span>
					</div>
				</td>
				<td width="33%" style="border-top:1px solid #F6F5F2;border-left:0px solid #F6F5F2;">
					<div onClick="window.location='orderlist.php?bstat=0';" style="width:100%;height:100%;padding-top:5px;">
						<div style="width:24px;height:20px;">
							<img src="images\p2_a.png" width="24" height="20" border="0">
						</div>
						<span style="color:#747474;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:11px;text-shadow:none;">我的帐单</span>
					</div>
				</td>
				<!--
				<td width="25%" style="border-top:1px solid #F6F5F2;border-left:0px solid #F6F5F2;">
					<div onClick="window.location='vipmain.php';" style="width:100%;height:100%;padding-top:5px;">
						<div style="width:24px;height:20px;">
							<img src="images\p4_a.png" width="20" height="20" border="0">
						</div>
						<span style="color:#747474;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:11px;text-shadow:none;">我的</span>
					</div>
				</td>
				-->
			</tr>
		</table>						
	</footer>
	    
    
	 <script type="text/javascript">
	 
		//id="labItemRemarksSub1<?php echo $intRowIndex;?>" onClick="bmtSetItemSubCheck(<?php echo $intRowIndex;?>,<?php echo $strSelItemText1;?>)" 
		function bmtSetItemSubCheck(intSubRowIndex,intSubID,intRowIndex,strItemText)
		{
			//原有做法
			var strLableID='labSubItemRemarks' + intRowIndex;
			var strNowText=document.getElementById(strLableID).innerHTML;
			
			var strDivID='labItemRemarksSub' + intSubRowIndex + intSubID + intRowIndex;
			
			//判断是否已经在原有做法里
			if(strNowText.includes(strItemText))
			{
				//alert("已经在");
				//将已经在的删除掉
				strNowText=strNowText.replace(strItemText, "");
				strNowText=strNowText.replace(",,", ",");
				
				//判断第一个字符是否是,
				if(strNowText.charAt(0)==',')
				{
					strNowText = strNowText.substring(1);
				}
				
				var intLength=strNowText.length;
				if(intLength>0)
				{
					intLength=intLength-1;
					if(strNowText.charAt(intLength)==',')
					{
						strNowText = strNowText.substring(0,intLength);
					}
				}
				
				//设置新的说明显示
				document.getElementById(strLableID).innerHTML=strNowText;
				
				//设置状态为未选择
				document.getElementById(strDivID).style.backgroundColor = '#f2f2f2';
			}
			else
			{
				//alert("不在");
				if(strNowText.length>0)
				{
					strNowText = strNowText + ',' + strItemText;
				}
				else
				{
					strNowText = strItemText;
				}
				
				//设置新的说明显示
				document.getElementById(strLableID).innerHTML=strNowText;
				
				//设置状态为选择
				document.getElementById(strDivID).style.backgroundColor = '#D7AA28';
			}
			
		};
		
		
		//确认做法
		function bmtSetItemRemarksFinish(intToALLFlag,lngItemListNo,intRowIndex)
		{
			//做法
			var strLableID='labSubItemRemarks' + intRowIndex;
			var strNowText=document.getElementById(strLableID).innerHTML;
			
			
			//开始更新菜品点单说明
			var strurl="carmodifyremarks.php?selbillno=" + lngItemListNo + "&strtxt=" + strNowText + "&allflg=0";
			if(intToALLFlag>0)
			{
				strurl="carmodifyremarks.php?selbillno=" + lngItemListNo + "&strtxt=" + strNowText + "&allflg=" + intToALLFlag;
			}
			
			//alert(strurl);
			
			var strret="";
			//用ajax的“同步方式”调用一般处理程序
			$.ajax({
				url: strurl ,
				async: false,//改为同步方式
				type: "POST",
				//data: {doid:1, rmid: "strRoomNo" },
				success: function (RetData) 
				{
					strret = RetData;
				}
			});
			
			//alert(strret);
			
			if(strret='RET1')
			{
				if(intToALLFlag>0)
				{
					//重新加载页面
					window.location="cartlist.php";
				}
				else
				{
					//更新到已点列表中
					strLableID='labItemRemarks' + intRowIndex;
					document.getElementById(strLableID).innerHTML = strNowText;
					
					
					//关闭窗体
					strLableID='#ShowItemRemarks' + intRowIndex;
					$(strLableID).popup('close');
				}
			}
			
		};
	 
	 
		//删除一个项目
		function bmtDeleteOnItem(clistno)
		{
			
			var strurl="delcartitem.php?clistno=" + clistno;
			var strret="";
			//用ajax的“同步方式”调用一般处理程序
			$.ajax({
				url: strurl ,
				async: false,//改为同步方式
				type: "POST",
				//data: {doid:1, rmid: "strRoomNo" },
				success: function (RetData) 
				{
					strret = RetData;
				}
			});
			
			if(strret.length>0)
			{
				//得到新的数量值
				window.location="cartlist.php";
			}
			
		};

		//修改数量
		function bmtRefreshItemCount(myspanid,doid,clistno)
		{						
			//得到要操作的span项目
			var myspan = "myspan" + myspanid.toString().trim();
			//得到原来的数量
			var strCount = document.getElementById(myspan).innerHTML;
			var intNewCount = parseInt(strCount); 
			
			var strurl="";
			
			if(doid>0)
			{
				strurl = "savecartcount.php?doid=1&clistno=" + clistno;
				//intNewCount = intNewCount +1;
			}
			else
			{
				if(intNewCount>0)
				{
					//intNewCount = intNewCount - 1;
					strurl = "savecartcount.php?doid=0&clistno=" + clistno;
				}
			}

			//将数量转为字符
			//strCount = intNewCount.toString().trim();
			
			if(strurl.length>0)
			{
				var strret="";
				//用ajax的“同步方式”调用一般处理程序
				$.ajax({
					url: strurl ,
					async: false,//改为同步方式
					type: "POST",
					//data: {doid:1, rmid: "strRoomNo" },
					success: function (RetData) 
					{
						strret = RetData;
					}
				});
				
				if(strret.length>0)
				{
					//得到新的数量值,开始分解数据 2*8*256.2
					var strNewCount;
					var strSumCount;
					var strSumValue;
					
					var intpos = strret.indexOf("*");
					strNewCount = strret.substr(0,intpos);
					
					if(strNewCount<=0)
					{
						window.location="cartlist.php";	
						return;
					}
					
					strret = strret.substr(intpos+1);
					intpos = strret.indexOf("*");
					strSumCount = strret.substr(0,intpos);
					
					strret = strret.substr(intpos+1);
					strSumValue = strret;
					
					//alert(strret);
					
					//显示新调整后的数量
					document.getElementById(myspan).innerHTML = strNewCount;
					document.getElementById("spansum1").innerHTML = "合计：￥" + strSumValue;
					document.getElementById("spansum2").innerHTML = "结算下单(" + strSumCount + ")";
				}
			}			
		};
		
		
		
		//相应提交按钮事件处理部分
		function bmtSaveBillFromCart()
		{			
						
			//2.判断是否登录系统		
			/*
			var strviplogined = '<?php echo $_SESSION["main_viplogined"];?>';
			var strvipno = '<?php echo $_SESSION["main_vipno"];?>';
			if(strviplogined!="1" | strvipno=="")
			{
				//没有登录开始启动登录
				window.location = 'login.php?stext=';
				return;
			}
			*/
			
			//3.开始从购物车中创建订单			
			var strret;
			//用ajax的“同步方式”调用一般处理程序
			$.ajax({
				url: "ordersave.php",
				async: false,//改为同步方式
				type: "POST",
				//data: {doid:1, rmid: "strRoomNo" },
				success: function (RetData) 
				{
					strret = RetData;
				}
			});

			if(strret.length>10)
			{
				//创建订单成功,得到订单号,启动订单支付界面
				var strResault = strret.substr(0,1);
				var strNewBillNo = strret.substr(1);

				window.location="ordermodify.php?selbillno=" + strNewBillNo;
			}
										
		}
		
	</script>
	
</section>

</body>
	
</html>