<!-- #include file="include/con_shop.asp" -->
<%
tit="订单浏览"

call web_head(0,0,0,0,0)
call shop_load(0,0,0)
'----------------------------左边 开始----------------------------
call shop_left()
call shop_left_nsort(0)
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
call shop_order_view()
'----------------------------中间 结束----------------------------
call shop_end()
call web_end(0,0)

sub shop_order_view()
  dim id,ordernum,isuser,username,nname,carry_price
  ordernum=joekoe_cms.code_form(request.querystring("ordernum"))
  if ordernum="" then
    response.write vbcrlf&joekoe_cms.js_put("alert('订单号为空！');location.href='shop_order.asp';",1)
    exit sub
  end if
  sql="select top 1 * from shop_orders where ordernum='"&ordernum&"'"
  set rs=joekoe_cms.exec(sql,1)
  if rs.eof then
    rs.close
    response.write vbcrlf&joekoe_cms.js_put("alert('订单号（"&ordernum&"）不存在！');location.href='shop_order.asp';",1)
    exit sub
  end if
  id=rs("id")
  isuser=rs("isuser")
  username=rs("username")
  carry_price=rs("carry_price")
  if isuser then
    if login_username<>username then
      rs.close
      response.write vbcrlf&joekoe_cms.js_put("alert('该订单只能由提交的登陆用户才可以浏览！');location.href='shop_order.asp';",1)
      exit sub
    end if
  end if
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td colspan=2 class=td><%response.write tit%>（<%response.write ordernum%>）</td></tr>
<tr class=bg_td>
<td width='20%'>付款方式：</td>
<td width='80%'><%response.write rs("payment")%></td>
</tr>
<tr class=bg_td>
<td>运送方式：</td>
<td><%response.write rs("carry")%>&nbsp;（<%
  if int(carry_price)>0 then
    response.write "加"&carry_price&val_unit
  else
    response.write "免费"
  end if
%>）</td>
</tr>
<tr class=bg_td>
<td>订单总金额：</td>
<td><font class=red><%response.write fm_price(rs("prices"),1)%></font>&nbsp;<%response.write val_unit%></td>
</tr>
<tr class=bg_tds>
<td>收货人姓名：</td>
<td><%response.write rs("nname")%></td>
</tr>
<tr class=bg_tds>
<td>收货人地址：</td>
<td><%response.write rs("address")%></td>
</tr>
<tr class=bg_tds>
<td>邮政编码：</td>
<td><%response.write rs("code")%></td>
</tr>
<tr class=bg_tds>
<td>联系电话：</td>
<td><%response.write rs("phone")%></td>
</tr>
<tr class=bg_tds>
<td>电子信箱：</td>
<td><%response.write rs("email")%></td>
</tr>
<tr class=bg_tds>
<td>备注信息：</td>
<td>
  <table border=0 width='100%' class=tf>
  <tr><td class=bw><%response.write joekoe_cms.code_html(rs("remark"),2,0)%></td></tr>
  </table>
</td>
</tr>
<tr class=bg_td>
<td>上次处理时间：</td>
<td><%response.write rs("dis_tim")%></td>
</tr>
<tr class=bg_td>
<td>处理信息：</td>
<td>
  <table border=0 width='100%' class=tf>
  <tr><td class=bw><%response.write joekoe_cms.code_html(rs("dis_remark"),2,0)%></td></tr>
  </table>
</td>
</tr>
</table>
<%
  rs.close
  call shop_order_product(id)
  response.write ukong
end sub

sub shop_order_product(oid)
  dim ssum,nid,nnum,price,price_now,discount,name
  ssum=0
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr class=bg><td colspan=7 height=30 align=center><font class=red>以下是您所选购的<%response.write val_name%>清单</font></td></tr>
<tr height=22 align=center> 
<td width='7%' class=td>序号</td>
<td width='34%' class=td><%response.write val_name%>名称</td>
<td width='18%' class=td><%response.write val_name%>编号</td>
<td width='7%' class=td>数量</td>
<td width='13%' class=td>原价（<%response.write val_unit%>）</td>
<td width='8%' class=td>折扣</td>
<td width='13%' class=td>购买（<%response.write val_unit%>）</td>
</tr>
<%
  sql="select * from shop_oorders where oid="&oid
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    nid=rs("pid")
    nnum=rs("num")
    name=rs("name")
    price=fm_price(rs("price"),1)
    discount=rs("discount")
    price_now=fm_price(price*(discount/100),1)
    discount=fm_discount(discount)
    ssum=ssum+price_now*nnum
%>
<tr class=bg_td align=center>
<td><%response.write i+1%></td>
<td align=left><a href='###' alt='点击浏览<%response.write val_name%>详细信息' onclick="javascript:open_view('shop_view.asp?id=<%response.write nid%>',1);"><%response.write name%></a></td>
<td align=left><%response.write rs("serial")%></td>
<td><%response.write nnum%></td>
<td align=right><%response.write price%></td>
<td>
<%
        if discount=fm_discount(100) then
          response.write "<font class=gray>"&discount&"</font>"
        else
          response.write "<font class=red2>"&discount&"</font>"
        end if
%>
</td>
<td align=right><font class=blue><%response.write price_now%></font></td>
</tr>
<%
    rs.movenext
  loop
  rs.close
%>
<tr class=bg_tds><td colspan=7 height=30 align=right><%response.write "您所选购的"&val_name&"总的有效金额：<font class=red>"&fm_price(ssum,1)&"</font>&nbsp;"&val_unit%>&nbsp;</td></tr>
</table>
<%
end sub
%>