<!-- #Include File="../Include/Channel_Shop.asp" -->
<!-- #Include File="Common.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

tit="订单浏览"
dim otype:otype=trim(request.querystring("type"))
call DoWebHead(0,0)
Call Channel_Load(0)
tit_fir=Cls.ChannelName
select case otype
case "emoney"
  call emoney_order_view()
case else
  call shop_order_view()
end select
Call Channel_End(0)
call DoWebEnd()

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

Function shop_order_product(oid)
  dim sTmp,ssum,nid,nnum,price,price_now,discount,name
  ssum=0
  i=0
sTmp="<table cellspacing=1 cellpadding=4 class=table><tr class=trb><td colspan=7 height=30 align=center><font class=red>以下是您所选购的"&Cls.ChannelTit&"清单</font></td></tr><tr height=22 align=center><td width='7%' class=td>序号</td><td width='30%' class=td>"&Cls.ChannelTit&"名称</td><td width='22%' class=td>"&Cls.ChannelTit&"编号</td><td width='7%' class=td>数量</td><td width='13%' class=td>原价("&val_unit&")</td><td width='8%' class=td>折扣</td><td width='13%' class=td>购买("&val_unit&")</td></tr>"
  sql="select * from AsaiMHShopOorders where oid="&oid
  set rs=Cls.exec(sql,1)
  do while not rs.eof
    i=i+1
    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=Cls.FM_Discount(discount)
    ssum=ssum+price_now*nnum
sTmp=sTmp&"<tr class=tr align=center><td>"&i&"</td><td align=left><a href='#' title='点击浏览"&Cls.ChannelTit&"详细信息' onclick=""javascript:open_view('View.asp?id="&nid&"',1);"">"&name&"</a></td><td align=left>"&rs("serial")&"</td><td>"&nnum&"</td><td align=right>"&price&"</td><td>"
        if discount=Cls.FM_Discount(100) then
          sTmp=sTmp&"<font class=Gys>"&discount&"</font>"
        else
          sTmp=sTmp&"<font class=red2>"&discount&"</font>"
        end if
sTmp=sTmp&"</td><td align=right><font class=blue>"&price_now&"</font></td></tr>"
    rs.movenext
  loop
  rs.close
sTmp=sTmp&"<tr class=trs><td colspan=7 height=30 align=right>"&"您所选购的"&Cls.ChannelTit&"总的有效金额：<font class=red>"&fm_price(ssum,1)&"</font>&nbsp;"&val_unit&"&nbsp;</td></tr></table>"
shop_order_product=sTmp
End Function

sub emoney_order_view()
  dim id,ordernum,isuser,username,nname,pid,name,serial,num,emoney,ptim,emoneys,sTmp,nid,titel
    ordernum=Cls.Code_Var(request.querystring("ordernum"))
  if ordernum="" then
    Response.Write  vbcrlf&Cls.js_put("alert('订单号为空！');location.href='Order.asp';",1)
    exit sub
  end if
  sql="select top 1 * from AsaiMHShopEmoneyNotes where ordernum='"&ordernum&"'"
  set rs=Cls.exec(sql,1)
  if rs.eof then
    rs.close
    Response.Write  vbcrlf&Cls.js_put("alert('订单号（"&ordernum&"）不存在！');location.href='Order.asp';",1)
    exit sub
  end if
  titel=tit&ordernum
  id=rs("id")
  username=rs("username")
  pid=rs("pid")
  name=rs("name")
  serial=rs("serial")
  num=rs("num")
  emoney=rs("emoney")
  ptim=rs("tim")
  emoneys=rs("emoneys")
  if login_username<>username then
    rs.close
  Response.Write  vbcrlf&Cls.js_put("alert('该订单只能由提交的登陆用户才可以浏览！');location.href='Order.asp';",1)
    exit sub
  end if
