<!--#include file="conn.asp"-->
<%
page_title=Eval("order_title"&Language)
page_keywords=Eval("order_keywords"&Language)
page_description=Eval("order_description"&Language)
if page_title="" then
page_title=city_title
page_keywords=city_keywords
page_description=city_description
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="zh-CN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%=page_title%></title>
<meta name="keywords" content="<%=page_keywords%>" />
<meta name="description" content="<%=page_description%>" />
<!--#include file="top.asp"-->
<!--#include file="header.asp"-->
<%
if session("user_xxx_name")="" then
response.Redirect("login.asp")
end if
%>
<link href="<%=filepath%>inc/mycenter.css" type="text/css" rel="stylesheet">
<link href="<%=filepath%>inc/style.css" type="text/css" rel="stylesheet">
<link href="<%=filepath%>inc/user.css" type="text/css" rel="stylesheet">

    <div id="wrap">
        <!--container-->
        <div class="main">
            
<!--sidebar-->
<!--#include file="Mb_left.asp"-->

<script type="text/javascript">
                try
                {
                    document.getElementById("User_Order_List").className = "current"; //控制CSS
                }
                catch(e){}
</script>

<!--sidebar end-->

<!--main-->

<div class="mainBox">
				<div class="mainContent">
					<div class="mycontent">
						<div class="mycontent_10">
							<span>我的订单</span>
						</div>
						<div class="mycontent_11">截止至<%=year(date())%>年<%=month(date())%>月<%=day(date())%>日，您共有:&nbsp;&nbsp;
							<a href="orderList.asp?status=1">待付款(<span class="jfSTYLE1"><%call shownum(1)%></span>)</a>&nbsp;&nbsp;&nbsp;&nbsp;
							<a href="orderList.asp?status=4">待确认收货(<span class="jfSTYLE1"><%call shownum(4)%></span>)</a>&nbsp;&nbsp;&nbsp;&nbsp;
							<a href="orderList.asp?status=5">待评价(<span class="jfSTYLE1"><%call shownum(5)%></span>)</a>&nbsp;&nbsp;&nbsp;&nbsp;
						</div>
					</div>
						<select id="status" name="status" onchange="if(value!=''){location.href=''+this.options[this.selectedIndex].value+'';}else{return(false);}">
							<option value="orderList.asp?status=0" <%if request("status")=0 or request("status")="" then%> selected="selected"<%end if%>>全部</option>
							<option value="orderList.asp?status=1" <%if request("status")=1 then%> selected="selected"<%end if%>>未付款</option>
							<option value="orderList.asp?status=3" <%if request("status")=3 then%> selected="selected"<%end if%>>待发货</option>
							<option value="orderList.asp?status=4" <%if request("status")=4 then%> selected="selected"<%end if%>>确认收货</option>
							<option value="orderList.asp?status=5" <%if request("status")=5 then%> selected="selected"<%end if%>>待评价</option>
							<option value="orderList.asp?status=6" <%if request("status")=6 then%> selected="selected"<%end if%>>已完成</option>
						</select>
					<div class="mycontent_12">
						<div id="listtable" style="position: relative; width: 100%">
 <%set rs=server.CreateObject("adodb.recordset")
  dim zhuangtai,timesel
  zhuangtai=request.QueryString("status")
  timesel=request.QueryString("timesel")
if timesel<>"" then

sel_no1=dateadd("m",-int(timesel),date())
sel_no2=dateadd("m",-0,date())

rs.open "select distinct(dingdan),niming,username,actiondate,userid,jifen_dk,promoRuleId,couponCodeNumber,zhuangtai,shopxp_shfs,zhifufangshi,user_01 from shopxp_action where username='"&session("user_xxx_name")&"' and actiondate>#"&sel_no1&"# and actiondate <#"&sel_no2&"#  order by actiondate desc",conn,1,1

elseif zhuangtai<>"" then

