1cc44ecc772d3eb0553a78e1cc9c83487b0b737c.svn-base 10.5 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 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410

// 程序名称:    时速邮件管理系统(EsMail)
// 程序版本:    V2.0
// 作    者:    深圳市科飞时速网络技术有限公司(0755-88843776)
// 版权所有:    深圳市科飞时速网络技术有限公司
// 技术支持:    Tech@21gmail.com
// 单元名称:    营销邮件列表js文件
// 开始时间:    2013.11.1
// 程 序 员:    谢勇
// 最后修改:    2013.11.1
// 备    注:    

var yxyM_currpage=1;//当前页
var yxyM_tolpage=1;//总页数
var condition=0;
var conditionvalue=0;
var status=1;
var yxyM_pageNum=10;//每页显示数
var mailaddressid=0;
var yxyM_cliclId = 0;//点击的邮件ID
var emailSubject = "";//邮件的主题
var eamilTime = "";//邮件的发送时间
$(document).ready(function(){
	
	//初始化语言
	languageName="language_yxy";
	languageValue="yxy_mail";
	//加载语言文件
	var index_language = $.cookie( "language" );
	LoadLanguage(index_language,SetLanguage);
	//查询已发邮件
	ysyM_findMasterStatus(1);
	/*//跳转到多少页
	$("#yxyM_selectpage").change(function(){
	yxyM_currpage=$("#yxyM_selectpage").val();
	ysyM_findMasterStatus();
	
	});*/
	
	//用户选择每页显示量
	$("#yxyM_pageNum").blur(function(){
		yxyM_pageNum=$("#yxyM_pageNum").val();
		if(isNaN($('#yxyM_pageNum').val())){
			alert("只能是数字");
		}else{
			yxyM_currpage=1;
			ysyM_findMasterStatus();
		}
		
	});
	
});

