//当前时间 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('
'); 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('
'+(tttmonth+1)+'月'+''+tyear+'
') // dayhtml.push(); // $.each(week,function(i,v){ // dayhtml.push('
'+week[i]+'
') // }); var str = ''; $.each(week,function(i,v){ str += '
'+week[i]+'
'; }); dayhtml.push('
'+str+'
') 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 = '
'; for(var i = 0;idate2 || 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'; }else{ if(i==today){ // if(getPar('from')=="fill_order"){ // daystr+='
'+i+'
'; // }else{ daystr+='
今天
'; // } } else if(i'; }else{ daystr+='
'+i+'
'; } } } }else if(month' } }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+='
'+i+'
' } } daystr += "
"; dayhtml.push(daystr); dayhtml.push('
'); } dom.html(dayhtml.join("")) //选中去程的日期 $(".canday").each(function(index,domE){ if($(this).attr('data-cur')==getPar('go_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 go_ticket_id=getPar('go_ticket_id'); var go_date=getPar('go_date'); var data_cur=$(this).attr('data-cur'); var data_cur_str=$(this).attr('data-cur-str'); var tt=getDateTime(4); var listURL="search_results.html?go_date="+data_cur+"&go_ticket_id="+go_ticket_id+"&tt="+tt; 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_type = getPar('start_area_type'); var start_area_id = getPar('start_area_id'); var end_area_id = getPar('end_area_id'); var end_area_type = getPar('end_area_type'); 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_type="+start_area_type+"&start_area_id="+start_area_id+"&end_area_id="+end_area_id+"&end_area_type="+end_area_type+"&go_ticket_id="+ticket_id+"&from=search_results"; }else{ listURL="./search_results.html?run_date="+data_cur+"&data_cur_str="+data_cur_str+"&start_area_type="+start_area_type+"&start_area_id="+start_area_id+"&end_area_id="+end_area_id+"&end_area_type="+end_area_type+"&go_ticket_id="+"&from=search_results"; } listURL=encodeURI(listURL); window.location.href=listURL; } // $(".canday").removeClass('thisday'); // $(this).next().addClass("placesel"); // $(this).addClass("thisday"); }) }