<!--#include virtual="/show/userhead.asp"-->

<script>document.getElementById('o_2').setAttribute("class", "ed"); document.getElementById("t_2").style.display="";document.getElementById('s_2_2').setAttribute("class", "ed4");</script>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=webname%>-商品列表</title>




<%
act=SafeRequest("act")
cact=SafeRequest("cact")
page=SafeRequest("page")
f=SafeRequest("f")
shangname=SafeRequest("shangname")


if SafeRequestform("act")="move" then
call chkyanzheng("goodlist")
listid=SafeRequestform("list1")
movef=SafeRequestform("movef")
if listid="" then call PopErr("没有任何选择")
if movef="0" then call PopErr("选择分类有误")

sql="select * from aykafenlei where aykafenleiid="&movef&" and aykanamesuoyou="&clng(request.Cookies("aynameid"))&"" 
rs.open sql,conn,1,1
if not(rs.bof and rs.eof) then
if clng(rs("ayfenleidlid"))<>0 then call PopErr("代理商商品无法操作")
else
call PopErr("未找到转移目的商品")
end if
rs.close


	delid=split(listid,",")
	For dianka=0 To Ubound(delid) 
	'response.Write delid(dianka)&"<br>"
	sql="select * from aygood where aygoodid="&trim(delid(dianka))&" and aygoodsuoyouid="&clng(request.Cookies("aynameid"))&"" 
	rs.open sql,conn,1,3
	if not(rs.bof and rs.eof) then
	if clng(rs("aygooddlid"))<>0 then call PopErr("代理商商品无法操作")
	rs("aygoodfl")=clng(movef)
	rs.update
	end if
	rs.close
	next
	call logadd(request.Cookies("aynameid"),"商品转移分类成功",0,0)
	response.Redirect request.Cookies("url")
end if


if act="all" then
act=""
response.Cookies("fenlei")=""
response.Cookies("shangname")=""
page=""
end if


if act="del" then
call chkyanzheng("goodlist")
id=SafeRequest("id")
if id="" then call PopErr("获取参数错误")
conn.execute ("delete from "&request.Cookies("kamiku")&" where aykagoodid="&clng(id)&" and aykasuoyou="&clng(request.Cookies("aynameid"))&"")
conn.execute ("delete from aygood where aygoodid="&clng(id)&" and aygoodsuoyouid="&clng(request.Cookies("aynameid"))&"")
call logadd(request.Cookies("aynameid"),"商品删除成功"&id,0,0)
call PopErr2("删除成功",request.Cookies("url"))
end if



ulink="goodlist?cact=&f="&f&"&"
nowulink=ulink
if page<>"" then nowulink=ulink&"page="&page
response.Cookies("url")=nowulink
'response.Write nowulink



if f<>"" then
if f<>0 then sql2=" and aygoodfl="&f&""
end if

if shangname<>"" then
response.Cookies("shangname")=shangname
sql2=sql2&" and aygoodname like '%"&shangname&"%'"
end if



%>
<SCRIPT LANGUAGE="JavaScript">
var checkflag1 = "false";
function check1(field) {
if (checkflag1 == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag1 = "true";
return "false"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag1 = "false";
return "true"; }
}

function unselectall1()
{
    if(document.myform.chkAll1.checked){
	document.myform.chkAll1.checked = document.myform.chkAll1.checked&0;
	checkflag1 = "false";
    } 	
}
</script>
<SCRIPT language=javascript>
function on(str1,str2,str3)
{
  zhezhao.style.display="block"; 
  aaa.style.display="block"; 
  smingcheng.innerHTML=str1;
  smingcheng2.innerHTML=str1;
  sid.innerHTML="<a href=<%=weburl%>"+str2+".htm target=_blank><%=weburl%>"+str2+".htm</a>"
  sdid.innerHTML="<a href=<%=weburl%>buy/"+str3+".htm target=_blank><%=weburl%>buy/"+str3+".htm</a>"
  sidf.innerHTML="&lt;iframe src=&quot;<%=weburl%>vip/"+str2+".htm&quot; frameborder=&quot;0&quot; scrolling=&quot;yes&quot; width=&quot;980&quot; height=&quot;940&quot; &gt;&lt;/iframe&gt;"
  sdidf.innerHTML="&lt;iframe src=&quot;<%=weburl%>vip/buy/"+str3+".htm&quot; frameborder=&quot;0&quot; scrolling=&quot;yes&quot; width=&quot;980&quot; height=&quot;940&quot; &gt;&lt;/iframe&gt;"
}	
function off()
{
  zhezhao.style.display="none"; 
  aaa.style.display="none"; 
}
</SCRIPT>

