<!--#include file="Include/Const.asp" -->
<!--#include file="Include/NoHackSql.Asp" -->
<!--#include file="Include/ConnSiteData.asp" -->
<!--#include file="Cart.Asp" -->

<%call SiteInfo
headid=3
if ISHTML = 1 then
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.CacheControl = "no-cache"
End If

dim Products
dim mMemID,mRealName,mSex,mCompany,mAddress,mZipCode,mTelephone,mFax,mMobile,mEmail
if session("MemName")<>"" and session("MemLogin")="Succeed" then
  call MemInfo()
else
  mSex="先生"
  mMemID=0
end if
%>

<!--#include file="Head.Asp" -->
<div id='index_wrapper'>
<div id=best-r class="best" style="width:586px;float:left">
<div id=best-sc>
<div class=best-tb>
<a style="width:80px;">当前位置：</a>
<a>在线订购</a>
</div>
</div>
<div id=bests>

<table cellspacing="0" cellpadding="0" width="98%" bgcolor="#ffffff" border="0" align="center">
    <tbody>
        <tr>
          <td height="18">&nbsp;</td>
        </tr>
        <tr>
          <td>
	<% call ProductList() %>
<table width="560" border="0" align="center" cellpadding="0" cellspacing="0">
   <tr>
     <td height="25">
	 <form action="ProductBuy.asp" method="post" name="formshop">
       <table width="100%" border="1" cellspacing="0" bordercolor="#C3E1F7" cellpadding="0" class="tableBorder" > 
         <tr>
           <th width="20%" height="25" align="center" class="forumRow">序号</th>
           <th width="36%" align="center" class="forumRow">物品名称</th>
           <th width="12%" align="center" class="tb_tbl">物品数量</th>
           <th width="20%" align="center" class="tb_tbl">物品单价/元</th>
           <th width="10%" align="center" class="tb_tbl">操作</th>
         </tr>
<%
Dim acction
acction=Trim(request("CartXiugai"))
select case acction
Case "shanchu"
Call uCart.ModifItem(request.QueryString("id"),CInt(request.QueryString("shuliang")),3)
Case "修改"
pro_id=request("id")
numbercount=request("xiugaishuliang")
arr_id=Split(Replace(pro_id," ",""),",")
arr_number=Split(Replace(numbercount," ",""),",")
For i = 0 To UBound(arr_id)
Call uCart.ModifItem(arr_id(i),CInt(arr_number(i)),2)
Next
end Select
'定义购物车
mycart=uCart.ViewCart()
For i =LBound(myCart,2) to UBound(myCart,2)
if myCart(0,i)<>"" Then 
%>
         <tr onMouseOver="this.style.backgroundColor='#DEEFFB'" onMouseOut="this.style.backgroundColor='#FFFFFF'">
           <td height="25" align="center"  class="forumRow"><input type="hidden" name="id" size="10" value="<%=myCart(0,i)%>"> <%=myCart(0,i)%></td>
           <td align="center"  class="forumRow"><%=StrLeft(myCart(1,i),20)%></td>
           <td align="center"  class="forumRow"><input style="border:#cccccc 1px solid" name="xiugaishuliang" type="text" size="16" value="<%=myCart(5,i) %>" onChange="if(isNotaNumber(this.value)==true){alert('请输入整数数字');this.value=1;}else{this.value=''}"></td>
           <td align="center"  class="forumRow"><input type="hidden" name="pice1" size="10" value="<%=myCart(2,i)%>"><%=myCart(2,i)%></td>
            <input type="hidden" name="pice2" size="10" value="<%=myCart(3,i)%>">
           <td align="center"  class="forumRow"><a href="ProductBuy.asp?CartXiugai=shanchu&id=<%=myCart(0,i)%>&shuliang=<%=myCart(5,i) %>">删除</a>
		   </td>
         </tr>
<%
end if
next
%>

<tr>
<td colspan="5" align="right"> 
总价：<%

