<!--#include file="conn.asp"-->
<%if strUserName="" then
Conn.Close
Set Conn = Nothing
response.write "<script language=javascript>alert('对不起，请先注册或登录！');history.go(-1);</script>"
response.End
end if%>
<!--#include file="config.asp"-->
<title><%=webname%>--订单详细资料</title>
<%dim goods,YourPrice
goods=SafeRequest("dan",1)
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from  orders  where username='"&strUserName&"' and goods='"&goods&"' ",conn,1,1
if rs.eof and rs.bof then
rs.Close
Set rs = Nothing
Conn.Close
Set Conn = Nothing
response.write "<center>此订单中有商品已被管理员删除，无法处理，请通知管理员或者重下订单！</center>"
response.End
end if
%>
<table width="98%" border="0" cellspacing="1" cellpadding="1" bgcolor=#e1e1e1 align="center">
  <tr bgcolor=#ffffff> 
    <td height="20" colspan="2" align="center">订单号为：<%=goods%> ，详细资料如下：</td>
  </tr>
  <tr bgcolor=#ffffff> 
    <td width="13%" valign="top">商品列表：</td>
    <td><table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor=#e1e1e1>
        <tr bgcolor=#cccccc align="center"> 
          <td><font color="#333333">商品名称</font></td>
          <td width="10%"><font color="#333333">订购数量</font></td>
          <td width="10%"><font color="#333333">市场价</font></td>
          <td width="10%"><font color="#333333">网店价</font></td>
          <td width="12%"><font color="#333333">成交价</font></td>
          <td WIDTH="10%"><font color="#333333">平衡费</font></td>
          <td width="8%"><font color="#333333">积分</font></td>
          <td width="14%"><font color="#333333">金额小计</font></td>
        </tr>
        <%dim sum1,sums1
		do while not rs.eof 
		If rs("amount") = 0 Then
		YourPrice = rs("price2")
		Else
		YourPrice =rs("price2")*LngDiscount
		End If
		%>
        <tr bgcolor=#FFFFFF > 
          <td style='PADDING-LEFT: 5px;height:26px;'><a href=product.asp?id=<%=rs("id")%> target=_blank><%=trim(rs("name"))%></a></td>
          <td align="center"><%=rs("productnum")%></td>
          <td align="center"><%=rs("price1")%>元</td>
          <td align="center"><%=rs("price2")%>元</td>
          <td align="center"><%=rs("priced")%>元</td>
          <td><%=rs("vipprice")%>元</td>
          <td align="center"><%=rs("score")*rs("productnum")%>分</td>
          <td align="center"><%=Round(rs("paid"),2)%>元</td>
        </tr>
        <%sum1=rs("paid")+sum1
		sums1=sums1+rs("score")*rs("productnum")
		rs.movenext
		loop
		rs.movefirst%>
        <tr bgcolor= #FFFFFF> 
          <td colspan="8" height="19" align="left">您的送货方式是： 
            <%dim rs2,LngFee
              set rs2=server.CreateObject("adodb.recordset")
              rs2.Open "select * from delivery where deliveryid="&rs("deliverymethord"),conn,1,1
              if rs2.EOF and rs2.BOF then
              response.Write "此方式已经被删除"
              response.write "&nbsp;邮递送货费：0元"
			  response.write "&nbsp;&nbsp;金额总计："&sum1&" 元，获得积分"&sums1&"分"
              else
			
		  IF webbj5 = 0 Then
		  LngFee = rs2("fee")
		  Else
		  	If Sum1>=Webbj5 Then
			LngFee = 0
			Else
			LngFee = rs2("fee")
			End If
		  End IF
              response.Write trim(rs2("subject"))
              response.write "&nbsp;邮递送货费："&LngFee&"元"
		  response.write "&nbsp;&nbsp;金额总计：<font color=red>"&Round((sum1+LngFee),2)&"</font>&nbsp;元，获得积分&nbsp;<font color=red>"&sums1&"</font>&nbsp;分"
		  end if
               sum=Round((sum1+LngFee),2)
		  rs2.Close
		  set rs2=nothing
		 IF webbj5 <> 0 Then
		  	response.write "购物满&nbsp;<font color=red>"&webbj5&"</font>&nbsp;元免邮递送货费。"
		    End IF
		  %>
          </td>
        </tr>
      </table> </td>
  </tr>
  <tr bgcolor=#ffffff> 
    <td valign="top">订单状态：</td>
    <td><table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor=#e1e1e1>
        <form name="form1" method="post" action="save.asp?dan=<%=goods%>&score=<% = sums1 %>&action=save">
          <tr> 
            <td bgcolor="#FFFFFF">
              <%  grade() %>&nbsp;<input type="submit" name="Submit" value="修改订单状态"> 
            </td>
          </tr>
        </form>
      </table></td>
  </tr>
  <tr bgcolor=#ffffff> 
    <td style='PADDING-LEFT: 6px'>订货人姓名：</td>
    <td><%=trim(rs("realname"))%></td>
  </tr>
  <tr bgcolor=#ffffff> 
    <td style='PADDING-LEFT: 6px'>收货人姓名：</td>
    <td><%=trim(rs("receipt"))%><% 
		   if trim(rs("receipt")) = 0 then
    response.Write "&nbsp;(先生)"
    else
    response.Write "&nbsp;(女士)"
    end if%></td>
  </tr>
  <tr bgcolor=#ffffff> 
    <td style='PADDING-LEFT: 6px'>收货地址：</td>
    <td><%=trim(rs("address"))%></td>
  </tr>
  <tr bgcolor=#ffffff> 
    <td style='PADDING-LEFT: 6px'>邮　　编：</td>
    <td><%=trim(rs("postcode"))%></td>
  </tr>
  <tr bgcolor=#ffffff> 
    <td style='PADDING-LEFT: 6px'>联系电话：</td>
    <td><%=trim(rs("usertel"))%></td>
  </tr>
  <tr bgcolor=#ffffff> 
    <td style='PADDING-LEFT: 6px'>电子邮件：</td>
    <td><%=trim(rs("useremail"))%></td>
  </tr>
  <tr bgcolor=#ffffff> 
    <td style='PADDING-LEFT: 6px'>送货方式：</td>
    <td> <%set rs2=server.CreateObject("adodb.recordset")
    rs2.Open "select * from delivery where deliveryid="&rs("deliverymethord"),conn,1,1
     if rs2.eof and rs2.bof then
		  response.write "方式已被删除"
		  else
		  response.Write trim(rs2("subject"))
          end if
    rs2.Close
    %> </td>
  </tr>
  <tr bgcolor=#ffffff> 
    <td style='PADDING-LEFT: 6px'>支付方式：</td>
    <td> <%
    rs2.Open "select * from delivery where deliveryid="&rs("paymethord"),conn,1,1
    response.Write trim(rs2("subject"))
    rs2.close
    set rs2=nothing%> </td>
  </tr>
  <tr bgcolor=#ffffff> 
    <td style='PADDING-LEFT: 6px'>您的留言：</td>
    <td><%=trim(rs("comment"))%></td>
  </tr>
  <tr bgcolor=#ffffff> 
          <td>管理员评论：</td>
          <td><%=rs("remarks")%></td>
        </tr>
