Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

516 lignes
13 KiB

  1. $(document).ready(function(){
  2. // $(".packagelist").on("touchstart",function(){
  3. // var index = $(this).index();
  4. // $(".packagelist").removeClass("on");
  5. // $(this).addClass("on");
  6. // $(".disneylistgrid").hide();
  7. // $(".disneylistgrid").eq(index).fadeIn();
  8. // })
  9. var tomonth = new Date();
  10. atimehtml = $(".atime").outerHTML();
  11. $(".atime").remove();
  12. atimehtml2 = $(".atime2").outerHTML();
  13. $(".atime2").remove();
  14. atimehtml3 = $(".atime3").outerHTML();
  15. $(".atime3").remove();
  16. console.log(atimehtml)
  17. var timeinfo = $(".timeinfo").outerHTML();
  18. //addmouth($(".month"),tomonth.getFullYear(),13);
  19. $(".sel_goback").on("click",function(){
  20. addmouth($(".month"),tomonth.getFullYear(),tomonth.getMonth());
  21. $(".month").show();
  22. $(".asell_list").hide();
  23. disney()
  24. });
  25. $(".add").on("click",function(){
  26. console.log(1)
  27. var num = parseInt($(this).siblings("input").val());
  28. $(this).siblings("input").val(++num);
  29. //var price = parseInt($(this).parent().siblings(".ticket_price").html().replace("¥",""))*num
  30. var allprice = 0;
  31. for(var i = 0 ;i<$(".aticket").length;i++){
  32. var thisone = $(".aticket").eq(i).val();
  33. var price = parseInt($(".aticket").eq(i).parent().siblings(".ticket_price").html().replace("¥",""))
  34. var aprice = thisone*price;
  35. allprice+=aprice
  36. }
  37. $(".buyprice").html("¥"+allprice)
  38. })
  39. $(".cut").on("click",function(){
  40. var num = parseInt($(this).siblings("input").val());
  41. if(num==0){
  42. }else{
  43. $(this).siblings("input").val(--num);
  44. var allprice = 0;
  45. for(var i = 0 ;i<$(".aticket").length;i++){
  46. var thisone = $(".aticket").eq(i).val();
  47. var price = parseInt($(".aticket").eq(i).parent().siblings(".ticket_price").html().replace("¥",""))
  48. var aprice = thisone*price;
  49. allprice+=aprice
  50. }
  51. $(".buyprice").html("¥"+allprice)
  52. }
  53. })
  54. $(".aticket").on("change",function(){
  55. $(".buyprice").html();
  56. var price = parseInt($(this).parent().siblings(".ticket_price").html().replace("¥",""))*$(this).val();
  57. })
  58. var doubletime = [];
  59. var atime = [];
  60. });
  61. function addmouth(dom,year,month){
  62. //console.log(atimehtml)
  63. !dom.hasClass("amonth")&&dom.addClass("amonth");
  64. var date = new Date(year,month);
  65. var tomonth = new Date().getMonth();
  66. var today = new Date().getDate();
  67. var dayhtml = [];
  68. var week = ["一","二","三","四","五","六","日"];
  69. dayhtml.push('<div class="showdate"><span class="monthleft">&lt;</span><span class="currentdate">'+date.getFullYear()+'年'+(date.getMonth()+1)+'</span><span>月</span><span class="monthright">&gt;</span></div>')
  70. $.each(week,function(i,v){
  71. dayhtml.push('<div class="aweek">'+week[i]+'</div>')
  72. });
  73. var firstweek = date.getDay();
  74. console.log(date)
  75. var first = date.getDate();
  76. var allday = new Date(parseInt(year),(parseInt(month)+1),0).getDate();
  77. //console.log(allday)
  78. //console.log(parseInt(year)+","+(parseInt(month)+1))
  79. // console.log(new Date(year,month+1,0))
  80. for(var i = 0;i<firstweek-1;i++){
  81. dayhtml.push('<div class="aday"></div>')
  82. };
  83. if (month==tomonth){
  84. for(i=1;i<=allday;i++){
  85. if(i==today){
  86. dayhtml.push('<div class="aday canday">今天</div>')
  87. }
  88. else if(i<today){
  89. dayhtml.push('<div class="aday disday">'+i+'</div>')
  90. }else{
  91. dayhtml.push('<div class="aday canday">'+i+'</div>')
  92. }
  93. }
  94. }else if(month<tomonth){
  95. for(i=1;i<=allday;i++){
  96. dayhtml.push('<div class="aday disday">'+i+'</div>')
  97. }
  98. }else{
  99. for(i=1;i<=allday;i++){
  100. dayhtml.push('<div class="aday canday">'+i+'</div>')
  101. }
  102. }
  103. dom.html(dayhtml.join(""))
  104. $(".monthleft").unbind();
  105. $(".monthright").unbind();
  106. $(".monthleft").on("click",function(){
  107. var currentdate = $(".currentdate").html();
  108. currentdate = currentdate.split("年");
  109. addmouth($(".month"),currentdate[0],(currentdate[1]-2));
  110. $(".cartime").removeClass("sel")
  111. $(".aweekday").hide();
  112. disney()
  113. //console.log(new Date(currentdate[0],(currentdate[1]-2)))
  114. })
  115. $(".monthright").on("click",function(){
  116. var currentdate = $(".currentdate").html();
  117. currentdate = currentdate.split("年");
  118. //console.log(currentdate);
  119. addmouth($(".month"),currentdate[0],(currentdate[1]));
  120. $(".cartime li").removeClass("sel")
  121. $(".aweekday").hide();
  122. disney()
  123. //console.log(new Date(currentdate[0],(currentdate[1])))
  124. })
  125. }
  126. function disney(){
  127. $(".canday").unbind();
  128. if($(".timeinfo").hasClass("oneday")){
  129. $(".canday").on("click",function(){
  130. $(".canday").removeClass("thisday");
  131. $(this).addClass("thisday");
  132. $(".timeinfo").find("li").removeClass("sel")
  133. atime = [];
  134. var thisdate = $(".currentdate").html().split("年");
  135. var thisday = $(this).html();
  136. console.log(thisday);
  137. if($(this).html()=="今天"){
  138. var selday = new Date().getDay();
  139. var seldate = new Date().getDate();
  140. }else{
  141. var seldate = $(this).html();
  142. var selday = new Date(parseInt(thisdate[0]),(parseInt(thisdate[1])-1),parseInt(thisday)).getDay();
  143. console.log(selday)
  144. }
  145. var index = null;
  146. if(selday==0){
  147. $(".aweekday").hide();
  148. $(".aweekday").eq(0).show();
  149. }
  150. else{
  151. $(".aweekday").hide();
  152. $(".aweekday").eq(selday).show();
  153. }
  154. $(".timeinfo").show();
  155. $(".timeinfo").find("li").unbind();
  156. $(".timeinfo").find("li").on("click",function(){
  157. atime = [];
  158. console.log(atime)
  159. if(!($(this).hasClass("disable"))){
  160. $(this).siblings("li").removeClass("sel");
  161. $(this).addClass("sel");
  162. $.each($(".timeinfo").find(".sel"),function(){
  163. atime.push($(this).children(".time").html());
  164. })
  165. if(atime.length==2){
  166. var yearmonth = $(".currentdate").html().split("年")
  167. var thisdata = yearmonth[0]+"."+yearmonth[1]+"."+seldate;
  168. var html = atimehtml.replace(/mydata|mytime1|mytime2/g,function(match){
  169. switch(match){
  170. case "mydata":
  171. return thisdata;
  172. case "mytime1":
  173. return atime[0];
  174. case "mytime2":
  175. return atime[1];
  176. }
  177. })
  178. $(".cartime li").removeClass("sel")
  179. $(".sel_goback").html(html);
  180. $(".month").hide();
  181. $(".timeinfo").hide();
  182. $(".asell_list").show();
  183. }
  184. }
  185. })
  186. })
  187. }else if($(".timeinfo").hasClass("twoday")){
  188. addsel()
  189. }else if($(".timeinfo").hasClass("lion")){
  190. $(".canday").on("click",function(){
  191. $(".canday").removeClass("thisday");
  192. $(this).addClass("thisday");
  193. $(".timeinfo").find("li").removeClass("sel")
  194. atime = [];
  195. var thisdate = $(".currentdate").html().split("年");
  196. var thisday = $(this).html();
  197. console.log(thisday);
  198. if($(this).html()=="今天"){
  199. var selday = new Date().getDay();
  200. var seldate = new Date().getDate();
  201. }else{
  202. var seldate = $(this).html();
  203. var selday = new Date(parseInt(thisdate[0]),(parseInt(thisdate[1])-1),parseInt(thisday)).getDay();
  204. console.log(selday)
  205. }
  206. var index = null;
  207. if(selday==0){
  208. $(".aweekday").hide();
  209. $(".aweekday").eq(0).show();
  210. }
  211. else{
  212. $(".aweekday").hide();
  213. $(".aweekday").eq(selday).show();
  214. }
  215. $(".timeinfo").show();
  216. $(".timeinfo").find("li").unbind();
  217. $(".timeinfo").find("li").on("click",function(){
  218. atime = [];
  219. console.log(atime)
  220. if(!($(this).hasClass("disable"))){
  221. $(this).siblings("li").removeClass("sel");
  222. $(this).addClass("sel");
  223. $.each($(".timeinfo").find(".sel"),function(){
  224. atime.push($(this).children(".time").html());
  225. })
  226. if(atime.length==1){
  227. var yearmonth = $(".currentdate").html().split("年")
  228. var thisdata = yearmonth[0]+"."+yearmonth[1]+"."+seldate;
  229. var html = atimehtml3.replace(/mydata|gotime/g,function(match){
  230. switch(match){
  231. case "mydata":
  232. return thisdata;
  233. case "gotime":
  234. return atime[0];
  235. }
  236. })
  237. $(".cartime li").removeClass("sel")
  238. $(".sel_goback").html(html);
  239. $(".month").hide();
  240. $(".timeinfo").hide();
  241. $(".asell_list").show();
  242. }
  243. }
  244. })
  245. })
  246. }
  247. }
  248. var dayinfo=[];
  249. var week1= {};
  250. var week2= {};
  251. function addsel(){
  252. $(".canday").unbind();
  253. var mymonth = $(".currentdate").html().split("年");
  254. var allday = new Date(mymonth[0],(parseInt(mymonth[1])),0).getDate();
  255. var twoday = [];
  256. $(".canday").on("click",function(){
  257. //$(this).html()==new Date(mymonth[0],(parseInt(mymonth[1]))).getDate()||($(this).html()=="今天"&&new Date().getDate()==new Date(mymonth[0],(parseInt(mymonth[1]))).getDate())
  258. 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()))){
  259. console.log(12)
  260. var aweek = 2 ;
  261. var thisdate = $(".currentdate").html().split("年");
  262. var thisday = $(this).html();
  263. $(this).addClass("thisday");
  264. $(this).removeClass("placesel");
  265. }else if($(this).hasClass("placesel")){
  266. var thisdate = $(".currentdate").html().split("年");
  267. var thisday = $(this).html();
  268. $(this).addClass("thisday");
  269. $(this).removeClass("placesel");
  270. var aweek = 2;
  271. }else{
  272. var aweek = 1 ;
  273. $(".canday").removeClass("thisday");
  274. $(".canday").removeClass("placesel");
  275. var thisdate = $(".currentdate").html().split("年");
  276. var thisday = $(this).html();
  277. if(thisday=="今天"){
  278. thisday=new Date().getDate();
  279. }
  280. $(this).next().addClass("placesel");
  281. $(this).addClass("thisday");
  282. $(".timeinfo").find("li").removeClass("sel");
  283. week1= {};
  284. week2= {};
  285. };
  286. if($(this).html()==allday||($(this).html()=="今天"&&new Date().getDate()==allday)){
  287. week1= {};
  288. week2= {};
  289. var thisdate = $(".currentdate").html().split("年");
  290. var thisday = allday;
  291. //addmouth($(".month"),mymonth[0],mymonth[1]);
  292. //$(".canday:eq(0)").addClass("placesel");
  293. //addsel()
  294. }
  295. console.log(thisday)
  296. if($(this).html()=="今天"){
  297. var selday = new Date().getDay();
  298. var seldate = new Date().getDate();
  299. console.log(seldate)
  300. }else{
  301. var seldate = $(this).html();
  302. //console.log(seldate)
  303. var selday = new Date(parseInt(thisdate[0]),(parseInt(thisdate[1])-1),parseInt(thisday)).getDay();
  304. };
  305. //console.log(seldate)
  306. if(selday==0){
  307. $(".aweekday").hide();
  308. $(".aweekday").eq(0).show();
  309. }else{
  310. $(".aweekday").hide();
  311. $(".aweekday").eq(selday).show();
  312. };
  313. $(".timeinfo").show();
  314. $(".timeinfo").find("li").unbind();
  315. $(".timeinfo").find("li").on("click",function(){
  316. $(this).parent().find("li").removeClass("sel");
  317. $(this).addClass("sel");
  318. var time = $(this).children(".time").html();
  319. dayinfo=[];
  320. Array.prototype.push.apply(dayinfo,thisdate);
  321. //console.log(selday+","+time)
  322. dayinfo.push(seldate);
  323. dayinfo.push(time);
  324. if($(this).parent().hasClass("go")){
  325. var goback="go";
  326. }else{
  327. var goback="back";
  328. };
  329. if(judge(aweek,dayinfo,goback)){
  330. if(typeof week1.back=="undefined"){
  331. var yearmonth = $(".currentdate").html().split("年");
  332. var thisdata = yearmonth[0]+"."+yearmonth[1]+"."+$(".thisday").html();
  333. var html = [];
  334. var ahtml = atimehtml2.replace(/mydata|gotime/g,function(match){
  335. switch(match){
  336. case "mydata":
  337. return week1.go[0]+"."+ week1.go[1]+"."+ week1.go[2];
  338. case "gotime":
  339. return week1.go[3];
  340. }
  341. });
  342. html.push(ahtml);
  343. ahtml = atimehtml3.replace(/mydata|gotime/g,function(match){
  344. switch(match){
  345. case "mydata":
  346. return week2.back[0]+"."+ week2.back[1]+"."+ week2.back[2];
  347. case "gotime":
  348. return week2.back[3];
  349. }
  350. });
  351. html.push(ahtml);
  352. $(".cartime li").removeClass("sel");
  353. $(".sel_goback").html(html);
  354. $(".month").hide();
  355. $(".timeinfo").hide();
  356. $(".asell_list").show();
  357. }else{
  358. var yearmonth = $(".currentdate").html().split("年");
  359. var thisdata = yearmonth[0]+"."+yearmonth[1]+"."+$(".thisday").html();
  360. var html = [];
  361. var ahtml = atimehtml.replace(/mydata|mytime1|mytime2/g,function(match){
  362. switch(match){
  363. case "mydata":
  364. return week1.go[0]+"."+ week1.go[1]+"."+ week1.go[2];
  365. case "mytime1":
  366. return week1.go[3];
  367. case "mytime2":
  368. return week1.back[3]
  369. }
  370. });
  371. html.push(ahtml);
  372. var ahtml = atimehtml.replace(/mydata|mytime1|mytime2/g,function(match){
  373. switch(match){
  374. case "mydata":
  375. return week2.go[0]+"."+ week2.go[1]+"."+ week2.go[2];
  376. case "mytime1":
  377. return week2.go[3];
  378. case "mytime2":
  379. return week2.back[3]
  380. }
  381. });
  382. html.push(ahtml);
  383. $(".cartime li").removeClass("sel");
  384. $(".sel_goback").html(html);
  385. $(".month").hide();
  386. $(".timeinfo").hide();
  387. $(".asell_list").show();
  388. week1={};
  389. week2={};
  390. }
  391. }
  392. })
  393. })
  394. }
  395. function judge(week,time,goback){
  396. console.log(goback);
  397. if(week==1){
  398. week1[goback]=time;
  399. }else{
  400. week2[goback]=time;
  401. };
  402. console.log(week1)
  403. console.log(week2)
  404. if(typeof week1.go!="undefined"&&typeof week2.back!="undefined"){
  405. return true
  406. }
  407. }
  408. function disney2(){
  409. }
  410. function leftright(){
  411. }
  412. jQuery.fn.outerHTML = function(s) {
  413. return (s) ? this.before(s).remove() : $("<Hill_man>").append(this.eq(0).clone()).html();
  414. }
  415. // onClick="showIframe('http://yii2.com/hotel/report/purchase',460,280)"
  416. function showIframe(url){
  417. //添加iframe
  418. $("title").html('酒店业务统计');
  419. var if_w = $(window).width() - $('.control-bar').width();
  420. var if_h = $(window).height();
  421. //allowTransparency='true' 设置背景透明
  422. $('.control-show').empty();
  423. $("<iframe width='" + 1433 + "' height='" + if_h + "' id='YuFrame1' name='YuFrame1' style='position:absolute;z-index:4;' frameborder='no' marginheight='0' marginwidth='0' allowTransparency='true'></iframe>").prependTo('.control-show');
  424. $(".navbar").width(1626);
  425. $("#YuFrame1").attr("src", url)
  426. }