f0e9cd083442738950e0e7d9a47b6ed97c337025.svn-base
7.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
// 程序名称: 时速邮件管理系统(EsMail)
// 程序版本: V2.0
// 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
// 版权所有: 深圳市科飞时速网络技术有限公司
// 技术支持: Tech@21gmail.com
// 单元名称: 营销退订地址列表js文件
// 开始时间: 2013.11.1
// 程 序 员: 谢勇
// 最后修改: 2013.11.1
// 备 注:
var yxyUN_currentPage=1;
var yxyUN_tolPage=1;
var yxyUN_pageNum=10;//每页显示的条
var reg = /^([a-zA-Z\.0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
$(document).ready(function(){
$(".ctj_1,.ctj_2").click(function(){
$(".ctj_1").removeClass().addClass("ctj_2");
$(this).removeClass().addClass("ctj_1");
});
//查询退订地址
findunsubscribe(1);
//用户选择每页显示量
$("#yxyUN_pageNum").blur(function(){
yxyUN_pageNum=$("#yxyUN_pageNum").val();
if(isNaN($('#yxyUN_pageNum').val())){
alert("只能是数字");
}else{
yxyUN_currentPage=1;
findunsubscribe();
}
});
//3.跳转到多少页
$("#yxyUN_selectpage").change(function(){
yxyUN_currentPage=$("#yxyUN_selectpage").val();
findunsubscribe();
});
});
//查询退订地址
function findunsubscribe(page){
$.ajax({
type: "post",
url: "yxyUN_findUnsubscribeByUserID.action",
dataType:"json",
async:false,
cache: false,
data:{
currentPage:page,
pageNum:yxyUN_pageNum
},
error: function() {alert(frontMsg.get("yxy_mail.language_114"));},
success: function(msg) {
yxy_pageview(msg);
}
});
}
//页面显示
function yxy_pageview(msg){
var w= new Array();
$.each(msg.yxyUnsubscribeList,function(index,row){
var q= new Array();
q[0]='';
q[1]='<span>'+row.unsubscribe_email+'</span>';
q[2]='<span">'+row.unsubscribe_date+'</span>';
q[3]='<span>'+row.unsubscribe_body+'</span>';
q[4]='<span><a href="javascript:void(0);" onClick="yxy_delunsubscribe('+row.unsubscribe_id+')">删除</a></span>';
w[index]=q;
});
var joinhtml='<select id=yxyUN_skips>';
for(var p=0;p<msg.pageBean.totalPage;p++){
if((p+1)==yxyUN_currentPage){
joinhtml+='<option selected=selected>'+(p+1)+'</option>';
}else{
joinhtml+='<option>'+(p+1)+'</option>';
}
}
joinhtml+='</select>';
var joinhtml1='<select id=yxyUN_page>';
for(var o=50;o<=200;o=o+50){
if(o==yxyUN_pageNum){
joinhtml1+='<option selected=selected>'+o+'</option>';
}else{
joinhtml1+='<option>'+o+'</option>';
}
}
joinhtml1+='</select>';
$("#yxy_unsubscribediv").lgytable({
tbinfo:'退订地址',//"草稿邮件",
tbtitle:['','退信地址', '退订时间','退订理由','操作'],
tbwidth:['10','300','150', '300', '100'],
tbcon:[{"tbcon":w,"dqpage":msg.pageBean.currentPage,"tolpage":msg.pageBean.totalPage,"tolcount":msg.pageBean.totalRecord}],
homepage:function(){
findunsubscribe(1);
},
prepage:function(){
yxyUN_currentPage=msg.pageBean.currentPage;
if(yxyUN_currentPage>1){
findunsubscribe(yxyUN_currentPage-1);
yxyUN_currentPage--;
}
},nextpage:function(){
yxyUN_currentPage=msg.pageBean.currentPage;
if(yxyUN_currentPage<msg.pageBean.totalPage){
findunsubscribe(yxyUN_currentPage+1);
yxyUN_currentPage++;
}
},lastpage:function(){
findunsubscribe(msg.pageBean.totalPage);
},
tbsetnumtxt:joinhtml1,
tbsetnum:function(){//每页显示量
yxyUN_pageNum=$("#yxyUN_page").val();
findunsubscribe(1);
},
tbsetpagetxt:joinhtml,
tbsetpage:function(){//跳转到某页
yxyUN_currentPage=$("#yxyUN_skips").val();
findunsubscribe(yxyUN_currentPage);
}
});
}
//根据地址查询退订地址
function yxy_findunemail(){
if($("#yxy_unemail").val()==null||$("#yxy_unemail").val()==""){
//alert(frontMsg.get("yxy_mail.language_144"));
return ;
}
$.ajax({
type: "post",
url: "yxyUN_findUnsubscribeByEmail.action",
dataType:"json",
async:false,
cache: false,
data:{
currentPage:yxyUN_currentPage,
unsubsctibeEmail:$("#yxy_unemail").val()
},
error: function() {alert(frontMsg.get("yxy_mail.language_114"));},
success: function(msg) {
var w= new Array();
$.each(msg.yxyUnsubscribeList,function(index,row){
var q= new Array();
q[0]='';
q[1]='<span>'+row.unsubscribe_email+'</span>';
q[2]='<span">'+row.unsubscribe_date+'</span>';
q[3]='<span>'+row.unsubscribe_body+'</span>';
q[4]='<span><a href="javascript:void(0);" onClick="yxy_delunsubscribe('+row.unsubscribe_id+')">删除</a></span>';
w[index]=q;
});
$("#yxy_unsubscribediv").lgytable({
tbinfo:'退订地址',//"草稿邮件",
tbtitle:['','退信地址', '退订时间','退订理由','操作'],
tbpageshow:false,
tbwidth:['10','300','150', '300', '100'],
tbcon:[{"tbcon":w,"dqpage":msg.pageBean.currentPage,"tolpage":msg.pageBean.totalPage,"tolcount":msg.pageBean.totalRecord}],
homepage:function(){
findunsubscribe(1);
},
prepage:function(){
yxyUN_currentPage=msg.pageBean.currentPage;
if(yxyUN_currentPage>1){
findunsubscribe(yxyUN_currentPage-1);
yxyUN_currentPage--;
}
},nextpage:function(){
yxyUN_currentPage=msg.pageBean.currentPage;
if(yxyUN_currentPage<msg.pageBean.totalPage){
findunsubscribe(yxyUN_currentPage+1);
yxyUN_currentPage++;
}
},lastpage:function(){
findunsubscribe(msg.pageBean.totalPage);
}
});
}
});
}
//删除退订
function yxy_delunsubscribe(unid){
var a= confirm("您确定删除该退订地址?");
if(a==true){
//调用ajax删除
$.ajax({
type: "post",
url: "yxyUN_delUnsubscribe.action",
dataType:"json",
async:false,
cache: false,
data:{
unid:unid
},
error: function() {alert(frontMsg.get("yxy_mail.language_114"));},
success: function(msg) {
if(msg==1){
findunsubscribe();
//alert(frontMsg.get("yxy_mail.language_146"));
}else{
alert(frontMsg.get("yxy_mail.language_147"));
}
}
});
}else{
return;
}
}
//根据语言设置标签及按扭显示文本
function SetLanguage(){
var languageID="";
$("[language="+languageName+"]").each(function(i,row){
languageID=$(this).attr("languageValue");
$(this).text(frontMsg.get(languageValue+"."+languageID));
$(this).attr("value",frontMsg.get(languageValue+"."+languageID));
});
}
//关闭层
function confirmTerm(s) {
closeWindown(s);
}
//弹出层
function popTips(name,id,dx){
showTipsWindown(name, id, dx);
}
//层方法
function showTipsWindown(title,id,width){
var hdeight2=$("#"+id).height();
tipsWindown(title,"id:"+id,width,"100%",hdeight2,"true","","true",id);
var pickerOpts1 = {
changeMonth: true,
changeYear: true,
dateFormat: "yy-mm-dd"
};
}
//提交退订
function commitUnAddr(div){
if($("#un_address").val()==null||$("#un_address").val()==""){
alert("请输入退订的地址!");
}else if(!reg.test($("#un_address").val())){
alert("email地址不合法!");
}else{
$.ajax({
type: "post",
url: "yxyUN_addUnsubscribe.action",
dataType:"json",
async:false,
cache: false,
beforeSend: function(){},
complete: function(){},
data:{
unsubsctibeEmail:$("#un_address").val(),
unsubBody:$("#un_body").val()
},
error: function() {alert(frontMsg.get("yxy_mail.language_114"));},
success: function(msg) {
if(msg==1){
//查询退订地址
upseccess("添加成功");
findunsubscribe();
confirmTerm(div);
}else{
alert("添加失败!");
}
}
});
}
}
//导出退订地址
function exportAddress()
{
$.ajax({
type:"post",
url:"yxyUN_exportAddress.action",
dataType:"json",
async:false,
cache: false,
error: function() {alert("异常");},
success:function(msg)
{
if(msg==1)
{
alert("无任何退订地址信息");
}
else if(msg == 2)
{
alert("出现异常,导出失败,请稍候重试!");
}
else if(msg == 3)
{
$("#downloadid").attr("src","dowload.action?filedir=tempUserFile&fileName=unsubscribe.xls");
}
}
});
}