<!--#include file="conn.asp"-->
<!--#include file="ProductList.asp"-->

<%
strCurrMenu=GetVariable("mnid")
%>
<%
if GetVariable("action")="save" then 
	'下订餐单
	if Session("ProductList")="" then
		Response.Write "<script language='javascript'>alert('欢迎您来到，您尚未点订购任何商品！\n\n请您先到产品展示区选择您想要的商品');</script>"
	end if

	strUser=GetFormVariable("txtuser")	
	strAddr=GetFormVariable("txtaddress")	
	strPhote=GetFormVariable("txtphote")	
	strEmail=GetFormVariable("txtemail")	
	strNote=GetFormVariable("txtnote")
	
	strProduct=""
	'输出商品列表
	ProductList = Session("ProductList")		'商品ID列表
	ProductCount=Session("ProductCount")		'商品数量列表
	PtCounts = Split(ProductCount, ",")
	strSQL="Select * From web_product Where id In (" & ProductList & "0)"
	Rs.open strSQL,conn,1,1
	money=0
	strProduct=strProduct & "<table width=100% border=0 cellspacing=1 cellpadding=0>" 
	strProduct=strProduct & "  <tr> " 
	strProduct=strProduct & "    <td width=11% align=center>序号</td>" 
	strProduct=strProduct & "    <td width=32% align=center>商品名</td>" 
	strProduct=strProduct & "    <td width=21% align=right>单价</td>" 
	strProduct=strProduct & "    <td width=18% align=right>数量</td>" 
	strProduct=strProduct & "    <td width=18% align=right>小计</td>" 
	strProduct=strProduct & "  </tr>" 
	For i=1 to rs.recordcount
		if rs.eof then exit for
		
		xj=Rs("p_price") * Cint(PtCounts(i-1))
		 money=money+xj
		strProduct=strProduct & "  <tr> " 
		strProduct=strProduct & "    <td align=center>" & i & "</td>" 
		strProduct=strProduct & "    <td align=center>" & trim(Rs("p_name")) & "</td>" 
		strProduct=strProduct & "    <td align=right>￥" & trim(Rs("p_price")) & "</td>" 
		strProduct=strProduct & "    <td align=right>" & PtCounts(i-1) & "</td>" 
		strProduct=strProduct & "    <td align=right>￥" & xj & "</td>" 
		strProduct=strProduct & "  </tr>" 
		rs.movenext
	next
	strProduct=strProduct & "<tr>     <td colspan=5><strong>总计：￥" & money & "</strong></td>  </tr></table>"

	
	strSQL="Insert Into web_product_order(m_id,mn_id,o_addr,o_phote,o_user,o_email,o_note,o_product,o_productList,o_productCount) Values("
	strSQL=strSQL & "0" & trim(Session("UserID")) & ","
	strSQL=strSQL & "0" & GetVariable("mnid") & ","
	strSQL=strSQL & "'" & strAddr & "',"
	strSQL=strSQL & "'" & strPhote & "',"
	strSQL=strSQL & "'" & strUser & "',"
	strSQL=strSQL & "'" & strEmail & "',"
	strSQL=strSQL & "'" & strNote & "',"
	strSQL=strSQL & "'" & strProduct & "',"	
	strSQL=strSQL & "'" & ProductList & "',"	
	strSQL=strSQL & "" & cint(ProductCount) & ")"	
	conn.execute strSQL,0,1
	Response.Write "<script language='javascript'>alert('已经接收您的订单，谢谢您惠顾!');</script>"
end if
%>

<%
'++++++++++++++++++++++++++++++购物车操作+++++++++++++++++++++++++++++++
'
'添加商品
if GetVariable("action")="add" then
	call AddProduct(GetVariable("spid"),CInt(GetVariable("PtCount")))
end if

'删除商品
if GetVariable("action")="modify" then
	call ModifyProduct(GetVariable("spid"),CInt(GetVariable("PtCount")))
end if

'清空购物车
if GetVariable("action")="clear" then
	call clearProduct()
end if

