$(document).ready(function(){ /*$("body").click(function(event){ var X = $('#zhandian-go').offset().left; var Y = $('#zhandian-go').offset().top; var pageX = event.pageX; var pageY = event.pageY; if(pageX==undefined) { pageX=event.clientX+document.body.scrollLeft||document.documentElement.scrollLeft; } if(pageY==undefined) { pageY = event.clientY+document.body.scrollTop||document.documentElement.scrollTop; } if (pageX < X || pageX > X+570 || pageY < Y-30 || pageY > Y+350) { $('#zhandian-go').hide(); } }); $("body").click(function(event){ var X = $('#zhandian-return').offset().left; var Y = $('#zhandian-return').offset().top; var pageX = event.pageX; var pageY = event.pageY; if(pageX==undefined) { pageX=event.clientX+document.body.scrollLeft||document.documentElement.scrollLeft; } if(pageY==undefined) { pageY = event.clientY+document.body.scrollTop||document.documentElement.scrollTop; } if (pageX < X || pageX > X+570 || pageY < Y-30 || pageY > Y+350) { $('#zhandian-return').hide(); } });*/ //详情booth图片 $("#detail-nav-0").hover(function(){ $("#detail-slder-0").show(); $("#detail-slder-0").siblings().hide(); }); $("#detail-nav-1").hover(function(){ $("#detail-slder-1").show(); $("#detail-slder-1").siblings().hide(); }); $("#detail-nav-2").hover(function(){ $("#detail-slder-2").show(); $("#detail-slder-2").siblings().hide(); }); $("#detail-nav-3").hover(function(){ $("#detail-slder-3").show(); $("#detail-slder-3").siblings().hide(); }); $("#detail-nav-4").hover(function(){ $("#detail-slder-4").show(); $("#detail-slder-4").siblings().hide(); }); $("#detail-nav-5").hover(function(){ $("#detail-slder-5").show(); $("#detail-slder-5").siblings().hide(); }); //选项卡切换 $(".detail-info-tab li a").click(function(){ $(this).parent().removeClass("li"); $(this).parent().addClass("li-actived") $(this).parent().siblings().removeClass("li-actived"); $(this).parent().siblings().addClass("li"); $(this).parent().siblings().children("a").css("color", "#4b4946"); $(this).css("color", "white"); }); $("#tab-a-1").click(function(){ $(".price-contain").show(); $(".xuzhi-contain").hide(); $(".xiangqing-contain").hide(); $(".comment-contain").hide(); }); $("#tab-a-2").click(function(){ $(".price-contain").hide(); $(".xuzhi-contain").show(); $(".xiangqing-contain").hide(); $(".comment-contain").hide(); }); $("#tab-a-3").click(function(){ $(".price-contain").hide(); $(".xuzhi-contain").hide(); $(".xiangqing-contain").show(); $(".comment-contain").hide(); }); $("#tab-a-4").click(function(){ $(".price-contain").hide(); $(".xuzhi-contain").hide(); $(".xiangqing-contain").hide(); $(".comment-contain").show(); }); //提示票价类型 $(".detail-item").mouseover(function(){ $(this).css("background-color", "#fff3d9"); $(this).find(".half-tip").show(); $(this).find($(".half-txt")).show(); }); $(".detail-item").mouseleave(function(){ $(this).css("background-color", "white"); $(this).children(".half-tip").hide(); $(this).children("p").hide(); }); //关闭兑换窗口 $(".exchange-div-close").click(function(){ $(this).parent().hide(); $(".cover").hide(); }); $("#lackof .cfm-btn").click(function(){ $(this).parent().parent().hide(); $(".cover").hide(); }); //提示票数 /*$(".cfm-bottom").click(function(){ location.href = "order.html?num_1=10"; alert("全票人数:" + num_1 +"半票人数:" + num_2 + "免票人数:" +num_3+"。"); })*/ // 订单页开始----------------------------------------------------------------------------------------- //去程选中车次 $('#order-go input[name="checi_go"]').click(function(){ if (!$(this).attr("checked")) { $(this).parent().css("background-color", "#ff7900"); $(this).parent().parent().find(".order-item-hidden").show(); $(this).parent().parent().siblings().find(".order-item-hidden").hide(); $(this).parent().parent().siblings().find(".checi-bottom").css("background-color", "#66ba00"); } }); //返程选中车次 $('#order-return input[name="checi_return"]').click(function(){ if (!$(this).attr("checked")) { $(this).parent().css("background-color", "#ff7900"); $(this).parent().parent().find(".order-item-hidden").show(); $(this).parent().parent().siblings().find(".order-item-hidden").hide(); $(this).parent().parent().siblings().find(".checi-bottom").css("background-color", "#66ba00"); } }); $(".meta-buynow").click(function(){ $(".price-contain").show(); $(".xuzhi-contain").hide(); $(".xiangqing-contain").hide(); $(".comment-contain").hide(); }); $("#tab-a-1").parent().removeClass("li"); $("#tab-a-1").parent().addClass("li-actived"); $("#tab-a-1").parent().siblings().removeClass("li-actived"); $("#tab-a-1").parent().siblings().addClass("li"); $("#tab-a-1").parent().siblings().children("a").css("color", "#4b4946"); $("#tab-a-1").css("color", "white"); $(".submit-order").click(function(){ location.href = "pay.html"; }); // 订单页结束----------------------------------------------------------------------------------------- //景区快线幻灯片 var le = -768; function movele() { $(".kuaixian-sliders").hide(); $(".kuaixian-sliders").css("left",le+"px"); $(".kuaixian-sliders").fadeIn(800); if (le==0) { $("#kuaixian-li-1").removeClass("kuaixian-li"); $("#kuaixian-li-1").addClass("kuaixian-li-active"); $("#kuaixian-li-1").siblings().removeClass("kuaixian-li-active"); $("#kuaixian-li-1").siblings().addClass("kuaixian-li"); } if (le==-768) { $("#kuaixian-li-2").removeClass("kuaixian-li"); $("#kuaixian-li-2").addClass("kuaixian-li-active"); $("#kuaixian-li-2").siblings().removeClass("kuaixian-li-active"); $("#kuaixian-li-2").siblings().addClass("kuaixian-li"); } if (le==-1536) { $("#kuaixian-li-3").removeClass("kuaixian-li"); $("#kuaixian-li-3").addClass("kuaixian-li-active"); $("#kuaixian-li-3").siblings().removeClass("kuaixian-li-active"); $("#kuaixian-li-3").siblings().addClass("kuaixian-li"); } if (le==-2304) { $("#kuaixian-li-4").removeClass("kuaixian-li"); $("#kuaixian-li-4").addClass("kuaixian-li-active"); $("#kuaixian-li-4").siblings().removeClass("kuaixian-li-active"); $("#kuaixian-li-4").siblings().addClass("kuaixian-li"); } if(le > -2304) { le = le - 768; } else{ le = 0; } } setInterval(movele,6000); $(".kuaixian-sliders-contain-list li").click(function(){ $(this).removeClass("kuaixian-li"); $(this).addClass("kuaixian-li-active"); $(this).siblings().removeClass("kuaixian-li-active"); $(this).siblings().addClass("kuaixian-li"); if( $(this).is('#kuaixian-li-1')) { $(".kuaixian-sliders").hide(); $(".kuaixian-sliders").css("left","0"); $(".kuaixian-sliders").fadeIn(); } if( $(this).is('#kuaixian-li-2')) { $(".kuaixian-sliders").hide(); $(".kuaixian-sliders").css("left","-768px"); $(".kuaixian-sliders").fadeIn(); } if( $(this).is('#kuaixian-li-3')) { $(".kuaixian-sliders").hide(); $(".kuaixian-sliders").css("left","-1536px"); $(".kuaixian-sliders").fadeIn(); } if( $(this).is('#kuaixian-li-4')) { $(".kuaixian-sliders").hide(); $(".kuaixian-sliders").css("left","-2304px"); $(".kuaixian-sliders").fadeIn(); } }) //单程 返程 里程兑换 $('.search-panel-main #return').click(function(){ $("#return-date-div").show(); $("#duihuan-p").hide(); $("#oneway-p").hide(); }); $('.search-panel-main #go').click(function(){ if (!$(this).attr("checked")) { $("#return-date-div").hide(); $("#duihuan-p").hide(); $("#oneway-p").show(); } }); $('.search-panel-main #duihuan').click(function(){ if (!$(this).attr("checked")) { $("#return-date-div").hide(); $("#duihuan-p").show(); $("#oneway-p").hide(); } }); $("#radio-date-go").click(function(){ $("#return-span").hide(); }) $("#radio-date-return").click(function(){ $("#return-span").show(); }) //出发站 到达站选择 $("#chufazhan").focus(function(){ $("#zhandian-go").show(); $("#zhandian-return").hide(); }) $("#daodazhan").focus(function(){ $("#zhandian-return").show(); $("#zhandian-go").hide(); }) $("#zhandian-go .zhandian-main span").click(function(){ $("#chufazhan").val($(this).text()); $("#chufazhanId").val($(this).attr("tag")); $("#zhandian-go").hide(); if ($("#daodazhan").val()) { initDate() } }) $("#zhandian-return .zhandian-main span").click(function(){ $("#daodazhan").val($(this).text()); $("#daodazhanId").val($(this).attr("tag")); $("#zhandian-return").hide(); if ($("#chufazhan").val()) { initDate(); } }); function initDate(){ var chufazhanId = $("#chufazhanId").val(); var daodazhanId = $("#daodazhanId").val(); // 出发日期数据 $.ajax({ //要用post方式 type: "Post", url: vm.basePath + "/pro/validSchedule?beginStationId="+chufazhanId+"&endStationId="+daodazhanId, contentType: "application/json; charset=utf-8", dataType: "json", success: function(json) { goVaildDate = json.obj; tempGoVaildDate = goVaildDate; }, error: function(err) { } }); // 返回日期数据 $.ajax({ //要用post方式 type: "Post", url: vm.basePath + "/pro/validSchedule?beginStationId="+daodazhanId+"&endStationId="+chufazhanId, contentType: "application/json; charset=utf-8", dataType: "json", success: function(json) { backVaildDate = json.obj; tempBackVaildDate = backVaildDate; $("#date-go-disabled").hide();//激活日期 $("#date-go").show();//激活日期 $("#date-return-disabled").hide();//激活日期 $("#date-return").show();//激活日期 $("#date-go").datepicker({ beforeShowDay:vaildDate, onChangeMonthYear:findNewMonthDate, onClose : dateToTemp, onSelect : tempToDate, minDate: 0 }); $("#date-return").datepicker({ beforeShowDay:vaildDateBack, onChangeMonthYear:findNewMonthDateBack, onClose : dateToTemp, onSelect : tempToDate, minDate: 0 }); }, error: function(err) { } }); } function dateToTemp(){ tempGoVaildDate = goVaildDate; tempBackVaildDate = backVaildDate; } function tempToDate(){ goVaildDate = tempGoVaildDate; backVaildDate = tempBackVaildDate; } function findNewMonthDate(year,month){ var chufazhanId = $("#chufazhanId").val(); var daodazhanId = $("#daodazhanId").val(); loading_now(); $.ajax({ //要用post方式 type: "Post", async:false,//使用同步的Ajax请求 url: vm.basePath + "/pro/validSchedule?beginStationId="+chufazhanId+"&endStationId="+daodazhanId + "&year="+year+"&month="+month, contentType: "application/json; charset=utf-8", dataType: "json", success: function(json) { tempGoVaildDate = json.obj; loading_end(); }, error: function(err) { } }); } function findNewMonthDateBack(year,month){ var chufazhanId = $("#chufazhanId").val(); var daodazhanId = $("#daodazhanId").val(); loading_now(); $.ajax({ //要用post方式 type: "Post", async:false,//使用同步的Ajax请求 url: vm.basePath + "/pro/validSchedule?beginStationId="+daodazhanId+"&endStationId="+chufazhanId + "&year="+year+"&month="+month, contentType: "application/json; charset=utf-8", dataType: "json", success: function(json) { tempBackVaildDate = json.obj; loading_end(); }, error: function(err) { } }); } function vaildDate(date){ var d = date.getDate(); if($.inArray(d, tempGoVaildDate)!=-1){ return [true]; } return [false]; } function vaildDateBack(date){ var d = date.getDate(); if($.inArray(d, tempBackVaildDate)!=-1){ return [true]; } return [false]; } $(".huan").click(function(){ var huan; var huanId; huan = $("#chufazhan").val(); $("#chufazhan").val($("#daodazhan").val()); $("#daodazhan").val(huan); huanId = $("#chufazhanId").val(); $("#chufazhanId").val($("#daodazhanId").val()); $("#daodazhanId").val(huanId); }) $("#express-panel-li").click(function(){ $("#taopiao-caption").hide(); $("#days-div").hide(); $("#return-date-div").show(); $("#travel-type-select").show(); $("#duihuan-label").show(); $(this).addClass("panel-li-selected"); $(this).siblings().removeClass("panel-li-selected"); $("#searchType").val('1'); }) $("#taopiao-panel-li").click(function(){ $("#taopiao-caption").show(); $("#days-div").show(); $("#return-date-div").hide(); $("#travel-type-select").hide(); $(this).addClass("panel-li-selected"); $(this).siblings().removeClass("panel-li-selected"); $("#searchType").val('2'); }) $("#chepiao-panel-li").click(function(){ $("#taopiao-caption").hide(); $("#days-div").hide(); $("#duihuan-label").hide(); $("#return-date-div").show(); $("#travel-type-select").show(); $(this).addClass("panel-li-selected"); $(this).siblings().removeClass("panel-li-selected"); $("#searchType").val('3'); }) //商品选择面板 $(".select-line span").click(function(){ $(this).addClass("selected"); $(this).siblings().removeClass("selected"); }) //商品跳转到详情页 // $(".product").click(function(){ // location.href="detail.html" // }) // 商品排序 样式部分 $(".product-rank span").click(function(){ $(this).addClass("rank-active"); $(this).removeClass("rank-normal"); $(this).siblings().addClass("rank-normal"); $(this).siblings().removeClass("rank-active"); }) $("#xiaoliang-xia").click(function(){ $(this).hide(); $("#xiaoliang-shang").show(); $("#xiaoliang-shang").addClass("rank-active"); }) $("#xiaoliang-shang").click(function(){ $(this).hide(); $("#xiaoliang-xia").show(); $("#xiaoliang-xia").addClass("rank-active"); }) $("#jiage-xia").click(function(){ $(this).hide(); $("#jiage-shang").show(); $("#jiage-shang").addClass("rank-active"); }) $("#jiage-shang").click(function(){ $(this).hide(); $("#jiage-xia").show(); $("#jiage-xia").addClass("rank-active"); }) });