<!--#include virtual="/show/adminhead.asp"-->
<!--#include file="adminleft.asp"-->

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



<title><%=webname%>-最高权限-套餐管理</title>

<DIV>

<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>
<%

act=request.QueryString("act")

if act="zengsongque" then
call lognamecode()
call logquanxian("e8",1)

tid=request.QueryStringform("tid")
aytcuid=request.QueryStringform("aytcuid")
aytcname=request.QueryStringform("aytcname")
aytcjin=request.QueryStringform("aytcjin")
aytczong=request.QueryStringform("aytczong")
aytcsj=request.QueryStringform("aytcsj")
aytcisyear=trim(request.QueryStringform("aytcisyear"))
aytcyearf=trim(request.QueryStringform("aytcyearf"))

sql="select * from aytaocanlog where aytcuid="&aytcuid&" and aytczt=0" 
rs.open sql,conn,1,3
if rs.bof and rs.eof then
rs.addnew
rs("aytcuid")=aytcuid
rs("aytcname")=trim(aytcname)
rs("aytcjin")=trim(aytcjin)
rs("aytczong")=trim(aytczong)
rs("aytcsheng")=trim(aytczong)
rs("aytcsj")=trim(aytcsj)
rs("aytcisyear")=aytcisyear
rs("aytcyearf")=aytcyearf
rs.update
else
	rs.addnew
	rs("aytcuid")=aytcuid
	rs("aytcname")=trim(aytcname)
	rs("aytcjin")=trim(aytcjin)
	rs("aytczong")=trim(aytczong)
	rs("aytcsheng")=trim(aytczong)
	rs("aytcsj")=trim(aytcsj)
	rs("aytczt")=2
	rs("aytcisyear")=aytcisyear
	rs("aytcyearf")=aytcyearf
	rs.update
end if
rs.close

call logadd(request.Cookies("aynameid"),"管理-套餐赠送成功"&aytcuid,0,0)
call PopErr2("赠送成功","admintaocan.asp")
end if


if act="del" then
call lognamecode()
call logquanxian("e8",1)
tid=request.QueryString("tid")
sql="select * from aytaocan where aytcid="&tid&"" 
rs.open sql,conn,1,3
if not(rs.bof and rs.eof) then
rs.delete
else
call PopErr("未找到该套餐")
end if
rs.close
call logadd(request.Cookies("aynameid"),"管理-套餐删除成功"&tid,0,0)
call PopErr2("删除成功","admintaocan.asp")
end if


if act="add" then
call lognamecode()
call logquanxian("e8",1)
aytcname=trim(request.QueryStringform("aytcname"))
aytczong=trim(request.QueryStringform("aytczong"))
aytcjin=trim(request.QueryStringform("aytcjin"))
aytcsj=trim(request.QueryStringform("aytcsj"))
aytcisbuy=trim(request.QueryStringform("aytcisbuy"))
aytcisyear=trim(request.QueryStringform("aytcisyear"))
aytcyearf=trim(request.QueryStringform("aytcyearf"))
aytczhiding=trim(request.QueryStringform("aytczhiding"))

if cint(aytcisyear)=0 then call PopErr("暂不支持流量套餐")

if aytcisbuy="" then aytcisbuy=1
if aytcname="" or aytcjin="" or aytcsj="" or aytczhiding="" then call PopErr("请填写完整")
if cint(aytcisyear)=0 then
if aytczong="" then call PopErr("请填写完整")
end if
if cint(aytcisyear)=1 then
if aytcyearf="" then call PopErr("请填写完整")
end if
if aytczong="" then aytczong=0
if aytcyearf="" then aytcyearf=98

	taocanjid=""
	jid=split(aytczhiding,",")
	For sum=0 To Ubound(jid) 
	taocanjid=taocanjid&trim(jid(sum))&","
	next
	taocanjid=mid(taocanjid,1,len(taocanjid)-1)

sql="select * from aytaocan where aytcname='"&aytcname&"'" 
rs.open sql,conn,1,3
if not(rs.bof and rs.eof) then
call PopErr("套餐名称已存在")
else
rs.addnew
rs("aytcname")=aytcname
rs("aytczong")=aytczong
rs("aytcjin")=aytcjin
rs("aytcsj")=aytcsj
rs("aytcisbuy")=aytcisbuy
rs("aytcisyear")=aytcisyear
rs("aytcyearf")=aytcyearf
rs("aytczhiding")=taocanjid
rs.update
end if
rs.close
call logadd(request.Cookies("aynameid"),"管理-套餐添加成功"&aytcname,0,0)
call PopErr2("添加成功","admintaocan.asp")
end if

