//美容师活动报名
//活动列表
function findMrBaomingList(page){
var sendData = {};
sendData["showAddress"] = $("#activityPlace").val().trim();
sendData["showType"] = $("#showType").val();
sendData["showName"] = $("#activityName").val().trim();
sendData["pageSize"] = "10";
sendData["pageNo"] = page;
util.sendAjax({
url:'groomer/groomerShow',
data:sendData,
async:true,
loadFlag:true,
type:'GET',
cache:false,
success:function(data){
if(data.rc==0){
$("#MrBaomingList").html("");
if(data.list.length>0) {
list = data.list;
$.each(list, function (index, item) {
var durTime = new Date(new Date(util.formatDateLong(item.registerEndTime).replace(/-/g,"/"))).getTime()+86399000 - new Date().getTime();
var showTime = util.endTime(durTime);
item["showDurTime"] = showTime;
});
$.each(list,function(index,item){
$("#MrBaomingList").append("
"
+""+item.showType+" | "
+""+item.showName+" | "
+""+item.showAddress+" | "
+""+item.showDurTime+" | "
+"报名 | "
+"
");
$(".register").eq(index).on("click",function(){
getApplyMsg(item);
})
});
var timeRun = null;
timeRun = setInterval(function() {
setTime(list);
},10000);
initPage(page,10,data.total);
}else{
layer.open({
content:"美容师活动列表为空!",
skin:"msg",
time:2
});
initPage(page,10,1);
$("#MrBaomingList").html("");
}
}else{
layer.open({
content:"信息查询失败:"+data.msg,
skin:"msg",
time:2
});
$("#MrBaomingList").html("");
}
}
});
}
//截止时间
function setTime(list){
$.each(list,function(index,item){
var durTime = new Date(new Date(util.formatDateLong(item.registerEndTime).replace(/-/g,"/"))).getTime()+86399000-new Date().getTime();
var showTime = util.endTime(durTime);
item.showDurTime = showTime;
$(".endTime").eq(index).html(showTime);
});
}
//获取报名信息
function getApplyMsg(data){
var id = data.id;
var showType = data.showType;
var show_code = data.showCode;
var sendData = {};
sendData["show_code"] = show_code;
util.sendAjax({
url:'groomer/apply',
data:sendData,
async:true,
loadFlag:true,
type:'GET',
cache:false,
success:function(data){
if(data.rc==0){
var showLevel = data.data.showLevel;
var schoolNameCn = data.data.schoolNameCn;
window.location.href = "ckuMrBaoming2.html?showCode="+encodeURIComponent(show_code)+"&showType="+encodeURIComponent(showType)+"&showLevel="+encodeURIComponent(showLevel)+"&schoolNameCn="+encodeURIComponent(schoolNameCn);
}else{
layer.open({
content:"报名失败:"+data.msg,
skin:"msg",
time:2
});
}
}
});
}
//初始化分页
function initPage(nowPage,pageSize,total){
var html=""+
""+nowPage+"/"+Math.ceil(total/pageSize)+"
"+
"
";
$("#showPageContent").html(html);
}
$(function(){
var page =1;
var obj = util.getQueryString();
if(obj.page==undefined){
page=1;
}else{
page=obj.page;
}
findMrBaomingList(page);
})