<!-- #include file="include/config.asp" -->
<%
tit="订单查询"
dim otype:otype=trim(request.querystring("type"))
call web_head(0,0,0,0,0)
call shop_load()
'----------------------------左边 开始----------------------------
call shop_left()
call shop_left_nsort(0)
call shop_top(10,10)
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
call order_search()
if action="search" then 
  select case otype
    case "emoney"
      call emoney_order_list()
    case else 
  call order_search_list()
   end select
end if

sub order_search_list()
dim tmp1,ispayment,tim,ordernum,sqladd,keyword
dim t1,t2

tmp1=vbcrlf&"  <tr align=center class=bg_tds height=20 valign=bottom>" & _
     vbcrlf&"  <td width='6%'>序号</td>" & _
     vbcrlf&"  <td width='24%'>订 单 号</td>" & _
     vbcrlf&"  <td width='14%'>收货人</td>" & _
     vbcrlf&"  <td width='12%'>订购金额</td>" & _
     vbcrlf&"  <td width='16%'>订购时间</td>" & _
     vbcrlf&"  <td  width='12%'>支付方式</td>" & _
     vbcrlf&"  <td width='10%'>支付否</td>" & _
     vbcrlf&"  <td width='8%'>查看</td>" & _
     vbcrlf&"  </tr>"
 
  keyword=code_search(request.querystring("keyword"))
  sqladd=" where ordernum='"&keyword&"'"
  i=1
  sql="select id,ordernum,nname,tim,prices,ispayment,ispay from shop_orders "&sqladd&" order by id desc"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    ordernum=rs("ordernum")
    tim=rs("tim")

   if rs("ispayment") then
     t1="在线支付"
    else
     t1="<font class=gray>其它方式</font>"
    end if

    if rs("ispay") then
     t2="<font class=red>已支付</font>"
    else
      t2="<font class=gray>未支付</font>"
    end if

  tmp1=tmp1&vbcrlf&" <tr class=bg_td align=center>" & _
  vbcrlf&"<td>"&i&"</td>" & _
  vbcrlf&"<td align=left><a href='order_view.asp?ordernum="&ordernum&"'>"&ordernum&"</a></td>" & _
  vbcrlf&"<td align=left>"&rs("nname")&"</td>" & _
  vbcrlf&"<td align=right>"&fm_price(rs("prices"),1)&"</td>" & _
  vbcrlf&"<td><font alt='"&joekoe_cms.time_type(tim,2)&"' class=tims>"&joekoe_cms.time_type(tim,3)&"</td>" & _
  vbcrlf&"<td>"& t1 & "</td>" & _
  vbcrlf&"<td>"& t2 & "</td>" & _
  vbcrlf&"<td><a href='order_view.asp?ordernum="&ordernum&"'>详细</a></td>" & _
  vbcrlf&"</tr>"
    i=i+1
    rs.movenext
  loop
  rs.close
call shop_center_table("查询结果",tmp1,1,1)
end sub  


sub emoney_order_list()

  dim tim,ordernum,sqladd,tmp1
  keyword=code_search(request.querystring("keyword"))
  sqladd=" where ordernum='"&keyword&"'"
  i=1
  sql="select id,ordernum,nname,tim,emoneys,num from shop_emoney_notes "&sqladd&" order by id desc"
  set rs=joekoe_cms.exec(sql,1)
  if rs.eof then
  tmp1=vbcrlf&"<tr class=bg_td align=center><td colspan=7 height=30>没有找到您搜索的订单！</td></tr>"
  end if
  do while not rs.eof
    ordernum=rs("ordernum")
    tim=rs("tim")
  tmp1=vbcrlf&"<tr align=center>" & _
        vbcrlf&"<td class=tds width='6%'>序号</td>" & _
        vbcrlf&"<td class=tds width='30%'>订 单 号</td>" & _
        vbcrlf&"<td class=tds width='18%'>客户姓名</td>" & _
        vbcrlf&"<td class=tds width='12%'>订购"&joekoe_cms.web_unit&"</td>" & _
        vbcrlf&"<td class=tds width='12%'>订购数量</td> " & _
        vbcrlf&"<td class=tds width='16%'>订购时间</td>" & _
        vbcrlf&"<td class=tds width='6%'>查看</td>" & _
        vbcrlf&"</tr>" & _
       vbcrlf&"<tr class=bg_td align=center>" & _
       vbcrlf&"<td>"&i&"</td>" & _
       vbcrlf&"<td align=left><a href='order_view.asp?ordernum="&ordernum&"'>"&ordernum&"</a></td>" & _
       vbcrlf&"<td align=left>"&rs("nname")&"</td>" & _
       vbcrlf&"<td align=right>"&fm_price(rs("emoneys"),1)&"</td>" & _
       vbcrlf&"<td align=center>"&rs("num")&"</td>" & _
       vbcrlf&"<td><font alt='"&joekoe_cms.time_type(tim,2)&"' class=tims>"&joekoe_cms.time_type(tim,3)&"</td>" & _
       vbcrlf&"<td><a href='order_view.asp?type=emoney&ordernum="&ordernum&"'>详细</a></td>" & _
       vbcrlf&"</tr>"
    i=i+1
    rs.movenext
  loop
  rs.close
call shop_center_table("查询结果",tmp1,1,1)
end sub

response.write ukong
'----------------------------中间 结束----------------------------
call shop_end()
call web_end(0,0)

sub order_search()
dim tmp1
tmp1=vbcrlf&"<form name=shop_order_sea_frm action='order.asp' method=get onsubmit=""javascript:frm_submitonce(this);"">" & _
vbcrlf&"<input type=hidden name=action value='search'>" & _
vbcrlf&"<tr>" & _
vbcrlf&"<td>订单号：</td>" & _
vbcrlf&"<td><input type=text name=keyword value='请输入订单号' onfocus=""if (value =='请输入订单号'){value =''}"" onblur=""if (value ==''){value='请输入订单号'}"" size=15 maxlength=20></td>" & _
vbcrlf&"<td width=5></td>" & _
vbcrlf&"<td><select name=type size=1><option value='other'>一般支付订单</option><option value='emoney'>"& joekoe_cms.web_unit&"支付订单</option></select></td>" & _
vbcrlf&"<td width=5></td>" & _
vbcrlf&"<td><input type=submit class=btn value='搜索订单'></td>" & _
vbcrlf&"<td width=20></td>" & _
vbcrlf&"<td><font class=red2>请输入您在购买时生成的订单号</font></td>" & _
vbcrlf&"</tr></form>" 
call shop_center_table(tit,tmp1,1,1)
end sub
%>