if act="editque" then
call lognamecode()
call logquanxian("e8",1)
tid=trim(request.form("tid"))
aytcname=trim(request.form("aytcname"))
aytczong=trim(request.form("aytczong"))
aytcjin=trim(request.form("aytcjin"))
aytcsj=trim(request.form("aytcsj"))
aytcisbuy=trim(request.form("aytcisbuy"))
aytcisyear=trim(request.form("aytcisyear"))
aytcyearf=trim(request.form("aytcyearf"))
aytczhiding=trim(request.form("aytczhiding"))

if aytcisbuy="" then aytcisbuy=1
if tid="" or aytcname="" or aytcjin="" or aytcsj="" or aytczhiding="" then call PopErr("请填写完整")
if cint(aytcisyear)=0 then
if aytczong="" then call PopErr("请填写完整")
end if
if cint(aytcisyear)=1 then
if aytcyearf="" then call PopErr("请填写完整")
end if
if aytczong="" then aytczong=0
if aytcyearf="" then aytcyearf=98

	taocanjid=""
	jid=split(aytczhiding,",")
	For sum=0 To Ubound(jid) 
	taocanjid=taocanjid&trim(jid(sum))&","
	next
	taocanjid=mid(taocanjid,1,len(taocanjid)-1)
	
sql="select * from aytaocan where aytcid="&tid&"" 
rs.open sql,conn,1,3
if not(rs.bof and rs.eof) then
rs("aytcname")=aytcname
rs("aytczong")=aytczong
rs("aytcjin")=aytcjin
rs("aytcsj")=aytcsj
rs("aytcisbuy")=aytcisbuy
rs("aytcisyear")=aytcisyear
rs("aytcyearf")=aytcyearf
rs("aytczhiding")=taocanjid
rs.update
else
call PopErr("未找到该套餐")
end if
rs.close
call logadd(request.Cookies("aynameid"),"管理-套餐修改成功"&aytcname,0,0)
call PopErr2("修改成功","admintaocan.asp")
end if
%>
<DIV id=main1200> 
<%call webleft()%>

<DIV id=main_right>
<DIV id=main_right_content>
<STYLE>.apply_style {
	POSITION: absolute
}
.right_title A {
	LINE-HEIGHT: 27px; WIDTH: 126px; DISPLAY: inline-block; BACKGROUND: url(<%=ossurl%>images/bg22.gif) no-repeat; HEIGHT: 27px
}
.right_title A.current {
	BACKGROUND: url(<%=ossurl%>images/main_right_title_bg.gif) no-repeat; COLOR: #fff; FONT-WEIGHT: bold
}
.table_style_1 TD {
	HEIGHT: 38px
}
.table_style_home_info TD {
	PADDING-BOTTOM: 0px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; HEIGHT: 30px; PADDING-TOP: 0px
}
</STYLE>
<%
if act="edit" then
call logquanxian("e8",1)
call edittaocan()
response.End()
end if
%>
<DIV class=right_titleadmin>&nbsp;&nbsp;套餐管理</DIV>
<DIV class=main><br>

<%if trim(request.QueryString("act"))="zengsong" then
call lognamecode()
call logquanxian("e8",1)
tid=trim(request.QueryString("tid"))

sql="select * from aytaocan where aytcid="&tid&"" 
rs.open sql,conn,1,3
if rs.bof and rs.eof then
call PopErr("未找到套餐")
else
aytcname=rs("aytcname")
aytczong=rs("aytczong")
aytcjin=rs("aytcjin")
aytcsj=rs("aytcsj")
aytcisyear=rs("aytcisyear")
aytcyearf=rs("aytcyearf")
end if 
rs.close
call zengsongtaocan()
response.End()
end if%>