If Trim(uCart.TPrice()(0))="" Then 
Response.Write ("0")
Else 
Response.Write Formatnumber(uCart.TPrice()(0),2,-1,-1,0)
End If 
%> (元)	
<input type="submit" name="CartXiugai" value="修改">
</td>
</tr>
       </table>
	  </form>
	</td>
   </tr>
</table>	   
		  </td>
        </tr>
        <tr>
          <td><table width="98%" border="0" align="center" cellpadding="3" cellspacing="5">
              <form action="ProductBuySave.asp?MemberID=<%=mMemID%>" method="post" name="formBuy" id="formBuy">
                <tr>
                  <td width="17%" align="right">标题：</td>
                  <td width="83%"><input name="OrderName" type="text" id="OrderName" value="订购产品" size="40" maxlength="100" />
                    <font color="red">*</font></td>
                </tr>
                <tr>
                  <td align="right">相关说明：</td>
                  <td><input type="hidden" name="Products" value="<%=Products%>" />
                    <textarea name="Remark" cols="60" rows="8" id="Remark"></textarea></td>
                </tr>
                <tr>
                  <td align="right">联系人：</td>
                  <td><input name="RealName" type="text" id="RealName" value="<%=mRealName%>" size="20" maxlength="50" />
                    <font color="red">*</font></td>
                </tr>
                <tr>
                  <td align="right">性别：</td>
                  <td><input name="Sex" type="radio" value="先生" class="inputnoborder" <%if mSex="先生" then response.write ("checked")%> />
                    先生
                    <input type="radio" name="Sex" value="女士" class="inputnoborder" <%if mSex="女士" then response.write ("checked")%> />
                    女士 <font color="red">*</font></td>
                </tr>
                <tr>
                  <td align="right">单位名称：</td>
                  <td><input name="Company" type="text" id="Company" value="<%=mCompany%>" size="40" maxlength="100" />
                    <font color="red">*</font></td>
                </tr>
                <tr>
                  <td align="right">详细地址：</td>
                  <td><input name="Address" type="text" id="Address" value="<%=mAddress%>" size="40" maxlength="100" />
                    <font color="red">*</font></td>
                </tr>
                <tr>
                  <td align="right">邮政编码：</td>
                  <td><input name="ZipCode" type="text" id="ZipCode" value="<%=mZipCode%>" size="20" maxlength="20" />
                    <font color="red">*</font></td>
                </tr>
                <tr>
                  <td align="right">联系电话：</td>
                  <td><input name="Telephone" type="text" id="Telephone" value="<%=mTelephone%>" size="20" maxlength="50" />
                    <font color="red">*</font></td>
                </tr>
                <tr>
                  <td align="right">传真号码：</td>
                  <td><input name="Fax" type="text" id="Fax" value="<%=mFax%>" size="20" maxlength="50" />
                  <font color="red">*</font></td>
                </tr>
                <tr>
                  <td align="right">手机号码：</td>
                  <td><input name="Mobile" type="text" id="Mobile" value="<%=mMobile%>" size="20" maxlength="50" />
                  <font color="red">*</font></td>
                </tr>
                <tr>
                  <td align="right">电子信箱：</td>
                  <td><input name="Email" type="text" id="Email" value="<%=mEmail%>" size="30" maxlength="50" />
                    <font color="red">*</font></td>
                </tr>
                <tr>
                  <td align="right">验证码：</td>
                  <td><input name="CheckCode" type="text" size="6" maxlength="6" />
                    <a href="javascript:refreshimg()" title="看不清楚，换个图片。"><img src="../Include/CheckCode/CheckCode.asp" name="checkcode" align="absmiddle" id="checkcode" style="border: 1px solid #ffffff" /></a> <font color="red">*</font></td>
                </tr>
                <tr>
                  <td align="right">&nbsp;</td>
                  <td><input name="Submit" type="submit" value="立即订购以上产品" /></td>
                </tr>
              </form>
            </table></td>
        </tr>
        <tr>
          <td height="20">&nbsp;</td>
        </tr>
      </table>
