|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170 |
- $(document).ready(function(){
-
-
- $(".fancybox").fancybox({
- helpers : {
- overlay : {
- css : {'background':'rgba(000,000,000,0.3)'}
- }
- },
- openEffect:'elastic',
- openSpeed : 150,
- closeEffect:'elastic',
- transitionIn:'elastic',
- transitionOut:'elastic'
-
- });
-
-
- // $(".fancybox").click(function(){
-
- // })
- if($(".timeinfo").hasClass("disney")){
-
- $(".pay").on("click",function(){
- var judge = false ;
- $.each($(".aticket"),function(){
- if($(this).val()>0){judge=true;}
- });
- var num = 0;
- $.each($(".aticket"),function(){
- num+=parseInt($(this).val());
- });
-
- if(judge!=true){
- // $("#inline").html("请选择票种");
- // $(".fancybox").click();
- alert("请选择票种")
- return
- }else if(num>5){
- // $("#inline").html("单次购买不能超过5张");
- // $(".fancybox").click();
- alert("单次购买不能超过5张")
- return
- }else if( $(".hide").length!=0 ){
- // $("#inline").html("请选择日期");
- // $(".fancybox").click();
- alert("请选择日期");
- return
- }else if( $(".hidestation").length!=0 ){
- // $("#inline").html("请选择日期");
- // $(".fancybox").click();
- alert("请选择上下站点");
- return
- }else if($(".name").val()==""){
- // $("#inline").html("请填写姓名")
- // $(".fancybox").click();
- alert("请填写姓名")
- return
- }else if($(".phone").val()==""||$(".phone").val().length!=11){
- // $("#inline").html("请填写正确的手机号码")
- // $(".fancybox").click();
- alert("请填写正确的手机号码")
- return
- }else if($(".idcard").val()==""){
- // $("#inline").html("请填写身份证号码")
- // $(".fancybox").click();
- alert("请填写身份证号码")
- return
- }
- document.pay_form.submit();
-
- })
-
- }else{
- $(".pay").on("click",function(){
- var judge = false ;
- $.each($(".aticket"),function(){
- if($(this).val()>0){judge=true;}
- });
- if(judge!=true){
- // $("#inline").html("请选择票种");
- // $(".fancybox").click();
- alert("请选择票种")
- return
- }else if( $(".hide").length!=0 ){
- // $("#inline").html("日期");
- // $(".fancybox").click();
- alert("请选择日期")
- return
- }else if( $(".hidestation").length!=0 ){
- // $("#inline").html("请选择日期");
- // $(".fancybox").click();
- alert("请选择上下站点");
- return
- }else if($(".name").val()==""){
- // $("#inline").html("请填写姓名")
- // $(".fancybox").click();
- alert("请填写姓名")
- return
- }else if($(".phone").val()==""||$(".phone").val().length!=11){
- // $("#inline").html("请填写正确的手机号码")
- // $(".fancybox").click();
- alert("请填写正确的手机号码")
- return
- }else if($("idcard").val()==""){
- // $("#inline").html("请填写身份证号码")
- // $(".fancybox").click();
- alert("请填写身份证号码")
- return
- }
- document.pay_form.submit();
- })
- }
-
-
- // $(".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();
- atimehtml4 = $(".atime4").outerHTML();
- $(".atime4").remove();
- astationhtml = $(".astation").outerHTML();
- $(".astation").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()
- });
-
- $(".sel_station").on("click",function(){
- $(".station").show();
- $(".asell_list").hide();
- });
-
-
- $(".station").find("li").click(function(){
- var astation = [];
- $(this).siblings("li").removeClass("selects");
- $(this).addClass("selects");
- $.each($(".station").find(".selects"),function(){
- astation.push($(this).html());
-
- })
- if(astation.length==2){
- var html = astationhtml.replace(/star_station|end_station/g,function(match){
- switch(match){
- case "star_station":
- return astation[0];
- case "end_station":
- return astation[1];
- }
- })
- // $(".cartime li").removeClass("selects")
- $(".sel_station").html(html);
- $(".station").hide();
- $(".asell_list").show();
-
- }
-
- })
-
- $(".add").on("click",function(){
- if($(".timeinfo").hasClass("disney")){
- var num =0;
- $.each($(".aticket"),function(){
- num += parseInt($(this).val());
- })
- if(num==5){}else{
- var num = $(this).siblings("input").val();
- $(this).siblings("input").val(++num);
- }
-
-
- }else{
- 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 tomorrow = today+1;
-
- var todayhours = new Date().getHours();
-
- // window.localStorage.setItem("carTodayhours",carTodayhours);
- // window.localStorage.setItem("carTodayMin",carTodayMin);
- var ticketType = window.localStorage.getItem("ticketType");
-
- var dayhtml = [];
- var week = ["一","二","三","四","五","六","日"];
- dayhtml.push('<div class="showdate fire borderbot"><span class="monthleft"><</span><span class="currentdate">'+date.getFullYear()+'年'+(date.getMonth()+1)+'</span><span>月</span><span class="monthright">></span></div>')
-
- $.each(week,function(i,v){
- dayhtml.push('<div class="aweek">'+week[i]+'</div>')
- });
- 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<firstweek-1;i++){
- dayhtml.push('<div class="aday"></div>')
- };
- if (month==tomonth){
- for(i=1;i<=allday;i++){
- if(i==today){
- if($(".timeinfo").hasClass("oneday")||$(".timeinfo").hasClass("twoday")){
- dayhtml.push('<div class="aday disday">今天</div>')
- }else if($(".timeinfo").hasClass("oneway")){
- if(todayhours<17){
- dayhtml.push('<div class="aday canday">今天</div>')
- }else{
- dayhtml.push('<div class="aday disday">今天</div>')
- }
-
- }else if($(".timeinfo").hasClass("lion")||$(".timeinfo").hasClass("disney")){
- alert(1)
- if((type_id==16)||(type_id==18)){
-
- if(todayhours<14){
- alert(2)
- dayhtml.push('<div class="aday canday">今天</div>')
- }else{
- alert(3)
- dayhtml.push('<div class="aday disday">今天</div>')
- }
- }else{
- if(todayhours>8&&todayhours<22){
- dayhtml.push('<div class="aday canday">今天</div>')
- }else{
- dayhtml.push('<div class="aday disday">今天</div>')
- }
- }
-
- }
-
-
- }else if(i==tomorrow){
-
- if($(".timeinfo").hasClass("oneday")||$(".timeinfo").hasClass("twoday")){
- if(todayhours<22){
- dayhtml.push('<div class="aday canday">'+i+'</div>')
- }else{
- dayhtml.push('<div class="aday disday">'+i+'</div>')
- }
- }else if($(".timeinfo").hasClass("oneway")){
- dayhtml.push('<div class="aday canday">'+i+'</div>')
-
- }else if($(".timeinfo").hasClass("lion")||$(".timeinfo").hasClass("disney")){
- if((type_id==16)||(type_id==18)){
-
- dayhtml.push('<div class="aday canday">'+i+'</div>')
-
- }else{
- if(todayhours>21){
- dayhtml.push('<div class="aday disday">'+i+'</div>')
- }else{
- dayhtml.push('<div class="aday canday">'+i+'</div>')
- }
- }
-
-
-
- }
-
-
- }else if(i<tomorrow){
- dayhtml.push('<div class="aday disday">'+i+'</div>')
- }else{
-
- dayhtml.push('<div class="aday canday">'+i+'</div>')
- }
- }
- }else if(month<tomonth){
- for(i=1;i<=allday;i++){
- dayhtml.push('<div class="aday disday">'+i+'</div>')
- }
- }else{
- for(i=1;i<=allday;i++){
- dayhtml.push('<div class="aday canday">'+i+'</div>')
- }
- }
-
-
-
- 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("disney")){
- $(".canday").on("click",function(){
- if($(this).html()=="今天"){
- var seldate = new Date().getDate();
- }else{
- var seldate =$(this).html();
- }
- var yearmonth = $(".currentdate").html().split("年")
- var thisdata = yearmonth[0]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
- var html = atimehtml4.replace(/mydata|star_time|time_val/g,function(match){
- switch(match){
- case "star_time":
- return "star_time";
- case "time_val":
- return thisdata;
- case "mydata":
- return thisdata;
- }
- })
-
- $(this).addClass("thisday");
- $(".sel_goback").html(html);
- $(".month").hide();
- $(".asell_list").show();
-
- })
- }
- else 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]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
- var html = atimehtml.replace(/mydata|mytime1|mytime2|star_time|time_val/g,function(match){
- switch(match){
- case "star_time":
- return "star_time";
- case "time_val":
- return thisdata+atime[0]+"-"+thisdata+atime[1];
- 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();
-
- }
-
-
-
- }
-
-
- })
- //判断车票开车4小时内不能买票
- if($(".thisday").html()=="今天"){
- var carTodayhours = new Date().getHours()+4;
- var carTodayMin = new Date().getMinutes();
- if(carTodayMin<10){
- carTodayMin="0"+carTodayMin;
- }else{
- carTodayMin=carTodayMin;
- }
- var NowTime = carTodayhours.toString()+carTodayMin.toString();
- var objGo = $("input[name=check_go_time]").val();
- var objBack = $("input[name=check_back_time]").val()
- var objGoArr = objGo.split(",");
- var objBackArr = objBack.split(",");
-
- for(var i=0;i<objGoArr.length;i++){
- if(Number(NowTime)>objGoArr[i]){
- $(".carticketGo"+i).unbind("click");//去掉事件
- $(".carticketGo"+i).css("background-color","#bbb");
- }
- }
- for(var i=0;i<objBackArr.length;i++){
- if(Number(NowTime)>objBackArr[i]){
- $(".carticketBack"+i).unbind("click");//去掉事件
- $(".carticketBack"+i).css("background-color","#bbb");
- }
- }
-
- }else{
- var objGo = $("input[name=check_go_time]").val();
- var objBack = $("input[name=check_back_time]").val()
- var objGoArr = objGo.split(",");
- var objBackArr = objBack.split(",");
- for(var i=0;i<objGoArr.length;i++){
- $(".carticketGo"+i).removeAttr("style");
- }
- for(var i=0;i<objBackArr.length;i++){
- $(".carticketBack"+i).removeAttr("style");
-
- }
- $(".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]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
- var html = atimehtml.replace(/mydata|mytime1|mytime2|star_time|time_val/g,function(match){
- switch(match){
- case "star_time":
- return "star_time";
- case "time_val":
- return thisdata+atime[0]+"-"+thisdata+atime[1];
- 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]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
- var html = atimehtml3.replace(/mydata|gotime|star_time|time_val/g,function(match){
- switch(match){
- case "star_time":
- return "star_time";
- case "time_val":
- return thisdata+atime[0];
- case "mydata":
- return thisdata;
- case "gotime":
- return atime[0];
-
- }
- })
- $(".cartime li").removeClass("sel")
- $(".sel_goback").html(html);
- $(".month").hide();
- $(".timeinfo").hide();
- $(".asell_list").show();
-
- }
-
-
-
- }
-
-
- })
- //判断狮子王演出半小时内不能买票
- if($(".thisday").html()=="今天"){
- var NowTime;
- var carTodayhours = new Date().getHours();
- var carTodayMin = new Date().getMinutes()+30;
- if(carTodayMin<10){
- carTodayMin="0"+carTodayMin;
- NowTime = carTodayhours.toString()+carTodayMin.toString();
- }else if(carTodayMin>60){
- carTodayMin = carTodayMin%60;
- if(carTodayMin<11){
- NowTime = (carTodayhours+1).toString()+("0"+carTodayMin).toString();
- }else{
- NowTime = (carTodayhours+1).toString()+carTodayMin.toString();
-
- }
-
- }else{
- NowTime = carTodayhours.toString()+carTodayMin.toString();
-
- }
- var objGo = $("input[name=check_go_time]").val();
- var objGoArr = objGo.split(",");
-
-
- for(var i=0;i<objGoArr.length;i++){
- if(Number(NowTime)>objGoArr[i]){
- $(".carticketGo"+i).unbind("click");//去掉事件
- $(".carticketGo"+i).css("background-color","#bbb");
- }
- }
-
- }else{
- var objGo = $("input[name=check_go_time]").val();
- var objGoArr = objGo.split(",");
- for(var i=0;i<objGoArr.length;i++){
- $(".carticketGo"+i).removeAttr("style");
- }
-
- $(".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]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
- var html = atimehtml3.replace(/mydata|gotime|star_time|time_val/g,function(match){
- switch(match){
- case "star_time":
- return "star_time";
- case "time_val":
- return thisdata+atime[0];
- case "mydata":
- return thisdata;
- case "gotime":
- return atime[0];
-
- }
- })
- $(".cartime li").removeClass("sel")
- $(".sel_goback").html(html);
- $(".month").hide();
- $(".timeinfo").hide();
- $(".asell_list").show();
-
- }
-
-
-
- }
-
-
- })
- }
-
-
- })
-
-
- }else if($(".timeinfo").hasClass("oneway")){
- $(".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]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
- var html = atimehtml3.replace(/mydata|gotime|star_time|time_val/g,function(match){
- switch(match){
- case "star_time":
- return "star_time";
- case "time_val":
- return thisdata+atime[0];
- case "mydata":
- return thisdata;
- case "gotime":
- return atime[0];
-
- }
- })
- $(".cartime li").removeClass("sel")
- $(".sel_goback").html(html);
- $(".month").hide();
- $(".timeinfo").hide();
- $(".asell_list").show();
-
- }
-
-
-
- }
-
-
- })
- //判断车票开车4小时内不能买票
- if($(".thisday").html()=="今天"){
- var carTodayhours = new Date().getHours()+4;
- var carTodayMin = new Date().getMinutes();
- if(carTodayMin<10){
- carTodayMin="0"+carTodayMin;
- }else{
- carTodayMin=carTodayMin;
- }
- var NowTime = carTodayhours.toString()+carTodayMin.toString();
-
- var objGo = $("input[name=check_go_time]").val();
- var objBack = $("input[name=check_back_time]").val()
- var objGoArr = objGo.split(",");
- var objBackArr = objBack.split(",");
-
- for(var i=0;i<objGoArr.length;i++){
- if(Number(NowTime)>objGoArr[i]){
- $(".carticketGo"+i).unbind("click");//去掉事件
- $(".carticketGo"+i).css("background-color","#bbb");
- }
- }
- for(var i=0;i<objBackArr.length;i++){
- if(Number(NowTime)>objBackArr[i]){
- $(".carticketBack"+i).unbind("click");//去掉事件
- $(".carticketBack"+i).css("background-color","#bbb");
- }
- }
-
- }else{
- var objGo = $("input[name=check_go_time]").val();
- var objBack = $("input[name=check_back_time]").val()
- var objGoArr = objGo.split(",");
- var objBackArr = objBack.split(",");
- for(var i=0;i<objGoArr.length;i++){
- $(".carticketGo"+i).removeAttr("style");
- }
- for(var i=0;i<objBackArr.length;i++){
- $(".carticketBack"+i).removeAttr("style");
-
- }
- $(".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]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
- var html = atimehtml3.replace(/mydata|gotime|star_time|time_val/g,function(match){
- switch(match){
- case "star_time":
- return "star_time";
- case "time_val":
- return thisdata+atime[0];
- 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]+"年"+addzero(yearmonth[1])+"月"+addzero($(".thisday").html())+"日";
- var html = [];
- var ahtml = atimehtml2.replace(/mydata|gotime|star_time|time_val/g,function(match){
- switch(match){
- case "star_time":
- return "star_time";
- case "time_val":
- return week1.go[0]+"年"+ addzero(week1.go[1])+"月"+ addzero(week1.go[2])+"日"+week1.go[3];
- case "mydata":
- return week1.go[0]+"年"+ addzero(week1.go[1])+"月"+ addzero(week1.go[2]);
- case "gotime":
- return week1.go[3];
- }
- });
- html.push(ahtml);
- ahtml = atimehtml3.replace(/mydata|gotime|star_time|time_val/g,function(match){
- switch(match){
- case "star_time":
- return "end_time";
- case "time_val":
- return week2.back[0]+"年"+ addzero(week2.back[1])+"月"+ addzero(week2.back[2])+"日"+week2.back[3];
- case "mydata":
- return week2.back[0]+"年"+ addzero(week2.back[1])+"月"+ addzero(week2.back[2]);
- case "gotime":
- return week2.back[3];
- }
- });
- //$(".aaaa").val(thisdata);
- //console.log($(".aaaa").val());
-
- 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]+"年"+addzero(yearmonth[1])+"月"+addzero($(".thisday").html())+"日";
- var html = [];
- //<input type="text" value="time_val" name="star_time">
-
- var ahtml = atimehtml.replace(/mydata|mytime1|mytime2|time_val|star_time/g,function(match){
- switch(match){
- case "star_time":
- return "star_time";
- case "time_val":
- return week1.go[0]+"年"+ addzero(week1.go[1])+"月"+ addzero(week1.go[2])+"日"+week1.go[3]+"-"+week1.go[0]+"年"+ addzero(week1.go[1])+"月"+ addzero(week1.go[2])+"日"+week1.back[3];
- case "mydata":
- return week1.go[0]+"年"+ addzero(week1.go[1])+"月"+ addzero(week1.go[2])+"日";
- case "mytime1":
- return week1.go[3];
- case "mytime2":
- return week1.back[3]
- }
- });
-
- // console.log(week1.go[0]+"."+ week1.go[1]+"."+ week1.go[2]);
- // console.log(".aaaa");
- // $(".aaaa").val(week1.go[0]+"."+ week1.go[1]+"."+ week1.go[2]);
- //console.log($(".aaaa").val());
- // console.log($(".aaaa"));
- html.push(ahtml);
-
- var ahtml = atimehtml.replace(/mydata|mytime1|mytime2|time_val|star_time/g,function(match){
- switch(match){
- case "star_time":
- return "end_time";
- case "time_val":
- return week2.go[0]+"年"+addzero(week2.go[1])+"月"+ addzero(week2.go[2])+"日"+week2.go[3]+"-"+week2.go[0]+"年"+ addzero(week2.go[1])+"月"+ addzero(week2.go[2])+"日"+week2.back[3];
- case "time_val":
- return week2.go[0]+"年"+ addzero(week2.go[1])+"月"+ addzero(week2.go[2])+"日"+week2.back[3];
- case "mydata":
- return week2.go[0]+"年"+ addzero(week2.go[1])+"月"+ addzero(week2.go[2])+"日";
- case "mytime1":
- return week2.go[3];
- case "mytime2":
- return week2.back[3]
- }
- });
- html.push(ahtml);
- // console.log($(".aaaa").val());
-
- $(".cartime li").removeClass("sel");
- $(".sel_goback").html(html);
- //console.log($(".aaaa").val())
- $(".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(){
-
-
- }
-
- //得到url上的参数,并反映线路名称
- function getPar(par){
- var local_url = document.location.href;
- local_url = decodeURI(local_url);
- var get = local_url.indexOf(par +"=");
- if(get == -1){
- return false;
- }
- var get_par = local_url.slice(par.length + get + 1);
- var nextPar = get_par.indexOf("&");
- if(nextPar != -1){
- get_par = get_par.slice(0, nextPar);
- }
- return get_par;
- }
- var type_id = getPar("id");
-
-
- function addzero(num){
- if(num.length<2){
- return "0"+num;
- }else{
- return num;
- }
-
- }
-
-
- jQuery.fn.outerHTML = function(s) {
- return (s) ? this.before(s).remove() : $("<Hill_man>").append(this.eq(0).clone()).html();
- }
-
|