<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="inc/Page_cls.asp"-->
<!--#include file="../include/Lebi_md5.asp"-->
<!--#include file="../Include/Lebi_config.asp"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_orders_quick.asp
'* 最后更新 2013-6-13 by 56770.kingdge
'*****************************************
Dim admin_flag
admin_flag=",1.5,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_order.inc"
CurrentId = 2
CurrentUrl = "admin_order_quick.asp"
LB_Head()
LB_Menu()
Response.Write("<div class=""mainbody"">")
Response.Write("<div class=""mainbody2"">")
If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
		adminflag()
Else
		If OutSubmit = 1 Then CheckOutSubmit()
		Select Case Request("action")
			   Case "setcookie" setcookie()
			   Case "product" product()
			   Case Else
					Main()
		End Select
End If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

Sub Main()
%>
<script language="javascript" type="text/javascript" src="inc/js/search.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="order_quick" class="classtable">
<form name="form" method="post" action="?action=setcookie">
<tr>
  <td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
  <td align="right" class="classhead">
  <%=QuickMenu("Home_orders.asp|"& Lang_Menu(88) &"","Admin_buy.asp|"& Lang_Menu(98) &"")%>
  </td>
 </tr>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Menu(87)%></td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(81)%></td>
<td class="classrow"><input type="radio" name="UserMode" value="1" checked> <%=Lang_Order(82)%>
<input type="radio" name="UserMode" value="0" onClick="location.href='Admin_user.asp?action=add&isback=1'"> <%=Lang_Order(83)%>
</td>
</tr>
<tr class="classrow">
<td height="30" class="classtop" colspan="2"><%=Lang_Order(82)%></td>
</tr>
<tr class="classrow">
<td height="30" class="classrow"><%=Lang_Order(84)%></td>
<td class="classrow"><input type="text" name="user_id" id="user_id" class="form" size="30" autocomplete="off" onkeyup="search_suggest('user_id','lebi_user','')"><br /><div id="search_suggest_user_id" class="search_suggest" style="display:none"></div>
</td>
</tr>
<tr class="classfooter">
  <td height="30" colspan="2" align="left" class="classfooter"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
 </tr>
 </form>
</table>
<script>tdshow("order_quick");</script>
<%
End Sub

Sub setcookie()
		randomize:ranNum=int(90000000*rnd)+10
		user_id = safereplace(Trim(request("user_id")))
		Set rs = conn.execute("select u.id,u.user_name,u.user_grade,g.grade_name,user_password from lebi_user as u,lebi_user_grade as g where u.user_grade = g.grade_dj and u.user_id = '"& user_id &"'")
		If rs.eof Then
				Call Close_mes(Lang_sys(46),"·"& Lang_Order(80),3)
		Else
				userid = rs(0)
				user_name = rs(1)
				user_grade = rs(2)
				user_grade_name = rs(3)
				user_password = rs(4)
		End If
		rs.close : Set rs = Nothing

		Response.cookies(cookiesname&"_basket")("order_userid") = userid
		Session(cookiesname&"_basket"&"order_userid") = userid
		userid = request.cookies(cookiesname&"_basket")("order_userid")
		If userid = "" Then userid = Session(cookiesname&"_basket"&"order_userid")
		If request.cookies(cookiesname&"_basket")("order_"& userid &"_cookiesid") = "" Then
				Response.cookies(cookiesname&"_basket")("order_"& userid &"_cookiesid") = ranNum
				Session(cookiesname&"_basket"&"order_"& userid &"_cookiesid") = ranNum
		End If
		order_user_cookiesid = request.cookies(cookiesname&"_basket")("order_"& userid &"_cookiesid")
		If order_user_cookiesid ="" Then order_user_cookiesid = Session(cookiesname&"_basket"&"order_"& userid &"_cookiesid")
