|
-
-
- //记录选中的方式
- var select_style = 255;
- //记录迪士尼隐藏
- var ifhide_disney = 0;
- //记录出发地还是目的地
- var area_if = '';
-
- var login_data = getStorJson("login_data");
-
- var HTML = '';
-
- //出发地和目的地全局 保存之前用户输入的信息
- var data_start = '';
- var data_end = '';
-
- window.onload = function(){
- var start_data = getStorJson('start_data_str');
- var end_data = getStorJson('end_data_str');
- if (start_data != null) {
- $('#start_area').text(start_data.line);
- $('#start_area').attr('changeid',start_data.value);
- }
- if (end_data != null) {
- $('#end_area').text(end_data.line);
- $('#end_area').attr('changeid',end_data.value);
- }
-
-
-
- HTML = $('#disney_shuttle').html();
-
- if(login_data.login_type==1){
- $("#footer").hide();
- if(login_data.user_id==62 || login_data.user_id==148 || login_data.user_id==290)
- {
- $("#shuttle").hide();
- $("#disney").hide();
- $("#through").trigger("click");
- }else if(login_data.user_id==121 || login_data.user_id==141){
- $("#through").trigger("click");
- }else
- {
- $("#shuttle").trigger("click");
- }
-
- }else{
- $("#footer").show();
- }
- if( login_data.main_corp_id==4 ) {
- $("#disney").hide();
- }
-
- var day = getDateTime(11);
- $('#nowdate').html(day);
- $('#nowdate').attr('sendStr',getDateTime(0));
- var nowWeek = getWeekDay(getDateTime(10));
- $('#nowWeek').html(nowWeek);
-
- }
-
-
- //出发地查询
- function areaSearch(start_id){
- area_if = start_id;
- $('#search_area_all').val('');
-
- $('#search_info').addClass('ui_hide');
- $('#search_area_div').removeClass('ui_hide');
- //propertychange
- $('#search_area_all').focus();
- $('#search_area_all').bind('input onchange',function(){
- searchAreaInfo(area_if);
- });
-
- }
-
- //查询相关的信息
- function searchAreaInfo(search_id){
- if(search_id == 'start_area'){
- var inout_type = 'in';
- }else{
- var inout_type = 'out';
- }
- var area_name = $("#search_area_all").val();
- $.ajax({
- url:'./zz-fx/control.php',
- type: "post",
- data: {
- area_name:area_name,
- type:"retrieval_area",
- bus_type:select_style,
- inout_type:inout_type
- },
- dataType: "json",
- success: function (data) {
- console.log(data);
- if(data.code == 0){
- console.log(data);
- createHtml(data.list,search_id);
- $(".select_content").removeClass("ui_hide");
- }
- },
- fail: function (data) {
- }
- });
- }
-
- //筛选列表
- function createHtml(data,id){
- var temp ="";
- for (var i = 0; i < data.length; i++) {
- temp +='<div class="content_xiala ui_p_t10 ui_p_b10 ui_m_l15 ui_m_r15 ui_line_b bc-border" id="'+id+''+data[i].area_id+'" onmouseover="getDark(this.id)" onmouseout="getLight(this.id)" area_id="'+data[i].area_id+'">'+data[i].area_name+'</div>'
- }
-
- $(".select_content").html(temp);
-
- $(".content_xiala").click(function(){
- var line = $(this).text();
- var value = $(this).attr('area_id');
-
- $("#search_area_all").val(line);
- $(".select_content").addClass("ui_hide");
-
- //返回
- $('#search_info').removeClass('ui_hide');
- $('#search_area_div').addClass('ui_hide');
- $('#'+id).html(line);
- $("#"+id).attr('changeid',value);
- $('#'+id).removeClass('blackfont');
-
- if (id == 'start_area') {
- var start_data = {
- line : line,
- value : value
- }
- // data_start = start_data;
- setStorJson('start_data_str',start_data);
- }
- if(id == 'end_area'){
- var end_data = {
- line : line,
- value : value
- }
- // end_data = data_end;
- setStorJson('end_data_str',end_data)
- }
-
-
-
- })
-
- }
-
- function getDark(value,select_id){
- $('#'+value).addClass("get_dark");
- }
- function getLight(value){
- $('#'+value).removeClass("get_dark");
- }
-
- //交换出发地和目的地
- function changePosition(){
- //取值
- var strid = '';
- var strtext = '';
- var start_area_id = $('#start_area').attr('changeid');
- var start_area_text = $('#start_area').html();
- var end_area_id = $('#end_area').attr('changeid');
- var end_area_text = $('#end_area').html();
-
- //替换
- strid = start_area_id;
- start_area_id = end_area_id;
- end_area_id = strid;
- strtext = start_area_text;
- start_area_text = end_area_text;
- end_area_text = strtext;
-
- $('#start_area').attr('changeid',start_area_id);
- $('#start_area').html(start_area_text);
- $('#end_area').attr('changeid',end_area_id);
- $('#end_area').html(end_area_text);
-
- if ($('#start_area').html() == '输入出发地' || $('#start_area').html() == '输入目的地' ) {
- $('#start_area').addClass('blackfont');
- }else{
- $('#start_area').removeClass('blackfont');
- }
- if ($('#end_area').html() == '输入出发地' || $('#end_area').html() == '输入目的地') {
- $('#end_area').addClass('blackfont');
- }else{
- $('#end_area').removeClass('blackfont');
- }
- }
-
- //选择日期
- $(document).ready(function(){
- var tomonth = new Date();
-
- $(".sel_goback").on("click",function(){
- addmouth($(".month"),tomonth.getFullYear(),tomonth.getMonth());
- $(".month").show();
- $("#search_info").hide();
- selectDate();
- });
- })
- //选中日期
- function selectDate(){
- $(".canday").on("click",function(){
- if($(this).html()=="今天"){
- var seldate = new Date().getDate();
- }else{
- var seldate =$(this).html();
- }
- var yearmonth = $(".currentdate").html().split("年");
-
- if (yearmonth[1] != 10 && yearmonth[1] != 11 && yearmonth[1] != 12) {
- var show_yearmonth = '0'+yearmonth[1];
- }else{
- var show_yearmonth = yearmonth[1];
- }
- if (seldate<10) {
- var show_seldate = '0'+seldate;
- }else{
- var show_seldate = seldate;
- }
- //前台展示
- var thisdataStrShow = yearmonth[1]+'月'+seldate+'日';
- //后台传参
- var thisdataStrSend = yearmonth[0]+"-"+show_yearmonth+"-"+show_seldate;
- //获取星期
- var thisdata = yearmonth[0]+"/"+yearmonth[1]+"/"+seldate;
- var select_week = getWeekDay(thisdata);
- $("#nowdate").html(thisdataStrShow);
- $('#nowdate').attr('sendStr',thisdataStrSend);
- $('#nowWeek').html(select_week);
- $(".month").hide();
- $("#search_info").show();
- })
- }
-
- //选择方式
- function selectStyle(value){
- switch(value){
- case 255:
- select_style = 255;
- $('#select_style').children().removeClass('bc-bg');
- $("#through").addClass('bc-bg')
- $('#disney_shuttle').addClass('ui_hide');
- reloadTroughInfo();
- break;
- case 256:
- select_style = 256;
- $('#select_style').children().removeClass('bc-bg');
- $("#shuttle").addClass('bc-bg');
-
- reloadDisneyInfo();
-
-
-
- break;
- default:
- select_style = 257;
- $("#mask").removeClass('ui_hide');
- $('#select_style').children().removeClass('bc-bg');
- $('#disney_shuttle').addClass('ui_hide');
- $("#disney").addClass('bc-bg')
-
-
- if (ifhide_disney == 0) {
- $('#hide_disney').removeClass('ui_hide');
- ifhide_disney = 1;
- }else{
- $('#hide_disney').addClass('ui_hide');
- ifhide_disney = 0;
- }
-
- }
- }
-
- //展示直通车的数据
- function reloadTroughInfo(){
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- data:{type:'distribut_recommendThrough'},
- type: "post", //请求方式
- async:false,
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- var list = data.list;
- var newHTML='';
- for(var i=0;i<list.length;i++){
- var tempHTML=HTML;
- tempHTML=tempHTML.replace('[出发地]',list[i].up_station_name);
- tempHTML=tempHTML.replace('[start_attrid]',list[i].up_station);
- tempHTML=tempHTML.replace('[end_attrid]',list[i].down_station);
- tempHTML=tempHTML.replace('[目的地]',list[i].down_station_name);
- tempHTML=tempHTML.replace('[i]',i);
- tempHTML=tempHTML.replace('[disney_start]','disney_start'+i);
- tempHTML=tempHTML.replace('[disney_end]','disney_end'+i);
- newHTML+=tempHTML;
- }
- $('#disney_shuttle').html(newHTML);
- $('#disney_shuttle').removeClass('ui_hide');
- }else{
- $('#disney_shuttle').addClass('ui_hide');
- }
-
-
- },
- fail: function (date) {
- }
- });
- }
-
- //展示穿梭车的数据
- function reloadDisneyInfo(){
- $.ajax({
- url:'./zz-fx/Model/distribut/hotel_through.php', //请求地址
- type: "post", //请求方式
- async:false,
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- var list = data.list;
- var newHTML='';
- for(var i=0;i<list.length;i++){
- var tempHTML=HTML;
- tempHTML=tempHTML.replace('[出发地]',list[i].up_station_name);
- tempHTML=tempHTML.replace('[start_attrid]',list[i].up_station);
- tempHTML=tempHTML.replace('[end_attrid]',list[i].down_station);
- tempHTML=tempHTML.replace('[目的地]',list[i].down_station_name);
- tempHTML=tempHTML.replace('[i]',i);
- tempHTML=tempHTML.replace('[disney_start]','disney_start'+i);
- tempHTML=tempHTML.replace('[disney_end]','disney_end'+i);
- newHTML+=tempHTML;
- }
- $('#disney_shuttle').html(newHTML);
- $('#disney_shuttle').removeClass('ui_hide');
- }else{
- $('#disney_shuttle').addClass('ui_hide');
- }
-
-
- },
- fail: function (date) {
- }
- });
- }
-
- //选择穿梭信息
- function selectDisneyInfo(id){
- var start_attrid = $('#disney_start'+id).attr('attrid');
- var start_area_name = $('#disney_start'+id).html();
- var end_attrid = $('#disney_end'+id).attr('attrid');
- var end_area_name = $('#disney_end'+id).html();
-
- $('#start_area').attr('changeid',start_attrid);
- $('#start_area').html(start_area_name);
- $('#end_area').attr('changeid',end_attrid);
- $('#end_area').html(end_area_name);
-
- $('#start_area').removeClass('blackfont');
- $('#end_area').removeClass('blackfont');
- }
-
- $('#mask').click(function(){
- $("#mask").addClass("ui_hide");
- $('#hide_disney').addClass('ui_hide');
- ifhide_disney = 0;
- })
- //$("#hide_disney").click(function(e){
- // e.stopPropagation();
- // $("#hide_disney").removeClass("ui_hide");
- // $("#hide_disney").addClass("ui_hide");
- //});
-
-
- //查询按钮
- function searchBtnDidClicked(){
- var startId = $('#start_area').attr('changeid');
- var endId = $('#end_area').attr('changeid');
- var dataStr = $('#nowdate').attr('sendstr');
- var styleStr = select_style;
- var dateStr = $('#nowdate').html();
- var data = {
- start_area : startId,
- end_area : endId,
- go_time : dataStr,
- bus_type : styleStr,
- type:"retrieval_through",
- run_type:0,
- currpage:1,
- pagesize:10000
- }
- setStorJson('searchData',data);
- setStorage('sendDate',dateStr);
- window.location.href = './search_result.html';
- }
-
- //search页面的后退按钮
- function returnMain(){
- $('#search_area_div').addClass('ui_hide');
- $('#search_info').removeClass('ui_hide');
- }
-
- //删除input的内容
- function delInput(){
- $('#search_area_all').val('');
- }
|