%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<LINK href="common/style.css" rel=stylesheet>
<script language="JavaScript" src="common/JS_CheckForm.js"></script>
<script language="JavaScript">
function checkform(theform){
	if(!CheckEmpty(theform.key, "关键字")) return false;
	if(!CheckInteger(theform.price1, "最低价格")) return false;
	if(!CheckInteger(theform.price2, "最高价格")) return false;
}
</script>

<script language="JavaScript">
function checkform(theform){
	if(!CheckEmpty(theform.txtuser, "联系人")) return false;
	if(!CheckEmpty(theform.txtphote, "联系电话")) return false;
	if(!CheckEmpty(theform.txtaddress, "详细地址")) return false;
}
</script>

</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" BodyBegin>
<table width="776" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td width="8" height="108" background="images/shadow.gif"></td>
    <td width="760" height="108" valign="top"> 
      <!--#include file="top.asp"-->
      <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">
        <tr> 
          <td height="5"></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="580" height="150" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="579" height="150">
              <param name=movie value="images/we.swf">
              <param name=quality value=high>
              <embed src="images/we.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="579" height="150">
              </embed> 
            </object></td>
          <td width="180" background="images/cp.gif" height="150">&nbsp;</td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="580" height="29" valign="top"> 
            <table width="579" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td background="images/line.gif" height="8"></td>
              </tr>
            </table>
            <table width="579" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td bgcolor="#F76D31" height="27" valign="top"><font face="Arial Black" color="#FFFFFF"><font size="3"> 
                  &nbsp;&nbsp;<b>&nbsp;&nbsp;<img src="images/dian.gif" width="16" height="15"> 
                  &nbsp;<strong>订购商品</strong></b></font></font></td>
              </tr>
            </table>
            <table width="579" border="0" cellspacing="0" cellpadding="0" bgcolor="#F76D31" height="100%">
              <tr> 
                <td width="579" height="264"  valign="top" bgcolor="#FFFFFF"> 
                  <table width="90%" border="0" align="center">
                    <tr> 
                      <td  height="8"> <div align="center"></div></td>
                    </tr>
                    <tr> 
                      <td  height="23">您的位置 : <A href=".">首页</A> &gt; 订购商品 </td>
                    </tr>
                    <tr> 
                      <td height="1" background="images/linebg.gif"></td>
                    </tr>
                  </table>
                  <table width="520" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td width="16">&nbsp;</td>
                      <td width="490" height="300" valign="top"><table width="520" border="0" cellspacing="0" cellpadding="0">
                          <tr> 
                            <td width="16">&nbsp;</td>
                            <td width="490" height="200" valign="top"> <table width="98%" height="267" border="0" cellpadding="0" cellspacing="1">
                                <tr> 
                                  <td height="20" valign="top"> <table width="100%" height="20" border="0" cellpadding="0" cellspacing="1">
                                      <tr> 
                                        <td height="27" bgcolor="#FFFFFF"><strong><font color="#FFFFFF">&nbsp;</font>您预订的商品清单：</strong></td>
                                      </tr>
                                      <tr> 
                                        <td height="67" valign="top"> <table width="95%" border="0" align="center" cellpadding="2" cellspacing="1">
                                            <tr> 
                                              <td width="43%" height="18" bgcolor="#EEEEEE"><strong>商品名称</strong></td>
                                              <td width="16%" align="center" bgcolor="#EEEEEE"><strong>数量</strong></td>
                                              <td width="18%" align="center" bgcolor="#EEEEEE"><strong>价格</strong></td>
                                              <td width="23%" align="center" bgcolor="#EEEEEE"><strong>删除 
                                                </strong></td>
                                            </tr>
                                            <SCRIPT language=javascript>
						<!--
							function SetCount(strID,strCount){
								if (CheckValue(strCount)){
									window.location="shopping.asp?action=modify" + "&spid=" + strID + "&PtCount=" + strCount;
								}
							}
							
							function DeleProduct(strID){
								window.location="?action=modify" + "&spid=" + strID + "&PtCount=0&mnid=<%=strCurrMenu%>";
							}
							
							function clearProduct(){
								window.location="shopping.asp?action=clear";
							}
							
							function buy(){
								window.open("dc.asp");
							}
							
						//-->
					  </SCRIPT>
                                            <%
				'输出商品列表
				ProductList = Session("ProductList")		'商品ID列表
				ProductCount=Session("ProductCount")		'商品数量列表
				PtCounts = Split(ProductCount, ",")
				
				strSQL="Select * From web_product Where id In (" & ProductList & "0)"
				set Rs=Server.CreateObject("ADODB.RecordSet")
				Rs.open strSQL,conn,1,1
				money=0
				if rs.recordcount=0 then 
					response.Write("<tr bgcolor=#FFFFFF><td colspan=4>欢迎您来到，您尚先购任何商品！</td></tr>")
				end if
				For i=1 to rs.recordcount
					if rs.eof then exit for
				%>
                                            <tr> 
                                              <td height="18"><%=trim(Rs("p_name"))%></td>
                                              <td width="16%" align="center"><%=PtCounts(i-1)%>件</td>
                                              <td width="18%" align="center"><%=trim(Rs("p_price"))%>/件</td>
                                              <td width="23%" align="center"><a href="javascript:DeleProduct('<%=rs("id")%>')"><img src="images/shanchu.gif" width="36" height="15" border="0"></a> 
                                                <%
				  xj=Rs("p_price") * Cint(PtCounts(i-1))
				  money=money+xj
				  %>
                                              </td>
                                            </tr>
                                            <%
					rs.movenext
				next
				%>
                                            <tr> 
                                              <td height="1" colspan="4" align="center" bgcolor="#EEEEEE"> 
                                                <table width="98%" border="0" cellspacing="0" cellpadding="0">
                                                  <tr> 
                                                    <td height="1" bgcolor="#666666"></td>
                                                  </tr>
                                                </table></td>
                                            </tr>
                                            <tr> 
                                              <td colspan="2" bgcolor="F5F5F5"><a href="javascript:;" onClick="window.open('shopping.asp?mnid=<%=strCurrMenu%>','','width=580,height=250,scrollbars=yes,resizable=yes');">查看购物车<img src="images/buy.gif" alt="" width=60 height=20 border="0" align="absmiddle"></a></td>
                                              <td align="right" bgcolor="#EEEEEE">合计：</td>
                                              <td width="23%" align="center" bgcolor="#EEEEEE"><font color="#FF0000"><strong><%=money%></strong></font>元 
                                              </td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                    </table></td>
                                </tr>
                                <tr> 
                                  <td valign="top"> <form name="orderform" method="post" onSubmit="return checkform(this)" action="?action=save&mnid=<%=strCurrMenu%>">
                                      <table border="0" width="480" height="132" bordercolorlight="#000000" cellspacing="0" cellpadding="5" bordercolordark="#E8E8E8">
                                        <tr bgcolor="#CfCfCf"> 
                                          <td height="26" colspan="3"><strong>填写订单：</strong></td>
                                        </tr>
                                        <tr> 
                                          <td height="26" width="73" align="right">联系人：</td>
                                          <td height="26" colspan="2"><input name="txtuser" type="text" id="txtuser3" size="18">
                                            *必填</td>
                                        </tr>
                                        <tr> 
                                          <td height="27"  align="right">联系电话：</td>
                                          <td height="27" colspan="2"><input name="txtphote" type="text" id="txtphote" size="18">
                                            *必填 </td>
                                        </tr>
                                        <tr> 
                                          <td height="26" width="73" align="right">E_mail：</td>
                                          <td height="26" colspan="2"><input type="text" name="txtemail" size="31"> 
                                          </td>
                                        </tr>
                                        <tr> 
                                          <td height="24" align="right">详细地址：</td>
                                          <td height="24" colspan="2"> <input type="text" name="txtaddress" size="31">
                                            *必填，尽量详细</td>
                                        </tr>
                                        <tr> 
                                          <td height="1" align="right">订购备注：</td>
                                          <td width="230" height="1"><textarea name="txtnote" cols="31" rows="4" id="txtnote" ></textarea></td>
                                          <td width="147" height="1">&nbsp;</td>
                                        </tr>
                                        <tr> 
                                          <td height="1" width="73" align="right">&nbsp;</td>
                                          <td height="1"><input type="submit" name="Submit" value="提交"> 
                                            <input type="reset" name="Submit2" value="重置"></td>
                                          <td height="1">&nbsp;</td>
                                        </tr>
                                      </table>
                                    </form></td>
                                </tr>
                              </table></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
            </table>
          </td>
          <td width="180" bgcolor="#EAEAEA" height="29" valign="top"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td background="images/news.gif" height="40"><font color="#FFFFFF" class="unnamed2">　　　　<b>产品搜索</b></font></td>
              </tr>
            </table>
            <form name="form1" method="post" action="product.asp?" onSubmit="return checkform(this)">
              <table width="156" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr> 
                  <td width="58" height="8" align="right"></td>
                  <td width="98" height="8"></td>
                </tr>
                <tr> 
                  <td width="58" height="26" align="right">分　类：</td>
                  <td width="98" height="26"> <select name="class" id="class" style="width:80px">
                      <option value="">全部产品</option>
                      <%
								'开始输出分类
								strSQL="Select * From web_product_class Where mn_id=" & strCurrMenu & " Order by c_index"
								Set rs=Server.CreateObject("ADODB.RecordSet")
								rs.open strSQL,conn,1,1
								for i=1 to rs.recordcount
								%>
                      <option value="<%=rs("id")%>"><%=trim(rs("c_name"))%></option>
                      <%
									rs.movenext
								next
								%>
                    </select> </td>
                </tr>
                <tr> 
                  <td height="26" align="right">关键字：</td>
                  <td height="26"> <input name="key" type="text" id="key" size="14" maxlength="50" style="width:80px"> 
                  </td>
                </tr>
                <% if showPrice<>"none" then %>
                <tr> 
                  <td height="26" align="right">价　格：</td>
                  <td height="26"> <input name="price1" type="text" id="price1" size="2" maxlength="5" style="width:30px">
                    到 
                    <input name="price2" type="text" id="price2" size="2" style="width:30px"> 
                  </td>
                </tr>
                <%end if%>
                <tr align="left"> 
                  <td height="30" colspan="2"> <table width="156" height="40" border="0" cellpadding="0" cellspacing="0">
                      <tr> 
                        <td width="117" height="40" align="right"> <input name="imageField" type="image" src="images/search1.gif" width="82" height="24" border="0" style="border:0"> 
                        </td>
                        <td width="39" height="40" valign="bottom">&nbsp;&nbsp;</td>
                      </tr>
                    </table></td>
                </tr>
              </table>
            </form>
            <!--Link Begin-->
            <%
							isLink=GetKey("Enable",WebUserID,"link")
							if isLink="Yes" then
							%> 
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td background="images/news.gif" height="40"><font color="#FFFFFF" >　　　　<b>友情链接</b></font></td>
              </tr>
            </table>
            <table width="100%" border="0" cellpadding="7" cellspacing="0">
              <tr> 
                <td height="107" align="center"  valign="top"> 　 <br> <script language="JavaScript" src="admin/link/link.asp"></script>
                </td>
              </tr>
            </table>
                              <%
							  end if
							  %> 
                              <!--Link End-->
			
          </td>
        </tr>
      </table>
    </td>
    <td width="8" height="108" background="images/shadow2.gif"></td>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="776" id="AutoNumber7" height="53" align="center">
  <tr> 
    <td width="8" background="images/shadow.gif" height="53" rowspan="2"></td>
    <td width="743" height="4" bgcolor="#000000"></td>
    <td width="8" background="images/shadow2.gif" height="53" rowspan="2"></td>
  </tr>
  <tr> 
    <td width="760" height="85"> <p align="center" >公司地址：未知<br>电话： E-Mail:1235@123.com.cn<br>Copyright&copy;2005-2006 1234 All Rights Reserved.<br><br>
        您是本站第<script language="JavaScript" src="admin/count/counter.asp"></script>位访问者 </td>
  </tr>
</table>
<script language="JavaScript" src="common/init.js"></script><br><script language=Javascript src="common/tranbig5.Js"></script>
</body>
</html>

