📄 card_act.asp
字号:
<!--#include file="../ACT.Function.asp"-->
<!--#include file="../../ACT_inc/cls_pageview.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>1</title>
<link href="../Images/css1/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {font-weight: bold}
-->
</style>
</head>
<body>
<%ConnectionDatabase
dim MaxPerPage,RS,TotalPut,TotalPages,I,CurrentPage,SQL,ComeUrl
MaxPerPage=20
Response.Write"<table width=""98%"" align=""center"" height=""25"" border=""0"" cellspacing=""1"" cellpadding=""2"" class=""table"">"
Response.Write " <tr class=""bg_tr"">"
Response.Write" <td height=""25"" class=""sort""> "
Response.Write " <strong>操作导航:</strong> <a href=""?"">所有充值卡</a> | <a href=""?status=1"">未使用充值卡</a> | <a href=""?status=2"">已使用充值卡</a> | <a href=""?status=3"">已失效充值卡</a> | <a href=""?status=4"">未失效充值卡</a> | <a href=""?action=Add"">添加充值卡</a> | <a href=""?action=AddMore"">批量生成充值卡</a>"
Response.Write " </td>"
Response.Write " </tr>"
Response.Write"</TABLE>"
ComeUrl=Cstr(Request.ServerVariables("HTTP_REFERER"))
Select Case request("Action")
Case "Add","Edit"
Call Add()
Case "DoAdd"
Call DoAdd()
Case "AddMore"
Call AddMore()
Case "DoAddMore"
Call DoAddMore()
Case "Del"
Call Del()
Case Else
Call CardList()
End Select
'点卡列表
Sub CardList()
%>
<table width="98%" style="MARGIN-TOP: 3px" border="0" align="center" cellspacing="1" cellpadding="2" class="table">
<tr class="bg_tr">
<td width="38" height="25" align="center" class="bg_tr"><strong>选中</strong></td>
<td width="116" height="25" align="center" class="bg_tr"><strong>充值卡号</strong></td>
<td width="88" height="25" align="center" class="bg_tr"><strong>密码</strong></td>
<td width="75" align="center" class="bg_tr"><strong>面值</strong></td>
<td width="82" height="25" align="center" class="bg_tr"><strong>点数</strong></td>
<td width="100" align="center" class="bg_tr"><strong>过期时间</strong></td>
<td width="80" height="25" align="center" class="bg_tr"><strong>出售情况</strong></td>
<td width="80" align="center" class="bg_tr"><strong>使用情况</strong></td>
<td width="100" height="25" align="center" class="bg_tr"><strong>使用者</strong></td>
<td width="100" height="25" align="center" class="bg_tr"><strong>充值时间</strong></td>
<td width="130" align="center" class="bg_tr"><strong>操作</strong></td>
</tr>
<%
CurrentPage = actcms.ChkNumeric(request("page"))
Dim Param:Param=" where 1=1"
Select Case actcms.ChkNumeric(request("Status"))
Case 1
Param=Param & " And IsUsed=0"
Case 2
Param=Param & " And IsUsed=1"
Case 3
Param=Param & " And datediff('d',EndDate,"&NowString&")>0"
Case 4
Param=Param & " And datediff('d',EndDate,"&NowString&")<0"
End Select
Dim SqlStr:SqlStr="Select ID,CardNum,CardPass,Money,ValidNum,ValidUnit,AddDate,EndDate,UseDate,UserName,IsUsed,IsSale From Card_ACT " & Param & " order by ID desc"
Set RS=Server.CreateObject("ADODB.RecordSet")
RS.Open SqlStr,conn,1,1
If RS.Eof And RS.Bof Then
Response.Write "<tr><td colspan=11 align=center height=25 >没有充值卡!</td></tr>"
Else
TotalPut=rs.recordcount
if (TotalPut mod MaxPerPage)=0 then
TotalPages = TotalPut \ MaxPerPage
else
TotalPages = TotalPut \ MaxPerPage + 1
end if
if CurrentPage > TotalPages then CurrentPage=TotalPages
if CurrentPage < 1 then CurrentPage=1
rs.move (CurrentPage-1)*MaxPerPage
SQL = rs.GetRows(MaxPerPage)
rs.Close:set rs=Nothing
ShowContent
End If
%>
</table>
<table border="0" style="margin-top:20px" width="90%" align=center>
<tr><td><Font color=red><strong>提示:</strong>
已售出或已使用的充值卡,不允许删除,修改等操作。</font>
</td></tr>
</table>
<%End Sub
Sub ShowContent
Dim InPoint,OutPoint
%>
<form name=selform method=post action=?action=Del>
<%
For i=0 To Ubound(SQL,2)
%>
<tr height="25" onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="center" ><input type="checkbox" name="id" value="<%=SQL(0,i)%>"></td>
<td align="center" ><%=SQL(1,i)%></td>
<td align="center" ><%=SQL(2,i)%></td>
<td align="center" ><%=SQL(3,i)%>元</td>
<td align="center" ><%Response.Write SQL(4,I)
if SQL(5,I)=1 Then
Response.Write "点"
ELSEIf SQL(5,I)=2 Then
Response.Write "天"
elseif SQL(5,I)=3 Then
response.write "元"
end if%></td>
<td align="center" ><%Response.Write formatdatetime(SQL(7,I),2)%></td>
<td align="center" >
<%
IF SQL(11,I)=1 Then
Response.Write "已售出"
Else
Response.Write "<font color=red>未出售</font>"
End If
%></td>
<td align="center" >
<%
IF SQL(10,I)=1 Then
Response.Write "<font color='#a7a7a7'>已使用</font>"
Else
Response.Write "<font color=red>未使用</font>"
End If
%></td>
<td align="center" ><%Response.Write SQL(9,I)%></td>
<td align="center" >
<%if Isdate(Sql(8,i)) then
response.write formatdatetime(SQL(8,i),2)
end if%></td>
<td align="center" >
<%if SQL(11,I)<>1 and SQL(10,I)<>1 then%>
<a href="?action=Edit&ID=<%=SQL(0,i)%>">修改</a> <a href="?action=Del&ID=<%=SQL(0,i)%>">删除</a>
<%end if%>
</td>
</tr>
<%Next
Response.Write "<tr><td height='30' colspan=11 >"
Response.Write " <input id=""chkAll"" onClick=""CheckAll(this.form)"" type=""checkbox"" value=""checkbox"" name=""chkAll""><label for=""chkAll"">全选 </label><input class=act_btn type=""submit"" name=""Submit2"" value="" 删除选中的充值卡 "" onclick=""{if(confirm('此操作不可逆,确定要删除选中的记录吗?')){this.document.selform.submit();return true;}return false;}""> "
Call ShowPagePara(totalPut, MaxPerPage,"Card_Act.asp?action=Add", True, "条记录", CurrentPage, "status=" & request("status"))
Response.Write "</td></tr></form>"
End Sub
'删除充值卡
Sub Del()
Dim ID:ID=Replace(request("ID"),"Card_Act.asp?action=Add","Card_Act.asp?action=Add")
Conn.Execute("Delete From Card_ACT Where ID In(" & ID &") and IsSale=0 and IsUsed=0")
Response.Write "<script>alert('删除成功!');location.href='" & Request.Servervariables("http_referer") & "';</script>"
End Sub
'批量添加充值卡
Sub AddMore()
%>
<form method='post' action='?' name='myform'>
<table width='98%' border='0' align='center' cellpadding='2' cellspacing='1' class='table' >
<tr class="bg_tr">
<td height='22' colspan='2'> <div align='center'><strong>批 量 生 成 充 值 卡</strong></div></td>
</tr>
<tr >
<td width='40%'><strong>充值卡数量:</strong></td>
<td width='60%'><input name='Nums' type='text' value='100' size='10' maxlength='10'>
张</td>
</tr>
<tr >
<td width='40%'><strong>充值卡号码前缀:</strong><br>
例如:2006,Act2007等固定不变的字母或数字</td>
<td width='60%'><input name='CardNumPrefix' type='text' id='CardNumPrefix' value='ACT2007' size='10' maxlength='10'></td>
</tr>
<tr >
<td width='40%'><strong>充值卡号码位数:</strong><br>请输入包含前缀字符在内的总位数</td>
<td width='60%'><input name='CardNumLen' type='text' id='CardNumLen' value='12' size='10' maxlength='10'>
<font color='#0000FF'>建议设为10-15位</font></td>
</tr>
<tr >
<td width='40%'><strong>充值卡密码位数:</strong></td>
<td width='60%'><input name='PasswordLen' type='text' id='PasswordLen' value='6' size='10' maxlength='10'>
<font color='#0000FF'>建议设为6-10位</font></td>
</tr>
<tr >
<td><strong>卡密码构成方式:</strong><br>你可以选择数据或字母的组合</td>
<td><input type="radio" name="zhtype" value="1" checked>纯数字 <input type="radio" name="zhtype" value="2">数字与字母随机组合 </td>
</tr>
<tr >
<td width='40%'><strong>充值卡面值:</strong><br>
即购买人需要花费的实际金额</td>
<td width='60%'><input name='Money' type='text' id='Money' value='50' size='10'>
元</td>
</tr>
<tr >
<td width='40%'><strong>充值卡点数、资金或有效期:</strong><br>
购买人可以得到的点数、资金或有效期 </td>
<td width='60%'><input name='ValidNum' type='text' id='ValidNum' value='50' size='10' maxlength='10'>
<select name='ValidUnit' id='ValidUnit'>
<option value='1' selected>资金</option>
<option value='2'>积分</option>
</select></td>
</tr>
<tr >
<td width='40%'><strong>充值截止期限:</strong><br>
购买人必须在此日期前进行充值,否则自动失效</td>
<td width='60%' ><input name='EndDate' type='text' id='EndDate' value='<%=now+365%>' size='10' maxlength='10'></td>
</tr>
<tr >
<td height='40' colspan='2' align='center'><input name='Action' type='hidden' id='Action' value='DoAddMore'>
<input class="ACT_btn" type='submit' name='Submit' value=' 开始生成 ' style='cursor:hand;'>
<input class="ACT_btn" name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick="window.location.href='?'" style='cursor:hand;'></td>
</tr>
</table>
</form>
<%
End Sub
'添加充值卡
Sub Add()
Dim CardNum,PassWord,IsSale,IsUsed,Money,ValidNum,ValidUnit,EndDate,action1
Dim ID:ID=actcms.ChkNumeric(request("ID"))
if request("action")="Edit" then
Dim RS:Set RS=Server.CreateObject("adodb.recordset")
rs.open "select * from Card_ACT where ID=" & ID,conn,1,1
if rs.bof and rs.eof then
rs.close:set rs=nothing
Call ACTCMS.Alert("参数传递出错!","Card_Act.asp?action=Add")
Exit sub
end if
CardNum=rs("CardNum")
PassWord=rs("CardPass")
Money=rs("money")
ValidNum=rs("ValidNum")
ValidUnit=rs("ValidUnit")
EndDate=rs("EndDate")
IsSale=rs("IsSale")
IsUsed=rs("IsUsed")
action1="Edit"
else
IsSale=0:IsUsed=0:Money=50:ValidNum=50:ValidUnit=1:EndDate=Now+365
end if
%>
<table width='98%' border='0' align='center' cellpadding='2' cellspacing='1' class='table' >
<form method='post' action='?action1=<%=action1%>&id=<%=ID%>' name='myform'>
<tr class="bg_tr">
<td height='22' colspan='2' class="bg_tr"> <div align='center'><strong>
<%IF request("Action")="Edit" then
response.write "修 改 充 值 卡"
Else
Response.Write "添 加 充 值 卡"
End If
%></strong></div></td>
</tr>
<tr <%if request("action")="Edit" Then response.write " style='display:none'"%>>
<td width='40%'><strong>添加方式:</strong></td>
<td width='60%'><input name='AddType' type='radio' value='0' checked onClick="trSingle1.style.display='';trSingle2.style.display='';trBatch.style.display='none';"> 单张充值卡 <input name='AddType' type='radio' value='1' onClick="trSingle1.style.display='none';trSingle2.style.display='none';trBatch.style.display='';">批量添加充值卡</td>
</tr>
<tr id='trSingle1'>
<td width='40%'><b>充值卡卡号:</b></td>
<td><input name='CardNum' type='text' id='CardNum' size='20' value="<%=CardNum%>" maxlength='30'>
<font color='#0000FF'>建议设为10-""5位</font></td>
</tr>
<tr id='trSingle2'>
<td width='40%'><b>充值卡密码:</b></td>
<td><input name='Password' type='text' id='Password' size='20' value="<%=PassWord%>" maxlength='30'>
<font color='#0000FF'>建议设为6-""0位 </font></td>
</tr>
<tr id='trBatch' style='display:none'>
<td width='40%'><b>格式文本:</b><br><font color='red'>请按照每行一张卡,每张卡按“卡号+分隔符+密码”的格式录入</font><br>
例:734534759|Actf15f4ag5te(以“|”作为分隔符)</td>
<td><textarea name='CardList' rows='10' cols='50'></textarea></td>
</tr>
<tr >
<td width='40%'><strong>充值卡面值:</strong><br>
即购买人需要花费的实际金额</td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -