yxysendwait.js 5.0 KB

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

var yxyW_currpage=1;//当前页
var yxyW_tolpage=1;//总页数
var status=0;
var yxyW_pageNum=10;//每页显示数
$(document).ready(function(){ 				
	//查询待发邮件
	ysyW_findMasterStatus(1);
	//跳转到多少页
	$("#yxyW_selectpage").change(function(){
	yxyW_currpage=$("#yxyW_selectpage").val();
	ysyW_findMasterStatus(1);	
	});
	//用户选择每页显示量
	$("#yxyW_pageNum").blur(function(){
		yxyW_pageNum=$("#yxyW_pageNum").val();
		if(isNaN($('#yxyW_pageNum').val())){
			alert("只能是数字");
		}else{
			yxyW_currpage=1;
			ysyW_findMasterStatus(1);
		}
	});
});

//查询待发邮件
function ysyW_findMasterStatus(page){
	$.ajax({ 
		type: "post", 
		url: "yxyM_findMasterByStatus.action", 
		dataType:"json",
		async:false,
	 	cache: false,
		data:{
			currpage:page,
			status:status,
			pageSize:yxyW_pageNum
		},
		error: function() {alert(frontMsg.get("yxy_mail.language_114"));}, 
		success: function(msg) {
			var w= new Array();
			$.each(msg.masterList,function(index,row){
				var q= new Array();
			
				var subjet1=row.subject.split("###")[0];
				var subjet2=row.setsubject.split("###")[0];
			
				q[0]='';
				q[1]='<span title='+subjet1.replace(/\s/g," ")+'>'+subjet2+'</span>';
				q[2]='<span title='+row.setHHtime+'>'+row.setYYtime+'</span>';
				q[3]=row.send_num+"";
				q[4]='<a href="javascript:void(0);" onClick="yxyW_popTips(\'统计信息\',\'yxyW_countdiv\',350,\''+row.send_mail_id+'\',\''+row.mail_uid+'\','+row.send_num+');">统计信息</a>';
				
				w[index]=q;
			});
			
			var joinhtml='<select id=yxyW_skips>';
			for(var p=0;p<msg.pageBean.totalPage;p++){
				if((p+1)==yxyW_currpage){
					joinhtml+='<option selected=selected>'+(p+1)+'</option>';
				}else{
					joinhtml+='<option>'+(p+1)+'</option>';
				}
				
			}
			joinhtml+='</select>';
			var joinhtml1='<select id=yxyW_page>';
			for(var o=50;o<=200;o=o+50){
				if(o==yxyW_pageNum){
					joinhtml1+='<option selected=selected>'+o+'</option>';
				}else{
					joinhtml1+='<option>'+o+'</option>';
				}
			}
			joinhtml1+='</select>';
	
	
			$("#yxyW_list").lgytable({
				tbinfo:'待发邮件',//"草稿邮件",
				tbtitle:['','主题', '时间','投递','详细'], 
				tbwidth:['20','400','100', '100','100', '100'],
				tbcon:[{"tbcon":w,"dqpage":msg.pageBean.currentPage,"tolpage":msg.pageBean.totalPage,"tolcount":msg.pageBean.totalRecord}],
				homepage:function(){
					ysyW_findMasterStatus(1);
				},
				prepage:function(){
					yxyW_currpage=msg.pageBean.currentPage;
					if(yxyW_currpage>1){
						ysyW_findMasterStatus(yxyW_currpage-1);
						yxyW_currpage--;
					}
				},
				nextpage:function(){
					yxyW_currpage=msg.pageBean.currentPage;
					if(yxyW_currpage<msg.pageBean.totalPage){
						ysyW_findMasterStatus(yxyW_currpage+1);
						yxyW_currpage++;
					}
				},
				lastpage:function(){
					ysyW_findMasterStatus(msg.pageBean.totalPage);
				},
				tbsetnumtxt:joinhtml1,
				tbsetnum:function(){//每页显示量
					yxyW_pageNum=$("#yxyW_page").val();
					ysyW_findMasterStatus(1);
				},
				tbsetpagetxt:joinhtml,
				tbsetpage:function(){//跳转到某页
					yxyW_currpage=$("#yxyW_skips").val();
					ysyW_findMasterStatus(yxyW_currpage);
				}
			});		
		}	
	});	
}

//首页
function yxyW_homepage(){
	yxyW_currpage=1;
	ysyW_findMasterStatus();
}

//下一页
function yxyW_nextpage(){
	if(yxyW_currpage>=yxyW_tolpage){
		alert(frontMsg.get("yxy_mail.language_126"));
	}else{
		yxyW_currpage=yxyW_currpage+1;
		ysyW_findMasterStatus();
	}
}

//上一页
function yxyW_uppage(){
	if(yxyW_currpage<=1){
		alert(frontMsg.get("yxy_mail.language_126"));
	}else{
		yxyW_currpage=yxyW_currpage-1;
		ysyW_findMasterStatus();
	}
}
//尾页
function yxyW_endpage(){
	yxyW_currpage=yxyW_tolpage;
	ysyW_findMasterStatus();
}

//弹出层调用
function yxyW_popTips(name,id,dx,mailid,mailuid,sendnum){
	yxyW_mailCount(mailid,mailuid,sendnum);
	yxyW_showTipsWindown(name, id, dx);
}
function yxyW_showTipsWindown(title,id,width){
	var hdeight2=$("#"+id).height();
	tipsWindown(title,"id:"+id,width,"100%",hdeight2,"true","","true",id);
}
//邮件统计信息
function yxyW_mailCount(mailid,mailuid,sendnum){
	$.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"));}, 
		success: function(msg) {
			$("#yxyW_sendtol").html(sendnum);
			$("#yxyW_readtol").html(msg[2]);
			$("#yxyW_readperson").html(msg[3]);
			$("#yxyW_sendover").html(sendnum-msg[1]);//已发完量
			$("#yxyW_sendwait").html(msg[1]);//待发量
		}	
	});	
}