<%if Session("huiyuan")="" then
Response.redirect "cart-login.asp" 
Response.end
end if
%><!--#include file="inc_top.asp" -->
<!--#include file="conn/inc_banner.asp" -->
<table width="762" bgcolor="#ffffff" border="0" align="center" cellpadding="0" cellspacing="0" class="table-zuoyou">
  <tr>
    <td width="170" valign="top" bgcolor="#f3f3f3" class="table-you"> 

      <table width="170" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="32" align="center" valign="bottom" class="table-shang"><img src="image/huiyuan.gif" width="166" height="30"></td>
        </tr>
        <tr> 
          <td height="25" align="center" valign="middle"><img src="image/tp08.gif" width="13" height="13"> 
            <a href="huiyuan-1.asp">我的订单</a></td>
        </tr>
        <tr> 
          <td align="center"><img src="image/xx.gif"></td>
        </tr>
        <tr> 
          <td height="25" align="center" valign="middle"><img src="image/tp08.gif" width="13" height="13"> 
            <a href="huiyuan-2.asp">我的收藏</a></td>
        </tr>
        <tr> 
          <td align="center"><img src="image/xx.gif"></td>
        </tr>
        <tr> 
          <td height="25" align="center" valign="middle"><img src="image/tp08.gif" width="13" height="13"> 
            <a href="huiyuan-3.asp">个人资料</a></td>
        </tr>
        <tr> 
          <td align="center"><img src="image/xx.gif"></td>
        </tr>
        <tr> 
          <td height="25" align="center" valign="middle"><img src="image/tp08.gif" width="13" height="13"> 
            <a href="huiyuan-4.asp">修改密码</a></td>
        </tr>
        <tr> 
          <td align="center"><img src="image/xx.gif"></td>
        </tr>
      </table>
    </td>
    <td width="590" height="350" align="center" valign="top"><br>
<%
'处理请求
if request("del")="yes" then
         set rs = conn.execute("select huiyuan from cart where id="&Request("id")&"")
		huiyuan=rs("huiyuan")
	    rs.close
    if huiyuan=session("huiyuan") then
	Set rs2=Server.CreateObject("ADODB.Recordset")
	sql="select * from cart where id="&cint(Request("id"))&""
	rs2.open sql,conn,1,3
	rs2("zt")=1
	rs2.update
	zongjia=rs2("je")
	jifen=zongjia*5
	conn.execute("Update huiyuan set je = je-"&zongjia&", jifen=jifen-"&jifen&" where huiyuan='"&huiyuan&"'")
	rs2.close
	set rs2=nothing
        Response.redirect "huiyuan-1.asp"
    else
		Response.Write("对不起，您不能取消该条订单。如有疑问请与网站管理员联系。")
	 end if
end if
'显示订单
Set rs=Server.CreateObject("ADODB.Recordset")
sql="select id,peisong_rmb,je,cl from cart where huiyuan='"&session("huiyuan")&"' and zt=0 order by id desc"
rs.open sql,conn,1,1 
 rs.pagesize = 4
if request("page")=""  or isempty(request("page")) then
page = 1
else
page=int(request("page"))
end if
if page>rs.pagecount then
page=rs.pagecount
end if
if not rs.BOF then
Rs.Move Rs.PageSize*(page-1)
end if
i=1
do while not rs.eof and i<=rs.pagesize
%>     订单号：<font color=red><%=rs("id")%></font>&nbsp;&nbsp;订单状态：<font color=red><%if rs("cl")=1 then 
					                     response.write "订单货已发出,请注意查收！</font>"
					                   else
					                      response.write "订单等待处理</font>&nbsp;&nbsp;&nbsp;&nbsp;[<a href=?del=yes&id="&rs("id")&">取消该订单</a>]"
					                   end if%>
      <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
        <tr align="center" valign="middle" bgcolor="#f7f7f7"> 
          <td width="300" height="20">商品名称</td>
          <td width="75" height="20">市场价</td>
          <td width="75" height="20">会员价</td>
          <td width="75" height="20">订购数量</td>
          <td width="75" height="20">小计</td>
        </tr>
        <%set rs1 = conn.execute("select * from list where cartid="&rs("id")&" order by id desc")
		do while not rs1.eof%>
        <tr valign="middle" bgcolor="#FFFFFF"> 
          <td width="300" height="20"><%=rs1("mc")%></td>
          <td width="75" height="20" align="center"><%=rs1("jg1")%></td>
          <td width="75" height="20" align="center"><%=rs1("jg2")%></td>
          <td width="75" height="20" align="center"><%=rs1("sl")%></td>
          <td width="75" height="20" align="center"><%=FormatNumber(rs1("jg2")*rs1("sl"),2)%></td>
        </tr>
        <%rs1.movenext
loop
rs1.close
%>
      </table> <br>
      <%
i=i+1
 rs.MoveNext                                              
 loop 
%>
<form name=form method=get action=?>
<%
if rs.recordcount<>0 then
if page-1 mod 5=0 then
		p=(page-1) \ 5
	else
		p=(page-1) \ 5
	end if

	response.write "页次："& page &"/"& rs.pagecount &"页 每页"& rs.pagesize &" 共"& rs.recordcount &"条记录"&_
					" 分页："

	if p*5>0 then response.write "<a href='?page="&p*5&"' title=上5页>[&lt;&lt;]</a>   "
    uming_i=1
	for ii=p*5+1 to P*5+5
		   if ii=page then
	          response.write "<font color=#ff0000>["+Cstr(ii)+"]</font> "
		   else
		      response.write "<a href='?page="&ii&"'>["+Cstr(ii)+"]</a>   "
		   end if
		if ii=rs.pagecount then exit for
		 uming_i=uming_i+1
	next
	if ii<=rs.pagecount and uming_i=11 then response.write "<a href='?page="&ii&"' title=下5页>[&gt;&gt;]</a>   "
response.write(" 　跳页：<input type=text name=page size=2 maxlength=3 class=wenbenkuang> <input type=submit name=Submit value=Go class=go-wenbenkuang>")
end if
rs.close
set rs=nothing%>
      </form>
</td>
  </tr>
</table>
<!--#include file="inc_end.asp" -->