//Author:fuhc //Date:20160826 //Description:出行预订 var start_area_name="请选择出发地"; var start_area_id=""; var start_area_type=""; var end_area_name="请选择目的地"; var end_area_id=""; var end_area_type=""; var run_date=""; //获取头部切换信息 var top_cut = getStorage("top_cut"); //获取城际直通车出发地目的地 var start_city_id = getStorage("start_city_id"); //获取奔驰专线出发地目的地 var start_benz_id = getStorage("start_benz_id"); //线路类型 var line_type = getStorage("line_type"); //读取缓存 var start_area_info=getStorJson('f_wx_start_hot_city20160826');//出发地 var end_area_info=getStorJson('f_wx_end_hot_city20160826'); //目的地 //$("#loading_html").show(); //页面加载 window.onload=function(){ $("#body_html").show(); baseInfo(); if(top_cut == null){ top_cut = 0; } if(start_city_id == null){ start_city_id = 0; } if(start_benz_id == null){ start_benz_id = 0; } if(line_type == null){ line_type = 0; } cut_bus_load(top_cut); run_date=getPar('run_date'); //出发日期 var run_date_str=getPar('run_date_str'); //出发日期eg 8月21日 // 有目的地 if(start_area_info){ start_area_id=start_area_info['area_id']; start_area_name=start_area_info['area_name']; start_area_type=start_area_info['area_type']; } // 有出发地 if(end_area_info){ end_area_id=end_area_info['area_id']; end_area_name=end_area_info['area_name']; end_area_type=end_area_info['area_type']; } //出发日期 if(run_date){ $('#run_date').text(run_date_str); }else{ // var cur_date_m_d=getDateTime(0); var cur_date_m_d = after(getDateTime(0)); cur_date_m_d=cur_date_m_d.substring(5); cur_date_m_d=cur_date_m_d.replace('-','月'); cur_date_m_d=cur_date_m_d+'日'; run_date=after(getDateTime(0)); $('#run_date').text(cur_date_m_d); } //zhangsq var year = getMonthAndDayByDate(run_date,'year'); var month = getMonthAndDayByDate(run_date,'month'); var day = getMonthAndDayByDate(run_date,'day'); var str = year+ '/' +month +'/'+day; var week = getWeekDay(str); //zhangsq end $('#run_day').text(run_date==getDateTime(0)?'今天':week); //判断选择的日期是否是当前日期 // $('#run_day').text(run_date==getDateTime(0)?'今天':""); //有缓存就进去 if(start_area_id!=""){ $('#start_area').text(start_area_name); $('#start_area').removeClass('lightgray_color'); } if(end_area_id!=""){ $('#end_area').text(end_area_name); $('#end_area').removeClass('lightgray_color'); } // $("#loading_html").show(); } //点击事件 $(document).ready(function(){ //点击出发地 $('#start_area').click(function(){ var tt=getDateTime(4); // 跳转前将URL编码 var listURL='hot_city.html?from=travel_book&poi_type=&op_type=in&tt='+tt+'&station_id='+''+'&line_type='+line_type; listURL = encodeURI(listURL); window.location.href=listURL; }); //点击目的地 $('#end_area').click(function(){ var tt=getDateTime(4); // 跳转前将URL编码 var listURL='hot_city.html?from=travel_book&poi_type=&op_type=out&tt='+tt+'&station_id='+start_area_id+'&line_type='+line_type; listURL = encodeURI(listURL); window.location.href=listURL; }); //选择日期 $('#sel_data').click(function(){ var tt=getDateTime(4); var listURL='calendar.html?from=travel_book&tt='+tt; // 跳转前将URL编码 listURL = encodeURI(listURL); window.location.href=listURL; }); //点击交换 $('.exchange').click(function(){ if(start_area_name=="请选择出发地"||end_area_name=="请选择目的地"){ return; }else{ // 有出发地缓存 if(start_area_info){ var data = { op_type: "in", area_id: end_area_id, area_name: end_area_name }; setStorJson('f_wx_start_hot_city20160826', data); } // 有目的地缓存 if(end_area_info){ var data = { op_type: "out", area_id: start_area_id, area_name: start_area_name }; setStorJson('f_wx_end_hot_city20160826', data); } var temp_id=start_area_id; var temp_name=start_area_name; var temp_type=start_area_type; start_area_id=end_area_id; start_area_name=end_area_name; start_area_type=end_area_type; end_area_id=temp_id; end_area_name=temp_name; end_area_type=temp_type; $('#start_area').text(start_area_name); $('#end_area').text(end_area_name); if(start_area_name!="请选择出发地"&&start_area_name!="请选择目的地"){ $('#start_area').removeClass('lightgray_color'); }else{ $('#start_area').addClass('lightgray_color'); } if(end_area_name!="请选择目的地"&&end_area_name!="请选择出发地"){ $('#end_area').removeClass('lightgray_color'); }else{ $('#end_area').addClass('lightgray_color'); } } }); //点击查询 $('#btn_search').click(function(){ //判断日期非空 if(run_date=="" || start_area_id=="" || end_area_id==""){ alert('请选择出发地或目的地!'); return; } //清空缓存 clearStorage('f_wx_start_hot_city'); clearStorage('f_wx_end_hot_city'); var tt=getDateTime(4); var listURL='search_results.html?start_area_id='+start_area_id +"&end_area_id="+end_area_id +"&if_go=go" +"&run_date="+run_date; listURL=encodeURI(listURL); window.location.href=listURL; }); $('.btn_Recommend').click(function(){ start_area_id = $(this).attr("start_area_id"); start_area_type = $(this).attr("type"); end_area_id = $(this).attr("end_area_id"); end_area_type = $(this).attr("type"); var tomorrow = parseInt(getMonthAndDayByDate(run_date,'day'))+1; run_date = GetDateStr(1); var tt=getDateTime(4); var listURL='search_results.html?start_area_id='+start_area_id +"&start_area_type="+start_area_type +"&end_area_id="+end_area_id +"&end_area_type="+end_area_type +"&run_date="+run_date +"&tt="+tt; listURL=encodeURI(listURL); window.location.href=listURL; }); }) //头部切换 function cut_bus(index){ //切欢时清缓存信息、变样式 clearStorage("f_wx_end_hot_city20160826"); clearStorage("f_wx_start_hot_city20160826"); $('#start_area').text("请选择出发地"); $('#start_area').addClass('lightgray_color'); $('#end_area').text("请选择目的地"); $('#end_area').addClass('lightgray_color'); start_area_name = "请选择出发地"; start_area_id = ""; end_area_name = "请选择目的地"; end_area_id = ""; $(".cut_top").children().addClass("cut_top_hide"); $(".cut_top").children().removeClass("cut_top_show"); $("#cut_"+index).removeClass("cut_top_hide"); $("#cut_"+index).addClass("cut_top_show"); $("#bus_station").children().hide(); $(".cut_bus"+index).show(); top_cut = index; line_type = $("#cut_"+index).attr("line_type"); setStorage("top_cut",top_cut); setStorage("line_type",line_type); } function cut_bus_load(index){ $(".cut_top").children().addClass("cut_top_hide"); $(".cut_top").children().removeClass("cut_top_show"); $("#cut_"+index).removeClass("cut_top_hide"); $("#cut_"+index).addClass("cut_top_show"); $("#bus_station").children().hide(); $(".cut_bus"+index).show(); top_cut = index; line_type = $("#cut_"+index).attr("line_type"); setStorage("top_cut",top_cut); setStorage("line_type",line_type); } // 是否存在相同的 function is_exists(all_arr,dict){ var flag=false; for (var i=0,m=all_arr.length;i' } $(".swiper-wrapper").html(temp_lunbo); $('.urlurl').click(function(){ var urlstr = $(this).attr('to_url'); window.location.href = urlstr; }) //迪士尼穿梭 for(var i=0,j=data.dsn.length;i' + '
' + '
全程用时
' + '
'+data.dsn[i].bus_time+'
' + '
' + '' + '
' + '
'+data.dsn[i].dsnstart+'
' + '
'+data.dsn[i].dsnend+'
' + '
' + '
' + '' + ''+parseInt(Math.ceil(data.dsn[i].price))+'' + '
' + '' } $("#dsn_bus").html(temp_dsn); $('#dsn_bus').show(); //直通巴士 for(var i=0,j=data.scenicList.length;i' + '
' + '' + '
' + '
' + '
' + '
全程'+data.scenicList[i].bus_time+'
' + '
'+data.scenicList[i].car_type+'
' + '
' + '
'+parseInt(Math.ceil(data.scenicList[i].price))+'
' + '
' + '' } $("#through_bus").html(temp_through); $('#through_bus').show(); //周边游 for(var i=0,j=data.rimList.length;i' + '' + '
' + '
' + '
'+data.rimList[i].zname+'
' + '
'+data.rimList[i].tickdes+'
' + '
' + '
' + '' + ''+parseInt(Math.ceil(data.rimList[i].price))+'' + '
' + '
' + '' } $("#rim_travel").html(temp_rim); $('#rim_travel').show(); $("#loading_html").show(); //轮播空间swiper var swiper = new Swiper('.swiper-container', { loop : true, paginationClickable: true, centeredSlides: true, autoplay : 2000, autoplayDisableOnInteraction : false }); //轮播点击事件 // function go_ticket(){ // window.location.href="disney_bus.html"; // } // function go_picture(){ // window.location.href="search_bus.html"; // } } function around_travel(){ //MtaH5.clickStat('test0001'); window.location.href="trave_around_main.html"; } function dsn_travel(){ //MtaH5.clickStat('test0001'); window.location.href="disney_tranship.html"; } function plane_travel(){ //MtaH5.clickStat('test0001'); window.location.href="pick_drop_person.html"; } //景区直通点击 跳转列表页面 function aroundDidClicked(start_id,end_id){ var run_date = after(getDateTime(0)); window.location.href = './search_results.html?start_area_id='+start_id+'&end_area_id='+end_id+'&ifgo=go'+'&run_date='+run_date; } //周边游点击 跳转详情页面 function rimDidClicked(pro_id){ window.location.href = './travel_around_detail.html?pro_id='+pro_id; } //迪士尼 跳转列表页面 function disneyDidClicked(start_id,end_id){ var run_date = after(getDateTime(0)); window.location.href = './search_results.html?start_area_id='+start_id+'&end_area_id='+end_id+'&ifgo=go'+'&run_date='+run_date; } //跳转活动页面’ function goToProductDetail(toUrl){ window.location.open(toUrl); }