'		Set rs = server.CreateObject("adodb.recordset")
'		rs.open "select sessionid,basket_date,coupon_num from [Lebi_lshy] where sessionid = "& CLng(order_user_cookiesid) &"",conn,1,3
'		If rs.eof Then
'		rs.addnew
'		        rs("sessionid") = CLng(order_userid_cookiesid)
'				rs("basket_date") = Now()
'		        rs("coupon_num") = ""
'		rs.update
'		End If
'		rs.close : Set rs = Nothing
	    Response.cookies(cookiesname&"_user")("user_id") = user_id
	    Response.cookies(cookiesname&"_user")("user_grade") = user_grade
	    Response.cookies(cookiesname&"_user")("user_key") = md5(user_password)
	    Response.Cookies(cookiesname&"_user").Expires = Date() + 1
	    Response.cookies(cookiesname&"_user"&"a")("JsCookieUserId") = user_id
	    Response.cookies(cookiesname&"_user"&"b")("JsCookieUserGrade") = user_grade
		session(cookiesname&"_user"&"user_id")=user_id
		session(cookiesname&"_user"&"user_grade")=user_grade
		session(cookiesname&"_user"&"user_key") = md5(user_password)
		If request.ServerVariables("SERVER_PORT") <> 80 Then
				linkurl = "http://"&Request.ServerVariables("SERVER_NAME")&":"&request.ServerVariables("SERVER_PORT")
		Else
				linkurl = "http://"&Request.ServerVariables("SERVER_NAME")
		End If
		linkurl = linkurl & Eshop_url
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="order_quick" class="classtable">
<tr>
  <td height="30" align="left" class="classhead">&nbsp;</td>
  <td align="right" class="classhead">
  <%=QuickMenu("Home_orders.asp|"& Lang_Menu(88) &"","Admin_buy.asp|"& Lang_Menu(98) &"")%>
  </td>
 </tr>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Menu(87)%></td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(7)%></td>
<td class="classrow"><%=user_id%></td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(38)%></td>
<td class="classrow"><%=user_grade_name%></td>
</tr>
<tr class="classfooter">
  <td height="30" colspan="2" align="left" class="classfooter"><%=Lang_Order(205)%><a href="<%=linkurl%>" target="_blank"><%=linkurl%></a></td>
 </tr>
</table>
<script>tdshow("order_quick");window.open('<%=linkurl%>');</script>
<%
End Sub

