<!-- #include file="skin.asp" -->
<!-- #include file="common_shop.asp" -->
<!-- #include file="jk_nsort.asp" -->
<!-- #include file="jk_keyes.asp" -->
<!-- #include file="joekoe_pay.asp" -->
<!-- #include file="../style/data_sort_shop.asp" -->
<%

dim n_name
cid=0
sid=0
n_sort="shop"
index_url="shop"
tit_fir=format_menu(index_url)
m_channel=index_url
web_img_m="m_"&m_channel
web_img_h="h_"&m_channel

sub shop_load(t1,t2,t3)
  response.write joekoe_cms.js_put("style/con_shop.js",0)
end sub

sub shop_end()
  if isarray(sort_dim) then erase sort_dim
end sub

sub shop_left()
  response.write vbcrlf&shop_bar_top("用户信息",1,3) & _
                 vbcrlf&"<tr><td align=center height=30>&nbsp;"&img_skin("label_"&m_channel&"_bag")&"&nbsp;<a href='shop_bag.asp'>购 物 车</a></td></tr>" & _
                 vbcrlf&"<tr><td align=center>&nbsp;"&img_skin("label_"&m_channel&"_pay")&"&nbsp;<a href='shop_pay.asp'>收 银 台</a></td></tr>" & _
                 vbcrlf&"<tr><td align=center height=30>&nbsp;"&img_skin("label_"&m_channel&"_order")+"&nbsp;<a href='shop_order.asp'>订单查询</a></td></tr>" & _
                 vbcrlf&shop_bar_end("",1)
end sub

sub shop_left_nsort(ltype)
  response.write vbcrlf&shop_bar_top("产品分类",0,2) & _
                 vbcrlf&nsort_left_type("shop_list.asp?",ltype) & _
                 vbcrlf&shop_bar_end("",0)
end sub

sub shop_cs_name()
  if cname<>"" then
    n_name=cname
    if sname<>"" then
      n_name=n_name&"→"&sname
    end if
  end if
  if n_name<>"" then
    n_name="（"&n_name&"）"
  end if
end sub

sub shop_good(sqlvar)
  dim price,price_now,discount,name,remark_1
  response.write vbcrlf&shop_bar_top("推荐产品",0,1) & _
		 vbcrlf&"<table border=0 width='100%'><tr>"
  sql="select top 1 id,name,smallimg,brand,remark_1,price,discount,is_emoney,emoney from shop_product where hidden=1 and isgood=1"&sqlvar&" order by id desc"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    name=joekoe_cms.code_html(rs("name"),1,0)
    remark_1=joekoe_cms.code_html(rs("remark_1"),2,0)
    price=fm_price(rs("price"),0)
    discount=rs("discount")
    price_now=fm_price(price*(discount/100),0)
    discount=fm_discount(discount)
    response.write vbcrlf&shop_main_good(rs("id"),name,rs("smallimg"),rs("brand"),price,price_now,discount,rs("is_emoney"),rs("emoney"),remark_1)
    rs.movenext
  loop
  rs.close
  response.write vbcrlf&"</tr></table>" & _
		 vbcrlf&shop_bar_end("",0)
end sub


sub shop_cast_top(n_num,c_num)
  dim n_topic,n_tim
  response.write vbcrlf&shop_bar_top("商城公告",1,1)
  sql="select top "&n_num&" id,topic,tim from shop_cast where hidden=1 order by istop desc,id desc"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    n_topic=rs("topic")
    n_tim=rs("tim")
    n_tim=joekoe_cms.time_type(n_tim,1)
    response.write vbcrlf&shop_topic_type(c_num,rs("id"),n_topic,n_tim)
    rs.movenext
  loop
  rs.close
  response.write vbcrlf&shop_bar_end("<a href='shop_cast.asp'>浏览更多…</a>",1)
end sub

function fm_discount(dvar)
  if dvar>=100 then
    fm_discount="不打折"
    exit function
  end if 
  fm_discount=cstr(dvar/10)&"折"
end function

sub shop_search()
  response.write shop_bar_top("产品搜索",0,3)
  response.write ukong
