<!-- #include file="include/config_shop.asp" -->
<!-- #include file="include/jk_pagecute.asp" -->
<!-- #include file="include/conn.asp" -->
<%
dim nid,nummer,page,rssum,thepages,viewpage,pageurl,sqladd
call cid_sid()

if cid=0 then
  if action="search" then
    tit="查询结果"
    tit_fir=tit_fir
  else
    tit=tit_fir
    tit_fir=""
  end if
else
  if action="search" then
    tit="查询结果"
    tit_fir=tit_fir
  else
    tit="分类浏览"
    tit_fir=tit_fir
  end if
end if

call web_head(0,0,0,0,0)
'------------------------------------left----------------------------------
call format_login()
call shop_sort()
call shop_left()
'----------------------------------left end--------------------------------
call web_center(0)
'-----------------------------------center---------------------------------
response.write ukong

call product_sea()
call shop_help()   ''在此处调用即可
%>
<table border=0 width='98%' align=center>
<tr><td align=center>
<%

if cid=0 then
  if action="search" then
    call shop_list()
  else
    call shop_main()
  end if
else
  call shop_list()
end if
%>
</td></tr>
<tr><td align=center></td></tr>
</table>
<%
'---------------------------------center end-------------------------------
call web_end(0)

sub shop_main()
%>
<table border=0 width='100%' cellspacing=0 cellpadding=0>
<tr><td><table border=0 cellspacing=0 cellpadding=0 width='100%'><tr><td width=100  height=20 align=center  background="IMAGES/<%response.write web_var(web_config,5)%>/bg_td.gif" bgcolor=<%response.write web_var(web_color,2)%> class=end><b>产品推荐</b></td><td>&nbsp;</td></tr></table></td></tr>
<tr><td height=1 background='images/bg_dian.gif'></td></tr>
<tr><td height=5></td></tr>
</table>
<table border=0 width='98%' cellspacing=0 cellpadding=0><tr valign=top>
<%
  sql="select top 3 id,name,serial,brand,stock,smallimg,price_1,price_2,remark_1 from product where isgood=1 and hidden=1 order by tim desc,id desc"
  set rs=conn.execute(sql)
  do while not rs.eof
    response.write vbcrlf&"<td width='33%' align=center>"&shop_view()&"</td>"
    rs.movenext
  loop
  rs.close
%></tr></table>
<table border=0 width='100%' cellspacing=0 cellpadding=0>
<tr><td height=10></td></tr>
<tr><td><table border=0 cellspacing=0 cellpadding=0 width='100%'><tr><td width=100 height=20 align=center  background="IMAGES/<%response.write web_var(web_config,5)%>/bg_td.gif" bgcolor=<%response.write web_var(web_color,2)%> class=end><b>最新产品</b></td><td align=right><a href='#top'><img src='images/small/gotop.gif' border=0></a></td></tr></table></td></tr>
<tr><td height=1 background='images/bg_dian.gif'></td></tr>
<tr><td height=5></td></tr>
</table>
<table border=0 width='100%' cellspacing=0 cellpadding=0>
<%
  sql="select top 6 id,name,serial,brand,stock,smallimg,price_1,price_2,remark_1 from product where hidden=1 order by id desc"
  set rs=conn.execute(sql)
  do while not rs.eof
    response.write vbcrlf&"<tr valign=top>"
    for i=1 to 3
      if rs.eof or rs.bof then exit for
      response.write vbcrlf&"<td width='33%' align=center>"&shop_view()&"</td>"
      rs.movenext
    next
    response.write vbcrlf&"</tr><tr><td height=1 colspan=3 background='images/bg_dian.gif'></td></tr>"
  loop
  rs.close:set rs=nothing
  response.write vbcrlf&"</table>"
end sub

sub shop_list()
  dim j,sea_type,keyword
  pageurl="shop.asp?":sqladd=""
  thepages=0:viewpage=1:nummer=9
  sea_type=trim(request.querystring("sea_type"))
  keyword=replace(trim(request.querystring("keyword")),"'","")
  if cid>0 then
    sqladd=" and c_id="&cid
    pageurl=pageurl&"c_id="&cid&"&"
    if sid>0 then
      sqladd=sqladd&" and s_id="&sid
      pageurl=pageurl&"s_id="&sid&"&"
    end if
  end if
  if len(keyword)>0 and (sea_type="name" or sea_type="brand" or sea_type="remark_1") then
    sqladd=sqladd&" and "&sea_type&" like '%"&keyword&"%'"
    pageurl=pageurl&"keyword="&server.htmlencode(keyword)&"&sea_type="&sea_type&"&"
  end if