//查询已发邮件
function ysyM_findMasterStatus(page){
	$.ajax({ 
		type: "post", 
		url: "yxyM_findMailCondition.action", 
		dataType:"json",
		async:false,
	 	cache: false,
		data:{
			currpage:page,
			status:status,
			pageSize:yxyM_pageNum,
			condition:condition,
		 	conditionvalue:conditionvalue
		},
		success: function(msg) {
			var w= new Array();
			$.each(msg.masterlist,function(index,row){
			var q= new Array();
			q[0]=(index+1)+"|center";
			var subjet1=row.subject.split("###")[0];
			subjet1=subjet1.replace(/\'/g,"´");
			var subjet2=row.subject.split("###")[0];
			q[1]='<span title='+(subjet1.replace(/\s/g," "))+'>'+subjet2+'</span>';
			q[2]='<span title='+row.setHHtime+'>'+row.setYYtime+'</span>';
			q[3]='<a href="javascript:void(0);" onclick="importmailaddress('+row.send_mail_id+')">'+row.send_num+'</a>';
			q[4]='<a href="javascript:yxyM_ReadInfo(\''+row.mail_uid+'\',\''+(subjet1.replace(/\s/g," "))+'\',\''+row.setYYtime+'\')">'+row.reading_tol+'</a>';
			if(row.un_person+0){
				q[5]='<a href="javascript:yxyM_UnInfo(\''+row.mail_uid+'\','+row.un_person+')">'+row.un_person+'</a>';
			}else{
				q[5]=row.un_person+"";
			}
			
			q[6]=row.replynum+"";
			q[7]='<a href="javascript:yxyM_doing(\''+row.send_mail_id+'\');"> 删除 </a>|<a href="javascript:yxyM_daochu(\''+row.send_mail_id+'\');"> 导出 </a><a href="javascript:void(0);" onclick=lookMailInfoOpen('+row.send_mail_id+')> | 查看</a>';
          	
		   w[index]=q;
		});
		var joinhtml='<select id=yxyM_skips>';
		for(var p=0;p<msg.pagebean.totalPage;p++){
			if((p+1)==yxyM_currpage){
				joinhtml+='<option selected=selected>'+(p+1)+'</option>';
			}else{
				joinhtml+='<option>'+(p+1)+'</option>';
			}
			
		}
		joinhtml+='</select>';
		
		var joinhtml1='<select id=yxyM_page>';
		for(var o=50;o<=200;o=o+50){
			if(o==yxyM_pageNum){
				joinhtml1+='<option selected=selected>'+o+'</option>';
			}else{
				joinhtml1+='<option>'+o+'</option>';
			}
		}
		joinhtml1+='</select>';
		$("#yxyM_list").lgytable({
			tbinfo:'已发邮件',//"草稿邮件",
			tbtitle:['编号|center','主题', '时间','投递', '点击','退订','回复', '操作'], 
			tbwidth:['50','400','100', '100', '50','50', '50', '100'],
			tbcon:[{"tbcon":w,"dqpage":msg.pagebean.currentPage,"tolpage":msg.pagebean.totalPage,"tolcount":msg.pagebean.totalRecord}],
			homepage:function(){
				ysyM_findMasterStatus(1);
			},
			prepage:function(){
				yxyM_currpage=msg.pagebean.currentPage;
				if(yxyM_currpage>1){
					ysyM_findMasterStatus(yxyM_currpage-1);
					yxyM_currpage--;
				}
			},
			nextpage:function(){
				yxyM_currpage=msg.pagebean.currentPage;
				if(yxyM_currpage<msg.pagebean.totalPage){
					ysyM_findMasterStatus(yxyM_currpage+1);
					yxyM_currpage++;
				}
			},
			lastpage:function(){
				ysyM_findMasterStatus(msg.pagebean.totalPage);
			},
			tbsetnumtxt:joinhtml1,
			tbsetnum:function(){//每页显示量
				yxyM_pageNum=$("#yxyM_page").val();
				ysyM_findMasterStatus(1);
			},
			tbsetpagetxt:joinhtml,
			tbsetpage:function(){//跳转到某页
				yxyM_currpage=$("#yxyM_skips").val();
				ysyM_findMasterStatus(yxyM_currpage);
			}
		});		
		}	
	});	
}

//邮件统计信息
function yxyM_mailCount(mailid,mailuid){
	$.ajax({ 
		type: "post", 
		url: "yxyM_findreadinfo.action", 
		dataType:"json",
		async:false,
	 cache: false,
		data:{
			mailUID:mailuid,
			mailID:mailid
		},
		error: function() {alert(frontMsg.get("yxy_mail.language_114"));}, 
		beforeSend:function() { 
	
				},
				complete:function() { 

				},
		success: function(msg) {
			$("#yxyF_sendtol").html(msg[0]);
			$("#yxyF_readtol").html(msg[2]);
			$("#yxyF_readperson").html(msg[3]);
			$("#yxyF_sendover").html(msg[1]);
			$("#yxyF_sendwait").html(msg[0]-msg[1]);
			$("#yxyF_unNum").html(msg[4]);
		}	
	});	
}

//弹出层调用
function popTips(name,id,dx,mailid,mailuid){
	showTipsWindown(name, id, dx);
}
function showTipsWindown(title,id,width){
		var hdeight2=$("#"+id).height();
	tipsWindown(title,"id:"+id,width,"100%",hdeight2,"true","","true",id);
}
//删除邮件
function yxyM_doing(mailID){
	var a= confirm("你确定删除该邮件?"); 
	if(a==true){
		$.ajax({ 
		type: "post", 
		url: "yxyM_delMailByID.action", 
		dataType:"json",
		async:false,
	 cache: false,
		data:{
			mailid:mailID
		},
		error: function() {alert(frontMsg.get("yxy_mail.language_114"));}, 
		success: function(msg) {
			if(msg==1){
				ysyM_findMasterStatus(yxyM_currpage);
			}else{
				alert("删除失败!");
			}
		}	
	});	
	}else{
		return ;
	}
}

//导出邮件
function yxyM_daochu(mailID){
	$.ajax({ 
		type: "post", 
		url: "yxyM_leadingOutMail.action", 
		dataType:"json",
		async:false,
		contentType: "application/x-www-form-urlencoded; charset=utf-8",
	 	cache: false,
		data:{
			mailid:mailID,
			filejia:'Download'
		},
		error: function() {alert(frontMsg.get("yxy_mail.language_114"));}, 
		success: function(msg) {
			if(msg!=0){
				$("#downloadid").attr("src","dowload.action?filedir=tempUserFile&filename="+msg+".eml");
			}else{
				alert("导出失败,文件不存在!");
			}
		}	
	});
	
}

//导出某一封邮件的点读数
function yxyM_DaoChuDU()
{
	$.ajax({ 
		type: "post", 
		url: "yxyRead_downloadDD.action", 
		dataType:"json",
		async:false,
		cache: false,
		data:
		{
			mailUID:yxyM_cliclId,
			emailSubject:emailSubject,
			emailTime:eamilTime
		},
		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=readinfo.xls");
			}
		}	
	});
}

