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

<script>document.getElementById('o_7').setAttribute("class", "ed"); document.getElementById("t_7").style.display="";document.getElementById('s_7_3').setAttribute("class", "ed6");</script>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title><%=webname%>-管理优惠券</title>

<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="JScript"> 
function copyToClipBoard(copyid,copycon){ 
if (navigator.userAgent.indexOf("MSIE") == -1)
{
  alert("您的浏览器非IE内核,请手动复制内容");
  return false;
}
var clipBoardContent=""; 
clipBoardContent += document.getElementById(copycon).value; 
window.clipboardData.setData("Text",clipBoardContent); 
copyid.innerHTML ="<font color=#FF3300> [已复制]</font>";
//alert(copyid); 
} 
</script>
<SCRIPT LANGUAGE="JavaScript">
function del(){

if(confirm("确定要删除通知吗？")){
	document.getElementById("isdel").value="alldel";
	document.getElementById(myform).submit();
        return true;
}else{
        return false;
}

}
</script>

<SCRIPT LANGUAGE="JavaScript">
function copy(){

var res=false;  
var youname = "";
for (var i=0;i<document.myform.list1.length;i++) 
{    
	var e = document.myform.list1[i];  
	if ( (e.name == 'list1')  &&  (e.type == 'checkbox')  &&  e.checked==true )      
	{      
	var youname =youname+document.getElementById("copyyouhui"+e.value).value+"\r\n";
	res=true;      
	}  

}  

if (res)  
{
	if (navigator.userAgent.indexOf("MSIE") == -1)
	{
  	alert("您的浏览器非IE内核,请手动复制内容");
  	return false;
	}
	window.clipboardData.setData("Text",youname); 
	alert("复制成功"); 
	//document.write(youname)
	

return false;
}

if (!res)  
{
alert("请至少选择一条信息！");  
return false;
}




}
</script>
<br>
<DIV id=main2> 

<%

act=SafeRequest("act")
page=SafeRequest("page")
link="myyouhui?ct="


if act="del" then
id=SafeRequest("id")
if id="" then call PopErr("获取参数错误")
sql="select * from ayyouhuiquan where ayyouhuiid="&clng(id)&" and ayyouhuisuoyou="&clng(request.Cookies("aynameid"))&"" 
rs.open sql,conn,1,3
if rs.bof and rs.eof then
call PopErr("未找到此项目")
else
if rs("ayyouhuihuozeng")=1 then
if rs("ayyouhuibuch")=0 then call PopErr("该优惠券还未得到系统补款，请补款后再尝试删除！")
end if
rs.delete
rs.close
call logadd(request.Cookies("aynameid"),"优惠券删除成功",0,0)
response.Redirect("myyouhui?page="&page&"")
end if
end if

isdel=SafeRequestform("isdel")
if isdel="alldel" then

list1=SafeRequestform("list1")
if list1="" then call PopErr("未找到此项目")
	delid=split(list1,",")
	
	For dianka=0 To Ubound(delid) 
	'response.Write delid(dianka)
	sql="select * from ayyouhuiquan where ayyouhuiid="&trim(delid(dianka))&" and ayyouhuisuoyou="&clng(request.Cookies("aynameid"))&"" 
	rs.open sql,conn,1,3
	if rs.bof and rs.eof then
	call PopErr("未找到此项目")
	else
	if rs("ayyouhuihuozeng")=1 then
	if rs("ayyouhuibuch")=0 then call PopErr2("有优惠券还未得到系统补款，请补款后再尝试删除！","myyouhui")
	end if
	rs.delete
	rs.close
	end if
	next
	call logadd(request.Cookies("aynameid"),"优惠券多选删除成功",0,0)
	response.Redirect("myyouhui?page="&page&"")

end if

%>


<DIV style="PADDING-LEFT:0px">
<DIV id=main_right_content>

<H2><SPAN>管理优惠券</SPAN></H2>
<DIV class=main3>

	  <table border="0" align="center" cellpadding="0" cellspacing="0" class="table_style_a1">
     <form action="?page=<%=page%>" method="post" name="myform" id="myform"> 
       <tr>
        <th class="border_right border_bottom" >
        <th align="center" class="border_right border_bottom" >优惠券
        <th align="center" class="border_right border_bottom">价值
        <th align="center" class="border_right border_bottom">重复        
        <th align="center" class="border_right border_bottom">平台赠送        
        <th align="center" class="border_right border_bottom">适用范围        
        <th align="center" class="border_right border_bottom">是否使用
        <th align="center" class="border_right border_bottom">添加时间
        <th align="center" class="border_right border_bottom">时效
        <th align="center" class="border_bottom">删除		</tr>