%>
<table border=0 width='100%' cellspacing=0 cellpadding=0>
<tr><td height=10></td></tr>
<tr><td><table border=0 cellspacing=0 cellpadding=0 width='100%'><tr><td width=100  height=20 align=center background="IMAGES/<%response.write web_var(web_config,5)%>/bg_td.gif" bgcolor=<%response.write web_var(web_color,2)%> class=end><b>产品列表</b></td><td>&nbsp;</td></tr></table></td></tr>
<tr><td height=1 background='images/bg_dian.gif'></td></tr>
<tr><td height=5></td></tr>
</table>
<table border=0 width='98%' cellspacing=0 cellpadding=0>
<%
  sql="select id,name,serial,brand,stock,smallimg,price_1,price_2,remark_1 from product where hidden=1"&sqladd&" order by id desc"
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,1,1
  if rs.eof and rs.bof then
    rssum=0
  else
    rssum=rs.recordcount
  end if
  call format_pagecute()
  if int(viewpage)>1 then
    rs.move (viewpage-1)*nummer
  end if
  for j=1 to nummer\3
    if rs.eof or rs.bof then exit for
    response.write vbcrlf&"<tr valign=top>"
    for i=1 to 3
      if rs.eof or rs.bof then exit for
      response.write vbcrlf&"<td width='33%' align=center>"&shop_view()&"</td>"
      rs.movenext
    next
    response.write vbcrlf&"</tr><tr><td height=5></td></tr><tr><td height=1 colspan=3 background='images/bg_dian.gif'></td></tr><tr><td height=5></td></tr>"
  next
  rs.close:set rs=nothing
%>
</table>
<table border=0 width='100%'>
<tr height=25>
<td align=left>页次：<font class=red><%response.write viewpage%></font>/<font class=red><%response.write thepages%></font>&nbsp;&nbsp;分页：<%response.write jk_pagecute(nummer,thepages,viewpage,pageurl,8,"#ff0000")%></td>
</tr>
</table>
<%
end sub

function shop_view()
  nid=rs("id")
  shop_view=vbcrlf&"<table border=0 width='90%' cellspacing=0 cellpadding=0 class=tf>" & _
	    vbcrlf&"<tr><td height=5></td></tr>" & _
	    vbcrlf&"<tr><td colspan=2 align=center><a href='shop_view.asp?id="&nid&"'><img src='"&url_true(upload_file,rs("smallimg"))&"' border=0 width=123 height=96></a></td></tr>" & _
	    vbcrlf&"<tr><td colspan=2 align=center height=25><a href='shop_view.asp?id="&nid&"' class=blue><b>"&rs("name")&"</b></a></td></tr>" & _
	    vbcrlf&"<tr><td colspan=2 align=center>"&img_small("jt0")&"会员价格：<font class=red>￥<u>"&rs("price_2")&"</u></font> <font class=gray>￥<i>"&rs("price_1")&"</i></font></td></tr>" & _
	    vbcrlf&"<tr><td colspan=2 align=center height=30><a href='shop_bag.asp?id="&nid&"'><img align=absMiddle src='images/shop/buy.gif' border=0></a>&nbsp;&nbsp;[ <a href='shop_view.asp?id="&nid&"'>详细介绍</a> ]</td></tr>" & _
	    vbcrlf&"</table>"
  'vbcrlf&"<tr><td colspan=2 align=center>"&rs("brand")&"</td></tr>" & _
  'vbcrlf&"<tr><td width='50%'>"&img_small("jt0")&"产品编号：</td><td width='50%'>"&rs("serial")&"</td></tr>" & _
  'vbcrlf&"<tr><td>"&img_small("jt0")&"产品库存：</td><td class=red>"&rs("stock")&"</td></tr>" & _
  'vbcrlf&"<tr><td colspan=2 class=bw height=50 valign=top>产品简介："&code_html(rs("remark_1"),1,35)&"</td></tr>" & _
end function
%>