Sub product()
        Dim list_type
        list_type = CheckNum(request("list_type"),0)
        sort_id=CheckNum(request("sort_id"),0)
        kucun=request("kucun")
        zhuangtai=CheckNum(request("zhuangtai"),1)
        page = CheckNum(request("page"),1)
	    pagecount=page
		userid = request.cookies(cookiesname&"_basket")("order_userid")
		If userid = "" Then userid = Session(cookiesname&"_basket"&"order_userid")
		order_user_id = safereplace(request.cookies(cookiesname&"_basket")("order_"& userid &"_id"))
		If order_user_id = "" Then order_user_id = Session(cookiesname&"_basket"&"order_"& userid &"_id")
		order_user_name = safereplace(request.cookies(cookiesname&"_basket")("order_"& userid &"_name"))
		If order_user_name = "" Then order_user_name = Session(cookiesname&"_basket"&"order_"& userid &"_name")
		order_user_grade = checknum(safereplace(request.cookies(cookiesname&"_basket")("order_"& userid &"_grade")),1)
		If order_user_grade = "" Then order_user_grade = Session(cookiesname&"_basket"&"order_"& userid &"_grade")
		order_user_grade_name = safereplace(request.cookies(cookiesname&"_basket")("order_"& userid &"_grade_name"))
		If order_user_grade_name = "" Then order_user_grade_name = Session(cookiesname&"_basket"&"order_"& userid &"_grade_name")
		keyword = safereplace(Trim(request("keyword")))
		Dim ors
		Set ors=new Cls_vbsPage
		Set ors.Conn=conn
		With ors
		.PageSize=10
		.PageName="Page"
		If IsSqlDataBase = 0 Then
				.DbType="AC"
		Else
				.DbType="MSSQL"
		End If
		.RecType=0
		.Pkey="p.id"
		.Field="p.id,p.bianhao,p.product_name,p.sprice,p.stj,p.ytj,p.zhuangtai,p.cx,p.cprice,p.kucun,p.buys,p.views,p.pic,p.P_SpecificationName,p.P_SpecificationValue,s.price as buyprice,p.P_SpecificationPic"
		.Table="[Lebi_product] as p,[Lebi_product_price] as s"
		sql = "s.product_id=p.id and s.grade_id="&order_user_grade
		if zhuangtai<>"" then sql=sql + " and p.zhuangtai="&zhuangtai&""
		if keyword<>"" then sql=sql + " and (p.product_name like '%"&keyword&"%' or p.bianhao like '%"&keyword&"%' or p.brand like '%"&keyword&"%')"
		If sort_id<>"0" And IsSqlDataBase = 1 Then sql=sql + " and charindex(',"&sort_id&",',p.categoryid)>0"
		If sort_id<>"0" And IsSqlDataBase = 0 Then sql=sql + " and instr(p.categoryid,',"&sort_id&",')>0"
		if request("kucun")="0" then sql=sql + " and p.kucun=0"
		if request("type")="3" then sql=sql + " and p.cx=1"
		if request("type")="4" then sql=sql + " and (p.stj=1 or p.ytj=1)"
		.Condition=sql
		if request("type")="" then sqlorder = "p.sj desc,p.id desc"
		if request("type")="1" then sqlorder = "p.views desc"
		if request("type")="2" then sqlorder = "p.buys desc"
		if request("type")="3" then sqlorder = "p.sj desc,p.id desc"
		if request("type")="4" then sqlorder = "p.sj desc,p.id desc"
		if request("type")="5" then sqlorder = "p.p_order desc,p.id desc"
		.OrderBy=sqlorder
		End With
		DataCount=ors.RecCount()
		DataList=ors.ResultSet()
