var submitData = { "ArriveStr": "", "Renshu": 1, "TravelWayType": 1, "DepartStr": "", "Contact": "", "CType": 1, "TType": 2, "MemberPhone": "","IsShanXi":1 }; var rphone = /^(?:0?1)[34578]\d{9}$/; var rtel = /^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$/; $(document).ready(function () { //初始化出发城市 InitDepartCity(); InitDestinagionCity(); $("#quickcustombtn").click(function () { if (bookingvalid()) { submitData.Renshu = $("#renshu").val(); submitData.TravelWayType = $("#TravelWayType").val(); $('.body-shade').show(); $.ajax({ type: "Get", contentType: 'application/json', url: "http://custom.aoyou.com/Custom/CreateCustom", data: submitData, dataType: "jsonp", jsonp: "callback", async: true, success: function (data) { if (data == 0) { $(".success-tip").show(); $('.body-shade').show(); } else { $(".fail-tip").show(); $('.body-shade').show(); } }, error: function () { $(".fail-tip").show(); } }); } }); $("#detailcustombtn").click(function () { //目的地 var arriveCity = $("#arrivecity").val(); if (arriveCity == undefined || arriveCity == "目的地不能为空" || arriveCity == "输入/选择目的地") { arriveCity = ""; } //出发城市 var departCity = $("#departCity").val(); if (departCity == undefined || departCity == "出发地不能为空" || departCity == "输入/选择出发地") { departCity = ""; } //出行方式 var travelWayType = $("#TravelWayType").val(); //出行人数 var peopleNum = $("#renshu").val(); //联系方式 var contactPhone = $("#contactPhone").val(); if (contactPhone == undefined || contactPhone == "输入手机/座机" || contactPhone == "联系方式必填哦" || contactPhone == "请填写手机/座机哦" || (!rphone.test(contactPhone) && !rtel.test(contactPhone))) { contactPhone = ""; } //var param = arriveCity + '|' + departCity + '|' + peopleNum + '|0|' + contactPhone + '|' + travelWayType + '|' + '2'; var param = "ArriveCity=" + arriveCity + "&DepartCity=" + departCity + "&PeopleNum=" + peopleNum + "&IsNeedLeader=0&ContactPhone=" + contactPhone + "&TravelWayType=" + travelWayType + "&TravelType=2&IsShanXi=1" var openUrl = "http://custom.aoyou.com/custom/bookingdetail?" + param; window.open(encodeURI(openUrl)); }); $(".icon-go").click(function () { $(".icon-go").removeClass("icon-goon"); $(this).addClass("icon-goon"); $("#TravelWayType").val($(this).attr("wayvalue")); $(".travelType").hide(); }); //服务宗旨 start var $fuWuList = $('.fuWuList li'); var index = $('.fuWuList li').index(); var timerInterval; var timer; startSwiperTimer(); $fuWuList.hover(function () { var $this = $(this); clearInterval(timerInterval); if (timer) { clearTimeout(timer) } timer = setTimeout(function () { $this.stop(true).addClass("wid").siblings().stop(true).removeClass("wid"); timer = undefined; }, 200); }, function () { var $this = $(this); var i = $this.index(); startSwiperTimer(i); }); function startSwiperTimer(i) { timerInterval = setInterval(function () { i++; if (i > index) { i = 0; } else { } $fuWuList.eq(i).stop(true).addClass("wid").siblings().stop(true).removeClass("wid"); }, 5000); } //服务宗旨 end BannerSlide(); //头部轮播 swiper(); //定制设计师轮播 InitUserStatus(); autoResize(); $(".aoyou-sidebar2").find(".sidebar-item").hover(function () { $(this).addClass("active"); }, function () { $(this).removeClass("active"); }); $("#gotopBar").click(function () { $("html,body").stop().animate({ "scrollTop": 0 }, 500); }); $(".tabCon").each(function () { $(this).find(".tabConn").eq(0).show(); $(this).find(".sixPro").each(function (k, v) { if (k % 3 === 2) { $(v).css("margin-right", "0"); } }); }); $(".tab li").each(function () { var $this = $(this); $this.mouseover(function () { var index = $this.index(); $this.addClass("on").siblings().removeClass("on"); $this.parents(".tabBox").next(".tabCon").find(".tabConn").eq(index).show().siblings().hide(); }) }); //关闭弹出层 function closePopup() { $('.close').parent('.drop-box').css('visibility', 'hidden'); $('.close').parent('.drop-box2').css('visibility', 'hidden'); $('.close').parent('.drop-box2').css('display', 'none'); $('.blank').css('z-index', '2'); if ($('.close').parents('.fk').find('input').length == 0) { $('.close').parents('.fk').find('input').val("目的地不能为空"); $('.close').parents('.fk').addClass('error-tips'); } if ($('.close').parents('.mdd-select').find('.mddselect').val = "") { $('.close').parents('.mdd-select').find('input').val("目的地不能为空"); $('.close').parents('.mdd-select').addClass('error-tips'); } } //弹出层高度 var winHeight = $(window).height(); $('.popup,.dz-popup').css({ 'top': winHeight / 2 }); //关闭遮罩层 $('.close').click(function () { closePopup(); $('.close').parent('.popup').hide(); $('.body-shade').hide(); }); $('.close-btn').click(function () { $('.dz-popup').hide(); $('.body-shade').hide(); }); $(".failsubmit").click(function () { closePopup(); $('.close').parent('.popup').hide(); $('.body-shade').hide(); }); //企业登录弹窗 $('.enter_btn').click(function () { $('.dz-popup').show(); $('.body-shade').show(); }); $("body").click(function (e) { if ($(e.target).attr('class') !== 'keydowninput' && $(e.target).attr('class') !== 'drop-box' && $(e.target).attr('class') !== 'drop-box2' && $(e.target).attr('mark') !== ('mdd') && $(e.target).attr('mark') !== ('cfd') && $(e.target).attr('class') !== 'city-span' && $(e.target).attr('data-li') !== 'item-li') { closePopup(); $('.keydowninput').attr('fc', 'off'); } }); $(".drop-box2").on("click", ".tt_tabs .item", function () { var $this = $(this); var index = $this.index(); $this.parents(".tt_tabs").find(".item").removeClass("now"); $this.addClass("now"); $this.parents(".more-block").find(".items .item").hide(); $this.parents(".more-block").find(".items .item").eq(index).show(); }); $(".drop-box2").on("click", ".itemcon .link_a", function () { var $this = $(this); var text = $this.text(); var aybk = $this.parents('.blank'); aybk.removeClass('error-tips'); aybk.find('input').val(text); closePopup(); return false; }); $(".drop-box").on("click", ".tab-nav li", function () { var $this = $(this); var index = $this.index(); $this.parents(".tab-nav").find("li").removeClass('now'); $this.addClass('now'); $this.parents(".drop-box").find(".list-city ul").addClass('hidden'); $this.parents(".drop-box").find(".list-city ul").eq(index).removeClass('hidden') }); $(".drop-box").on("click", ".list-city li", function () { var $this = $(this); var text = $this.text(); var aybk = $this.parents('.blank'); aybk.removeClass('error-tips'); aybk.find('input').val(text); closePopup(); }); //计数器 $('.spinner .icon-minus').click(function () { var _thisvalue = parseInt($('input', $(this).parent()).val()); if (_thisvalue > 1) { $('input', $(this).parent()).val(_thisvalue - 1); } }); $('.spinner .icon-plus').click(function () { var _thisvalue = parseInt($('input', $(this).parent()).val()); $('input', $(this).parent()).val(_thisvalue + 1); }); //输入验证 $(".fk input").focus(function () { $(this).val(''); $(this).parent('.blank').css('z-index', '3'); $(this).removeClass('gray') }); $('.cfd-select input').focus(function () { closePopup(); var liTag = $(this).parent().find('.tab-nav li'); var liWidth = 60; $(liTag).each(function (idx, e) { liWidth += $(e).width() + parseInt($(e).css('margin-left').replace('px', '')) + parseInt($(e).css('margin-right').replace('px', '')) }); $('.drop-box').css('width', liWidth + 'px'); $(this).val(''); $(this).parent('.blank').css('z-index', '3'); $(this).parent().find('.drop-box').css('visibility', 'visible'); $(this).removeClass('gray') }); $('.mdd-select input').focus(function () { closePopup(); $(this).val(''); $(this).parent('.blank').css('z-index', '3'); $(this).parent().find('.drop-box2').css('display', 'block'); $(this).parent().find('.drop-box2').css('visibility', 'visible'); $(this).removeClass('gray') }); $(".fk input").on('input', function (e) { $(this).removeClass('gray'); var str = $(this).attr('value'); if (str.length != 0) { $(this).removeClass('gray') } }); $('.fk input').click(function () { $(this).parent().removeClass('error-tips'); }); $('.fk input').blur(function (e) { var inputObj = $(this); window.setTimeout(function () { var str = inputObj.attr('value'); $(this).parent('.blank').css('z-index', '2'); if (str != undefined && typeof str == 'string') { if (str.length == 0) { var strMark = inputObj.attr('mark'); switch (strMark) { case 'mdd': inputObj.val("目的地不能为空"); break; case 'cfd': inputObj.val("出发地不能为空"); break; case 'lxfs': inputObj.val("联系方式必填哦"); break; case 'zh': inputObj.val("账户不能为空"); break; case 'mm': inputObj.val("密码不能为空"); break; } inputObj.parents('.fk').addClass('error-tips'); } else { var strMark = inputObj.attr('mark'); if (strMark == "lxfs") { var str = inputObj.attr('value'); if (!rphone.test(str) && !rtel.test(str)) { inputObj.val("请填写手机/座机哦"); inputObj.parents('.fk').addClass('error-tips'); } } } } }, 250); }); }); //输入验证end function BannerSlide() { $(window).resize(function () { var minWidth = $(window).width(); var minHeight = minWidth * (560 / 1920); if (minWidth > 1920) { $('.slider-img,.bd li,.slider').height(560); } }); index = 0; endIndex = $('.bd li').length; var minWidth = $(window).width(); var minHeight = minWidth * (560 / 1920); if (minWidth > 1920) { $('.slider-img,.bd li,.slider').height(560); } $bannerbdLi = $('#banner .bd li'); $bannerhdLi = $('#banner .hd li'); $bannerparaLi = $('#banner .para'); $bannerparaLi.eq(0).show(); function sliderLeft() { $bannerbdLi.each(function () { if ($(this).hasClass('current')) { index = $(this).index(); } }); if (index + 1 < endIndex) { $bannerbdLi.eq(index + 1).addClass('current'); $bannerbdLi.eq(index + 1).css({ "left": "100%", width: "0" }); $bannerbdLi.eq(index + 1).animate({ "left": "0", width: "100%" }, 800); setTimeout("$bannerbdLi.eq(index).removeClass('current')", 800); setTimeout("$bannerparaLi.hide();", 1000); setTimeout("$bannerparaLi.eq(index+1).show();", 1000); $bannerhdLi.removeClass('on').eq(index + 1).addClass('on'); } else { $bannerbdLi.eq(0).addClass('current'); $bannerbdLi.eq(0).css({ "left": "100%", width: "0" }); $bannerbdLi.eq(0).animate({ "left": "0", width: "100%" }, 800); $bannerbdLi.eq(index).removeClass('current'); setTimeout("$bannerparaLi.hide();", 1000); setTimeout("$bannerparaLi.eq(0).show();", 1000); $bannerhdLi.removeClass('on').eq(0).addClass('on'); } } function sliderRight() { $bannerbdLi.each(function () { if ($(this).hasClass('current')) { index = $(this).index(); } }); if (index - 1 > -2) { $bannerbdLi.eq(index - 1).addClass('current current-top'); $bannerbdLi.eq(index - 1).css({ width: "0" }); $bannerbdLi.eq(index - 1).animate({ width: "100%" }, 800); setTimeout("$bannerbdLi.eq(index).removeClass('current')", 800); setTimeout(" $bannerbdLi.removeClass('current-top')", 800); setTimeout("$bannerparaLi.hide();", 1000); setTimeout("$bannerparaLi.eq(index-1).show();", 1000); $bannerhdLi.removeClass('on').eq(index - 1).addClass('on'); } else { $bannerbdLi.eq(endIndex - 1).addClass('current'); $bannerbdLi.eq(endIndex - 1).css({ width: "0" }); $bannerbdLi.eq(endIndex - 1).animate({ width: "100%" }, 800); $bannerbdLi.eq(index).removeClass('current'); setTimeout("$bannerparaLi.hide();", 1000); setTimeout("$bannerparaLi.eq(0).show();", 1000); $bannerhdLi.removeClass('on').eq(endIndex - 1).addClass('on'); } } function sliderLeftIndex() { if (index + 1 < endIndex) { $bannerbdLi.eq(index + 1).addClass('current'); $bannerbdLi.eq(index + 1).css({ "left": "100%", width: "0" }); $bannerbdLi.eq(index + 1).animate({ "left": "0", width: "100%" }, 800); setTimeout("$bannerbdLi.removeClass('current')", 800); setTimeout("$bannerbdLi.eq(index+1).addClass('current')", 800); setTimeout("$bannerparaLi.hide();", 900); setTimeout("$bannerparaLi.eq(index+1).show();", 900); $bannerhdLi.removeClass('on').eq(index + 1).addClass('on'); } else { $bannerbdLi.eq(0).addClass('current'); $bannerbdLi.eq(0).css({ "left": "100%", width: "0" }); $bannerbdLi.eq(0).animate({ "left": "0", width: "100%" }, 800); $bannerbdLi.removeClass('current'); $bannerbdLi.eq(0).addClass('current'); setTimeout("$bannerparaLi.hide();", 900); setTimeout("$bannerparaLi.eq(0).show();", 900); $bannerhdLi.removeClass('on').eq(0).addClass('on'); } } function sliderRightIndex() { if (index - 1 > -2) { $bannerbdLi.eq(index - 1).addClass('current current-top'); $bannerbdLi.eq(index - 1).css({ width: "0" }); $bannerbdLi.eq(index - 1).animate({ width: "100%" }, 800); setTimeout("$bannerbdLi.removeClass('current')", 800); setTimeout("$bannerbdLi.eq(index-1).addClass('current current-top')", 800); setTimeout(" $bannerbdLi.removeClass('current-top')", 800); setTimeout("$bannerparaLi.hide();", 900); setTimeout("$bannerparaLi.eq(index-1).show();", 900); $bannerhdLi.removeClass('on').eq(index - 1).addClass('on'); } else { $bannerbdLi.eq(endIndex - 1).addClass('current'); $bannerbdLi.eq(endIndex - 1).css({ width: "0" }); $bannerbdLi.eq(endIndex - 1).animate({ width: "100%" }, 800); $bannerbdLi.removeClass('current'); $bannerbdLi.eq(endIndex - 1).addClass('current'); setTimeout("$bannerparaLi.hide();", 900); setTimeout("$bannerparaLi.eq(0).show();", 900); $bannerhdLi.removeClass('on').eq(endIndex - 1).addClass('on'); } } $bannerbdLi.eq(0).addClass('current'); var switchSliders = window.setInterval(sliderLeft, 5000); $bannerbdLi.hover(function () { window.clearInterval(switchSliders); }, function () { switchSliders = window.setInterval(sliderLeft, 5000); }); $bannerhdLi.click(function () { window.clearInterval(switchSliders); var myIndex = $('#banner .hd li.on').index(); var nowIndex = $(this).index(); if (nowIndex == myIndex) { return false; } if (nowIndex > myIndex) { index = nowIndex - 1; sliderLeftIndex(); } else { index = nowIndex + 1; sliderRightIndex(); } switchSliders = window.setInterval(sliderLeft, 5000); }); } function swiper() { var index = 1, len = $('.swiper-con li').size(), timer, str = ''; for (var i = 1; i <= len; i++) { if (i === 1) { str += '
  • '; } else { str += '
  • '; } } for (var i = 0; i < len; i++) { $('.swiper-con li').eq(i).css({ 'z-index': len - i }); } $('.swiper-list').append(str); var listWid = $(".swiper-list").width(); $(".swiper-list").css('margin-left', '-' + listWid / 2 + 'px'); $('.swiper').hover(function () { clearInterval(timer); }, function () { timer = setInterval(function () { play(index + 1); }, 5000); }).mouseleave(); $(".swiper-button-next").click(function () { play(index + 1); }).hover(function (e) { clearInterval(timer); }, function (e) { }); $(".swiper-button-prev").click(function () { play(index - 1); }).hover(function (e) { clearInterval(timer); }, function (e) { }); $('.swiper-list li').hover(function () { play($(this).index() + 1); }); function play(num) { if (!$('.swiper-con').is(':animated')) { if (num > len) { num = 1; } else if (num <= 0) { num = len; } index = num; $('.swiper-con li').eq(index - 1).show().siblings().hide(); $('.swiper-list li').eq(index - 1).addClass('on').siblings().removeClass('on'); } } } function bookingvalid() { var isOK = true; var arriveCity = $("#arrivecity").val(); if (arriveCity != undefined && arriveCity != "目的地不能为空" && arriveCity != "输入/选择目的地") { submitData.ArriveStr = arriveCity; } else { $("#arrivecity").parents('.fk').addClass('error-tips'); isOK = false; } var departCity = $("#departCity").val(); if (departCity != undefined && departCity != "出发地不能为空" && departCity != "输入/选择出发地") { submitData.DepartStr = departCity; } else { $("#departCity").parents('.fk').addClass('error-tips'); isOK = false; } var contactPhone = $("#contactPhone").val(); if (contactPhone != undefined && contactPhone != "输入手机/座机" && contactPhone != "联系方式必填哦" && contactPhone != "请填写手机/座机哦" && (rphone.test(contactPhone) || rtel.test(contactPhone))) { submitData.Contact = contactPhone; submitData.MemberPhone = contactPhone; } else { $("#contactPhone").parents('.fk').addClass('error-tips'); isOK = false; } var travalWayType = $("#TravelWayType").val(); if (travalWayType == '0') { $(".travelType").show(); isOK = false; } else { $(".travelType").hide(); } return isOK; } function InitDepartCity() { if (HeadStr != null && HeadStr.WebSiteB != undefined) { var AreaList = Array("华北", "华东", "华南", "华中", "西北", "西南", "东北", "出境"); var NavStr = ""; var DepartStr = ""; NavStr += "
  • 热门城市
  • "; DepartStr += ""; for (var i = 0; i < AreaList.length; i++) { var subStr = ""; jQuery.each(HeadStr.WebSiteB, function (n, sit) { if (sit.types == (i + 1)) { subStr += "
  • " + decodeURIComponent(sit.name) + "
  • "; } }); if (subStr.length > 0) { NavStr += "
  • " + AreaList[i] + "
  • "; DepartStr += "" } } if (NavStr != "") { $("#departcitynavigationlist").html(NavStr); if (DepartStr != "") { $("#departcitylist").html(DepartStr); } } } } function InitDestinagionCity() { var cityid = "1"; if (jQuery.cookie('the_city')) { cityid = jQuery.cookie('the_city'); } var chujing = ""; var jingnei = "";; var departCityList = DefaultJson.jsonStr; $(departCityList).each(function (c, item) { if (item.cityId == cityid) { var cityList = item.typeName; $(cityList).each(function (d, city) { if (city.type == "出境旅游") { var cityWordList = city.wordList; chujing += "

    " + city.displayName + "

    "; if (cityWordList.length > 0) { chujing += "
    "; $(cityWordList).each(function (e, showcity) { chujing += "" + showcity.name + ""; }); chujing += "
    " } } else if (city.type == "国内旅游") { var cityWordList = city.wordList; jingnei += "

    " + city.displayName + "

    "; if (cityWordList.length > 0) { jingnei += "
    "; $(cityWordList).each(function (e, showcity) { jingnei += "" + showcity.name + ""; }); jingnei += "
    " } } }); return false; } }); $("#jingneicitylist").html(chujing); $("#guoneicitylist").html(jingnei); } function autoResize() { var winHeight = window.screen.height; if (winHeight < 800) { $(".aoyou-sidebar2").addClass("small-sidebar"); } else { $(".aoyou-sidebar2").removeClass("small-sidebar"); } } function InitUserStatus() { $(".aoyou-sidebar2 .special").addClass('hidden'); if ($('.nav-right').length > 0) { jQuery.ajax({ type: "Get", url: $("#hidAsyRequestUrl").val() + "/CheckLogin", async: true, dataType: "jsonp", jsonp: "callback", success: function (json) { var topNavContainer = $('.nav-right'); if (json.loginOK) { topNavContainer.find(".aoyou-login").html("" + "您好," + json.loginUserName + "! " + "|"); topNavContainer.find(".aoyou-sign").html("[ 退出 ]"); if (json.atomPicUrl != "") { $(".aoyou-sidebar2 .special").removeClass('hidden'); $(".aoyou-sidebar2 .special img").attr("src", json.atomPicUrl); } } else { topNavContainer.find(".aoyou-login").html("登录|"); topNavContainer.find(".aoyou-sign").html("注册"); } } }); } }