<tr bgcolor=#ffffff> 
    <td style='PADDING-LEFT: 6px'>下单日期：</td>
    <td><%=rs("actiondate")%></td>
  </tr>
  
</table>
<% if rs("state")=2 then

set rspro=server.CreateObject("adodb.recordset")
rspro.open "select id from product where id  in ("&rs("id")&") ",conn,1,1
if   rspro.eof and rspro.bof then
response.write "<center>此订单中有产品已被管理员删除，无法进行付款，请通知管理员或者重下订单！</center>"
response.End

else

%>
<table width="98%" border="0" cellspacing="1" cellpadding="1" bgcolor="#e4e4e4" align="center" class=shopborder>
  <tr bgcolor="#FFffff"> 
    <td height="20" align="center" colspan="2" >
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" BGCOLOR="#f1f1f1">

     <tr BGCOLOR="#f1f1f1"> 
        <td align="center" height="30" background="images/goods_bg.gif">
         <font color="#ffffff"><b>如果想马上付款可以选择下面方式支付</b></font>
        </td>
     </tr>
<% if LngUserID <>0  then  %>
     <tr BGCOLOR="#f9f9f9"> 
        <td align="center" height="35">
         <b>1.预付款支付</b>(你现在帐户上有预存款&nbsp;<font color="#930000"><%=LngDeposit%></font>&nbsp;元)
        </td>
     </tr>
       <% if LngDeposit >= sum  then %>
        <tr BGCOLOR="#ffffff">
           <form action="saveDeposit.asp?paygoods=<%=goods%>&action=pay&username=<%=strusername%>" method="post" name="payDeposit"> 
          <td align="center" height="30">
          
         
                 <input type="hidden" name="paysum" id="paysum" size="40" value="<%= sum %>">
                 <input type="hidden" name="paysums" id="paysums" size="40" value="<%= sums %>">

                 <input class=shopinput1 type="submit" name="Submit" value="用预付款支付" >

        </td>
           </form>    
     </tr> 
 <% else   %>
     <tr BGCOLOR="#ffffff"> 
        <td align="center" height="30">
          
         你帐户里的预存款不足以支付这次购买价格，请先到<A HREF="profile.asp?action=profile" target="_blank"><font color="#930000"><b>会员中心充值入款</b></font></a>！
          
   
        </td>
     </tr> 
     <% end if   %>