%>
<script type="text/javascript">
//	for(var j=0;j<arraylist.length;j++){
//		if(arraylist[j][0]==spvalue){
//			ischeck="1";
//			document.getElementById("codes").innerHTML=arraylist[j][1];
//			document.getElementById("prices").innerHTML=arraylist[j][2];
//			document.getElementById("sumcount").innerHTML=arraylist[j][3];
//			document.getElementById("hid_count").value=arraylist[j][3];
//			document.getElementById("weights").innerHTML=arraylist[j][4];
//			document.getElementById("hid_sid").value=arraylist[j][5];
//			break;
//		}
//	}
//	if(ischeck=="0"){
//		document.getElementById("codes").innerHTML="";
//		document.getElementById("prices").innerHTML="";
//		document.getElementById("sumcount").innerHTML="";
//		document.getElementById("hid_count").value="";
//		document.getElementById("weights").innerHTML="";
//		document.getElementById("hid_sid").value="0";
//	}
</script>
<script language="javascript" type="text/javascript" src="inc/js/js_link.js"></script>
<script language="javascript" type="text/javascript" src="inc/js/order_quick.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
<tbody>
<tr>
<td height="30" align="left" class="classhead">
<%=Lang_Order(37) & order_user_id &"/"& order_user_name%>&nbsp;&nbsp;<%=Lang_Order(38) & order_user_grade_name%>
</td>
<td align="right" class="classhead">
<%=Lang_Order(39)%> <a href="admin_order_cart.asp"><u><span id="carttotalnum" class="totalnum">0</span> <%=Lang_Order(40)%></a></u>&nbsp;&nbsp;<%=Lang_Order(41)%> ￥<span id="carttotalprice" class="totalprice">0.00</span>
<script language="javascript" type="text/javascript" src="Ajax_Cart.asp?showtype=1"></script>
</td>
</tr>
<tr>
<form method="get" action="?">
<td height="30" align="left" class="classhead">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<select name="sort_id">
<option value="0" selected>┌ <%=Lang_Order(85)%></option>
<script language="javascript" type="text/javascript" src="../include/Lebi_Html/CategoryOption.js"></script>
</select>
<select name="zhuangtai">
<option value="" selected>┌ <%=Lang_Order(86)%></option>
<option value="">├ <%=Lang_Order(89)%></option>
<option value="0" <%=judge2("0",zhuangtai)%>>├ <%=Lang_Order(87)%></option>
<option value="1" <%=judge2("1",zhuangtai)%>>├ <%=Lang_Order(88)%></option>
</select>
</td>
<td style="padding-left:5px;">
<input name="keyword" id="keyword" type="text" class="form_query" size="15" autocomplete="off" onkeyup="search_suggest('keyword','Lebi_product','')"><input name="Submit" type="submit" value="" title="<%=Lang_sys(25)%>" align="absmiddle" class="btn_query"><input type="hidden" name="action" value="product"><input type="hidden" name="kucun" value="<%= kucun %>"><input type="hidden" name="type" value="<%= request("type") %>"><br /><div id="search_suggest_keyword" class="search_suggest" style="display:none"></div>
</td>
</tr>
</table>
</td>
</form>
<td align="right" class="classhead">
<select name="anclassid" onChange="var jmpURL=this.options[this.selectedIndex].value ;if(jmpURL!='') {window.location=jmpURL; }else{ this.selectedIndex=0; }">
<option selected>┌ <%=Lang_Order(90)%></option>
<option value="?action=product">├ <%=Lang_Order(91)%></option>
<option value="?action=product&type=3">├ <%=Lang_Order(92)%></option>
<option value="?action=product&type=4">├ <%=Lang_Order(93)%></option>
<option value="?action=product&type=1">├ <%=Lang_Order(94)%></option>
<option value="?action=product&type=2">├ <%=Lang_Order(95)%></option>
<option value="?action=product&type=5">├ <%=Lang_Order(96)%></option>
<option value="?action=product&kucun=0">├ <%=Lang_Order(97)%></option>
</select></td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="productlist" class="classtable2">
<thead>
<tr>
	<td height="30" class="classhead" align="right" colspan="10"><%=ors.ShowPageHead(page)%></td>
</tr>
<tr>
<td class="classtop" width="6%" height="30"><%=Lang_Order(43)%></td>
<td class="classtop" width="34%"><%=Lang_Order(50)%></td>
<td class="classtop" width="10%"><%=Lang_Order(49)%></td>
<td class="classtop" width="10%"><%=Lang_Order(98)%></td>
<td class="classtop" width="10%"><%=Lang_Order(99)%></td>
<td class="classtop" width="6%"><%=Lang_Order(100)%></td>
<td class="classtop" width="6%"><%=Lang_Order(86)%></td>
<td class="classtop" width="6%"><%=Lang_Order(101)%></td>
<td class="classtop" width="6%"><%=Lang_Order(102)%></td>
<td class="classtop" width="6%"><%=Lang_Order(103)%></td>
</tr>
</thead>
<tbody>
<form action="" method="post" name="LEBI_FORMBUY_0001" id="LEBI_FORMBUY_0001">
<%
If DataCount >0 Then
		For i = 0 To Ubound(DataList,2)
				P_SpecificationName=DataList(13,i)
				P_SpecificationValue=DataList(14,i)
				P_SpecificationPic=DataList(16,i)
				If InStr(P_SpecificationPic,"|")=0 Then P_SpecificationPic = "||||||||||||||||||||||||||||||||||||||||"
				If DataList(7,i) = 1 Then
						price = DataList(8,i)
				Else
						price = DataList(15,i)
				End If