<%sub zengsongtaocan()%>
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="table_style_a1">
     <form action="?act=zengsongque" method="post" name="zengsongque" id="zengsongque"> 
       <tr>
        <th colspan="12" align="center" class="border_bottom" style="font-weight: bold; color: #FF6633">赠送套餐</tr>
	  <tr onmouseover=this.bgColor='#D2FFFF' onmouseout=this.bgColor='#ffffff'>
        <td align="center" class="border_right border_bottom" style="font-weight: bold">套餐名称</td>
        <td align="center" class="border_right border_bottom"><%=trim(aytcname)%></td>
        <td align="center" class="border_right border_bottom" style="font-weight: bold">套餐价格</td>
        <td align="center" class="border_right border_bottom"><%=aytcjin%>元</td>
        <td align="center" class="border_right border_bottom" style="font-weight: bold">套餐流量</td>
        <td align="center" class="border_right border_bottom"><%=aytczong%>元</td>
        <td align="center" class="border_bottom border_right" style="font-weight: bold">套餐时效</td>
	    <td align="center" class="border_bottom border_right"><%=aytcsj%>天</td>
	    <td align="center" class="border_bottom border_right" style="font-weight: bold">是否为包年</td>
	    <td align="center" class="border_bottom border_right">
		<%if cint(aytcisyear)=0 then response.Write"否"%>
		<%if cint(aytcisyear)=1 then response.Write"是"%>	       </td>
	    <td align="center" class="border_bottom border_right" style="font-weight: bold">手续费</td>
	    <td align="center" class="border_bottom"><%=aytcyearf%>%</td>
	  </tr>
       <tr>
        <td colspan="12" align="center">商户ID
		<input name="aytcuid" type="text" id="aytcuid" size="6">
		<input name="tid2" type="hidden" id="tid2" value="<%=tid%>">
        <input name="aytcname" type="hidden" id="aytcname" value="<%=trim(aytcname)%>">
		<input name="aytcjin" type="hidden" id="aytcjin" value="<%=aytcjin%>">
		<input name="aytczong" type="hidden" id="aytczong" value="<%=aytczong%>">
		<input name="aytcsj" type="hidden" id="aytcsj" value="<%=aytcsj%>">
		<input name="aytcisyear" type="hidden" id="aytcisyear" value="<%=aytcisyear%>">
		<input name="aytcyearf" type="hidden" id="aytcyearf" value="<%=aytcyearf%>">
        <input type="submit" name="Submit" value=" 确 认 赠 送 "></td>
      </tr></form>
    </table>
<br>

<%end sub%>





<%sub edittaocan()
tid=request.QueryString("tid")
sql="select * from aytaocan where aytcid="&tid&"" 
rs.open sql,conn,1,1
if rs.bof and rs.eof then
call PopErr("未找到该套餐")
else%>
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="table_style_a1">
     <form action="?act=editque" method="post" name="editque" id="editque"> 
       <tr>
        <th colspan="14" align="center" class="border_bottom" style="font-weight: bold; color: #FF6633">修改套餐</tr>
	  <tr onmouseover=this.bgColor='#D2FFFF' onmouseout=this.bgColor='#ffffff'>
        <td align="center" class="border_right border_bottom">套餐名称</td>
        <td align="center" class="border_right border_bottom"><input name="aytcname" type="text" id="aytcname" value="<%=trim(rs("aytcname"))%>"></td>
        <td align="center" class="border_right border_bottom">套餐价格</td>
        <td align="center" class="border_right border_bottom"><input name="aytcjin" type="text" id="aytcjin" value="<%=rs("aytcjin")%>" size="6">
          元</td>
        <td align="center" class="border_right border_bottom">套餐流量</td>
        <td align="center" class="border_right border_bottom"><input name="aytczong" type="text" id="aytczong" value="<%=rs("aytczong")%>" size="6">
          元</td>
        <td align="center" class="border_bottom border_right">套餐时效</td>
	    <td align="center" class="border_bottom border_right"> 
	      <input name="aytcsj" type="text" id="aytcsj" value="<%=rs("aytcsj")%>" size="5">
	    天</td>
	    <td align="center" class="border_bottom">可见</td>
	    <td align="center" class="border_bottom border_right"><input name="aytcisbuy" type="checkbox" id="aytcisbuy" value="0" <%if cint(rs("aytcisbuy"))=0 then response.Write "checked"%>></td>
	    <td align="center" class="border_bottom border_right">是否为包年</td>
	    <td align="center" class="border_bottom border_right"><select name="aytcisyear" id="aytcisyear">
          <option value="0" <%if cint(rs("aytcisyear"))=0 then response.Write"selected"%>>否</option>
          <option value="1" <%if cint(rs("aytcisyear"))=1 then response.Write"selected"%>>是</option>
        </select></td>
	    <td align="center" class="border_bottom border_right">手续费</td>
	    <td align="center" class="border_bottom"><input name="aytcyearf" type="text" id="aytcyearf" value="<%=rs("aytcyearf")%>" size="5">
	      %</td>
	  </tr>
 		<tr>
        <td align="center" class="border_right border_bottom">指定级别</td>
        <td colspan="13" class="border_right border_bottom">
	  <%
	  set rsujb=server.CreateObject("adodb.recordset")
	  rsujb.open "select * from ayujb order by ayjbpaixu asc",conn,1,1
	  if not(rsujb.bof and rsujb.eof) then
	  do while not rsujb.eof
	  %>
      &nbsp;<input name="aytczhiding" type="checkbox" id="aytczhiding" value="<%=rsujb("ayujbgid")%>" <%if chkujb(rsujb("ayujbgid"),trim(rs("aytczhiding")))=true then response.Write "checked"%>><%=trim(rsujb("ayujbname"))%>
      <%
	  rsujb.movenext
	  loop
	  end if
	  rsujb.close
	  %>
        </td>
        </tr>
       <tr>
        <td colspan="14" align="center"><input name="tid" type="hidden" id="tid" value="<%=tid%>">
        <input type="submit" name="Submit" value=" 修 改 套 餐 "></td>
      </tr></form>
    </table>