%>
<table border=0>
<form name=shop_sea_frm action='shop_list.asp' method=get onsubmit="javascript:frm_submitonce(this);">
<input type=hidden name=action value='search'>
<tr>
<td><%response.write img_skin("new")%></td>
<td width=5></td>
<td><%response.write select_type("产品",0,0)%></td>
<td width=5></td>
<td><select name=sea_type sizs=1><option value='name'>产品名称</option><option value='price'>产品价格</option><option value='brand'>产品品牌</option><option value='serial'>产品编号</option></seelct></td>
<td width=5></td>
<td><select name=sea_term sizs=1><option value='all'>满足所有条件</option><option value='only'>满足一个条件</option></seelct></td>
<td width=5></td>
<td><input type=text name=keyword value='请输入关键字' onfocus="if (value =='请输入关键字'){value =''}" onblur="if (value ==''){value='请输入关键字'}" size=15 maxlength=20 title='多个关键字请用 空格 格开'></td>
<td width=5></td>
<td><input type=submit value='搜索'></td>
</tr></form></table>
<%    
  response.write shop_bar_end("",0)
end sub

function shop_bar_top(tvar,tt,ttype)
  dim w_wid,temp1
  w_wid="70"
  if len(tvar)>8 then w_wid="240"
  if len(tvar)>20 then w_wid="400"
  temp1=temp1&vbcrlf&"<table border=0 cellpadding=0 cellspacing=0 class=tablew>" & _
              vbcrlf&"<tr><td>" & _
              vbcrlf&"  <table border=0 cellpadding=0 cellspacing=0 width='100%'>" & _
              vbcrlf&"  <tr height=30>" & _
              vbcrlf&"  <td width=160 background='"&joekoe_cms.web_dir_skin&"main/"&m_channel&"_bar_right"&ttype&".gif' class=btd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font class=fbg>"&tvar&"</font></td>" & _
              vbcrlf&"  <td width='*' background='"&joekoe_cms.web_dir_skin&"main/"&m_channel&"_bar_center"&ttype&".gif'>&nbsp;</td>" & _
              vbcrlf&"  <td width=10><img src='"&joekoe_cms.web_dir_skin&"main/"&m_channel&"_bar_left"&ttype&".gif'></td>" & _
              vbcrlf&"  </tr>" & _
              vbcrlf&"  </table>" & _
              vbcrlf&"</td></tr>" & _
              vbcrlf&"<tr><td align=center>"
  if tt=1 then temp1=temp1&vbcrlf&"  <table border=0 width='100%'>"
  shop_bar_top=temp1
end function

function shop_bar_end(mvar,tt)
  dim temp1
  if tt=1 then temp1=temp1&vbcrlf&"  </table>"
  temp1=temp1&vbcrlf&"</td></tr>"
  if mvar<>"" then temp1=temp1&vbcrlf&"<tr><td align=right>"&mvar&"&nbsp;&nbsp;</td></tr>"
  temp1=temp1&vbcrlf&"</table>"
  shop_bar_end=temp1&ukong
end function

function shop_topic_type(b_c_num,b_id,b_topic,b_tim)
  dim n_url,n_jt
  n_url="shop_cast.asp?action=view&id="&b_id
  n_jt=img_skin(web_img_h)
  shop_topic_type="<tr><td>"&n_jt&"<a href='"&n_url&"' alt='公告标题："&joekoe_cms.code_html(b_topic,1,0)&"<br>发布时间："&b_tim&"' target=_blank>"&joekoe_cms.code_html(b_topic,1,b_c_num)&"</a></td></tr>"
end function