</div>

</div>
<div id=best-r class="best" style="width:200px; float:right;">
<div id=best-sc>
<div class=best-tb>
<a style="width:100px;">本期其它团购</a>       
</div>
</div>

<div id=bests>
<table cellpadding="0" cellspacing="0" width="100%px" style="padding:6px;">
<tr><td align="center">
<%Call ListProducts("0,",1,6,186,160,"Products")%>
</td></tr></table>
</div>
</div>

<div style="clear:both;;*display:inline;overflow:;hidden;">
</div>
<div style="float:none;height:10px;"></div>
</div></div>
</div></div>

<!--#include file="Foot.Asp"-->

<%
'调用显示节点------------------------------
Function CallFolderView()
%>
<% Folder(0) %>
<%
End Function
'列出所有节点------------------------------
Function Folder(id)
  Dim rs,sql,i,ChildCount,FolderType,FolderName,onMouseUp,ListType,ViewFlag
  Set rs=server.CreateObject("adodb.recordset")
  sql="Select * From LiangJing_ProductSort where ViewFlag and ParentID="&id&" order by id"
  rs.open sql,conn,1,1
  if id=0 and rs.recordcount=0 then
    response.write ("No Information!")
    response.end
  end if  
  i=1
  response.write("<table border='0' cellspacing='0' cellpadding='0'>")
  while not rs.eof
    ChildCount=conn.execute("select count(*) from LiangJing_ProductSort where ParentID="&rs("id"))(0)
    if ChildCount=0 then
	  if i=rs.recordcount then
	    FolderType="SortFileEnd"
	  else
	    FolderType="SortFile"
	  end if
	  FolderName=rs("SortName")&"&nbsp;"&ViewFlag
	  onMouseUp=""
    else
	  if i=rs.recordcount then
	 	FolderType="SortEndFolderOpen"
		ListType="SortEndListline"
		onMouseUp="EndSortChange('a"&rs("id")&"','b"&rs("id")&"');"
	  else
		FolderType="SortFolderOpen"
		ListType="SortListline"
		onMouseUp="SortChange('a"&rs("id")&"','b"&rs("id")&"');"
	  end if
	  FolderName=rs("SortName")&"&nbsp;"&ViewFlag
    end if
 
	If ISHTML = 1 Then
    response.write("<tr>")
    response.write("<td width=""10"" height=""10"" nowrap id='b"&rs("id")&"' class='"&FolderType&"' onMouseUp="&onMouseUp&"></td><td nowrap><a href=""ProductClass-"&rs("ID")&"-1.html"">"&FolderName&"</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")	
    response.write("</td></tr>")
	Else
    response.write("<tr>")
    response.write("<td width=""10"" height=""10"" nowrap id='b"&rs("id")&"' class='"&FolderType&"' onMouseUp="&onMouseUp&"></td><td nowrap><a href=""ProductList.asp?SortID="&rs("ID")&""">"&FolderName&"</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")	
    response.write("</td></tr>")
	End If 
    if ChildCount>0 then
%>
      <tr id="a<%= rs("id")%>" style="display:none"><td class="<%= ListType%>" nowrap></td><td ><% Folder(rs("id")) %></td></tr>
<%
    end if
    rs.movenext
    i=i+1
  wend
  response.write("</table>")
  rs.close
  set rs=nothing
end function

'最新产品展示
Function ListProducts(SortPath,trs,tds,PicW,PicH,Oderder)
  dim rs,sql,tr,td,ProductName,SmallPicPath
  set rs = server.createobject("adodb.recordset")
  If Oderder="Products" Then
  sql="select top "&trs*tds&" * from liangjing_Products where Instr(SortPath,'"&SortPath&"')>0 and [AddTime] between dateadd('ww',-1,now()) and now() order by AddTime desc"
  Else 
  sql="select top "&trs*tds&" * from liangjing_Products where NewFlag  and Instr(SortPath,'"&SortPath&"')>0 order by "&Oderder&" desc,id desc"
  End If 
  rs.open sql,conn,1,1
  if rs.eof then
    response.write "暂无相关信息"
  Else

	
	for tr=1 to trs
        for td=1 to tds
	      if StrLen(rs("ProductName"))<=18 then
            ProductName=rs("ProductName")
	      else
	        ProductName=rs("ProductName")
	      end If
			If ISHTML = 1 Then
				AutoLink = ""&ProName&""&Separated&""&rs("ID")&"."&HTMLName&""
			Else
				AutoLink = "ProductView.asp?ID="&rs("id")&""
			End If
			SmallPicPath=HtmlSmallPic(rs("GroupID"),rs("SmallPic"),rs("Exclusive"))
		ChildCount=conn.execute("select count(*) from liangjing_Order where IsokMoney=true and ProductNo='"&rs("ProductNo")&"'")(0)
Response.Write "<tr><td align=""center"">"
Response.Write " <div id=""mian_border"">"
Response.Write "<div id=""mian_border_title""><a href="""&AutoLink&""">"&ProductName&"</a></div>"
Response.Write "<div id=""mian_border_1""><a href="""&AutoLink&""" target=""_blank"">"
Response.Write "<img src="""&SmallPicPath&""" alt="""" width="""&PicW&""" height="""&PicH&""" border=""0""></a></div>"
Response.Write "<div class=""Pricelist"">现价:<font style=""color:red;"">￥"&rs("N_Price")-rs("P_Price")&"</font>原价:￥"&rs("N_Price")&" <br/>节省:￥"&rs("P_Price")&"</div>"
Response.Write "<div><font style=""color:red;font-size:16px;"">"&ChildCount&"</font>人已订购 <a href="""&AutoLink&"""><img src=""images/dinggou.jpg"" width=""75px"" height=""25px""></a></div>"
Response.Write "</div>"
Response.Write " </td></tr>"
	      rs.movenext
		  if rs.eof then exit for
		next
		if rs.eof then exit for
	Next
  end if
  rs.close
  set rs=nothing
End Function





function WebLocation()
  WebLocation="&nbsp;当前位置：<a href=""index.asp"" class=""agray"">首页</a> - <a href=""ProductList.asp"" class=""agray"">公司产品</a> - 订单"&VbCrLf
end Function

function ProductList()
if trim(request("ProductNo"))="" then
Else
	dim rs,sql
	set rs = server.createobject("adodb.recordset")
	sql="select * from LiangJing_Products where ProductNo='"&request("ProductNo")&"' order by id"
	rs.open sql,conn,1,1
	while not rs.eof
    aa=uCart.AddItem(rs("ProductNo"),rs("ProductName"),Formatnumber(rs("N_Price")-rs("P_Price"),2,-1,-1,0),12,12,1," ")
	rs.movenext
    wend
    rs.close
    set rs=Nothing
End If 
end function

sub MemInfo()
  dim rs,sql
  set rs = server.createobject("adodb.recordset")
  sql="select * from LiangJing_Members where MemName='"&session("MemName")&"'"
  rs.open sql,conn,1,1
  if rs.bof and rs.eof then
    response.write "<center>暂无相关信息</center>"
  else
    mMemID=rs("ID")
	if not rs("RealName")="" then
	  mRealName=rs("RealName")
	else
	  mRealName=rs("MemName")
	end if
	mSex=rs("Sex")
	mCompany=rs("Company")
	mAddress=rs("Address")
	mZipCode=rs("ZipCode")
	mTelephone=rs("Telephone")
	mFax=rs("Fax")
	mMobile=rs("Mobile")
	mEmail=rs("Email")
  end if
  rs.close
  set rs=nothing
end sub
%>
<script language="javascript">
<!--
function refreshimg(){document.all.checkcode.src="../Include/CheckCode/CheckCode.asp";}
//-->
</script>





