%>
<tr class="classrow">
<td height="30" rowspan="2" class="classrow"><div class="pro-pic"><a href="admin_product_edit.asp?id=<%=DataList(0,i)%>" target="_blank"><img src='../<%= PicPath %>/<%=trim(DataList(12,i))%>' width="60" height="60" align='absmiddle' onMouseover="javascript:ddrivetip('<table cellspacing=0 cellpadding=6 width=100% align=center><tr><Td width=<%=pic_xw%>><img src=../<%= PicPath %>/<%=trim(DataList(12,i))%> width=<%=pic_xw%> height=<%=pic_xh%></td><td valign=top><%= productinfo %></td></tr></table>', '#ffffff', '300')" onMouseout="hideddrivetip()" border="0"></a></div></td>
<td class="classrow"><%=DataList(2,i)%><%if DataList(7,i)=1 then%><font color=red>[<%=Lang_Order(104)%>]</font><%end if%></td>
<td class="classrow"><%=DataList(1,i)%></td>
<td class="classrow"><%=formatnumber2(DataList(3,i))%></td>
<td class="classrow"><%=formatnumber2(price)%></td>
<td class="classrow"><%if DataList(4,i)=1 then response.write"<font color=red>√</font>" else response.write"×" end if %></td>
<td class="classrow"><%if DataList(6,i)=1 then response.write"<font color=red>"& Lang_Order(88) &"</font>" else response.write Lang_Order(87) end if %></td>
<td class="classrow"<%If DataList(13,i) <> "" Then%>onMouseOver="GetStockTips('<%=DataList(2,i)%>','<%=DataList(0,i)%>','<%=DataList(13,i)%>','2');" onMouseOut="RemoveTips(null,true);"<%End If%>><%if DataList(9,i)<10 then response.write"<font color=red><strong>"&DataList(9,i)&"</strong></font>" else  response.write DataList(9,i) end if%></td>
<td class="classrow"><%=DataList(10,i)%></td>
<td class="classrow"><%=DataList(11,i)%></td>
</tr>
<tr class="classrow">
<td colspan="9" class="classrow">
<div class="choosesp">
<%
If P_SpecificationName <> "" Then 
		If InStr(P_SpecificationName,",") = 0 Then 
				n = 0
				P_SpecificationValue = Replace(P_SpecificationValue,"|",",")
				If Right(P_SpecificationValue,1) = "|" Then P_SpecificationValue = cut_Right(P_SpecificationValue)
				If Right(P_SpecificationValue,1) = "," Then P_SpecificationValue = cut_Right(P_SpecificationValue)
				Set rs = conn.execute("select s_name from [Lebi_SelectName] where s_id = "& checknum(P_SpecificationName,0) &"")
				If Not rs.eof Then 
						SName = rs(0)
						response.write("<dl class='size'><dt>"& SName &"</dt>")
				End If 
				rs.close : Set rs = Nothing
				Set rs = conn.execute("select s_value,id from [Lebi_SelectValue] where s_id = "& checknum(P_SpecificationName,0) &" and id in("& P_SpecificationValue &")")
				If Not rs.eof Then 
				j = 0
				response.write("<dd>")
				Do While Not rs.eof 
						p = getN(Replace(P_SpecificationValue,"|",","),rs(1),",")
						if Split(P_SpecificationPic,"|")(p) <> "" Then
								response.write("<div><a id=""sv_"& DataList(0,i) &"_"& n &"_"& j &""" name=""sv_n_"& DataList(0,i) &"_"& n &""" class=""spva-img"" title="""& rs(0) &""" onclick=""select_sp('"& DataList(0,i) &"','"& n &"','"& j &"','"& SName &"|"& rs(0) &"','"& price &"','0001');""><img src="""&Eshop_url&PicPath&"/"&Split(P_SpecificationPic,"|")(p)&""" /><span></span></a></div>")
						Else 
								response.write("<div><a id=""sv_"& DataList(0,i) &"_"& n &"_"& j &""" name=""sv_n_"& DataList(0,i) &"_"& n &""" class=""spva"" onclick=""select_sp('"& DataList(0,i) &"','"& n &"','"& j &"','"& SName &"|"& rs(0) &"','"& price &"','0001');"">"& rs(0) &"</a></div>")
						End If 
				rs.movenext
				j = j + 1
				Loop
				response.write("</dd>")
				End If 
				rs.close : Set rs = Nothing
				response.write("<input type=""hidden"" name=""hidv_0001_"& DataList(0,i) &""" id=""hidv_0001_"& DataList(0,i) &"_0""></dl>")
		Else
				For n = 0 To UBound(Split(P_SpecificationName,","))
				Set rs = conn.execute("select s_name from [Lebi_SelectName] where s_id = "& checknum(Split(P_SpecificationName,",")(n),0) &"")
				If Not rs.eof Then 
						SName = rs(0)
						response.write("<dl class='size'><dt>"& SName &"</dt>")
				End If 
				rs.close : Set rs = Nothing
				Set rs = conn.execute("select s_value,id from [Lebi_SelectValue] where s_id = "& checknum(Split(P_SpecificationName,",")(n),0) &" and id in("& Split(P_SpecificationValue,"|")(n) &")")
				If Not rs.eof Then 
				j = 0
				response.write("<dd>")
				Do While Not rs.eof 
						p = getN(Replace(P_SpecificationValue,"|",","),rs(1),",")
						if Split(P_SpecificationPic,"|")(p) <> "" Then
								response.write("<div><a id=""sv_"& DataList(0,i) &"_"& n &"_"& j &""" name=""sv_n_"& DataList(0,i) &"_"& n &""" class=""spva-img"" title="""& rs(0) &""" onclick=""select_sp('"& DataList(0,i) &"','"& n &"','"& j &"','"& SName &"|"& rs(0) &"','"& price &"','0001');""><img src="""&Eshop_url&PicPath&"/"&Split(P_SpecificationPic,"|")(p)&""" /><span></span></a></div>")
						Else 
								response.write("<div><a id=""sv_"& DataList(0,i) &"_"& n &"_"& j &""" name=""sv_n_"& DataList(0,i) &"_"& n &""" class=""spva"" onclick=""select_sp('"& DataList(0,i) &"','"& n &"','"& j &"','"& SName &"|"& rs(0) &"','"& price &"','0001');"">"& rs(0) &"</a></div>")
						End If 
				rs.movenext
				j = j + 1
				Loop
				response.write("</dd>")
				End If 
				rs.close : Set rs = Nothing
				response.write("<input type=""hidden"" name=""hidv_0001_"& DataList(0,i) &""" id=""hidv_0001_"& DataList(0,i) &"_"& n &"""></dl>")
				Next 
		End If 
End If 
response.write(""& Lang_Order(107) &"<input type=""text"" name=""pro_num_0001_"& DataList(0,i) &""" id=""pro_num_0001_"& DataList(0,i) &""" value=""1"" size=""3"" class=""form"">")
response.write("&nbsp;<input type=""button"" name=""button_0001_"& DataList(0,i) &""" id=""button_0001_"& DataList(0,i) &""" value="""& Lang_Order(108) &""" onClick=""javascript:addtobasket('"& DataList(0,i) &"','0001','',1)"" class=""button""> <span id=""result_0001_"& DataList(0,i) &""" class=""result""></span>")
%>
</div>
</td>
</tr>
<%
        Next
End If
%>
</form>
</tbody>
<tfoot>
<tr>
	<td height="30" class="classfooter" align="right" colspan="10"><%=ors.ShowPageFoot(page)%></td>
</tr>
</tfoot>
</table>
<script>tdshow("productlist");</script>
<%
end Sub
%>