<!--#include file="conn.asp"-->
<!--#include file="inc/cook2.asp"-->
<!--#include file="inc/dimflag.asp"-->
<!--#include file="top.asp"-->
<%
dingdan=request.QueryString("dan")
tid=request.QueryString("tid")

if not isnumeric(dingdan) then 
response.write"<script>alert(""非法访问!"");location.href=""../index.asp"";</script>"
response.end
end if
username=request.QueryString("username")
if InStr(username,"'")>0 then
response.write"<script>alert(""非法访问!"");location.href=""../index.asp"";</script>"
response.end
end if

set rs=server.CreateObject("adodb.recordset") 
rs.open "select shopxp_action.shopxpacid,shopxp_action.expressOrder,shopxp_action.expressDate,shopxp_action.pro_color,shopxp_action.pro_size,shopxp_action.promoRuleId,shopxp_action.couponCodeNumber,shopxp_action.pay_class,shopxp_action.feiyong,shopxp_action.provinceId,shopxp_action.cityId,shopxp_action.countyId,shopxp_action.deliveryTimeId,shopxp_action.user_01,shopxp_action.user_03,shopxp_action.user_04,shopxp_action.user_05,shopxp_action.user_06,shopxp_action.useremail,shopxp_action.delivery,shopxp_action.zhuangtai,shopxp_action.shopxp_shfs,shopxp_action.liuyan,shopxp_action.zhifufangshi,shopxp_action.shopxpptid,shopxp_action.actiondate,shopxp_action.productcount,shopxp_action.fapiaoTt,shopxp_action.jifen_dk,shopxp_action.zonger,com_books.id,com_books.cid,com_books.titlecn,com_books.bookpicm,com_books.titlecn,com_books.shichangjia,com_books.shopxphyjia,com_books.jifeng,com_books.shopxpvjia from com_books inner join  shopxp_action on com_books.id=shopxp_action.shopxpptid where shopxp_action.dingdan='"&dingdan&"' ",conn,1,1
'if rs.eof and rs.bof then
'response.write "<p align=center><br><br><br>此订单中有商品已被管理员删除，无法进行正确计算。<br>订单操作取消，请手动删除此订单！</p>"
'response.write "<div align=center><input class=button type=button name=Submit3 value=删除订单 onClick=""location.href='dingdan_save.asp?action=del2&dan="&dingdan&"&tid="&tid&"'""><div>"
'response.End
'end if
'shjiaid=rs("shjiaid")
%>
<div id="container">

<div id="container">
<div class="top_but">
 <li class="left">&nbsp;</li>
 <li><a href="user_order_manage.asp?tid=<%=tid%>"><img src="images/but_11.gif" alt="管理"></a></li>
 <li><img src="images/but_8.gif" alt="刷新" onClick="window.location.reload(true);"></li>
 <li><img src="images/but_9.gif" alt="打印" onClick="window.print() "/></li>
</div>

<div class="tableAll titlebgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:1000px">订单号：<font color="#FF0000"><%=dingdan%></font>，详细资料如下：</li>
</div>

<form name="form1" id="form1" method="post" action="dingdan_save.asp?dan=<%=dingdan%>&username=<%=username%>&action=save">
<div class="tableAll trbgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:1000px">订单状态：<%zhuang()%><%if rs("zhuangtai")<>5 then %><input class="button" name="submit" value="修改" type="submit"><%else response.write "<font color=red>订单完成</font>" end if%></li>
</div>
</form>

<div class="tableAll titlebgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:100px;">产品图片</li>
  <li style="width:200px;">商品名称</li>
  <li style="width:150px;">规格</li>
  <li style="width:80px;">订购数量</li>
  <li style="width:100px;">价格</li>
  <li style="width:200px;">金额小计</li>
</div>
<%
zongji=0
jf=0
kg_zong=0
do while not rs.eof
	bookiid=rs("shopxpptid")
	jianshu=jianshu+rs("productcount")
	zongji=zongji+rs("zonger")
	subtitle=rs("titlecn")
	subid=rs("id")
	subcid=rs("cid")
	subbookpicm=rs("bookpicm")
	jifeng=jifeng+rs("jifeng")
	shichangjia=rs("shichangjia")
	shopxphyjia=rs("shopxphyjia")
	jifen_dk=rs("jifen_dk")
	pro_color=rs("pro_color")
	pro_size=rs("pro_size")
	