<br>

<%
end if
rs.close
end sub%>



  <table width="99%" border="0" cellpadding="0" cellspacing="0" class="table_style_a1">
     <form action="?act=add" method="post" name="myform" id="myform"> 
       <tr>
        <th colspan="14" align="center" class="border_bottom" style="font-weight: bold; color: #FF6633">新增套餐</tr>
	  <tr onmouseover=this.bgColor='#D2FFFF' onmouseout=this.bgColor='#ffffff'>
        <td align="center" class="border_right border_bottom">套餐名称</td>
        <td align="center" class="border_right border_bottom"><input name="aytcname" type="text" id="aytcname"></td>
        <td align="center" class="border_right border_bottom">套餐价格</td>
        <td align="center" class="border_right border_bottom"><input name="aytcjin" type="text" id="aytcjin" size="6">
          元</td>
        <td align="center" class="border_right border_bottom">套餐流量</td>
        <td align="center" class="border_right border_bottom"><input name="aytczong" type="text" id="aytczong" size="6">
          元</td>
        <td align="center" class="border_bottom border_right">套餐时效</td>
	    <td align="center" class="border_bottom border_right">
	      <input name="aytcsj" type="text" id="aytcsj" value="365" size="5">
	    天</td>
	    <td align="center" class="border_bottom ">可见</td>
	    <td align="center" class="border_bottom border_right"><input name="aytcisbuy" type="checkbox" id="aytcisbuy" value="0"></td>
	    <td align="center" class="border_bottom border_right">是否为包年</td>
	    <td align="center" class="border_bottom border_right"><select name="aytcisyear" id="aytcisyear">
          <option value="0">否</option>
          <option value="1" selected>是</option>
                </select></td>
	    <td align="center" class="border_bottom border_right">手续费</td>
	    <td align="center" class="border_bottom"><input name="aytcyearf" type="text" id="aytcyearf" size="5">
	    %</td>
	  </tr>
       <tr>
        <td align="center" class="border_right border_bottom">指定级别</td>
        <td colspan="13" class="border_right border_bottom">
      <%set rsujb=server.CreateObject("adodb.recordset")
	  rsujb.open "select * from ayujb order by ayjbpaixu asc",conn,1,1
	  if not(rsujb.bof and rsujb.eof) then
	  do while not rsujb.eof
	  %>
      &nbsp;<input name="aytczhiding" type="checkbox" id="aytczhiding" value="<%=rsujb("ayujbgid")%>"><%=trim(rsujb("ayujbname"))%> 
      <%
	  rsujb.movenext
	  loop
	  end if
	  rsujb.close
	  %>  
        </td>
        </tr>
       <tr>
        <td colspan="14" align="center"><input type="submit" name="Submit" value=" 增 加 套 餐 "> <br>
		提示：包年套餐还将收取每笔交易手续费！非包年套餐将不在收取手续费(只对网银交易)！<br>
		如果该套餐为包年套餐 将“包年”选择“是”包年价值 如输入98 100元交易 商户入款98元。该套餐为包年套餐时 套餐流量 将视为无效！<br>
		如果该套餐不是包年套餐，即100元交易 商户入款100元(只限网银交易)！<br>
		非包年包年套餐 如同套餐价格等于预存的手续费。包年套餐如同购买套餐后 手续费会相对较低。</td>
      </tr></form>
    </table>
	<br>
	<table width="99%" border="0" cellpadding="0" cellspacing="0" class="table_style_a1">
     <form action="?act=alldel&page=<%=page%>" method="post" name="myform" id="myform"> 
       <tr>
        <th align="center" class="border_right border_bottom" >套餐ID
        <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 aytaocan order by aytcid asc" 
