您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

3 年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170
  1. $(document).ready(function(){
  2. $(".fancybox").fancybox({
  3. helpers : {
  4. overlay : {
  5. css : {'background':'rgba(000,000,000,0.3)'}
  6. }
  7. },
  8. openEffect:'elastic',
  9. openSpeed : 150,
  10. closeEffect:'elastic',
  11. transitionIn:'elastic',
  12. transitionOut:'elastic'
  13. });
  14. // $(".fancybox").click(function(){
  15. // })
  16. if($(".timeinfo").hasClass("disney")){
  17. $(".pay").on("click",function(){
  18. var judge = false ;
  19. $.each($(".aticket"),function(){
  20. if($(this).val()>0){judge=true;}
  21. });
  22. var num = 0;
  23. $.each($(".aticket"),function(){
  24. num+=parseInt($(this).val());
  25. });
  26. if(judge!=true){
  27. // $("#inline").html("请选择票种");
  28. // $(".fancybox").click();
  29. alert("请选择票种")
  30. return
  31. }else if(num>5){
  32. // $("#inline").html("单次购买不能超过5张");
  33. // $(".fancybox").click();
  34. alert("单次购买不能超过5张")
  35. return
  36. }else if( $(".hide").length!=0 ){
  37. // $("#inline").html("请选择日期");
  38. // $(".fancybox").click();
  39. alert("请选择日期");
  40. return
  41. }else if( $(".hidestation").length!=0 ){
  42. // $("#inline").html("请选择日期");
  43. // $(".fancybox").click();
  44. alert("请选择上下站点");
  45. return
  46. }else if($(".name").val()==""){
  47. // $("#inline").html("请填写姓名")
  48. // $(".fancybox").click();
  49. alert("请填写姓名")
  50. return
  51. }else if($(".phone").val()==""||$(".phone").val().length!=11){
  52. // $("#inline").html("请填写正确的手机号码")
  53. // $(".fancybox").click();
  54. alert("请填写正确的手机号码")
  55. return
  56. }else if($(".idcard").val()==""){
  57. // $("#inline").html("请填写身份证号码")
  58. // $(".fancybox").click();
  59. alert("请填写身份证号码")
  60. return
  61. }
  62. document.pay_form.submit();
  63. })
  64. }else{
  65. $(".pay").on("click",function(){
  66. var judge = false ;
  67. $.each($(".aticket"),function(){
  68. if($(this).val()>0){judge=true;}
  69. });
  70. if(judge!=true){
  71. // $("#inline").html("请选择票种");
  72. // $(".fancybox").click();
  73. alert("请选择票种")
  74. return
  75. }else if( $(".hide").length!=0 ){
  76. // $("#inline").html("日期");
  77. // $(".fancybox").click();
  78. alert("请选择日期")
  79. return
  80. }else if( $(".hidestation").length!=0 ){
  81. // $("#inline").html("请选择日期");
  82. // $(".fancybox").click();
  83. alert("请选择上下站点");
  84. return
  85. }else if($(".name").val()==""){
  86. // $("#inline").html("请填写姓名")
  87. // $(".fancybox").click();
  88. alert("请填写姓名")
  89. return
  90. }else if($(".phone").val()==""||$(".phone").val().length!=11){
  91. // $("#inline").html("请填写正确的手机号码")
  92. // $(".fancybox").click();
  93. alert("请填写正确的手机号码")
  94. return
  95. }else if($("idcard").val()==""){
  96. // $("#inline").html("请填写身份证号码")
  97. // $(".fancybox").click();
  98. alert("请填写身份证号码")
  99. return
  100. }
  101. document.pay_form.submit();
  102. })
  103. }
  104. // $(".packagelist").on("touchstart",function(){
  105. // var index = $(this).index();
  106. // $(".packagelist").removeClass("on");
  107. // $(this).addClass("on");
  108. // $(".disneylistgrid").hide();
  109. // $(".disneylistgrid").eq(index).fadeIn();
  110. // })
  111. var tomonth = new Date();
  112. atimehtml = $(".atime").outerHTML();
  113. $(".atime").remove();
  114. atimehtml2 = $(".atime2").outerHTML();
  115. $(".atime2").remove();
  116. atimehtml3 = $(".atime3").outerHTML();
  117. $(".atime3").remove();
  118. atimehtml4 = $(".atime4").outerHTML();
  119. $(".atime4").remove();
  120. astationhtml = $(".astation").outerHTML();
  121. $(".astation").remove();
  122. console.log(atimehtml)
  123. var timeinfo = $(".timeinfo").outerHTML();
  124. //addmouth($(".month"),tomonth.getFullYear(),13);
  125. $(".sel_goback").on("click",function(){
  126. addmouth($(".month"),tomonth.getFullYear(),tomonth.getMonth());
  127. $(".month").show();
  128. $(".asell_list").hide();
  129. disney()
  130. });
  131. $(".sel_station").on("click",function(){
  132. $(".station").show();
  133. $(".asell_list").hide();
  134. });
  135. $(".station").find("li").click(function(){
  136. var astation = [];
  137. $(this).siblings("li").removeClass("selects");
  138. $(this).addClass("selects");
  139. $.each($(".station").find(".selects"),function(){
  140. astation.push($(this).html());
  141. })
  142. if(astation.length==2){
  143. var html = astationhtml.replace(/star_station|end_station/g,function(match){
  144. switch(match){
  145. case "star_station":
  146. return astation[0];
  147. case "end_station":
  148. return astation[1];
  149. }
  150. })
  151. // $(".cartime li").removeClass("selects")
  152. $(".sel_station").html(html);
  153. $(".station").hide();
  154. $(".asell_list").show();
  155. }
  156. })
  157. $(".add").on("click",function(){
  158. if($(".timeinfo").hasClass("disney")){
  159. var num =0;
  160. $.each($(".aticket"),function(){
  161. num += parseInt($(this).val());
  162. })
  163. if(num==5){}else{
  164. var num = $(this).siblings("input").val();
  165. $(this).siblings("input").val(++num);
  166. }
  167. }else{
  168. var num = parseInt($(this).siblings("input").val());
  169. $(this).siblings("input").val(++num);
  170. }
  171. //var price = parseInt($(this).parent().siblings(".ticket_price").html().replace("¥",""))*num
  172. var allprice = 0;
  173. for(var i = 0 ;i<$(".aticket").length;i++){
  174. var thisone = $(".aticket").eq(i).val();
  175. var price = parseInt($(".aticket").eq(i).parent().siblings(".ticket_price").html().replace("¥",""))
  176. var aprice = thisone*price;
  177. allprice+=aprice
  178. }
  179. $(".buyprice").html("¥"+allprice)
  180. })
  181. $(".cut").on("click",function(){
  182. var num = parseInt($(this).siblings("input").val());
  183. if(num==0){
  184. }else{
  185. $(this).siblings("input").val(--num);
  186. var allprice = 0;
  187. for(var i = 0 ;i<$(".aticket").length;i++){
  188. var thisone = $(".aticket").eq(i).val();
  189. var price = parseInt($(".aticket").eq(i).parent().siblings(".ticket_price").html().replace("¥",""))
  190. var aprice = thisone*price;
  191. allprice+=aprice
  192. }
  193. $(".buyprice").html("¥"+allprice)
  194. }
  195. })
  196. $(".aticket").on("change",function(){
  197. $(".buyprice").html();
  198. var price = parseInt($(this).parent().siblings(".ticket_price").html().replace("¥",""))*$(this).val();
  199. })
  200. var doubletime = [];
  201. var atime = [];
  202. });
  203. function addmouth(dom,year,month){
  204. //console.log(atimehtml)
  205. !dom.hasClass("amonth")&&dom.addClass("amonth");
  206. var date = new Date(year,month);
  207. var tomonth = new Date().getMonth();
  208. var today = new Date().getDate();
  209. var tomorrow = today+1;
  210. var todayhours = new Date().getHours();
  211. // window.localStorage.setItem("carTodayhours",carTodayhours);
  212. // window.localStorage.setItem("carTodayMin",carTodayMin);
  213. var ticketType = window.localStorage.getItem("ticketType");
  214. var dayhtml = [];
  215. var week = ["一","二","三","四","五","六","日"];
  216. dayhtml.push('<div class="showdate fire borderbot"><span class="monthleft">&lt;</span><span class="currentdate">'+date.getFullYear()+'年'+(date.getMonth()+1)+'</span><span>月</span><span class="monthright">&gt;</span></div>')
  217. $.each(week,function(i,v){
  218. dayhtml.push('<div class="aweek">'+week[i]+'</div>')
  219. });
  220. var firstweek = date.getDay();
  221. console.log(date)
  222. var first = date.getDate();
  223. var allday = new Date(parseInt(year),(parseInt(month)+1),0).getDate();
  224. //console.log(allday)
  225. //console.log(parseInt(year)+","+(parseInt(month)+1))
  226. // console.log(new Date(year,month+1,0))
  227. for(var i = 0;i<firstweek-1;i++){
  228. dayhtml.push('<div class="aday"></div>')
  229. };
  230. if (month==tomonth){
  231. for(i=1;i<=allday;i++){
  232. if(i==today){
  233. if($(".timeinfo").hasClass("oneday")||$(".timeinfo").hasClass("twoday")){
  234. dayhtml.push('<div class="aday disday">今天</div>')
  235. }else if($(".timeinfo").hasClass("oneway")){
  236. if(todayhours<17){
  237. dayhtml.push('<div class="aday canday">今天</div>')
  238. }else{
  239. dayhtml.push('<div class="aday disday">今天</div>')
  240. }
  241. }else if($(".timeinfo").hasClass("lion")||$(".timeinfo").hasClass("disney")){
  242. alert(1)
  243. if((type_id==16)||(type_id==18)){
  244. if(todayhours<14){
  245. alert(2)
  246. dayhtml.push('<div class="aday canday">今天</div>')
  247. }else{
  248. alert(3)
  249. dayhtml.push('<div class="aday disday">今天</div>')
  250. }
  251. }else{
  252. if(todayhours>8&&todayhours<22){
  253. dayhtml.push('<div class="aday canday">今天</div>')
  254. }else{
  255. dayhtml.push('<div class="aday disday">今天</div>')
  256. }
  257. }
  258. }
  259. }else if(i==tomorrow){
  260. if($(".timeinfo").hasClass("oneday")||$(".timeinfo").hasClass("twoday")){
  261. if(todayhours<22){
  262. dayhtml.push('<div class="aday canday">'+i+'</div>')
  263. }else{
  264. dayhtml.push('<div class="aday disday">'+i+'</div>')
  265. }
  266. }else if($(".timeinfo").hasClass("oneway")){
  267. dayhtml.push('<div class="aday canday">'+i+'</div>')
  268. }else if($(".timeinfo").hasClass("lion")||$(".timeinfo").hasClass("disney")){
  269. if((type_id==16)||(type_id==18)){
  270. dayhtml.push('<div class="aday canday">'+i+'</div>')
  271. }else{
  272. if(todayhours>21){
  273. dayhtml.push('<div class="aday disday">'+i+'</div>')
  274. }else{
  275. dayhtml.push('<div class="aday canday">'+i+'</div>')
  276. }
  277. }
  278. }
  279. }else if(i<tomorrow){
  280. dayhtml.push('<div class="aday disday">'+i+'</div>')
  281. }else{
  282. dayhtml.push('<div class="aday canday">'+i+'</div>')
  283. }
  284. }
  285. }else if(month<tomonth){
  286. for(i=1;i<=allday;i++){
  287. dayhtml.push('<div class="aday disday">'+i+'</div>')
  288. }
  289. }else{
  290. for(i=1;i<=allday;i++){
  291. dayhtml.push('<div class="aday canday">'+i+'</div>')
  292. }
  293. }
  294. dom.html(dayhtml.join(""))
  295. $(".monthleft").unbind();
  296. $(".monthright").unbind();
  297. $(".monthleft").on("click",function(){
  298. var currentdate = $(".currentdate").html();
  299. currentdate = currentdate.split("年");
  300. addmouth($(".month"),currentdate[0],(currentdate[1]-2));
  301. $(".cartime").removeClass("sel")
  302. $(".aweekday").hide();
  303. disney()
  304. //console.log(new Date(currentdate[0],(currentdate[1]-2)))
  305. })
  306. $(".monthright").on("click",function(){
  307. var currentdate = $(".currentdate").html();
  308. currentdate = currentdate.split("年");
  309. //console.log(currentdate);
  310. addmouth($(".month"),currentdate[0],(currentdate[1]));
  311. $(".cartime li").removeClass("sel")
  312. $(".aweekday").hide();
  313. disney()
  314. //console.log(new Date(currentdate[0],(currentdate[1])))
  315. })
  316. }
  317. function disney(){
  318. //$(".canday").unbind();
  319. if($(".timeinfo").hasClass("disney")){
  320. $(".canday").on("click",function(){
  321. if($(this).html()=="今天"){
  322. var seldate = new Date().getDate();
  323. }else{
  324. var seldate =$(this).html();
  325. }
  326. var yearmonth = $(".currentdate").html().split("年")
  327. var thisdata = yearmonth[0]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
  328. var html = atimehtml4.replace(/mydata|star_time|time_val/g,function(match){
  329. switch(match){
  330. case "star_time":
  331. return "star_time";
  332. case "time_val":
  333. return thisdata;
  334. case "mydata":
  335. return thisdata;
  336. }
  337. })
  338. $(this).addClass("thisday");
  339. $(".sel_goback").html(html);
  340. $(".month").hide();
  341. $(".asell_list").show();
  342. })
  343. }
  344. else if($(".timeinfo").hasClass("oneday")){
  345. $(".canday").on("click",function(){
  346. $(".canday").removeClass("thisday");
  347. $(this).addClass("thisday");
  348. $(".timeinfo").find("li").removeClass("sel")
  349. atime = [];
  350. var thisdate = $(".currentdate").html().split("年");
  351. var thisday = $(this).html();
  352. console.log(thisday);
  353. if($(this).html()=="今天"){
  354. var selday = new Date().getDay();
  355. var seldate = new Date().getDate();
  356. }else{
  357. var seldate = $(this).html();
  358. var selday = new Date(parseInt(thisdate[0]),(parseInt(thisdate[1])-1),parseInt(thisday)).getDay();
  359. console.log(selday)
  360. }
  361. var index = null;
  362. if(selday==0){
  363. $(".aweekday").hide();
  364. $(".aweekday").eq(0).show();
  365. }
  366. else{
  367. $(".aweekday").hide();
  368. $(".aweekday").eq(selday).show();
  369. }
  370. $(".timeinfo").show();
  371. $(".timeinfo").find("li").unbind();
  372. $(".timeinfo").find("li").on("click",function(){
  373. atime = [];
  374. console.log(atime)
  375. if(!($(this).hasClass("disable"))){
  376. $(this).siblings("li").removeClass("sel");
  377. $(this).addClass("sel");
  378. $.each($(".timeinfo").find(".sel"),function(){
  379. atime.push($(this).children(".time").html());
  380. })
  381. if(atime.length==2){
  382. var yearmonth = $(".currentdate").html().split("年")
  383. var thisdata = yearmonth[0]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
  384. var html = atimehtml.replace(/mydata|mytime1|mytime2|star_time|time_val/g,function(match){
  385. switch(match){
  386. case "star_time":
  387. return "star_time";
  388. case "time_val":
  389. return thisdata+atime[0]+"-"+thisdata+atime[1];
  390. case "mydata":
  391. return thisdata;
  392. case "mytime1":
  393. return atime[0];
  394. case "mytime2":
  395. return atime[1];
  396. }
  397. })
  398. $(".cartime li").removeClass("sel")
  399. $(".sel_goback").html(html);
  400. $(".month").hide();
  401. $(".timeinfo").hide();
  402. $(".asell_list").show();
  403. }
  404. }
  405. })
  406. //判断车票开车4小时内不能买票
  407. if($(".thisday").html()=="今天"){
  408. var carTodayhours = new Date().getHours()+4;
  409. var carTodayMin = new Date().getMinutes();
  410. if(carTodayMin<10){
  411. carTodayMin="0"+carTodayMin;
  412. }else{
  413. carTodayMin=carTodayMin;
  414. }
  415. var NowTime = carTodayhours.toString()+carTodayMin.toString();
  416. var objGo = $("input[name=check_go_time]").val();
  417. var objBack = $("input[name=check_back_time]").val()
  418. var objGoArr = objGo.split(",");
  419. var objBackArr = objBack.split(",");
  420. for(var i=0;i<objGoArr.length;i++){
  421. if(Number(NowTime)>objGoArr[i]){
  422. $(".carticketGo"+i).unbind("click");//去掉事件
  423. $(".carticketGo"+i).css("background-color","#bbb");
  424. }
  425. }
  426. for(var i=0;i<objBackArr.length;i++){
  427. if(Number(NowTime)>objBackArr[i]){
  428. $(".carticketBack"+i).unbind("click");//去掉事件
  429. $(".carticketBack"+i).css("background-color","#bbb");
  430. }
  431. }
  432. }else{
  433. var objGo = $("input[name=check_go_time]").val();
  434. var objBack = $("input[name=check_back_time]").val()
  435. var objGoArr = objGo.split(",");
  436. var objBackArr = objBack.split(",");
  437. for(var i=0;i<objGoArr.length;i++){
  438. $(".carticketGo"+i).removeAttr("style");
  439. }
  440. for(var i=0;i<objBackArr.length;i++){
  441. $(".carticketBack"+i).removeAttr("style");
  442. }
  443. $(".timeinfo").find("li").on("click",function(){
  444. atime = [];
  445. console.log(atime)
  446. if(!($(this).hasClass("disable"))){
  447. $(this).siblings("li").removeClass("sel");
  448. $(this).addClass("sel");
  449. $.each($(".timeinfo").find(".sel"),function(){
  450. atime.push($(this).children(".time").html());
  451. })
  452. if(atime.length==2){
  453. var yearmonth = $(".currentdate").html().split("年")
  454. var thisdata = yearmonth[0]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
  455. var html = atimehtml.replace(/mydata|mytime1|mytime2|star_time|time_val/g,function(match){
  456. switch(match){
  457. case "star_time":
  458. return "star_time";
  459. case "time_val":
  460. return thisdata+atime[0]+"-"+thisdata+atime[1];
  461. case "mydata":
  462. return thisdata;
  463. case "mytime1":
  464. return atime[0];
  465. case "mytime2":
  466. return atime[1];
  467. }
  468. })
  469. $(".cartime li").removeClass("sel")
  470. $(".sel_goback").html(html);
  471. $(".month").hide();
  472. $(".timeinfo").hide();
  473. $(".asell_list").show();
  474. }
  475. }
  476. })
  477. }
  478. })
  479. }else if($(".timeinfo").hasClass("twoday")){
  480. addsel()
  481. }else if($(".timeinfo").hasClass("lion")){
  482. $(".canday").on("click",function(){
  483. $(".canday").removeClass("thisday");
  484. $(this).addClass("thisday");
  485. $(".timeinfo").find("li").removeClass("sel")
  486. atime = [];
  487. var thisdate = $(".currentdate").html().split("年");
  488. var thisday = $(this).html();
  489. console.log(thisday);
  490. if($(this).html()=="今天"){
  491. var selday = new Date().getDay();
  492. var seldate = new Date().getDate();
  493. }else{
  494. var seldate = $(this).html();
  495. var selday = new Date(parseInt(thisdate[0]),(parseInt(thisdate[1])-1),parseInt(thisday)).getDay();
  496. console.log(selday)
  497. }
  498. var index = null;
  499. if(selday==0){
  500. $(".aweekday").hide();
  501. $(".aweekday").eq(0).show();
  502. }
  503. else{
  504. $(".aweekday").hide();
  505. $(".aweekday").eq(selday).show();
  506. }
  507. $(".timeinfo").show();
  508. $(".timeinfo").find("li").unbind();
  509. $(".timeinfo").find("li").on("click",function(){
  510. atime = [];
  511. console.log(atime)
  512. if(!($(this).hasClass("disable"))){
  513. $(this).siblings("li").removeClass("sel");
  514. $(this).addClass("sel");
  515. $.each($(".timeinfo").find(".sel"),function(){
  516. atime.push($(this).children(".time").html());
  517. })
  518. if(atime.length==1){
  519. var yearmonth = $(".currentdate").html().split("年")
  520. var thisdata = yearmonth[0]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
  521. var html = atimehtml3.replace(/mydata|gotime|star_time|time_val/g,function(match){
  522. switch(match){
  523. case "star_time":
  524. return "star_time";
  525. case "time_val":
  526. return thisdata+atime[0];
  527. case "mydata":
  528. return thisdata;
  529. case "gotime":
  530. return atime[0];
  531. }
  532. })
  533. $(".cartime li").removeClass("sel")
  534. $(".sel_goback").html(html);
  535. $(".month").hide();
  536. $(".timeinfo").hide();
  537. $(".asell_list").show();
  538. }
  539. }
  540. })
  541. //判断狮子王演出半小时内不能买票
  542. if($(".thisday").html()=="今天"){
  543. var NowTime;
  544. var carTodayhours = new Date().getHours();
  545. var carTodayMin = new Date().getMinutes()+30;
  546. if(carTodayMin<10){
  547. carTodayMin="0"+carTodayMin;
  548. NowTime = carTodayhours.toString()+carTodayMin.toString();
  549. }else if(carTodayMin>60){
  550. carTodayMin = carTodayMin%60;
  551. if(carTodayMin<11){
  552. NowTime = (carTodayhours+1).toString()+("0"+carTodayMin).toString();
  553. }else{
  554. NowTime = (carTodayhours+1).toString()+carTodayMin.toString();
  555. }
  556. }else{
  557. NowTime = carTodayhours.toString()+carTodayMin.toString();
  558. }
  559. var objGo = $("input[name=check_go_time]").val();
  560. var objGoArr = objGo.split(",");
  561. for(var i=0;i<objGoArr.length;i++){
  562. if(Number(NowTime)>objGoArr[i]){
  563. $(".carticketGo"+i).unbind("click");//去掉事件
  564. $(".carticketGo"+i).css("background-color","#bbb");
  565. }
  566. }
  567. }else{
  568. var objGo = $("input[name=check_go_time]").val();
  569. var objGoArr = objGo.split(",");
  570. for(var i=0;i<objGoArr.length;i++){
  571. $(".carticketGo"+i).removeAttr("style");
  572. }
  573. $(".timeinfo").find("li").on("click",function(){
  574. atime = [];
  575. console.log(atime)
  576. if(!($(this).hasClass("disable"))){
  577. $(this).siblings("li").removeClass("sel");
  578. $(this).addClass("sel");
  579. $.each($(".timeinfo").find(".sel"),function(){
  580. atime.push($(this).children(".time").html());
  581. })
  582. if(atime.length==1){
  583. var yearmonth = $(".currentdate").html().split("年")
  584. var thisdata = yearmonth[0]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
  585. var html = atimehtml3.replace(/mydata|gotime|star_time|time_val/g,function(match){
  586. switch(match){
  587. case "star_time":
  588. return "star_time";
  589. case "time_val":
  590. return thisdata+atime[0];
  591. case "mydata":
  592. return thisdata;
  593. case "gotime":
  594. return atime[0];
  595. }
  596. })
  597. $(".cartime li").removeClass("sel")
  598. $(".sel_goback").html(html);
  599. $(".month").hide();
  600. $(".timeinfo").hide();
  601. $(".asell_list").show();
  602. }
  603. }
  604. })
  605. }
  606. })
  607. }else if($(".timeinfo").hasClass("oneway")){
  608. $(".canday").on("click",function(){
  609. $(".canday").removeClass("thisday");
  610. $(this).addClass("thisday");
  611. $(".timeinfo").find("li").removeClass("sel")
  612. atime = [];
  613. var thisdate = $(".currentdate").html().split("年");
  614. var thisday = $(this).html();
  615. console.log(thisday);
  616. if($(this).html()=="今天"){
  617. var selday = new Date().getDay();
  618. var seldate = new Date().getDate();
  619. }else{
  620. var seldate = $(this).html();
  621. var selday = new Date(parseInt(thisdate[0]),(parseInt(thisdate[1])-1),parseInt(thisday)).getDay();
  622. console.log(selday)
  623. }
  624. var index = null;
  625. if(selday==0){
  626. $(".aweekday").hide();
  627. $(".aweekday").eq(0).show();
  628. }
  629. else{
  630. $(".aweekday").hide();
  631. $(".aweekday").eq(selday).show();
  632. }
  633. $(".timeinfo").show();
  634. $(".timeinfo").find("li").unbind();
  635. $(".timeinfo").find("li").on("click",function(){
  636. atime = [];
  637. console.log(atime)
  638. if(!($(this).hasClass("disable"))){
  639. $(this).siblings("li").removeClass("sel");
  640. $(this).addClass("sel");
  641. $.each($(".timeinfo").find(".sel"),function(){
  642. atime.push($(this).children(".time").html());
  643. })
  644. if(atime.length==1){
  645. var yearmonth = $(".currentdate").html().split("年")
  646. var thisdata = yearmonth[0]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
  647. var html = atimehtml3.replace(/mydata|gotime|star_time|time_val/g,function(match){
  648. switch(match){
  649. case "star_time":
  650. return "star_time";
  651. case "time_val":
  652. return thisdata+atime[0];
  653. case "mydata":
  654. return thisdata;
  655. case "gotime":
  656. return atime[0];
  657. }
  658. })
  659. $(".cartime li").removeClass("sel")
  660. $(".sel_goback").html(html);
  661. $(".month").hide();
  662. $(".timeinfo").hide();
  663. $(".asell_list").show();
  664. }
  665. }
  666. })
  667. //判断车票开车4小时内不能买票
  668. if($(".thisday").html()=="今天"){
  669. var carTodayhours = new Date().getHours()+4;
  670. var carTodayMin = new Date().getMinutes();
  671. if(carTodayMin<10){
  672. carTodayMin="0"+carTodayMin;
  673. }else{
  674. carTodayMin=carTodayMin;
  675. }
  676. var NowTime = carTodayhours.toString()+carTodayMin.toString();
  677. var objGo = $("input[name=check_go_time]").val();
  678. var objBack = $("input[name=check_back_time]").val()
  679. var objGoArr = objGo.split(",");
  680. var objBackArr = objBack.split(",");
  681. for(var i=0;i<objGoArr.length;i++){
  682. if(Number(NowTime)>objGoArr[i]){
  683. $(".carticketGo"+i).unbind("click");//去掉事件
  684. $(".carticketGo"+i).css("background-color","#bbb");
  685. }
  686. }
  687. for(var i=0;i<objBackArr.length;i++){
  688. if(Number(NowTime)>objBackArr[i]){
  689. $(".carticketBack"+i).unbind("click");//去掉事件
  690. $(".carticketBack"+i).css("background-color","#bbb");
  691. }
  692. }
  693. }else{
  694. var objGo = $("input[name=check_go_time]").val();
  695. var objBack = $("input[name=check_back_time]").val()
  696. var objGoArr = objGo.split(",");
  697. var objBackArr = objBack.split(",");
  698. for(var i=0;i<objGoArr.length;i++){
  699. $(".carticketGo"+i).removeAttr("style");
  700. }
  701. for(var i=0;i<objBackArr.length;i++){
  702. $(".carticketBack"+i).removeAttr("style");
  703. }
  704. $(".timeinfo").find("li").on("click",function(){
  705. atime = [];
  706. console.log(atime)
  707. if(!($(this).hasClass("disable"))){
  708. $(this).siblings("li").removeClass("sel");
  709. $(this).addClass("sel");
  710. $.each($(".timeinfo").find(".sel"),function(){
  711. atime.push($(this).children(".time").html());
  712. })
  713. if(atime.length==1){
  714. var yearmonth = $(".currentdate").html().split("年")
  715. var thisdata = yearmonth[0]+"年"+addzero(yearmonth[1])+"月"+addzero(seldate)+"日";
  716. var html = atimehtml3.replace(/mydata|gotime|star_time|time_val/g,function(match){
  717. switch(match){
  718. case "star_time":
  719. return "star_time";
  720. case "time_val":
  721. return thisdata+atime[0];
  722. case "mydata":
  723. return thisdata;
  724. case "gotime":
  725. return atime[0];
  726. }
  727. })
  728. $(".cartime li").removeClass("sel")
  729. $(".sel_goback").html(html);
  730. $(".month").hide();
  731. $(".timeinfo").hide();
  732. $(".asell_list").show();
  733. }
  734. }
  735. })
  736. }
  737. })
  738. }
  739. }
  740. var dayinfo=[];
  741. var week1= {};
  742. var week2= {};
  743. function addsel(){
  744. $(".canday").unbind();
  745. var mymonth = $(".currentdate").html().split("年");
  746. var allday = new Date(mymonth[0],(parseInt(mymonth[1])),0).getDate();
  747. var twoday = [];
  748. $(".canday").on("click",function(){
  749. //$(this).html()==new Date(mymonth[0],(parseInt(mymonth[1]))).getDate()||($(this).html()=="今天"&&new Date().getDate()==new Date(mymonth[0],(parseInt(mymonth[1]))).getDate())
  750. 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()))){
  751. console.log(12)
  752. var aweek = 2 ;
  753. var thisdate = $(".currentdate").html().split("年");
  754. var thisday = $(this).html();
  755. $(this).addClass("thisday");
  756. $(this).removeClass("placesel");
  757. }else if($(this).hasClass("placesel")){
  758. var thisdate = $(".currentdate").html().split("年");
  759. var thisday = $(this).html();
  760. $(this).addClass("thisday");
  761. $(this).removeClass("placesel");
  762. var aweek = 2;
  763. }else{
  764. var aweek = 1 ;
  765. $(".canday").removeClass("thisday");
  766. $(".canday").removeClass("placesel");
  767. var thisdate = $(".currentdate").html().split("年");
  768. var thisday = $(this).html();
  769. if(thisday=="今天"){
  770. thisday=new Date().getDate();
  771. }
  772. $(this).next().addClass("placesel");
  773. $(this).addClass("thisday");
  774. $(".timeinfo").find("li").removeClass("sel");
  775. week1= {};
  776. week2= {};
  777. };
  778. if($(this).html()==allday||($(this).html()=="今天"&&new Date().getDate()==allday)){
  779. week1= {};
  780. week2= {};
  781. var thisdate = $(".currentdate").html().split("年");
  782. var thisday = allday;
  783. //addmouth($(".month"),mymonth[0],mymonth[1]);
  784. //$(".canday:eq(0)").addClass("placesel");
  785. //addsel()
  786. }
  787. console.log(thisday)
  788. if($(this).html()=="今天"){
  789. var selday = new Date().getDay();
  790. var seldate = new Date().getDate();
  791. console.log(seldate)
  792. }else{
  793. var seldate = $(this).html();
  794. //console.log(seldate)
  795. var selday = new Date(parseInt(thisdate[0]),(parseInt(thisdate[1])-1),parseInt(thisday)).getDay();
  796. };
  797. //console.log(seldate)
  798. if(selday==0){
  799. $(".aweekday").hide();
  800. $(".aweekday").eq(0).show();
  801. }else{
  802. $(".aweekday").hide();
  803. $(".aweekday").eq(selday).show();
  804. };
  805. $(".timeinfo").show();
  806. $(".timeinfo").find("li").unbind();
  807. $(".timeinfo").find("li").on("click",function(){
  808. $(this).parent().find("li").removeClass("sel");
  809. $(this).addClass("sel");
  810. var time = $(this).children(".time").html();
  811. dayinfo=[];
  812. Array.prototype.push.apply(dayinfo,thisdate);
  813. //console.log(selday+","+time)
  814. dayinfo.push(seldate);
  815. dayinfo.push(time);
  816. if($(this).parent().hasClass("go")){
  817. var goback="go";
  818. }else{
  819. var goback="back";
  820. };
  821. if(judge(aweek,dayinfo,goback)){
  822. if(typeof week1.back=="undefined"){
  823. var yearmonth = $(".currentdate").html().split("年");
  824. var thisdata = yearmonth[0]+"年"+addzero(yearmonth[1])+"月"+addzero($(".thisday").html())+"日";
  825. var html = [];
  826. var ahtml = atimehtml2.replace(/mydata|gotime|star_time|time_val/g,function(match){
  827. switch(match){
  828. case "star_time":
  829. return "star_time";
  830. case "time_val":
  831. return week1.go[0]+"年"+ addzero(week1.go[1])+"月"+ addzero(week1.go[2])+"日"+week1.go[3];
  832. case "mydata":
  833. return week1.go[0]+"年"+ addzero(week1.go[1])+"月"+ addzero(week1.go[2]);
  834. case "gotime":
  835. return week1.go[3];
  836. }
  837. });
  838. html.push(ahtml);
  839. ahtml = atimehtml3.replace(/mydata|gotime|star_time|time_val/g,function(match){
  840. switch(match){
  841. case "star_time":
  842. return "end_time";
  843. case "time_val":
  844. return week2.back[0]+"年"+ addzero(week2.back[1])+"月"+ addzero(week2.back[2])+"日"+week2.back[3];
  845. case "mydata":
  846. return week2.back[0]+"年"+ addzero(week2.back[1])+"月"+ addzero(week2.back[2]);
  847. case "gotime":
  848. return week2.back[3];
  849. }
  850. });
  851. //$(".aaaa").val(thisdata);
  852. //console.log($(".aaaa").val());
  853. html.push(ahtml);
  854. $(".cartime li").removeClass("sel");
  855. $(".sel_goback").html(html);
  856. $(".month").hide();
  857. $(".timeinfo").hide();
  858. $(".asell_list").show();
  859. }else{
  860. var yearmonth = $(".currentdate").html().split("年");
  861. var thisdata = yearmonth[0]+"年"+addzero(yearmonth[1])+"月"+addzero($(".thisday").html())+"日";
  862. var html = [];
  863. //<input type="text" value="time_val" name="star_time">
  864. var ahtml = atimehtml.replace(/mydata|mytime1|mytime2|time_val|star_time/g,function(match){
  865. switch(match){
  866. case "star_time":
  867. return "star_time";
  868. case "time_val":
  869. 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];
  870. case "mydata":
  871. return week1.go[0]+"年"+ addzero(week1.go[1])+"月"+ addzero(week1.go[2])+"日";
  872. case "mytime1":
  873. return week1.go[3];
  874. case "mytime2":
  875. return week1.back[3]
  876. }
  877. });
  878. // console.log(week1.go[0]+"."+ week1.go[1]+"."+ week1.go[2]);
  879. // console.log(".aaaa");
  880. // $(".aaaa").val(week1.go[0]+"."+ week1.go[1]+"."+ week1.go[2]);
  881. //console.log($(".aaaa").val());
  882. // console.log($(".aaaa"));
  883. html.push(ahtml);
  884. var ahtml = atimehtml.replace(/mydata|mytime1|mytime2|time_val|star_time/g,function(match){
  885. switch(match){
  886. case "star_time":
  887. return "end_time";
  888. case "time_val":
  889. 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];
  890. case "time_val":
  891. return week2.go[0]+"年"+ addzero(week2.go[1])+"月"+ addzero(week2.go[2])+"日"+week2.back[3];
  892. case "mydata":
  893. return week2.go[0]+"年"+ addzero(week2.go[1])+"月"+ addzero(week2.go[2])+"日";
  894. case "mytime1":
  895. return week2.go[3];
  896. case "mytime2":
  897. return week2.back[3]
  898. }
  899. });
  900. html.push(ahtml);
  901. // console.log($(".aaaa").val());
  902. $(".cartime li").removeClass("sel");
  903. $(".sel_goback").html(html);
  904. //console.log($(".aaaa").val())
  905. $(".month").hide();
  906. $(".timeinfo").hide();
  907. $(".asell_list").show();
  908. week1={};
  909. week2={};
  910. }
  911. }
  912. })
  913. })
  914. }
  915. function judge(week,time,goback){
  916. console.log(goback);
  917. if(week==1){
  918. week1[goback]=time;
  919. }else{
  920. week2[goback]=time;
  921. };
  922. console.log(week1)
  923. console.log(week2)
  924. if(typeof week1.go!="undefined"&&typeof week2.back!="undefined"){
  925. return true
  926. }
  927. }
  928. function disney2(){
  929. }
  930. function leftright(){
  931. }
  932. //得到url上的参数,并反映线路名称
  933. function getPar(par){
  934. var local_url = document.location.href;
  935. local_url = decodeURI(local_url);
  936. var get = local_url.indexOf(par +"=");
  937. if(get == -1){
  938. return false;
  939. }
  940. var get_par = local_url.slice(par.length + get + 1);
  941. var nextPar = get_par.indexOf("&");
  942. if(nextPar != -1){
  943. get_par = get_par.slice(0, nextPar);
  944. }
  945. return get_par;
  946. }
  947. var type_id = getPar("id");
  948. function addzero(num){
  949. if(num.length<2){
  950. return "0"+num;
  951. }else{
  952. return num;
  953. }
  954. }
  955. jQuery.fn.outerHTML = function(s) {
  956. return (s) ? this.before(s).remove() : $("<Hill_man>").append(this.eq(0).clone()).html();
  957. }