<%
sql="select * from ayyouhuiquan where ayyouhuisuoyou="&request.Cookies("aynameid")&" order by ayyouhuiid desc" 
rs.open sql,conn,1,1
rs.pagesize=50
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
do while not rs.eof%>

	  <tr onmouseover=this.bgColor='#D2FFFF' onmouseout=this.bgColor='#ffffff'>
        <td align="center" class="border_right border_bottom"><input name="list1" type="checkbox" id="list1" value="<%=rs("ayyouhuiid")%>" onClick="unselectall1()"></td>
        <td align="center" class="border_right border_bottom"><%=rs("ayyouhuiquan")%>	

		<input  name="copyyouhui<%=rs("ayyouhuiid")%>" type="hidden" id="copyyouhui<%=rs("ayyouhuiid")%>" value="<%=trim(rs("ayyouhuiquan"))%>"  maxlength="3">
		<span id="c<%=rs("ayyouhuiid")%>"><a href="#" onClick=copyToClipBoard(<%response.Write"c"&rs("ayyouhuiid")%>,"copyyouhui<%=rs("ayyouhuiid")%>")> [复制]</a></span>		</td>
        <td align="center" class="border_right border_bottom">
		<%if rs("ayyouhuifangshi")=0 then
		response.Write rs("ayyouhuijiage")&"元"
		elseif rs("ayyouhuifangshi")=1 then
		response.Write rs("ayyouhuijiage")&"%"
		end if
		%>		</td>
        <td align="center" class="border_right border_bottom">
		<%
		if rs("ayyouhuiisty")=1 then
		response.Write("<span style=color:#009933>是</span>")
		else
		response.Write("否")
		end if
		%>		</td>
        <td align="center" class="border_right border_bottom">
		<% if rs("ayyouhuihuozeng")=1 then
		response.Write("是")
		elseif rs("ayyouhuihuozeng")=0 then
		response.Write("-")
		end if
		%></td>
        <td width="280" align="center" class="border_right border_bottom">
		<%if rs("ayyouhuiall")=1 then 
		response.Write "<span title=适用于全部分类和商品>全部</span>"
		else
		isfen="no"
			if trim(rs("ayyouhuiflid"))<>"0" then
			response.Write "分类 "
			isfen="yes"
			fid=split(trim(rs("ayyouhuiflid")),",")
			set rsf=server.CreateObject("adodb.recordset")
			For dianka=0 To Ubound(fid) 
			rsf.open "select aykanamesuoyou,aykafenleiid,aykafenleiname from aykafenlei where aykafenleiid="&fid(dianka)&" and aykanamesuoyou="&request.Cookies("aynameid")&"",conn,1,1
			if not(rsf.bof and rsf.eof) then
			response.Write "<span title="&trim(rsf("aykafenleiname"))&">"&fid(dianka)&"</span>&nbsp;"
			else
			response.Write "<span title=或已删除>"&fid(dianka)&"</span>&nbsp;"
			end if
			rsf.close
			next
			end if
			if isfen="yes" then response.Write "<br>"
			if trim(rs("ayyouhuishangid"))<>"0" then
			response.Write "商品 "
			fid=split(trim(rs("ayyouhuishangid")),",")
			set rsf=server.CreateObject("adodb.recordset")
			For dianka=0 To Ubound(fid) 
			rsf.open "select aygoodsuoyouid,aygoodid,aygoodname from aygood where aygoodid="&fid(dianka)&" and aygoodsuoyouid="&request.Cookies("aynameid")&"",conn,1,1
			if not(rsf.bof and rsf.eof) then
			response.Write "<span title="&trim(rsf("aygoodname"))&">"&fid(dianka)&"</span>&nbsp;"
			else
			response.Write "<span title=或已删除>"&fid(dianka)&"</span>&nbsp;"
			end if
			rsf.close
			next
			end if
		end if
		%></td>
        <td align="center" class="border_right border_bottom">
		<% if rs("ayyouhuiyesno")=0 then
		response.Write("未使用")
		elseif rs("ayyouhuiyesno")=1 then
		response.Write("<span style=color:#FF0000>已使用</span>")
		end if
		%>		</td>
        <td align="center" class="border_right border_bottom"><%=rs("ayyouhuidate")%></td>
        <td align="center" class="border_right border_bottom"><%=rs("ayyouhuishixiao")%>天</td>
        <td align="center" class="border_bottom"><a href="?act=del&id=<%=rs("ayyouhuiid")%>&page=<%=page%>"  onclick="javascript:return confirm('您确定要删除吗？');"><img src="<%=ossurl%>images/ico_del.gif" alt="删除分类" border="0"></a></td>
	  </tr>
<%
n=n+1
rs.movenext  '指针向下移动
if n>=rs.pagesize then exit do  
loop
end if
zongshu=rs.RecordCount
rs.close%>
	  

      <tr>
        <td colspan="10">&nbsp;<input name="chkAll1" type="checkbox" id="chkAll1" onClick="this.value=check1(this.form.list1)" value="checkbox"> 
        全选
          <input type="submit" name="Submit" value="删除选定" onClick="return del();"> 
			<input type="button" name="Submit" value="复制选定" onClick="return copy();"> 
<%call pageye()
%>

<input type="hidden" name="isdel" id="isdel">
<input type="hidden" name="iscopy" id="iscopy"> </td>
      </tr></form>
    </table>
</DIV>


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

<br>

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