select case zhuangtai
case "0"
rs.open "select distinct(dingdan),niming,username,actiondate,userid,jifen_dk,promoRuleId,couponCodeNumber,zhuangtai,shopxp_shfs,zhifufangshi,user_01 from shopxp_action where username='"&session("user_xxx_name")&"' and zhuangtai<8 order by actiondate desc",conn,1,1
case else
rs.open "select distinct(dingdan),niming,username,actiondate,userid,jifen_dk,promoRuleId,couponCodeNumber,zhuangtai,shopxp_shfs,zhifufangshi,user_01 from shopxp_action where username='"&session("user_xxx_name")&"' and zhuangtai="&zhuangtai&" order by actiondate desc",conn,1,1
end select
else
rs.open "select distinct(dingdan),niming,username,actiondate,userid,jifen_dk,promoRuleId,couponCodeNumber,zhuangtai,shopxp_shfs,zhifufangshi,user_01 from shopxp_action where username='"&session("user_xxx_name")&"' and zhuangtai<8 order by actiondate desc",conn,1,1
end if




dim MaPerPage
MaPerPage=6
dim text,checkpage
text="0123456789"
Rs.PageSize=MaPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next
If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1 
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if

i=0
do while not rs.eof
%>
									<table cellspacing="0" cellpadding="0" align="center" border="1" class="listtable">
										<thead>
											<tr>
												<th class="tal" colspan="5">
													<span>订单号  <a href="orderDetail.asp?dingdan=<%=trim(rs("dingdan"))%>" target="_blank"><%=trim(rs("dingdan"))%></a></span> 
													<span>收货人  <%=rs("user_01")%></span>
												    <span>下单时间  <%=rs("actiondate")%></span></th>
											</tr>
										</thead>
										<tbody>
<%
set rsna=server.CreateObject("adodb.recordset")
rsna.open "select * from com_books inner join  shopxp_action on com_books.id=shopxp_action.shopxpptid where shopxp_action.dingdan='"&rs("dingdan")&"' ",conn,1,1
if not rsna.eof and not rsna.bof then
k=1
do while not rsna.eof
%>
												<tr>
													<td>
														<table class="prdinfo">
															<tbody><tr>
																<td class="pic" style="width:88px;"><img src="../<%=rsna("bookpicm")%>"></td>
																<td class="info">
																	<a href="products_show.asp?typeid=<%=rsna("cid")%>&id=<%=rsna("id")%>" target="_blank"><%=rsna("titlecn")%></a><br> 
																    <span class="price">￥<%=Formatnumber(rsna("shopxphyjia"),2,-1,-1,0)%></span>
<%
set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from shopxp_action where shopxpptid="&rsna("id")&" and  dingdan='"&rs("dingdan")&"'",conn,1,3
isbbs=rs_s("isbbs")
rs_s.close
set rs_s=nothing
%>
<%if rs("zhuangtai")=5 and isbbs=0 then%><br /><a href="MyCommentset.asp?subCId=<%=rsna("cid")%>&subId=<%=rsna("id")%>&dingdan=<%=trim(rs("dingdan"))%>" style="color:green;">[ 发表评论 ]</a><%end if%>
																</td>
															</tr>
														</tbody></table>
													</td>
													
													<%if k=1 then%>
													
<%dim shopxp,rs2
'////
set shopxp=server.CreateObject("adodb.recordset")
shopxp.open "select sum(zonger) as zonger from shopxp_action where dingdan='"&trim(rs("dingdan"))&"' ",conn,1,1
zonger=shopxp("zonger")
shopxp.close
set shopxp=nothing%>

<%
set shopxp=server.CreateObject("adodb.recordset")
shopxp.open "select feiyong from shopxp_action where dingdan='"&trim(rs("dingdan"))&"' ",conn,1,1

feiyong=shopxp("feiyong")
shopxp.close
set shopxp=nothing%>

