//Author:zhangsq //Date:20160826 //Description:查询结果 $("#loading_html").show(); var tempdate = ''; //有票种普通 var has_ticketHTML = ''; //有票种奔驰 var has_benzHTML = ''; //无票种普通 var no_ticketHTML = ''; //无票种奔驰 var no_benzHTML = ''; // 去程 var start_area_id = ""; var start_area_type = ""; var end_area_id = ""; var end_area_type = ""; var run_date = ""; var cur_date = ''; var cur_date_str = ''; // 返程 var go_ticket_id=""; // 返程的ticket_id var back_ticket_ids=new Array(); var no_resultHTMl = ''; var if_go = getPar("if_go"); var get_from = getPar("form"); var pick_drop_person_type = getPar("pick_drop_person_type") var go_date=""; window.onload = function(){ has_ticketHTML = $('.has_ticket').prop('outerHTML'); has_benzHTML = $('.has_benz').prop('outerHTML'); no_ticketHTML = $('.no_ticket').prop('outerHTML'); no_benzHTML = $('.no_benz').prop('outerHTML'); // has_ticketHTML=no_ticketHTML; no_resultHTMl = $('#no_no_no').html(); start_area_id = getPar('start_area_id'); start_area_type = getPar('start_area_type'); end_area_id = getPar('end_area_id'); end_area_type = getPar('end_area_type'); run_date = getPar('run_date')!=""?getPar('run_date'):getPar('go_date'); //zsq var date_str = getPar('run_date'); if (date_str != '' ) { run_date = date_str; } if (date_str == 'ad') { run_date = after(getDateTime(0)); // getDateTime(0); } console.log(run_date); //zsq end tempdate = run_date; var nowdate = getDateTime(0); var month = getMonthAndDayByDate(run_date,'month'); var day = getMonthAndDayByDate(run_date,'day'); if (tempdate==nowdate) { $('#show_date').html(month+'月'+day+'日'); $('#left').removeClass('fontgreen_color'); $('#left').addClass('commongray_color'); $('#left').removeAttr('onclick'); $('#left_img').attr('src','images/a2/ic_return_d.png'); } else{ $('#show_date').html(month+'月'+day+'日'); $('#left').removeClass('commongray_color'); $('#left').addClass('fontgreen_color'); $('#left').attr('onclick','leftDidClicked();'); $('#left_img').attr('src','images/a2/ic_return_n_l.png'); } go_date=getPar('go_date'); go_ticket_id=getPar('go_ticket_id'); if(go_ticket_id==""){ //去程 //清除填写订单的四个缓存 clearStorage('CacheInfo_people'); clearStorage('CacheInfo_station'); clearStorage('go_data'); clearStorage('back_data'); ZZLog('clearStorage'); go_list(); }else{ // 返程 back_list(); } } //点击了 前一天 function leftDidClicked(){ var nowdate = tempdate; var run_date = before(nowdate); tempdate = run_date; var nowdate = getDateTime(0); var month = getMonthAndDayByDate(run_date,'month'); var day = getMonthAndDayByDate(run_date,'day'); if (tempdate==nowdate) { $('#show_date').html(month+'月'+day+'日'); $('#left').removeClass('fontgreen_color'); $('#left').addClass('commongray_color'); $('#left').removeAttr('onclick'); $('#left_img').attr('src','images/a2/ic_return_d.png'); } else{ $('#show_date').html(month+'月'+day+'日'); $('#left').removeClass('commongray_color'); $('#left').addClass('fontgreen_color'); $('#left').attr('onclick','leftDidClicked();'); $('#left_img').attr('src','images/a2/ic_return_n_l.png'); } go_ticket_id=getPar('go_ticket_id'); if(go_ticket_id==""){ //去程 go_list(); }else{ // 返程 back_list(); } } //点击了后一天 function rightDidClicked(){ var nowdate = tempdate; var run_date = after(nowdate); tempdate = run_date; var nowdate = getDateTime(0); var month = getMonthAndDayByDate(run_date,'month'); var day = getMonthAndDayByDate(run_date,'day'); if (tempdate==nowdate) { $('#show_date').html(month+'月'+day+'日'); $('#left').removeClass('fontgreen_color'); $('#left').addClass('commongray_color'); $('#left').removeAttr('onclick'); $('#left_img').attr('src','images/a2/ic_return_d.png'); } else{ $('#show_date').html(month+'月'+day+'日'); $('#left').removeClass('commongray_color'); $('#left').addClass('fontgreen_color'); $('#left').attr('onclick','leftDidClicked();'); $('#left_img').attr('src','images/a2/ic_return_n_l.png'); } go_ticket_id=getPar('go_ticket_id'); if(go_ticket_id==""){ //去程 go_list(); }else{ // 返程 back_list(); } // var start_area_id = getPar('start_area_id'); // var start_area_type = getPar('start_area_type'); // var end_area_id = getPar('end_area_id'); // var end_area_type = getPar('end_area_type'); // } // go 去程 function go_list(){ //转圈圈 //$("#loadingToast").show(); var url=base_api+"runs/getRunsList"; var parm={ start_area_id:start_area_id, end_area_id:end_area_id, run_date:tempdate, is_recommend:1 } ZZLog(url+JSON.stringify(parm)); $.post(url,parm,function(res_data){ res_data=JSON.parse(res_data); console.log(res_data); if (res_data.flag == true) { if (res_data.data.common_list.length > 0) { $('#detailInfo').removeClass('ui_hide'); $('#no_result').addClass('ui_hide'); reloadData(res_data.data.common_list); } // else if(res_data.select_type == "tomorrow_normal"){ // $('#detailInfo').addClass('ui_hide'); // $('#no_result').removeClass('ui_hide'); // $('#tomorrow').html('今日没有匹配的车次'); // $('#tomorrow_new').html('请更换日期查询'); // $('#no').addClass('ui_hide'); // // } else{ recommendInfo(res_data.data.recommend_list); //TODO 进入隐藏 $('#detailInfo').addClass('ui_hide'); $('#no_result').removeClass('ui_hide'); } } else{ alert(res_data.msg); } }); } //推荐信息 function recommendInfo(list){ if (list.length == 0) { $('#no').hide(); } else{ $('#no').show(); var tempHTML = ''; var newHTML = ''; for(var i=0;i 0) { tempHTML = has_ticketHTML; } else{ tempHTML = no_ticketHTML; } tempHTML=tempHTML.replace('[出发地]',list[i].start_area_name); tempHTML=tempHTML.replace('[目的地]',list[i].end_area_name); tempHTML=tempHTML.replace('[时间]',list[i].run_time); tempHTML=tempHTML.replace('[价格]',parseInt(list[i].price)); tempHTML=tempHTML.replace('[全程用时]',list[i].total_time); tempHTML=tempHTML.replace('[start_area_id]',list[i].start_area_id); tempHTML=tempHTML.replace('[end_area_id]',list[i].end_area_id); tempHTML=tempHTML.replace('[run_id]',list[i].run_id); tempHTML=tempHTML.replace('[line_type]',list[i].line_type); tempHTML=tempHTML.replace('[air_type]',list[i].air_type); newHTML+=tempHTML; } $('#detailInfo').html(newHTML); $(".disney_bus").click(function(){ var end_area_id = $(this).attr("end_area_id"); var start_area_id = $(this).attr("start_area_id"); var line_type = $(this).attr("line_type"); var air_type = $(this).attr("air_type"); var run_id = $(this).attr("run_id"); if(line_type == "380"){ clearStorage("CacheStationInfo_Go"); clearStorage("CacheStationInfo_Back"); window.location.href="pick_drop_fill_order.html?air_type="+air_type+"&start_area_id="+start_area_id+"&end_area_id="+end_area_id+"&run_id="+run_id+"&if_go=go"; }else{ if(if_go=="back"){ clearStorage("CacheStationInfo_Back"); window.location.href="fill_order.html?start_area_id="+start_area_id+"&end_area_id="+end_area_id+"&run_id="+run_id+"&if_go=back"; }else{ clearStorage("CacheStationInfo_Go"); clearStorage("CacheStationInfo_Back"); window.location.href="fill_order.html?start_area_id="+start_area_id+"&end_area_id="+end_area_id+"&run_id="+run_id+"&if_go=go"; } } }); $('#detailInfo').show(); } //获取前一天日期 function before(d){ d = new Date(d); d = +d - 1000*60*60*24; d = new Date(d); //return d; //格式化 var year = ";" + d.getFullYear() + ";"; var month = ";" + (d.getMonth()+0+1) + ";"; var day = ";" + d.getDate() + ";"; if(year.length < 4) { year = "0" + year; } if(month.length < 4) { month = "0" + month; } if(day.length < 4) { day = "0" + day; } var datestr = year + "-" + month + "-" + day; datestr = datestr.replace(/;/g, ""); return datestr; // return d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate(); } //获取后一天日期 function after(d){ d = new Date(d); d = +d + 1000*60*60*24; d = new Date(d); //return d; //格式化 var year = ";" + d.getFullYear() + ";"; var month = ";" + (d.getMonth()+0+1) + ";"; var day = ";" + d.getDate() + ";"; if(year.length < 4) { year = "0" + year; } if(month.length < 4) { month = "0" + month; } if(day.length < 4) { day = "0" + day; } var datestr = year + "-" + month + "-" + day; datestr = datestr.replace(/;/g, ""); return datestr; // return d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate(); } function getMonthAndDayByDate(datestr,info){ var dateAry = datestr.split('-'); var cNewTimeStr; switch(info){ case 'year': cNewTimeStr = dateAry[0]; break; case 'month': cNewTimeStr = dateAry[1]; break; default: cNewTimeStr = dateAry[2]; break; } return cNewTimeStr; } //日历点击事件 function selectCalander(){ window.location.href = "./calendar.html?run_date="+run_date+"&start_area_id="+start_area_id+"&end_area_id="+end_area_id+"&if_go="+if_go+"&from=search_results"+"&go_run_date="+getPar('go_run_date'); }