$(document).ready(function(){
// $(".packagelist").on("touchstart",function(){
// var index = $(this).index();
// $(".packagelist").removeClass("on");
// $(this).addClass("on");
// $(".disneylistgrid").hide();
// $(".disneylistgrid").eq(index).fadeIn();
// })
var tomonth = new Date();
atimehtml = $(".atime").outerHTML();
$(".atime").remove();
atimehtml2 = $(".atime2").outerHTML();
$(".atime2").remove();
atimehtml3 = $(".atime3").outerHTML();
$(".atime3").remove();
console.log(atimehtml)
var timeinfo = $(".timeinfo").outerHTML();
//addmouth($(".month"),tomonth.getFullYear(),13);
$(".sel_goback").on("click",function(){
addmouth($(".month"),tomonth.getFullYear(),tomonth.getMonth());
$(".month").show();
$(".asell_list").hide();
disney()
});
$(".add").on("click",function(){
console.log(1)
var num = parseInt($(this).siblings("input").val());
$(this).siblings("input").val(++num);
//var price = parseInt($(this).parent().siblings(".ticket_price").html().replace("¥",""))*num
var allprice = 0;
for(var i = 0 ;i<$(".aticket").length;i++){
var thisone = $(".aticket").eq(i).val();
var price = parseInt($(".aticket").eq(i).parent().siblings(".ticket_price").html().replace("¥",""))
var aprice = thisone*price;
allprice+=aprice
}
$(".buyprice").html("¥"+allprice)
})
$(".cut").on("click",function(){
var num = parseInt($(this).siblings("input").val());
if(num==0){
}else{
$(this).siblings("input").val(--num);
var allprice = 0;
for(var i = 0 ;i<$(".aticket").length;i++){
var thisone = $(".aticket").eq(i).val();
var price = parseInt($(".aticket").eq(i).parent().siblings(".ticket_price").html().replace("¥",""))
var aprice = thisone*price;
allprice+=aprice
}
$(".buyprice").html("¥"+allprice)
}
})
$(".aticket").on("change",function(){
$(".buyprice").html();
var price = parseInt($(this).parent().siblings(".ticket_price").html().replace("¥",""))*$(this).val();
})
var doubletime = [];
var atime = [];
});
function addmouth(dom,year,month){
//console.log(atimehtml)
!dom.hasClass("amonth")&&dom.addClass("amonth");
var date = new Date(year,month);
var tomonth = new Date().getMonth();
var today = new Date().getDate();
var dayhtml = [];
var week = ["一","二","三","四","五","六","日"];
dayhtml.push('
<'+date.getFullYear()+'年'+(date.getMonth()+1)+'月>
')
$.each(week,function(i,v){
dayhtml.push(''+week[i]+'
')
});
var firstweek = date.getDay();
console.log(date)
var first = date.getDate();
var allday = new Date(parseInt(year),(parseInt(month)+1),0).getDate();
//console.log(allday)
//console.log(parseInt(year)+","+(parseInt(month)+1))
// console.log(new Date(year,month+1,0))
for(var i = 0;i')
};
if (month==tomonth){
for(i=1;i<=allday;i++){
if(i==today){
dayhtml.push('今天
')
}
else if(i'+i+'')
}else{
dayhtml.push(''+i+'
')
}
}
}else if(month'+i+'')
}
}else{
for(i=1;i<=allday;i++){
dayhtml.push(''+i+'
')
}
}
dom.html(dayhtml.join(""))
$(".monthleft").unbind();
$(".monthright").unbind();
$(".monthleft").on("click",function(){
var currentdate = $(".currentdate").html();
currentdate = currentdate.split("年");
addmouth($(".month"),currentdate[0],(currentdate[1]-2));
$(".cartime").removeClass("sel")
$(".aweekday").hide();
disney()
//console.log(new Date(currentdate[0],(currentdate[1]-2)))
})
$(".monthright").on("click",function(){
var currentdate = $(".currentdate").html();
currentdate = currentdate.split("年");
//console.log(currentdate);
addmouth($(".month"),currentdate[0],(currentdate[1]));
$(".cartime li").removeClass("sel")
$(".aweekday").hide();
disney()
//console.log(new Date(currentdate[0],(currentdate[1])))
})
}
function disney(){
$(".canday").unbind();
if($(".timeinfo").hasClass("oneday")){
$(".canday").on("click",function(){
$(".canday").removeClass("thisday");
$(this).addClass("thisday");
$(".timeinfo").find("li").removeClass("sel")
atime = [];
var thisdate = $(".currentdate").html().split("年");
var thisday = $(this).html();
console.log(thisday);
if($(this).html()=="今天"){
var selday = new Date().getDay();
var seldate = new Date().getDate();
}else{
var seldate = $(this).html();
var selday = new Date(parseInt(thisdate[0]),(parseInt(thisdate[1])-1),parseInt(thisday)).getDay();
console.log(selday)
}
var index = null;
if(selday==0){
$(".aweekday").hide();
$(".aweekday").eq(0).show();
}
else{
$(".aweekday").hide();
$(".aweekday").eq(selday).show();
}
$(".timeinfo").show();
$(".timeinfo").find("li").unbind();
$(".timeinfo").find("li").on("click",function(){
atime = [];
console.log(atime)
if(!($(this).hasClass("disable"))){
$(this).siblings("li").removeClass("sel");
$(this).addClass("sel");
$.each($(".timeinfo").find(".sel"),function(){
atime.push($(this).children(".time").html());
})
if(atime.length==2){
var yearmonth = $(".currentdate").html().split("年")
var thisdata = yearmonth[0]+"."+yearmonth[1]+"."+seldate;
var html = atimehtml.replace(/mydata|mytime1|mytime2/g,function(match){
switch(match){
case "mydata":
return thisdata;
case "mytime1":
return atime[0];
case "mytime2":
return atime[1];
}
})
$(".cartime li").removeClass("sel")
$(".sel_goback").html(html);
$(".month").hide();
$(".timeinfo").hide();
$(".asell_list").show();
}
}
})
})
}else if($(".timeinfo").hasClass("twoday")){
addsel()
}else if($(".timeinfo").hasClass("lion")){
$(".canday").on("click",function(){
$(".canday").removeClass("thisday");
$(this).addClass("thisday");
$(".timeinfo").find("li").removeClass("sel")
atime = [];
var thisdate = $(".currentdate").html().split("年");
var thisday = $(this).html();
console.log(thisday);
if($(this).html()=="今天"){
var selday = new Date().getDay();
var seldate = new Date().getDate();
}else{
var seldate = $(this).html();
var selday = new Date(parseInt(thisdate[0]),(parseInt(thisdate[1])-1),parseInt(thisday)).getDay();
console.log(selday)
}
var index = null;
if(selday==0){
$(".aweekday").hide();
$(".aweekday").eq(0).show();
}
else{
$(".aweekday").hide();
$(".aweekday").eq(selday).show();
}
$(".timeinfo").show();
$(".timeinfo").find("li").unbind();
$(".timeinfo").find("li").on("click",function(){
atime = [];
console.log(atime)
if(!($(this).hasClass("disable"))){
$(this).siblings("li").removeClass("sel");
$(this).addClass("sel");
$.each($(".timeinfo").find(".sel"),function(){
atime.push($(this).children(".time").html());
})
if(atime.length==1){
var yearmonth = $(".currentdate").html().split("年")
var thisdata = yearmonth[0]+"."+yearmonth[1]+"."+seldate;
var html = atimehtml3.replace(/mydata|gotime/g,function(match){
switch(match){
case "mydata":
return thisdata;
case "gotime":
return atime[0];
}
})
$(".cartime li").removeClass("sel")
$(".sel_goback").html(html);
$(".month").hide();
$(".timeinfo").hide();
$(".asell_list").show();
}
}
})
})
}
}
var dayinfo=[];
var week1= {};
var week2= {};
function addsel(){
$(".canday").unbind();
var mymonth = $(".currentdate").html().split("年");
var allday = new Date(mymonth[0],(parseInt(mymonth[1])),0).getDate();
var twoday = [];
$(".canday").on("click",function(){
//$(this).html()==new Date(mymonth[0],(parseInt(mymonth[1]))).getDate()||($(this).html()=="今天"&&new Date().getDate()==new Date(mymonth[0],(parseInt(mymonth[1]))).getDate())
if(typeof week1.go!="undefined"&&($(this).html()==new Date(mymonth[0],(parseInt(mymonth[1]))).getDate()||($(this).html()=="今天"&&new Date().getDate()==new Date(mymonth[0],(parseInt(mymonth[1]))).getDate()))){
console.log(12)
var aweek = 2 ;
var thisdate = $(".currentdate").html().split("年");
var thisday = $(this).html();
$(this).addClass("thisday");
$(this).removeClass("placesel");
}else if($(this).hasClass("placesel")){
var thisdate = $(".currentdate").html().split("年");
var thisday = $(this).html();
$(this).addClass("thisday");
$(this).removeClass("placesel");
var aweek = 2;
}else{
var aweek = 1 ;
$(".canday").removeClass("thisday");
$(".canday").removeClass("placesel");
var thisdate = $(".currentdate").html().split("年");
var thisday = $(this).html();
if(thisday=="今天"){
thisday=new Date().getDate();
}
$(this).next().addClass("placesel");
$(this).addClass("thisday");
$(".timeinfo").find("li").removeClass("sel");
week1= {};
week2= {};
};
if($(this).html()==allday||($(this).html()=="今天"&&new Date().getDate()==allday)){
week1= {};
week2= {};
var thisdate = $(".currentdate").html().split("年");
var thisday = allday;
//addmouth($(".month"),mymonth[0],mymonth[1]);
//$(".canday:eq(0)").addClass("placesel");
//addsel()
}
console.log(thisday)
if($(this).html()=="今天"){
var selday = new Date().getDay();
var seldate = new Date().getDate();
console.log(seldate)
}else{
var seldate = $(this).html();
//console.log(seldate)
var selday = new Date(parseInt(thisdate[0]),(parseInt(thisdate[1])-1),parseInt(thisday)).getDay();
};
//console.log(seldate)
if(selday==0){
$(".aweekday").hide();
$(".aweekday").eq(0).show();
}else{
$(".aweekday").hide();
$(".aweekday").eq(selday).show();
};
$(".timeinfo").show();
$(".timeinfo").find("li").unbind();
$(".timeinfo").find("li").on("click",function(){
$(this).parent().find("li").removeClass("sel");
$(this).addClass("sel");
var time = $(this).children(".time").html();
dayinfo=[];
Array.prototype.push.apply(dayinfo,thisdate);
//console.log(selday+","+time)
dayinfo.push(seldate);
dayinfo.push(time);
if($(this).parent().hasClass("go")){
var goback="go";
}else{
var goback="back";
};
if(judge(aweek,dayinfo,goback)){
if(typeof week1.back=="undefined"){
var yearmonth = $(".currentdate").html().split("年");
var thisdata = yearmonth[0]+"."+yearmonth[1]+"."+$(".thisday").html();
var html = [];
var ahtml = atimehtml2.replace(/mydata|gotime/g,function(match){
switch(match){
case "mydata":
return week1.go[0]+"."+ week1.go[1]+"."+ week1.go[2];
case "gotime":
return week1.go[3];
}
});
html.push(ahtml);
ahtml = atimehtml3.replace(/mydata|gotime/g,function(match){
switch(match){
case "mydata":
return week2.back[0]+"."+ week2.back[1]+"."+ week2.back[2];
case "gotime":
return week2.back[3];
}
});
html.push(ahtml);
$(".cartime li").removeClass("sel");
$(".sel_goback").html(html);
$(".month").hide();
$(".timeinfo").hide();
$(".asell_list").show();
}else{
var yearmonth = $(".currentdate").html().split("年");
var thisdata = yearmonth[0]+"."+yearmonth[1]+"."+$(".thisday").html();
var html = [];
var ahtml = atimehtml.replace(/mydata|mytime1|mytime2/g,function(match){
switch(match){
case "mydata":
return week1.go[0]+"."+ week1.go[1]+"."+ week1.go[2];
case "mytime1":
return week1.go[3];
case "mytime2":
return week1.back[3]
}
});
html.push(ahtml);
var ahtml = atimehtml.replace(/mydata|mytime1|mytime2/g,function(match){
switch(match){
case "mydata":
return week2.go[0]+"."+ week2.go[1]+"."+ week2.go[2];
case "mytime1":
return week2.go[3];
case "mytime2":
return week2.back[3]
}
});
html.push(ahtml);
$(".cartime li").removeClass("sel");
$(".sel_goback").html(html);
$(".month").hide();
$(".timeinfo").hide();
$(".asell_list").show();
week1={};
week2={};
}
}
})
})
}
function judge(week,time,goback){
console.log(goback);
if(week==1){
week1[goback]=time;
}else{
week2[goback]=time;
};
console.log(week1)
console.log(week2)
if(typeof week1.go!="undefined"&&typeof week2.back!="undefined"){
return true
}
}
function disney2(){
}
function leftright(){
}
jQuery.fn.outerHTML = function(s) {
return (s) ? this.before(s).remove() : $("").append(this.eq(0).clone()).html();
}
// onClick="showIframe('http://yii2.com/hotel/report/purchase',460,280)"
function showIframe(url){
//添加iframe
$("title").html('酒店业务统计');
var if_w = $(window).width() - $('.control-bar').width();
var if_h = $(window).height();
//allowTransparency='true' 设置背景透明
$('.control-show').empty();
$("").prependTo('.control-show');
$(".navbar").width(1626);
$("#YuFrame1").attr("src", url)
}