|
-
- $("#loading_html").show();
- //当前时间
- var tmonth = new Date();
-
- var year = tmonth.getFullYear();
-
- var month = tmonth.getMonth();
-
- var dom = $('.month');
- //中间变量 记录
- var tttmonth = '';
-
-
- var tyear = '';
-
- window.onload = function() {
- !dom.hasClass("amonth") && dom.addClass("amonth");
- //当前日期
- var date1 = new Date(year, month);
- //当前月份
- var tomonth = new Date().getMonth();
- //
- var today = new Date().getDate();
- var dayhtml = [];
- var week = ["日", "一", "二", "三", "四", "五", "六"];
-
- for(var t = 1; t <= 3; t++) {
- dayhtml.push('<div style="clear:both">');
-
- var date = date1;
- month = date.getMonth() + t - 1;
-
- if(month >= 11) {
- tyear = year + 1;
- tttmonth = month - 12;
-
- // month = 0;
- } else {
- tyear = year;
- tttmonth = month;
- }
- if(tttmonth == -1) {
- tttmonth = 11;
- tyear = year;
- }
- dayhtml.push('<div class="month_title"><span class="current_month">' + (tttmonth + 1) + '月' + '</span><span class="current_year">' + tyear + '</span></div>')
-
- // dayhtml.push();
- // $.each(week,function(i,v){
- // dayhtml.push('<div class="aweek" style="float:left">'+week[i]+'</div>')
- // });
-
- var str = '';
-
- $.each(week, function(i, v) {
- str += '<div style="padding-top: 0.08rem;" class="aweek ub-f1 text_middle ui_p_b15">' + week[i] + '</div>';
- });
- dayhtml.push('<div class="ub" style="margin-left:0.2rem;margin-right:0.2rem;">' + str + '</div>')
-
- var nextdate = new Date(year, month)
- var firstweek = nextdate.getDay();
- // var firstweek = month.getDay();
- // var first = month.getDay();
-
- var allday = new Date(parseInt(year), (parseInt(month) + 1), 0).getDate();
-
- var daystr = '<div style="margin-left:0.2rem;margin-right:0.2rem;">';
-
- for(var i = 0; i < firstweek; i++) {
- daystr += '<div class="aday"></div>'
- };
- var data_cur_str = ''; //日期str
- var data_cur = ''; //日期-
- // 得到去程日期
- var go_run_date = getPar('go_date');
- // var date1 = new Date(go_run_date.replace(/\-/g, '/'));
- // // 判断日期是否合理
- // var date1 = new Date(start_date.replace(/\-/g, '/'));
- // var date2 = new Date(end_date.replace(/\-/g, '/'));
- // if (date1>date2 || end_date=="") {
- // $('#id-date-picker-2').val(start_date);
- // }
- if(month == tomonth) {
- for(i = 1; i <= allday; i++) {
- var t_m = (tttmonth + 1);
- var t_m_str = t_m;
- var t_d_str = i;
- if(t_m <= 9) {
- t_m_str = "0" + t_m;
- }
- if(i <= 9) {
- t_d_str = "0" + i;
- }
- data_cur_str = t_m_str + "月" + t_d_str + '日';
- data_cur = tyear + "-" + (Array(2).join(0) + (tttmonth + 1)).slice(-2) + "-" + (Array(2).join(0) + i).slice(-2);
- var run_day = go_run_date.substring(8);
- if(i < parseInt(run_day)) {
- daystr += '<div class="aday disday">' + i + '</div>';
- } else {
- if(i == today) {
- // if(getPar('from')=="fill_order"){
- // daystr+='<div class="aday disday">'+i+'</div>';
- // }else{
- daystr += '<div data-cur-str="' + data_cur_str + '" data-cur="' + data_cur + '" class="aday canday today">今天</div>';
- // }
- } else if(i < today) {
- daystr += '<div class="aday disday">' + i + '</div>';
- } else {
- daystr += '<div data-cur-str="' + data_cur_str + '" data-cur="' + data_cur + '"class="aday canday">' + i + '</div>';
- }
- }
-
- }
- } else if(month < tomonth) {
- for(i = 1; i <= allday; i++) {
- daystr += '<div class="aday disday">' + i + '</div>'
- }
- } else {
- for(i = 1; i <= allday; i++) {
- var t_m = (tttmonth + 1);
- var t_m_str = t_m;
- var t_d_str = i;
- if(t_m <= 9) {
- t_m_str = "0" + t_m;
- }
- if(i <= 9) {
- t_d_str = "0" + i;
- }
- data_cur_str = t_m_str + "月" + t_d_str + '日';
- data_cur = tyear + "-" + (Array(2).join(0) + (tttmonth + 1)).slice(-2) + "-" + (Array(2).join(0) + i).slice(-2);
- daystr += '<div data-cur-str="' + data_cur_str + '" data-cur="' + data_cur + '"class="aday canday">' + i + '</div>'
- }
- }
-
- daystr += "</div>";
-
- dayhtml.push(daystr);
- dayhtml.push('</div>');
- }
- dom.html(dayhtml.join(""))
-
- //选中去程的日期
- $(".canday").each(function(index, domE) {
- if($(this).attr('data-cur') == getPar('go_run_date')) {
- $(this).removeClass('select_day');
- $(this).removeClass('select_go_day');
- $(this).addClass('select_go_day');
- };
-
- })
-
- $(".canday").on("click", function() {
- $(".canday").removeClass('select_day');
- $(this).addClass('select_day');
-
- //判断从哪个页面跳转过来
- var from = getPar('from');
- //出行预订
- if(from == "travel_book") {
- var data_cur = $(this).attr('data-cur');
- var data_cur_str = $(this).attr('data-cur-str');
- var tt = getDateTime(4);
- var listURL = 'travel_book.html?run_date=' + data_cur + "&run_date_str=" + data_cur_str + "&tt=" + tt ;
- listURL = encodeURI(listURL);
- window.location.href = listURL;
- }
- //订单详情
- if(from == "fill_order") {
- // go_ticket_id='+go_ticket_id+'&go_date='+go_date+'&back=back'+'&from=fill_order';
-
- var start_area_id = getPar("start_area_id");
- var end_area_id = getPar("end_area_id");
- var data_cur_str = $(this).attr('data-cur-str');
- var data_cur = $(this).attr('data-cur');
- var tt = getDateTime(4);
- var listURL = "search_results.html?start_area_id=" + start_area_id + "&end_area_id=" + end_area_id + "&run_date=" + data_cur + "&if_go=back" +"&go_run_date=" + getPar('go_run_date');
- listURL = encodeURI(listURL);
- window.location.href = listURL;
-
- // 测试返程列表接口。。。
- // var url=base_api+"./zz_wxsct/control.php";
- // var parm={
- // type:"bus_reservation_list_back",
- // date:go_date,
- // ticket_id:go_ticket_id
- // }
- // ZZLog(url+JSON.stringify(parm));
- // $.post(url,parm,function(res_data){
- // ZZLog(res_data);
- // res_data=JSON.parse(res_data);
- // ZZLog(res_data);
- // });
- }
-
- if(from == "search_results"){
- var data_cur_str = $(this).attr('data-cur-str');
- var data_cur = $(this).attr('data-cur');
- var start_area_id = getPar('start_area_id');
- var end_area_id = getPar('end_area_id');
- var ticket_id = getPar('go_ticket_id');
- var listURL = '';
- if(ticket_id != '') {
- listURL = "./search_results.html?run_date=" + data_cur + "&data_cur_str=" + data_cur_str + "&start_area_id=" + start_area_id + "&end_area_id=" + end_area_id + "&from=search_results" + "&go_run_date=" + getPar('go_run_date');
- } else {
- listURL = "./search_results.html?run_date=" + data_cur + "&data_cur_str=" + data_cur_str + "&start_area_id=" + start_area_id + "&end_area_id=" + end_area_id + "&from=search_results" + "&go_run_date=" + getPar('go_run_date');
- }
-
- listURL = encodeURI(listURL);
- window.location.href = listURL;
- }
-
- if(from == "pick_drop") {
- var data_cur_str = $(this).attr('data-cur-str');
- var data_cur = $(this).attr('data-cur');
- var temp=data_cur.replace('-','/');
- var week_day = getWeekDay(temp);
- window.location.href = "pick_drop_person.html?data_cur=" + data_cur + "&data_cur_str=" + data_cur_str+"&week_day=" + week_day + "&go_run_date=" + getPar('go_run_date') ;
- }
- if(from == "disney_tranship") {
- var data_cur_str = $(this).attr('data-cur-str');
- var data_cur = $(this).attr('data-cur');
- var temp=data_cur.replace(/-/g,"/");
- var week_day = getWeekDay(temp);
- window.location.href = "disney_tranship.html?data_cur=" + data_cur + "&data_cur_str=" + data_cur_str+"&week_day=" + week_day ;
- }
-
- // $(".canday").removeClass('thisday');
- // $(this).next().addClass("placesel");
- // $(this).addClass("thisday");
- })
-
- }
-
|