%>
<form name="form1" id="form1" method="post" action="dingdan_save.asp?acid=<%=rs("shopxpacid")%>&dan=<%=dingdan%>&username=<%=username%>&action=modify">
<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:100px;"><a href="../cn_asp/products_show.asp?typeid=<%=subcid%>&id=<%=subid%>" target="_blank"><img src="../<%=rs("bookpicm")%>" height="30" border="0"></a></li>
  <li style="width:200px; line-height:140%"><a href="../cn_asp/products_show.asp?typeid=<%=subcid%>&id=<%=subid%>" target="_blank"><%=subtitle%></a></li>
   <li style="width:150px;">颜色:<%=pro_color%>，规格:<%=pro_size%></li>
  <li style="width:80px;"><%=rs("productcount")%></li>
  <li style="width:100px;">￥<%=Formatnumber(shopxphyjia,2,-1,-1,0)%></li>
  <li style="width:200px;"><input name="zonger" type="text" size="15" value="<%=formatnumber(rs("zonger"),2)%>"> 元<input name="submit" value="修改" type="submit" class="button"></li>
</div>
</form>
<%
jf=jf+rs("jifeng")
'kg_zong=kg_zong+rs("cs4")*rs("productcount")
feiyong=rs("feiyong")
rs.movenext
loop
rs.movefirst
%>
<%
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")
	act_name=rsp("CodeNumber")
	end if
	rsp.close
	set rsp=nothing
showword="("&act_name&")优惠：<span>- <font color=red>"&Formatnumber(amount,2,-1,-1,0)&"</font></span>"

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
showword="优惠券：<span>- <font color=red>"&Formatnumber(amount,2,-1,-1,0)&"</font></span>"
	
else
amount=0
showword="无优惠：<span>- <font color=red>0.00</font></span>"
end if%>

<%
'if zongji<200 then
'zongji_a=feiyong+zongji-int(s_yfk)-int(s_jf)
'else
'zongji_a=zongji-int(s_yfk)-int(s_jf)
'end if
zongji_a=feiyong+zongji-jifen_dk-amount
%>
<div class="tableAll titlebgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:800px;">实际应付金额<font color=red><%=formatnumber(zongji_a,2)%></font>=<font color=red><%=formatnumber(zongji,2)%></font>货款总计 - <font color=red><%=formatnumber(jifen_dk,2)%></font>积分抵扣&nbsp;&nbsp;+ <font color=red><%=formatnumber(feiyong,2)%></font>邮费&nbsp;&nbsp;<%=showword%>&nbsp;&nbsp;商品总重量：<font color=red><%=kg_zong%></font>克<!--&nbsp;&nbsp;包装重量：<font color=red>500</font>克--></li>
</div>

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">收货姓名：</li>
  <li style="width:700px;"><%=trim(rs("user_01"))%></li>
</div>


<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">收货地址：</li>
  <li style="width:700"><%call showAddName(rs("provinceId"))%>&nbsp;<%call showAddName(rs("cityId"))%>&nbsp;<%call showAddName(rs("countyId"))%> &nbsp;&nbsp;<%=trim(rs("user_03"))%></li>
</div>
<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">邮　　编：</li>
  <li style="width:700px"><%=trim(rs("user_04"))%></li>
</div>
<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">联系电话：</li>
  <li style="width:700px;"><%=trim(rs("user_05"))%></li>
</div>
<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">电子邮箱：</li>
  <li style="width:700px;"><%=trim(rs("useremail"))%></li>
</div>
<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">送货方式：</li>
  <li style="width:700px;"><%
expressId=rs("shopxp_shfs")
set rszf=server.CreateObject("adodb.recordset")
rszf.open "select * from com_songhuo where id="&expressId&"",conn,1,1
response.write(rszf("subject"))
rszf.close
set rszf=nothing
%>
</li>
</div>

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">支付方式：</li>
  <li style="width:700px;"><%
select case rs("pay_class")
case 1
response.write("支付宝交易")
case 2
response.write("财付通交易")
case 3
response.write("快钱交易")
case else
	if rs("shopxp_shfs")=1 then
	response.write("货到付款")
	else
	response.write("未付款")
	end if
end select
 %></li>
</div>

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">送货时间：</li>
  <li style="width:700px;">
<%
select case rs("deliveryTimeId")
case "delivery_time_workday"
response.Write("工作日送货（周一到周五）")
case "delivery_time_weekend"
response.Write("周六周天")
case "delivery_time_allday"
response.Write("时间不限") 
end select				
%>
</li>
</div>

<!--<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">发票抬头：</li>
  <li style="width:700px;"><%=trim(rs("fapiaoTt"))%></li>
</div>-->

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">送货备注：</li>
  <li style="width:700px;"><%=trim(rs("liuyan"))%></li>
</div>

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;"><strong>优惠券号</strong>：</li>
  <li style="width:700px;"><%=trim(rs("couponCodeNumber"))%></li>
