<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Dim NCheck:NCheck=true
%>
<!--#include file="cgi/Config.asp"-->
<%

Dim rs
Dim eStr:eStr=""
Dim act
act=request("act")

select case act
	case "del"
	gid=request("g_id")
	if mobj.testreg(gid,"^\d{1,10}$") then
	mobj.cexe "delete from   b2c_goods  where g_id="&gid
	end if

end select


Dim page:page=request("page")
Dim word:word=mobj.CheckBadstr(request("word"))
DIm qudao:qudao=request("qudao")
if not mobj.testreg(qudao,"^(\w|-){36}$") then qudao=""
If not mobj.testreg(page,"^\d{1,10}$") Then page=1
page=abs(cint(page))
if page=0 then page=1
Dim pages:pages=20
DIm pageSql:pageSql="select count(0) as rcount from  b2c_goods,b2c_qudao   "
Dim listSqlFilter:listSqlFilter="b2c_goods.g_delete=0 and b2c_goods.g_qudao=b2c_qudao.q_sn "

if word<>"" then listSqlFilter=listSqlFilter&" and b2c_goods.g_name like '%"&word&"%'"

if qudao<>"" then listSqlFilter=listSqlFilter&" and b2c_goods.g_qudao='"&qudao&"'"
Dim allcounts
mobj.crs rs
rs.open pageSql&"where "&listSqlFilter,dStr,1,1
allcounts=rs("rcount")
mobj.drs rs
allPages=fix(allcounts/pages)
If (allcounts mod pages >0) and allcounts>pages then allPages=allPages+1
If allPages=0 then allPages=1

pStr="admin_goods_list.asp?page=$page$&qudao="&qudao&"&word="&word
 listSql="select b2c_goods.g_id,b2c_goods.g_guid,b2c_goods.g_name,b2c_goods.g_qudao,b2c_goods.g_price,b2c_goods.g_mprice,b2c_goods.g_default,b2c_qudao.q_id,b2c_qudao.q_name from b2c_goods,b2c_qudao where  "&listSqlFilter&" order by b2c_goods.g_id desc"


%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title>管理页面</title>
<meta http-equiv="Expires" Content="0"/>
<meta http-equiv="Cache-Control" Content="no-cache"/>
<meta http-equiv="Pragma" Content="no-cache"/>
<link href="/images/skin_1/style.css" type="text/css" rel="stylesheet"/>

<script language=javascript type="text/javascript" src="/js/jquery-1.7.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css">  
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">  
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<script language=javascript type="text/javascript" src="/js/comm.js"></script>

<base target="_self"/>
</head>
<body class="htmlbody">

<table class="table1" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<td class="tableline linetitle" width="200" align="left">产品频道</td>
		<td class="tableline" width="*" align="right"><a href="admin_goods.asp">频道首页</a>
			 - <a href="admin_goods_add.asp?act=add">添加商品</a>
			 - <a href="admin_goods_list.asp?ChannelID=1&order=0">商品列表</a>
			 - <a href="admin_goods_cat.asp?act=add">添加渠道</a>
			 - <a href="admin_goods_cat.asp?act=list">渠道管理</a>
			 <select onchange="if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}">
<option value="admin_goods_list.asp">≡选择详细分类≡</option>
<%
mobj.crs rs
rs.open "select q_id,q_name,q_sn from b2c_qudao  where q_del=0  ",dstr,1,1
do while not rs.eof
%>
<option value="admin_goods_list.asp?qudao=<%=rs("q_sn")%>" <%if qudao=rs("q_sn") then response.Write("selected='selected'")%>><%=rs("q_name")%></option>

<%


rs.movenext
loop
mobj.drs rs
%>

<option value='admin_goods_list.asp'>≡返回全部列表≡</option>
</select>
		</td>
	</tr>
</table>

<table id="tablehovered" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  <tr>
	<td class="tablerow1" colspan="6"><form name="search_form" id="search_form" method="get" action="admin_goods_list.asp">
		产品搜索：
		  <input type="text" class="alingmid" id="word" name="word" size="20"  value="<%=word%>" />
		<select name="qudao" id="ChannelOption" class="alingmid">
		<option value="">≡选择详细渠道≡</option>
			<%
mobj.crs rs
rs.open "select q_id,q_sn,q_name from b2c_qudao  where q_del=0  order by q_id desc ",dstr,1,1
do while not rs.eof
%>
<option value="<%=rs("q_sn")%>" ><%=rs("q_name")%></option>

<%


rs.movenext
loop
mobj.drs rs
%>
		</select>
		<input type="submit" value="开始搜索" name="search_submit" class="button alingmid" />
	</form>	</td>
</tr>
<tr>
	<th width="4%" noWrap="noWrap">序号</th>
	<th width="25%">商品标题</th>
	<th width="27%" align="center" >所属渠道</th>
    <th width="11%" align="center" noWrap="noWrap">市场价</th>
	<th width="11%" align="center" noWrap="noWrap">商城价</th>
	<th align="center" noWrap="noWrap">操作</th>
  </tr>

<form name="selform" method="post" action="admin_setting.asp?ChannelID=1">
<input type="hidden" name="action" value="batch">
<%

Dim kkk:kkk=1
Dim lindex:lindex=1
mobj.crs rs
rs.open listSql,dStr,1,1
If rs.eof and rs.bof Then
	rs.close
	set rs=nothing							
	allPages=1
else
	rs.pagesize=pages
	rs.absolutepage=page
	do while not rs.eof  and  pages>0%>
<tr align="center">
	<td class="tablerow<%=kkk%> hovered"><%=lindex%></td>
	<td class="tablerow<%=kkk%> hovered" align="left"><%=rs("g_name")%><%if rs("g_default")=1 then response.Write("<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;默认</font>")%></td>
	<td class="tablerow<%=kkk%> hovered" noWrap="noWrap"><%=rs("q_name")%></td>
	<td class="tablerow<%=kkk%> hovered" noWrap="noWrap"><%=rs("g_mprice")%></td>
	<td class="tablerow<%=kkk%> hovered" noWrap="noWrap" title=""><%=rs("g_price")%></td>
	<td noWrap="noWrap" class="tablerow<%=kkk%> hovered"><a href="admin_goods_edit.asp?act=edit&g_id=<%=rs("g_guid")%>">编辑</a> | <a href="javascript:delGoods('<%=rs("g_guid")%>')"> 删除产品</a></td>
	</tr>
<%
lindex=lindex+1
if kkk=2 then kkk=0
kkk=kkk+1
pages=pages-1
rs.movenext
loop
mobj.drs rs
end if%>
<tr>
	<td class="tablerow1" colspan="6">&nbsp;</td>
</tr>
</form>
<tr>
	<td class="tablerow2" align="right" colspan="6" id="NextPageText"><var class="morePage"><b>总数：<%=allcounts%></b><b><%=allPages%></b><code><a href="<%=replace(pStr,"$page$","1")%>"> <  首页</a><%=mObj.PageListActive(page,allPages,pStr)%><a href="<%=replace(pStr,"$page$",allPages)%>">末页  > </a></code></var></td></tr>
</table>

<!--#include file="end.asp"-->
</body></html>
<script language="javascript">
function delGoods(id){
	$.messager.confirm('确认删除','确定删除此产品?',function(r){  
		if (r){  
			$.getJSON("act.asp?act=delgoods&id="+id,function(json){		
			if(json.s==1){						
				window.location.reload();				
				}
			else{alert(json.m);}
		});		
			
		}  
	}); 	
}
</script>