rs.open sql,conn,1,1
if not(rs.bof and rs.eof) then
do while not rs.eof%>

	  <tr onmouseover=this.bgColor='#D2FFFF' onmouseout=this.bgColor='#ffffff'>
        <td align="center" class="border_right border_bottom"><%=rs("aytcid")%></td>
        <td align="center" class="border_right border_bottom"><%=rs("aytcname")%></td>
        <td align="center" class="border_right border_bottom"><span class="border_bottom border_right">
          <select name="aytcisyear" id="aytcisyear">
            <option value="0" <%if cint(rs("aytcisyear"))=0 then response.Write"selected"%>>否</option>
            <option value="1" <%if cint(rs("aytcisyear"))=1 then response.Write"selected"%>>是</option>
          </select>
        </span></td>
        <td align="center" class="border_right border_bottom"><input name="aytcyearf" type="text" id="aytcyearf" value="<%=Formatnumber(rs("aytcyearf"),2,true,-1,0)%>" size="5">
	    %</td>
        <td align="center" class="border_right border_bottom">
		<%response.Write Formatnumber(rs("aytcjin"),2,true,-1,0)&"元"%>
		</td>
        <td align="center" class="border_right border_bottom">
		<%if cint(rs("aytcisyear"))=0 then
		response.Write Formatnumber(rs("aytczong"),2,true,-1,0)&"元"
		else
		response.Write"-"
		end if
		%>
		</td>
        <td align="center" class="border_right border_bottom">
		<%
		if cint(rs("aytcisyear"))=0 then
		zhehe=rs("aytcjin")/rs("aytczong")*100
		response.Write Formatnumber(zhehe,3,true,-1,0)&"%"
		else
		response.Write"-"
		end if
		%>
		</td>
        <td align="center" class="border_right border_bottom"><%=rs("aytcsj")%>天</td>
        <td align="center" class="border_right border_bottom"><%
		if cint(rs("aytcisbuy"))=0 then response.Write "可见"
		if cint(rs("aytcisbuy"))=1 then response.Write "不可见"
		%></td>
        <td align="center" class="border_bottom"><a href="?act=edit&tid=<%=rs("aytcid")%>">修改</a> <a onClick="javascript:return confirm('您确定要删除此套餐吗？会造成已使用的商户套餐失效！');" href="?act=del&tid=<%=rs("aytcid")%>">删除</a> <a href="?act=zengsong&tid=<%=rs("aytcid")%>">赠送</a> 查看使用者</td>
	  </tr>
<%
rs.movenext 
loop
end if
rs.close%>
      </form>
    </table>
</DIV>


</DIV></DIV>
<DIV class=clear></DIV></DIV>
</DIV>
<SCRIPT>
$(function(){
$('.left_title').each(function(){
   $(this).click(function(){
	   var index=$('.left_title').index(this);
	   if($(this).next().hasClass('hide_m')){
		   $(this).next().removeClass('hide_m');
           $(this).next().show();		 
		   $(this).find('img').attr('src','<%=ossurl%>images/expansion.gif');
		   $.cookie('m_index_'+index,'',{expires:0});
	   } else {
	       $(this).next().hide();
		   $(this).next().addClass('hide_m');
		   $(this).find('img').attr('src','<%=ossurl%>images/shrank.gif');		   
		   $.cookie('m_index_'+index,'none',{expires:365});
	   }
   })
})

$('.left_title').each(function(){
	var index=$('.left_title').index(this);
    $(this).next().css('display',$.cookie('m_index_'+index) ? $.cookie('m_index_'+index) : '');
	if($.cookie('m_index_'+index)){
	    $(this).next().addClass('hide_m');
	}
	$(this).find('img').attr('src',$.cookie('m_index_'+index) ? '<%=ossurl%>images/shrank.gif' : '<%=ossurl%>images/expansion.gif');
})
})

</SCRIPT>


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

