<%
'**************************************
'* 最后更新 2012-08-23 by 56770.kingdge
'* Copyright www.56770.com
'**************************************
Dim addtime,listprice,listtime,listtype,page,sle_type,brand,sel_type,retime
Showpath = "<a href='"& Eshop_url & LangPath &"'>"& Lebi_word(0) &"</a> → "& Lebi_word(16)
page = checknum(request("page"),1)
sort_id = checknum(sort_id,0)
listprice=request("listprice")
listtime=request("listtime")
listtype=request("listtype")
listview=request("listview")
listbuy=request("listbuy")
'..................................
'商品列表
'动态页调用部分
'..................................
Function SaleProductList(showheadpage,showfootpage)
        Dim DataCount,DataList,Filename,i,showpic_width,showpic_height,div_width,div_height,briefed,pic_url ,j,RLoadStyle(5),strFile,skin_ys,tmpstr,loopstr,stock,PList_url,icostr,List_num,LoadListStr
        showheadpage = checknum(showheadpage,0) : showfootpage = checknum(showfootpage,0)
        skin_ys = top20
        If listtype="pic" Then skin_ys = 1
	    If listtype="word" Then skin_ys = 0
	    If listtype="listpic" Then skin_ys = 2
        if not isnumeric(page) Or isempty(page) Then page=1
	    Dim ors
	    Set ors=new Cls_vbsPage
	    Set ors.Conn=conn
	    With ors
		    .PageSize=top19
		    .PageName="Page"
			If IsSqlDataBase = 0 Then
		            .DbType="AC"
			Else
			        .DbType="MSSQL"
			End If
		    .RecType=0
		    .Pkey="id"
    	    .Field="id,product_name"& LangTxt &",pic,sprice,cprice,pic_size,cpic,briefed"& LangTxt &",kucun,p_jifen,sj,views,stj,ytj,IsNew,p_filename,bianhao"
		    .Table="[Lebi_product]"
		    .Condition="zhuangtai=1 and cx=1"
            If listprice="up" Then .OrderBy="cprice DESC"
            If listprice="down" Then .OrderBy="cprice asc"
            If listtime="up" Then .OrderBy="sj DESC"
            If listtime="down" Then .OrderBy="sj asc"
	        If listview="up" Then .OrderBy="views DESC"
	        If listview="down" Then .OrderBy="views ASC"
	        If listbuy="up" Then .OrderBy="buys DESC"
	        If listbuy="down" Then .OrderBy="buys ASC"
            If listprice="" And listtime="" And listview="" And listbuy="" Then .OrderBy="p_order desc,id desc"
	    End With
	    DataCount=ors.RecCount()
	    DataList=ors.ResultSet()
		List_num = 1
		strFile = Eshop_url& Style_Folder &"Lebi.SaleProductList."
		RLoadStyle(0) = splits(LoadStyle(strFile&"11.style"))	'购买按钮
		RLoadStyle(2) = splits(LoadStyle(strFile&"12.style"))	'预订按钮
		RLoadStyle(3) = splits(LoadStyle(strFile&"13.style"))	'零库存
		RLoadStyle(1) = splits(LoadStyle(strFile&"14.style"))	'收藏按钮
		LoadListStr = "<form action="""" method=""post"" name=""LEBI_FORMBUY_0001"" id=""LEBI_FORMBUY_0001"">"
		LoadListStr = LoadListStr & LoadStyle(strFile&"0.style")
		If show_html = 0 Then
				Filename = "default.asp"
		Else
				Filename = Eshop_url & LangPath & Folder(5) &"list"
		End If
		If showheadpage = 1 Then
			tmpstr = LoadStyle(strFile&"1.style")
			ReplaceStyle "headpage",ors.ShowPageHead(Filename),tmpstr
			LoadListStr = LoadListStr & tmpstr
		End If
	    If DataCount > 0 Then
				If skin_ys <> 2 Then
						LoadListStr = LoadListStr & splits(LoadStyle(strFile&"3.style"))
				End If
				Select Case skin_ys
				       Case "0" : RLoadStyle(4) = splits(LoadStyle(strFile&"7.style")) '文字显示
				       Case "1" : RLoadStyle(4) = splits(LoadStyle(strFile&"5.style")) '图片显示
				       Case "2" : RLoadStyle(4) = splits(LoadStyle(strFile&"6.style")) '图片多列显示
				End Select
				LoadListStr = LoadListStr & LoadStyle(strFile&"4.style")
				For i = 0 To Ubound(DataList,2)
				        loopstr = RloadStyle(4)
						stock=DataList(8,i)
		                briefed = DataList(7,i)
						Select Case show_html
							   Case "0"
									Select Case ISAPI_Rewrite
										   Case "0" PList_url=PagePath(10) &"?id="& DataList(0,i)
										   Case "1" PList_url=LangPath &"product-"& DataList(0,i) &".html"
									End Select
							   Case "1" : PList_url=LangPath & Folder(0) & DataList(15,i) &".1."& Sys_Ext
						End Select
						If Trim(DataList(2,i))<>"" Then
								tmpstr = ""
								ReplaceStyle "pic_url",PicturePath & DataList(2,i),loopstr
								ReplaceStyle "lazyload_pic_url",Eshop_url & PicturePath & DataList(2,i),loopstr
								If show_mouse = "0" Then
										If InStr(DataList(6,i),"@@") > 0 Then
												pic_url = Split(DataList(6,i),"@@")(0)
												If pic_url = "" Then pic_url = Split(DataList(6,i),"@@")(1)
										Else
												pic_url = DataList(6,i)
										End If
										tmpstr = " onMouseover=""javascript:ddrivetip('<img src="& Eshop_url & PicturePath & pic_url &" width="& pic_dw &">', '#ffffff', '"& pic_dw + 10 &"')"" onMouseout=""hideddrivetip()"""
								Else
										tmpstr = ""
								End If
								ReplaceStyle "onmouse",tmpstr,loopstr
						End If
						icostr=""
                        If Config_Lebi_Eshop(7)=1 And DataList(14,i)=1 Then
								icostr=icostr&" <img src='"& Eshop_url &"images/icons/pro_3.gif' align='absmiddle'> "
                        End if
                        If Config_Lebi_Eshop(5)=1 And CLng(DataList(11,i))>CLng(Config_Lebi_Eshop(6)) Then
								icostr=icostr&" <img src='"& Eshop_url &"images/icons/pro_2.gif' align='absmiddle'> "
                        End if
                        If Config_Lebi_Eshop(3)=1 then
                                icostr=icostr&" <img src='"& Eshop_url &"images/icons/pro_1.gif' align='absmiddle'> "
                        End If
                        If Config_Lebi_Eshop(4)=1 And (DataList(12,i)=1 Or DataList(13,i)=1) Then
								icostr=icostr&" <img src='"& Eshop_url &"images/icons/pro_4.gif' align='absmiddle'> "
                        End If
						ReplaceStyle "ico",icostr,loopstr
						ReplaceStyle "url",PList_url,loopstr
						ReplaceStyle "target",Config_Lebi_Eshop(9),loopstr
						ReplaceStyle "id",DataList(0,i),loopstr
						ReplaceStyle "name",DataList(1,i),loopstr
						rem	  会员组价格显示 2008-2-28 by 56770.WangLei
						If checkPricePurview(Lebi_UserGrade) Then
								ReplaceStyle "buy_price",Formatnumber2(DataList(4,i)/moneyhl),loopstr
						Else
								ReplaceStyle "buy_price",Lebi_word(66),loopstr
						End If
						ReplaceStyle "market_price",Formatnumber2(DataList(3,i)/moneyhl),loopstr
						'ReplaceStyle "sale_price",DataList(4,i),loopstr
						ReplaceStyle "point",DataList(9,i),loopstr
						ReplaceStyle "stock",DataList(8,i),loopstr
						ReplaceStyle "content",cutchar(briefed,100),loopstr
						ReplaceStyle "bianhao",DataList(16,i),loopstr
						rem	 购买、预订、零库存 样式 by 56770.WangLei
						If InStr(loopstr,"{@btn_buy}") > 0 Then
								tmpstr = ""
								if stock <= 0 Then
										Select Case CInt(getGradePurview(17))
											   Case "1" : tmpstr=tmpstr & RLoadStyle(2)	'预定
											   Case "0" : tmpstr=tmpstr & RLoadStyle(3)	'零库存
										End Select
								Else
										tmpstr=tmpstr & RLoadStyle(0)	'购买
								end If
								ReplaceStyle "listcode","0001",tmpstr
								ReplaceStyle "type","",tmpstr
								ReplaceStyle "isValid",getGradePurview(0),tmpstr
								ReplaceStyle "id",DataList(0,i),tmpstr
								ReplaceStyle "btn_buy",tmpstr,loopstr
						End If
						rem	}->
						rem	 收藏按钮 by 56770.WangLei
						If InStr(loopstr,"{@btn_fav}") > 0 Then
								tmpstr = ""
								tmpstr = RLoadStyle(1)	'收藏按钮
								ReplaceStyle "id",DataList(0,i),tmpstr
								ReplaceStyle "name",Urlencode(DataList(1,i)),tmpstr
								ReplaceStyle "backurl",Urlencode(geturl()),tmpstr
								ReplaceStyle "type","",tmpstr
								ReplaceStyle "btn_fav",tmpstr,loopstr
						End If
						rem	}->
						ReplaceStyle "loop_num",i + 1,loopstr
						LoadListStr = LoadListStr & loopstr
						List_num = List_num + 1
                Next
		Else
				LoadListStr = LoadListStr & splits(LoadStyle(strFile&"2.style"))
		End If
		LoadListStr = LoadListStr & LoadStyle(strFile&"8.style")
		If showfootpage = 1 Then
				tmpstr = LoadStyle(strFile&"9.style")
				ReplaceStyle "footpage",ors.ShowPageFoot(Filename),tmpstr
				LoadListStr = LoadListStr & tmpstr
		End If
		LoadListStr = LoadListStr & LoadStyle(strFile&"10.style")
		LoadListStr = LoadListStr & "</form>"
		SaleProductList = LoadListStr
End Function
%>