function shop_list_type(n_id,n_name,n_smallimg,n_brand,n_price,n_price_now,n_discount,n_is_emoney,n_emoney)
  dim temp1
  temp1=temp1&vbcrlf&"<td width='50%'>" & _
              vbcrlf&"  <table border=0 width='100%'>" & _
              vbcrlf&"  <tr>" & _
              vbcrlf&"  <td width='45%' align=center>"&pic_fk(n_smallimg,1,"shop_view.asp?id="&n_id)&"</td>" & _
              vbcrlf&"  <td width='55%'>" & _
              vbcrlf&"    <table border=0 width='100%'>" & _
              vbcrlf&"    <tr><td><a href='shop_view.asp?id="&n_id&"' target=_blank><font class=blue><b>"&n_name&"</b></font></a></td></tr>" & _
              vbcrlf&"    <tr><td>价格：<font class=red>"&n_price_now&"</font> "&val_unit&"</td></tr>" & _
              vbcrlf&"    <tr><td>原价："&n_price&val_unit&" <font class=red2>"&n_discount&"</font></td></tr>" & _
              vbcrlf&"    <tr><td>"&joekoe_cms.web_unit&"："&shop_emoney_pay(n_is_emoney,n_emoney,n_id)&"</td></tr>" & _
              vbcrlf&"    <tr><td>" & _
              vbcrlf&"      <table border=0 cellspacing=0 cellpadding=0 width='100%'>" & _
              vbcrlf&"      <tr>" & _
              vbcrlf&"      <td><a href='shop_bag.asp?id="&n_id&"' target=_blank><img src='"&joekoe_cms.web_dir_skin&"main/button_bag.gif' border=0></a></td>" & _
              vbcrlf&"      <td><a href='shop_view.asp?id="&n_id&"' target=_blank><img src='"&joekoe_cms.web_dir_skin&"main/button_view.gif' border=0></a></td>" & _
              vbcrlf&"      </tr>" & _
              vbcrlf&"      </table>" & _
              vbcrlf&"    </td></tr>" & _
              vbcrlf&"    </table>" & _
              vbcrlf&"  </td>" & _
              vbcrlf&"  </tr>" & _
              vbcrlf&"  </table>" & _
              vbcrlf&"</td>"
  shop_list_type=temp1
end function

function shop_main_good(n_id,n_name,n_smallimg,n_brand,n_price,n_price_now,n_discount,n_is_emoney,n_emoney,n_remark_1)
  dim temp1
  temp1=temp1&vbcrlf&"<td width='100%'>" & _
              vbcrlf&"  <table border=0 width='100%'>" & _
              vbcrlf&"  <tr>" & _
              vbcrlf&"  <td width='35%' align=center>"&pic_fk(n_smallimg,2,"shop_view.asp?id="&n_id)&"</td>" & _
              vbcrlf&"  <td width='65%'>" & _
              vbcrlf&"    <table border=0>" & _
              vbcrlf&"    <tr><td colspan=2><a href='shop_view.asp?id="&n_id&"' target=_blank><font class=blue><b>"&n_name&"</b></font></a></td></tr>" & _
              vbcrlf&"    <tr>" & _
              vbcrlf&"    <td>价格：<font class=red>"&n_price_now&"</font> "&val_unit&"</td>" & _
              vbcrlf&"    <td rowspan=4 align=center>" & _
              vbcrlf&"      <table border=0 width='100%'>" & _
              vbcrlf&"      <tr>" & _
              vbcrlf&"      <td><a href='shop_bag.asp?id="&n_id&"' target=_blank><img src='"&joekoe_cms.web_dir_skin&"main/button_bag.gif' border=0></a></td>" & _
              vbcrlf&"      <td><a href='shop_view.asp?id="&n_id&"' target=_blank><img src='"&joekoe_cms.web_dir_skin&"main/button_view.gif' border=0></a></td>" & _
              vbcrlf&"      </tr>" & _
              vbcrlf&"      </table>" & _
              vbcrlf&"    </td>" & _
              vbcrlf&"    </tr>" & _
              vbcrlf&"    <tr><td>原价："&n_price&val_unit&" <font class=red2>"&n_discount&"</font></td></tr>" & _
              vbcrlf&"    <tr><td>"&joekoe_cms.web_unit&"："&shop_emoney_pay(n_is_emoney,n_emoney,n_id)&"</td></tr>" & _
              vbcrlf&"    <tr><td>品牌："&n_brand&"</td></tr>" & _
              vbcrlf&"    <tr><td colspan=2>简介："&n_remark_1&"</td></tr>" & _
              vbcrlf&"    </table>" & _
              vbcrlf&"  </td>" & _
              vbcrlf&"  </tr>" & _
              vbcrlf&"  </table>" & _
              vbcrlf&"</td>"
  shop_main_good=temp1
end function

%>