<script language="javascript">
function ckfenlei(str){
if (str=="0")
{return false;}
var url="goodlist?act=all&f="+str
return gotoUrl(url)
function gotoUrl(url){
     if(document.all){
         var gotoLink = document.createElement('a');
         gotoLink .href = url;
         document.body.appendChild(gotoLink);
         gotoLink .click();
     }
     else window.location.href = url;
}
}
</script>

<SCRIPT LANGUAGE="JavaScript">
function delka(str,str2){
if(confirm("删除商品将同时删除该商品下所有卡密，并且无法恢复，是否继续操作？"))
{
tsdel.innerHTML="<img src=<%=ossurl%>images/jload.gif>";

		var url="?act=del&id="+str+"&page="+str2
		return gotoUrl(url)
		function gotoUrl(url){
			 if(document.all){
				 var gotoLink = document.createElement('a');
				 gotoLink .href = url;
				 document.body.appendChild(gotoLink);
				 gotoLink .click();
			 }
			 else window.location.href = url;
		}
}

else
{
return false;
}

}

</script>

<style>
table{font-size:14px; font-weight:normal;line-height:27px;}
.regts{width:440px; height:36px; border:#CCC solid 1px; background:#f1f1f1; color:#666666; line-height:36px; padding-left:10px}
.reginput{width:290px; height:36px; border:#CCC solid 1px; color:#949494; text-indent:10px; line-height:36px}
.gexian20{float:left;width:100%;height:20px;}
.mzsmbox2{width:90%; height:auto; overflow:hidden; background:#fcf8e2; border-left:#edd28a solid 5px; color:#956825; line-height:22px; padding:20px;margin-left:40px; margin-bottom:60px; font-size:13px;padding-top:20px;}
.neitable table{border: 1px solid #E8E8E8;width: 100%;}
.neitable table tr{border-bottom: 1px solid #E8E8E8;}
.neitable table tr td{line-height: 42px;text-align: center;color: #1b1b1b;font-size: 14px;}
.neitable table tr.hd td{line-height: 35px;background-color: #F7F7F7;}
.btnFn1 {cursor:pointer!important;cursor:hand;  height:40px; width:101px; padding:0px 0px 0 0; }
.btnFn2 {cursor:pointer!important;cursor:hand;  height:40px; width:101px; padding:0px 0px 0 0; font-weight:bold; }
.logindlreg2{cursor:pointer;margin-left:5px; padding:7px;font-family:"Microsoft YaHei",Verdana,Arial; font-size:13px; text-align:center; color:#505050; font-weight:bold; background:#F2F2F2; border:#C3C3C3 solid 1px; border-radius:2px; }
.logindlreg2:hover{color:#505050;border:#999999 solid 1px; border-radius:2px; }
.logindlregedit{ margin-top:3px;height:36px;font-family:"Microsoft YaHei",Verdana,Arial; line-height:30px; font-size:13px; text-align:center; color:#505050; font-weight:bold; background:#F2F2F2;  border:#C3C3C3 solid 1px; border-radius:2px; }
.logindlregedit:hover{color:#505050;border:#999999 solid 1px; border-radius:2px; }
.logindlreg2tj{ margin-top:4px;height:36px;font-family:"Microsoft YaHei",Verdana,Arial; line-height:30px; font-size:13px; text-align:center; color:#ffffff; font-weight:bold; background:#F79740; border:0; border-radius:2px; }
.logindlreg2tj:hover{background:#F99C48; }
.reginputd{ width:190px; height:36px; border:#CCC solid 1px; text-indent:10px; line-height:36px}
.reginputdd{ width:110px; height:36px; border:#CCC solid 1px; text-indent:10px; line-height:36px}
.reginputddd{ width:40px; height:36px; border:#CCC solid 1px; text-indent:10px; line-height:36px}
.reginputdddd{ width:50px; height:36px; border:#CCC solid 1px; text-indent:10px; line-height:36px}
</style>
<br>
<DIV id=main2> 
<DIV style="PADDING-LEFT:0px">
<DIV id=main_right_content>

<H2><SPAN>商品列表</SPAN></H2>
<DIV class=main4>
					<table>
                  		<tr>
                          <td>
			<%
            sql="select ayfenleidlid,aykafenleikg,aykanamesuoyou,ayshangjiid,aykafenleisx,aykafenleiid,aykafenleiname from aykafenlei where aykanamesuoyou="&request.Cookies("aynameid")&" and ayshangjiid=0 order by ayfenleidlid asc,aykafenleisx asc" 
            rs.open sql,conn,1,1
            if not(rs.bof and rs.eof) then
            movestr="<select name=movef id=movef  class=reginput>"
            movestr=movestr&"<option value=0>将选定商品移动至其他分类</option>"
            %>
            <form action="" method="get" name="form1" id="form1">
            &nbsp;商品分类：
            <select name="f" id="f" onChange="ckfenlei(this.value);" class="reginput">
                   <option value="00">全部</option>
                  <%do while not rs.eof%>
                  <%
				  iszt=""
				  isdl=""
				  if cint(rs("aykafenleikg"))=1 then iszt="【下架中】"
				  if clng(rs("ayfenleidlid"))<>0 then isdl="【代理】"
				  %>
                  <%movestr=movestr&"<option value="&rs("aykafenleiid")&">"&trim(rs("aykafenleiname"))&isdl&iszt&"</option>"%>
                  <option value="<%=rs("aykafenleiid")%>" 
                  <%
                  if trim(SafeRequest("f"))<>"" then
                  if clng(SafeRequest("f"))=clng(rs("aykafenleiid")) then response.Write("selected")
                  end if
                  %>><%=rs("aykafenleiname")%><%=isdl%><%=iszt%></option>
                        <%set rserji=server.CreateObject("adodb.recordset")
                        sql="select aykafenleikg,ayfenleidlid,aykanamesuoyou,ayshangjiid,aykafenleisx,aykafenleiid,aykafenleiname from aykafenlei where aykanamesuoyou="&request.Cookies("aynameid")&" and ayshangjiid="&rs("aykafenleiid")&" order by aykafenleisx asc" 
                        rserji.open sql,conn,1,1
                        if not(rserji.bof and rserji.eof) then
                        do while not rserji.eof
                       iszt=""
                       isdl=""
                       if cint(rserji("aykafenleikg"))=1 then iszt="【下架中】"
                       if clng(rserji("ayfenleidlid"))<>0 then isdl="【代理】"
                       %>
                        <%movestr=movestr&"<option value="&rserji("aykafenleiid")&">&nbsp;&nbsp;┕"&trim(rserji("aykafenleiname"))&isdl&iszt&"</option>"%>
                        <option value="<%=rserji("aykafenleiid")%>" 	  
                        <%
                        if trim(SafeRequest("f"))<>"" then
                        if clng(SafeRequest("f"))=clng(rserji("aykafenleiid")) then response.Write("selected")
                        end if
                        %>>&nbsp;&nbsp;┕<%=rserji("aykafenleiname")%><%=isdl%><%=iszt%></option>
                        <%
                        rserji.movenext 
                        loop
                        end if
                        rserji.close
                  rs.movenext 
                  loop
                  end if
                  rs.close
                  %>
                </select>
            <%movestr=movestr&"</select>"%>
            &nbsp;商品名称：
            <input name="shangname" type="text" id="shangname" value="<%=server.HTMLEncode(request.Cookies("shangname"))%>" maxlength="25" class="reginputd">
            <input type="submit" name="Submit" value="    查 询    " class="logindlregedit"><span id="yan111"></span>
            </form>

                         </td>
                        </tr>
                    </table>
                    
                    
<div class="neitable">
<form action="" method="post" name="myform" id="myform"> 

					<table>
                        <tr class="hd">
                        	<td width="30">&nbsp;</td>
        					<td>商品名称</td>
                            <td>所属分类</td>
                            <td>所属</td>
                            <td>价格(元)</td>
                            <td>已出</td>
                            <td>库存</td>
                            <td>排序</td>
                            <td width="400">管理</td>
                      </tr>


                      
						<%
                        rs.open "select ayismd5,aynameid from ayname where aynameid="&request.Cookies("aynameid")&"",conn,1,1
                        ayismd5=rs("ayismd5")
                        rs.close
                        
                        sql="select * from aygood where aygoodisydl=0 and aygoodsuoyouid="&request.Cookies("aynameid")&" and isptdx=0"&sql2&" order by aygooddlid,aygoodfl,aygoodsx" 
                        rs.open sql,conn,1,1
                        rs.pagesize=10
                        pagecount=rs.pagecount 
                        if request("page")="" then 
                        page=1
                        else
                        page=int(request("page")) 
                        end if
                        if page<=0 then page=1 
                        if request("page")="" then page=1
                        if not(rs.bof and rs.eof) then
                        rs.absolutepage=page
                        chaid=""
                        do while not rs.eof%>
                  		<tr onmouseover=this.bgColor='#FAFAFA' onmouseout=this.bgColor='#ffffff'>
                       	  <td><input name="list1" type="checkbox" id="list1" value="<%=rs("aygoodid")%>" onClick="unselectall1()"></td>
                            <td>
							<% 
                            'if len(trim(rs("aygoodname")))>18 then
                            '    response.Write"<a title="&rs("aygoodname")&" href=goodedit?id="&rs("aygoodid")&">"&left(rs("aygoodname"),18)&"…"&"</a>"
                            'else
                                response.Write"<a title="&rs("aygoodname")&" href=goodedit?id="&rs("aygoodid")&">"&rs("aygoodname")&"</a>"
                            'end if
                            %>
                        </td>
                            <td>
							<%
                            set rsfl=server.CreateObject("adodb.recordset")
                            sqlfl="select aykafenleiid,aykafenleiname,ayfenleidlid from aykafenlei where aykafenleiid="&clng(rs("aygoodfl"))&"" 
                            rsfl.open sqlfl,conn,1,1
                            if rsfl.bof and rsfl.eof then
                            response.Write("未找到")
                            else
								if len(trim(rsfl("aykafenleiname")))>18 then
								response.Write "<span title="&rsfl("aykafenleiname")&"> "&left(rsfl("aykafenleiname"),18)&"… </span>" 
								else
								response.Write "<span title="&rsfl("aykafenleiname")&"> "&rsfl("aykafenleiname")&" </span>"
								end if
                            end if
                            rsfl.close
                            %>
                        </td>
                          	<td>
							<%if clng(rs("aygooddlid"))<>0 then%>
                            <span style="color: #009900"><%=totruename(rs("aygooddlid"))%></span>
                            <%else
                            response.Write"本地"
                            end if%>
                        </td>
                            <td><%=Formatnumber(rs("ayjiage"),2,true,-1,0)%></td>
                            <td>
                            <span id="chu<%=rs("aygoodid")%>"><img src="<%=ossurl%>images/jload.gif" /></span>
                            <%chaid=chaid&rs("aygoodid")&","%>
                        </td>
                            <td><span id="ku<%=rs("aygoodid")%>"><img src="<%=ossurl%>images/jload.gif" /></span></td>
                            <td><%=rs("aygoodsx")%></td>
                            <td>
							<%if cint(rs("aygoodzhuangtai"))=0 then%>
                            <a href="goodedit?act=xj&id=<%=rs("aygoodid")%>&url=<%=nowulink%>" title="点击下架" class="logindlreg2">上架中</a> 
                            <%elseif cint(rs("aygoodzhuangtai"))=1 then%>
                            <a href="goodedit?act=sj&id=<%=rs("aygoodid")%>&url=<%=nowulink%>" title="点击上架" class="logindlreg2" style="color:#FF0000">下架中</a>
                            <%end if%>
                            <a href="goodlink?id=<%=rs("aygoodid")%>" style="color: #FF8000;" class="logindlreg2">链接</a>  
                            <!-- 
                            <a href="goodjiazhi?id=<%'=rs("aygoodid")%>&goodname=<%'=rs("aygoodname")%>" class="logindlreg2">卡价值</a> 
                            -->
                            <a href="kaadd?sid=<%=rs("aygoodid")%>" class="logindlreg2">加卡</a>
                            <a href="kucunka?shangid=<%=rs("aygoodid")%>&cact=cha" class="logindlreg2">卡密</a> 
                            <a href="goodedit?id=<%=rs("aygoodid")%>" class="logindlreg2">编辑</a>
                 <span id="tsdel" class="logindlreg2"><a onClick="delka(<%=rs("aygoodid")%>,<%=page%>);">删除</a></span>
                          </td>
                        </tr>
						<%n=n+1
                        rs.movenext
                        if n>=rs.pagesize then exit do  
                        loop
                        end if
                        rs.close%>
                        
                        <tr>
                        <td colspan="9" style="text-align:left">&nbsp;
                        <input name="chkAll1" type="checkbox" id="chkAll1" onClick="this.value=check1(this.form.list1)" value="checkbox">&nbsp;全选&nbsp;
                        <%=movestr%>
                        <label><input type="submit" name="Submit2" onClick="javascript:return confirm('您确定要移动选定商品吗？');" class="logindlregedit" value=" 确 定 移 动 " /></label>
                        <input name="act" type="hidden" id="act" value="move" />
                        </td>
                      </tr>
                      
                        <tr>
                        <td colspan="9" style="text-align:left">&nbsp;&nbsp;&nbsp;
                        <%if pagecount=0 then   
                        response.write("上一页&nbsp;&nbsp;")
                        elseif page=1 then       
                        response.write("上一页&nbsp;&nbsp;")
                        else%>                   
                        <a href="<%=ulink%>page=<%=page-1%>">上一页</a>&nbsp;&nbsp;
                        <%end if%> 
                        
                        <%'for i=1 to pagecount
                        'response.Write("<a href="&ulink&"?page="&i&">"&i&"</a>&nbsp;")
                        'next%>
                        
                        <%if pagecount=0 then 
                        response.write("下一页&nbsp;&nbsp;")
                        elseif page=pagecount then 
                        response.write("下一页&nbsp;&nbsp;")
                        else%>                    
                        <a href="<%=ulink%>page=<%=page+1%>">下一页</a>
                        <%end if%>&nbsp;&nbsp;
                        <%
                        if pagecount<>0 then 
                        response.Write page&"/"&pagecount
                        end if
                        %>
                        </td>
                      </tr>
                    </table>
                    </form>
</div>

            <div class="mzsmbox2" style="padding-top:20px;">
            商品排序：排序数值越小，排位越靠前，如：排序90的会在排序100之上，在购买页面的商品列表会以此排序<br>
			商品下架：如果商品选择下架，则在购买页面，该商品将不再展示<br>
            卡价值依据顺序：商品卡价值-分类卡价值-商家卡价值。如：如果商品没有单独设置卡价值，则使用分类卡价值，分类未设置则直接使用商家设置的卡价值。
            </div>
                    
</DIV>
<%
	  response.Cookies("fenlei")=""
	  response.Cookies("shangname")=""
%>

</DIV></DIV>
<DIV class=clear></DIV></DIV>

</DIV>

<br>
<script type="text/javascript">
var xmlhttp;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch (e){try{xmlhttp=new XMLHttpRequest();}catch (e){}}}
</script>


<%
if trim(chaid)<>"" then chaid=mid(chaid,1,len(chaid)-1)
'response.Write chaid
'chastr=split(chaid,",")
'For sum=0 To Ubound(chastr)

%>
<%'response.Write chaid%>
<script type="text/javascript">
xmlhttp.open("get","/inc/chakucun.asp?id=<%=chaid%>");
xmlhttp.onreadystatechange=function()
{	
	if(200==xmlhttp.status)
	{
		
		aStr=xmlhttp.responseText.split("^");
		for (i=0;i<aStr.length ;i++ )  
		{
				
		
				darrStr=aStr[i].split("|");
				for (j=0;j<darrStr.length ;j++ )    
				{  
					if(darrStr[1]==1)
					{
		document.getElementById("chu"+darrStr[0]).innerHTML="<a href=feikadaili?cact=cha&shangid="+darrStr[0]+">"+darrStr[2]+"</a>";	
					}
					else
					{
		document.getElementById("chu"+darrStr[0]).innerHTML="<a href=feika?cact=cha&shangid="+darrStr[0]+">"+darrStr[2]+"</a>";
		
					}
		document.getElementById("ku"+darrStr[0]).innerHTML="<a href=kucunka?cact=cha&shangid="+darrStr[0]+">"+darrStr[3]+"</a>";
				}
			
		
		
		}
		
		
		
		
	}
};
xmlhttp.send(null);
</script>
		




	<!--#include virtual="/show/foot.asp"-->