<% end if   %>
    <tr BGCOLOR="#f9f9f9"> 
        <td align="center" height="30">
         <b>2.使用在线支付</b>
        </td>
     </tr>
     <%
       set rspay=server.CreateObject("adodb.recordset")
       rspay.open "select opayid,opaysername,opayname,opaypassword,opayurl,opayon,opaytop,opaypic from sdx_opay where opayon=1 order by opaytop asc",conn,1,1  
				if err.number<>0 then
				end if
				if rspay.eof And rspay.bof then
  			   else

       %>
      <%do while not rspay.eof%>
     <tr bgcolor="#FFFFFF"> 
        <td align="center"  height="50">
         <A HREF="opay/<%=rspay("opayurl")%>?action=1&paygood=<%=goods%>&paysum=<%= sum %> " target="_blank">
<% if rspay("opaypic") <> ""  then %>
 <IMG src="<%=rspay("opaypic")%>" border=0 alt=<%=rspay("opaysername")%>>
<% else  %>
<p align="center" height="40"  width="100"  class=shopinput3><b><%=rspay("opaysername")%></b></p>
<% end if   %>
</a>
        </td>
     </tr>

       
      <%rspay.MoveNext
          loop
          end if%>
      <tr BGCOLOR="#f1f1f1"> 
        <td align="center" height="30" background="images/goods_bg.gif">
         <font color="#ffffff"><b>如果想通过网上银行或到银行柜台汇款请选择下列银行帐户</b></font>
        </td>
     </tr>
     <tr BGCOLOR="#f9f9f9"> 
        <td align="center" height="30">
         <TABLE WIDTH="100%" BORDER="0" ALIGN="center" CELLPADDING="0" CELLSPACING="1" class=table-zuoyou BGCOLOR="#f1f1f1">
	<tr height="30" BGCOLOR="#f9f9f9" align="center">
         
            <td width="25%">开户行名称</td> 
             <td width="10%">姓名</td>
            <td width="25%">帐户号码</td>
           
            <td width="40%">登陆网上银行</td>
           
          
          </tr>
         
      </TABLE>
        </td>
     </tr>
     <%
       set rsbank=server.CreateObject("adodb.recordset")
       rsbank.open "select bankid,bankname,payname,paynumber,bankurl,bankon,banktop from sdx_bank where bankon=1 order by banktop asc",conn,1,1  
				if err.number<>0 then
				end if
				if rsbank.eof And rsbank.bof then
  			   else

       %>
      <%do while not rsbank.eof%>
     <tr bgcolor="#FFFFFF"> 
        <td align="center"  height="30">

    <TABLE WIDTH="100%" BORDER="0" ALIGN="center" CELLPADDING="0" CELLSPACING="1" class=table-zuoyou BGCOLOR="#f1f1f1">
	<tr height="30" bgcolor="#FFFFFF" align="center">
         
            <td width="25%"><%=rsbank("bankname")%></td> 
             <td width="10%"><%=rsbank("payname")%></td>
            <td width="25%"><%=rsbank("paynumber")%></td>
           
            <td width="40%"><A HREF="<%=rsbank("bankurl")%>" target="_blank"><%=rsbank("bankurl")%></a></td>
           
          
          </tr>
         
      </TABLE>
        

        </td>
     </tr>

       
      <%rsbank.MoveNext
          loop
          end if%>
   </table>

</td>
  </tr>


</table>
<% 
rspro.close
set rspro = nothing
end if

end if%>
<table width="98%" border="0" cellspacing="1" cellpadding="1" bgcolor="#ffffff" align="center" > 
<tr bgcolor=#ffffff> 
    <td colspan="2" align="center"> <%if rs("state")=2 then%> <a href="save.asp?action=del&dan=<%=goods%>">删除订单</a>
      <%end if%> &nbsp;<a href="JavaScript:onClick=window.opener.location.href = window.opener.location.href; window.close();">关闭窗口</a> &nbsp;
    </td>
  </tr>
</table>


<%sub grade()
select case rs("state")
case "1"%> 
<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox2" value="checkbox" DISABLED>服务商已收到款<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox3" value="checkbox" DISABLED>服务商已发货<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox4" value="checkbox" DISABLED>用户已经收到货
 <%case "2"%> 
<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox2" value="checkbox" DISABLED>服务商已收到款<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox3" value="checkbox" DISABLED>服务商已发货<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox4" value="checkbox" DISABLED>用户已经收到货 
<%case "3"%> 
<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox2" value="checkbox" checked DISABLED>服务商已收到款<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox3" value="checkbox" DISABLED>服务商已发货<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox4" value="checkbox" DISABLED>用户已经收到货 
<%case "4"%> 
<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox2" value="checkbox" checked DISABLED>服务商已收到款<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox3" value="checkbox" checked DISABLED>服务商已发货<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="state" value="5" >用户已经收到货 
<%case "5"%> 
<input name="checkbox" type="checkbox" DISABLED id="checkbox" value="checkbox" checked>未作任何处理<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox2" value="checkbox" checked DISABLED>服务商已收到款<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="checkbox3" value="checkbox" checked DISABLED>服务商已发货<span style='font-family:Wingdings;'>à</span> 
<input type="checkbox" name="state" value="5"  checked DISABLED>用户已经收到货 
<%end select
end sub%>