//点读详细信息
function yxyM_ReadInfo(mailUID,subject,time){
	
	//赋值
	yxyM_cliclId = mailUID;
	emailSubject = subject;
	eamilTime = time;
	
	$.ajax({ 
		type: "post", 
		url: "yxyRead_findReadInfo.action", 
		dataType:"json",
		async:false,
	 cache: false,
		data:{
			mailUID:mailUID
		},
		error: function() {alert(frontMsg.get("yxy_mail.language_114"));}, 
		success: function(msg) {
			var htmls='';
			if(msg!=null&&msg!=""){				
				$.each(msg,function(index,row){		
					htmls+='<div class="concs btb">';
					htmls+='<div class="yxy_hb_dd  yhb_t_1a"><span class="mrt25">'+row.yxy_reading_email+'</span></div>';
					htmls+='<div class="yxy_hb_dd yxy_hb_center yhb_t_1b">'+row.yxy_reading_date+'</div>';
					htmls+='<div class="yxy_hb_dd yxy_hb_center yhb_t_1c">'+row.yxy_reading_num+'</div>';
					htmls+='<div class="yxy_hb_dd yxy_hb_center yhb_t_1d">'+row.yxy_reading_area+'</div>';
					htmls+='<div class="yxy_hb_dd yxy_hb_center yhb_t_1e">'+row.yxy_reading_ip+'</div>';
					htmls+='</div>';
				});
			}
			$("#yxyReadBody").html(htmls);
		}	
	});	
	//弹出框
	popTips("点读详细信息","yxyReadinfoDiv",800);
}

//退订详细信息
function yxyM_UnInfo(mailUID,unnum){
	$.ajax({ 
		type: "post", 
		url: "yxyUN_findUnAddrByUID.action", 
		dataType:"json",
		async:false,
	 cache: false,
		data:{
			mailUID:mailUID
		},
		error: function() {alert(frontMsg.get("yxy_mail.language_114"));}, 
		success: function(msg) {
			var htmls='';
			if(msg.yxyUnsubscribeList!=null&&msg.yxyUnsubscribeList!=""){
				$.each(msg.yxyUnsubscribeList,function(index,row){	
					var nowdate=row.unsubscribe_date.split(" ");
					htmls+='<div class="concs btb">';
					htmls+='<div class="yxy_hb_dd  yhb_td_1"><span class="mrt25">'+row.unsubscribe_email+'</span></div>';
					htmls+='<div class="yxy_hb_dd yxy_hb_center yhb_td_2" title='+nowdate[1]+'>'+nowdate[0]+'</div>';
					htmls+='<div class="yxy_hb_dd yxy_hb_center yhb_td_3">'+row.unsubscribe_body+'</div>';
					htmls+='</div>';
				});
			}
			
			$("#yxyUnBody").html(htmls);
		}	
	});
	//弹出框
	popTips("退订详细信息","yxyUninfoDiv",500);
}

//查看邮件信息弹出框
function lookMailInfoOpen(mailid){
	$.weeboxs.open('#mailInfoDiv', {
		title:"邮件详细信息",
        onopen:function() {
			lookMailInfo(mailid);
		},
		onok:function(box){
			comitFilter(id);
			box.close();//增加事件方法后需手动关闭弹窗
		},
		width:1000,
		height:500,
		showButton:false,
		oncancel:function(box){
			box.close();//增加事件方法后需手动关闭弹窗
		}
	});
}

//邮件地址数处理
function addressOperate(mailid){
	mailaddressid=mailid;
	//弹出操作框
	$.weeboxs.open('#addressoperatediv', {
		title:"导出",
		onok:function(box){
			box.close();//增加事件方法后需手动关闭弹窗
		},
		width:100,
		height:40,
		showButton:false,
		oncancel:function(box){
			box.close();//增加事件方法后需手动关闭弹窗
		}
	});
}

//邮件地址导出
function importmailaddress(mailid){
	var option=confirm("是否下载此邮件的地址?");
	if(option==true){
		$.ajax({
			type:"post",
			cache: false,
			async:false,
			url: "yxyM_findImportAddr.action", 
			dataType:"json",
			data:{
				mailID:mailid,
				filejia:'UserTxtFile'
			},
			error: function() {alert("异常");}, 
			success: function(msg) {
				if(msg==0){
					alert("文件不存在!");
				}else{
					//获取此文件的存放路径
					$("#downloadid").attr("src","dowload.action?filedir=userSaveFile&fileName="+msg);
				}
			}
		});
	}else{
		return false;
	}
}