<%
if rs("promoRuleId")<>"coupon_code" then
	setId=replace(rs("promoRuleId"),"act_","")
	set rsp=server.CreateObject("adodb.recordset")
	rsp.open "select * from com_act where id="&setId&"",conn,1,1
	if not rsp.bof or not rsp.eof then
	amount=rsp("amount")
	end if
	rsp.close
	set rsp=nothing
elseif rs("promoRuleId")="coupon_code" and rs("couponCodeNumber")<>"" then
	set rsp=server.CreateObject("adodb.recordset")
	rsp.open "select * from com_coupon where CodeNumber='"&rs("couponCodeNumber")&"'",conn,1,1
	if not rsp.bof or not rsp.eof then
	amount=rsp("amount")
	end if
	rsp.close
	set rsp=nothing
else
amount=0
end if
rownum=rsna.RecordCount
%>										<td width="82" rowspan="<%=rownum%>">
														<span class="price">￥<%=formatnumber(zonger+feiyong-rs("jifen_dk")-amount,2)%></span><br>
														<span class="grey">（含快递￥<%=formatnumber(feiyong,2)%>）</span>
													</td>
													<td width="82" rowspan="<%=rownum%>">
<%select case rs("zhuangtai")
	case "1"
	response.write "等候付款"
	case "2"
	response.write "确认收款"
	case "3"
	response.write "等待发货"
	case "4"
	response.write "已经发货"
	case "5"
	response.write "已经收货 <br /><font color=red>交易完成</font>"
	case "6"
	response.write "交易完成"
	case "7"
	response.write "已经退款"
	end select%>
<br> 
														<span class="tagphone"></span>
													</td>
													<td width="82" rowspan="<%=rownum%>"><a href="orderDetail.asp?dingdan=<%=trim(rs("dingdan"))%>">查看详情</a></td>
													<%end if%>
												</tr>

<%
k=k+1
rsna.movenext
loop
end if
rsna.close
set rsna=nothing
%>
												
										</tbody>
										
									</table>
<%
i=i+1 
if i >= MaPerpage then exit do 
rs.movenext 
loop 

%>
							
							<div id="wqPager" class="pager" style="white-space: nowrap;">
								<div class="pager_left" align="right" style="width:;">
<%
Response.write "每页" & MaPerpage & "条，&nbsp;"
Response.write "共" & Cstr(Rs.RecordCount) & "条&nbsp;"
%>
								</div>
								<div>
<%
If currentpage > 1 Then
response.write "<a href='orderList.asp?page="+cstr(1)+"#product' style='margin-right: 5px;'>第一页</a>"
Response.write "<a href='orderList.asp?page="+Cstr(currentpage-1)+"#product' style='margin-right: 5px;'>上一页</a>"
Else
Response.write "<a disabled='disabled' style='margin-right: 5px;'>上一页</a>"
End if
If currentpage < Rs.PageCount Then
Response.write "<a href='orderList.asp?page="+Cstr(currentPage+1)+"#product' style='margin-right: 5px;'>下一页</a>"
Response.write "<a href='orderList.asp?page="+Cstr(Rs.PageCount)+"#product' style='margin-right: 5px;'>最后一页</a>"
Else
Response.write ""
Response.write "<a disabled='disabled' style='margin-right: 5px;'>下一页</a>"
End if
%>
&nbsp;&nbsp;						
<%
Response.write "转到:"
response.write"<select name='sel_page' onChange='javascript:location=this.options[this.selectedIndex].value;'>"
    for i = 1 to Rs.PageCount
       if i = currentpage then 
          response.write"<option value='orderList.asp?page="&i&"' selected>"&i&"</option>"
       else

          response.write"<option value='orderList.asp?page="&i&"'>"&i&"</option>"
       end if
    next
response.write"</select>"
%>
								</div>
							</div>
							
<%
rs.close
set rs=nothing
%>

						</div>
					</div>
				</div>
			</div>
			<!--main end-->
        </div>
        <!--container end-->
        <div class="clr">
        </div>
        

  
<!--#include file="foot.asp"--> 