sTmp=vbcrlf&"<table cellspacing=1 cellpadding=4 class=table><tr class=tr><td width='20%'>付款方式：</td><td width='80%'><font class=red2><b>"&Cls.web_unit&"</b></font>&nbsp;支付</td></tr><tr class=tr><td>名称：</td><td><a href='###' alt='点击浏览"&Cls.ChannelTit&"详细信息'onclick=""javascript:open_view('View.asp?id="&nid&"',1);"">"&name&"</a></td></tr><tr  class=tr><td>编号：</td><td>"&rs("serial")&"</td></tr><tr class=tr><td>单价：</td><td><font class=red2>"&emoney&"</font> "&Cls.web_unit&"　购买数量：<font class=red>"&num&"</font></td></tr><tr class=tr><td>订单总"&Cls.web_unit&"：</td><td><font class=red2><b>"&rs("emoney")&"</b></font>&nbsp;"&Cls.web_unit&"</td></tr><tr class=tr><td>购买时间：</td><td>"&Cls.time_type(ptim,2)&"</td></tr><tr class=tre><td>客户姓名：</td><td>"&rs("nname")&"</td></tr><tr class=tre><td>客户地址：</td><td>"&rs("address")&"</td></tr><tr class=tre><td>邮政编码：</td><td>"&rs("code")&"</td></tr><tr class=tre><td>联系电话：</td><td>"&rs("phone")&"</td></tr><tr class=tre><td>电子信箱：</td><td>"&rs("email")&"</td></tr><tr class=tre><td>备注信息：</td><td><table border=0 width='100%' class=tf><tr><td class=bw>"&Cls.code_html(rs("remark"),2,0)&"</td></tr></table></td></tr>" & _
     vbcrlf&"<tr class=tr>" & _
     vbcrlf&"<td>上次处理时间：</td>" & _
     vbcrlf&"<td>"&rs("dis_tim")&"</td>" & _
     vbcrlf&"</tr>" & _
     vbcrlf&"<tr class=tr>" & _
     vbcrlf&"<td>处理信息：</td>" & _
     vbcrlf&"<td>" & _
     vbcrlf&"  <table border=0 width='100%' class=tf>" & _
     vbcrlf&"  <tr><td class=bw>"&Cls.code_html(rs("dis_remark"),2,0)&"</td></tr>" & _
     vbcrlf&"  </table>" & _
     vbcrlf&"</td>" & _
     vbcrlf&"</tr>" & _
     vbcrlf& ukong
  rs.close
sTmp=sTmp&""&shop_emoney_notes(id)&"" & _
vbcrlf&"</table>"
Call ShowMsg(titel,sTmp)
end sub

Function shop_emoney_notes(id)
  dim ssum,nid,name,nnum,emoney,emoneys,sTmp,serial
  ssum=0
  i=0
  sql="select * from AsaiMHShopEmoneyNotes where id="&id
  set rs=Cls.exec(sql,1)
  do while not rs.eof
    i=i+1
    nid=rs("pid")
    nnum=rs("num")
	serial=rs("serial")
    name=rs("name")
	emoney=rs("emoney")
	emoneys=rs("emoneys")
    rs.movenext
  loop
  rs.close
 sTmp=vbcrlf&"<table cellspacing=1 cellpadding=4 class=table><tr class=trb><td colspan=7 height=30 align=center><font class=red>以下是您所选购的"&Cls.ChannelTit&"清单</font></td></tr><tr height=22 align=center><td width='9%' class=td>序号</td><td width='28%' class=td>"&Cls.ChannelTit&"名称</td><td width='25%' class=td>"&Cls.ChannelTit&"编号</td><td width='8%' class=td>数量</td><td width='15%' class=td>原价("&Cls.web_unit&")</td><td width='15%' class=td>购买("&Cls.web_unit&")</td></tr><tr class=tr align=center><td>"&i&"</td><td align=center><a href='#' alt='点击浏览"&Cls.ChannelTit&"详细信息'onclick=""javascript:open_view('View.asp?id="&nid&"',1);"">"&name&"</a></td><td align=center>"&serial&"</td><td>"&nnum&"</td><td align=center>"&emoney&"</td><td align=center>"&emoneys&"</td></tr><tr class=trs><td colspan=7 height=30 align=right>"&"您所选购的"&Cls.ChannelTit&"总的有效金额：<font class=red>"&emoneys&"</font>&nbsp;"&Cls.web_unit&"&nbsp;</td></tr></table>"
shop_emoney_notes=sTmp
End Function
%>