</div>

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">下单日期：</li>
  <li style="width:700px;"><%=rs("actiondate")%></li>
</div>

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">快递单号：</li>
  <li style="width:700px;"><%=trim(rs("expressOrder"))%></li>
</div>

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">下单日期：</li>
  <li style="width:700px;"><%=rs("expressDate")%></li>
</div>

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
  <li style="width:80px;">&nbsp;</li>
  <li style="width:700px;">
  <input class="button" onClick="javascript:history.back(1)" type="button" value="返回" name=submit>
  <%if rs("zhuangtai") >1 then%>
  <input class="button" type="button" name="submit" value="删除(已付款)" onClick="if(confirm('您确定要删除吗?')) location.href='dingdan_save.asp?action=del2&dan=<%=dingdan%>&tid=<%=tid%>';else return;">
  <%else%>
 <input class="button" type="button" name="submit" value="删除(未付款)" onClick="if(confirm('您确定要删除吗?')) location.href='dingdan_save.asp?action=del&dan=<%=dingdan%>&tid=<%=tid%>';else return;">
  <%end if%>
  
  </li>
</div>


</div>
<%
sub zhuang()
'response.write(rs("zhifufangshi"))
select case rs("zhuangtai")
case "1"
%>
<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理 → 
<input name="checkbox" type="checkbox" id="checkbox" value="checkbox" DISABLED>用户已经划出款 → 
<input type="checkbox" name="zhuangtai" value="3">服务商已经收到款 → 
<input type="checkbox" name="checkbox3" value="checkbox" DISABLED>服务商已经发货 → 
<input type="checkbox" name="checkbox4" value="checkbox" DISABLED>用户已经收到货 
<%case "2"%>
<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理 → 
<input name="checkbox" type="checkbox" id="checkbox" value="adf" checked DISABLED>用户已经划出款 → 
<input type="checkbox" name="zhuangtai" value="3" >服务商已经收到款 → 
<input type="checkbox" name="checkbox" value="checkbox" DISABLED>服务商已经发货 → 
<input type="checkbox" name="checkbox4" value="checkbox" DISABLED>用户已经收到货
<%case "3"%>
	<%if rs("shopxp_shfs")=1 then%>
	<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理 → 
	<input type="checkbox" name="zhuangtai" value="4" >服务商已经发货&nbsp;&nbsp;快递单号：<input name="expressOrder" type="text" /> → 
	<input type="checkbox" name="checkbox4" value="checkbox" DISABLED>用户已经收到货
	<%else%>
	<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理 → 
	<input name="checkbox" type="checkbox" id="checkbox" value="checkbox" checked DISABLED>用户已经划出款 → 
	<input type="checkbox" name="checkbox2" value="checkbox" checked DISABLED>服务商已经收到款 → 
	<input type="checkbox" name="zhuangtai" value="4" >服务商已经发货&nbsp;&nbsp;快递单号：<input name="expressOrder" type="text" /> → 
	<input type="checkbox" name="checkbox4" value="checkbox" DISABLED>用户已经收到货
	<%end if%>
<%case "4"%>
	<%if rs("shopxp_shfs")=1 then%>
	<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理 → 
	<input type="checkbox" name="checkbox3" value="checkbox" checked DISABLED>服务商已经发货 → 
	<input type="checkbox" name="checkbox" value="checkbox" DISABLED>用户已经收到货
	<%else%>
	<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理 → 
	<input name="checkbox" type="checkbox" id="checkbox" value="2" checked DISABLED>用户已经划出款 → 
	<input type="checkbox" name="checkbox2" value="checkbox" checked DISABLED>服务商已经收到款 → 
	<input type="checkbox" name="checkbox3" value="checkbox" checked DISABLED>服务商已经发货 → 
	<input type="checkbox" name="checkbox" value="checkbox" DISABLED>用户已经收到货
	<%end if%>
<%case "5"%>
	<%if rs("shopxp_shfs")=1 then%>
	<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理 → 
	<input type="checkbox" name="checkbox3" value="checkbox" checked DISABLED>服务商已经发货 → 
	<input type="checkbox" name="checkbox4" value="checkbox" checked DISABLED>用户已经收到
	<%else%>
	<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理 → 
	<input name="checkbox" type="checkbox" id="checkbox" value="2" checked DISABLED>用户已经划出款 → 
	<input type="checkbox" name="checkbox2" value="checkbox" checked DISABLED>服务商已经收到款 → 
	<input type="checkbox" name="checkbox3" value="checkbox" checked DISABLED>服务商已经发货 → 
	<input type="checkbox" name="checkbox4" value="checkbox" checked DISABLED>用户已经收到货
	<%end if%>
<%
end select
end sub
%>