},500); } $('.line-details__idlink .reserve').click(function(){ _scrilltop(0); $('.line-details__start .start-date-op .select').addClass('bordercolor'); setTimeout(function(){ $('.line-details__start .start-date-op .select').removeClass('bordercolor'); },2000); }); //$(".line-details__list .bd li").length>10 ? $('.line-details__list').addClass('list-more') : ''; var ul_w=0; $(".line-details__list .bd li").each(function(index,el){ ul_w+=$(".line-details__list .bd li").eq(index).children('a').width()+30; }) ul_w>$(".line-details__list .bd .tempWrap").width() ? $('.line-details__list').addClass('list-more') : ''; console.log(ul_w); $('.line-details__list .bd ul').on('click','a',function(){ var _href=$(this).attr('data-href'); _scrilltop($('#'+_href).offset().top-70); //$(this).addClass('on').parent('li').siblings().children('a').removeClass('on'); }); $('.line-journey__brief ul').on('click','a',function(){ var _href=$(this).attr('data-href'); _scrilltop($('#'+_href).offset().top-70); }); // 滚动监听 $(window).scroll(function(e){ var $select=$('.line-details__start .select'); var $secon=$('.line-details__start .select-con'); $secon.hide(); var $idlink=$('.line-details__idlink'); var tops=$(document).scrollTop(); var $brief=$('.line-journey__brief'); var $jcon=$('.line-journey'); var $joconitem=$('.line-journey__con .item'); var $est=$('.line-journey').next(); var $li=$('.line-journey__brief .ul li'); var $tilte=$('.line-feature__title'); var item=[]; var item2=[]; for(var i=0;i<$joconitem.length;i++){ item.push($joconitem.eq(i).offset().top) } for(var i=0;i<$tilte.length;i++){ item2.push($tilte.eq(i).offset().top) } item.push(100000); item2.push(100000); for(var i=1;itops&&tops>item2[i-1]-100){ $idlink.find('li').siblings().children('a').removeClass('on'); $idlink.find('li').eq(i-1).children('a').addClass('on'); } } if(tops>=$idlink.offset().top){ $idlink.children('.idlink-con').addClass('line-details__fiexd'); }else{ $idlink.children('.idlink-con').removeClass('line-details__fiexd'); } if(tops>=($jcon.offset().top)&&tops<($est.offset().top-500)){ $brief.css('left',$brief.offset().left+'px').addClass('line-journey__fixed'); for(var i=1;itops&&tops>item[i-1]-1000){ $li.siblings().children('a,.icon').removeClass('on'); $li.eq(i-1).children('a,.icon').addClass('on'); return false; } } }else{ $brief.css('left','13px').removeClass('line-journey__fixed'); } }); //获取日历报价 function get_calendar(suitid,lineid) { $.ajax({ type: 'POST', url: SITEURL + 'line/ajax_line_suit_price_new', data: {suitid: suitid, lineid: lineid}, dataType: 'json', success: function (data) { // $(".line-details__date .line-slideTxtBox2 div").attr('style',''); if(data.length>0) { $(".line-details__date").show(); $(".line-details__date .line-slideTxtBox2 .bd .tempWrap").remove(); $(".line-details__date .line-slideTxtBox2 .bd ul").remove(); $(".line-details__date .line-slideTxtBox2 .bd").append(''); $(".line-details__date").show(); $('.line-slideTxtBox2 ul').timing({ 'cont': '.line-tb-tr', 'dates': '2019-7', 'arrays': data }); $(".line-slideTxtBox2").slide({ mainCell:".bd ul", effect:"left", vis:4, trigger:"click", pnLoop: false, prevCell: '.prev', nextCell: '.next' }); on_switch_month(); } else { $(".line-details__date").hide(); } } }); // showCalendar('calendar',suitid,function(){$(".calendar:first").css("margin-right","15px")},lineid); } //获取日历下拉列表 function get_date_list(suitid,lineid){ $.ajax({ type:'POST', url:SITEURL+'line/ajax_date_options', data:{suitid:suitid,lineid:lineid}, dataType:'json', success:function(data){ $('.date-list').empty(); var html = ''; if(data.list!='' && data.list.length>0){ $.each(data.list,function(i,row){ var people = ''; if(row.adultprice>0){ people+='¥'+row.adultprice+'/成人 '; } if(row.childprice>0){ people+='¥'+row.childprice+'/儿童 '; } if(row.oldprice>0){ people+='¥'+row.oldprice+'/老人 '; } if(row.people4_price>0){ people+='¥'+row.people4_price+'/ '; } if(row.people5_price>0){ people+='¥'+row.people5_price+'/ '; } if(row.people6_price>0){ people+='¥'+row.people6_price+'/ '; } /*if(i==0){ if(row.number==-1){ $('#adultnum').val(1); }else if(row.number>=1){ $('#adultnum').val(1); }else{ $('#adultnum').val(row.number); } }*/ html+='
  • '+row.shortdate+'('+row.weekday+')'+people+'
  • '; }) $("#data_list").css('height','160'); $(".book_btn").removeClass('off-reserve'); $(".start-date").show(); } else if(data.hasprice==0) { html+='
  • 请选择日期
  • '; $(".start-date-op .select .t").html('请选择出发日期'); $("#data_list").css('height','auto'); $(".book_btn").addClass('off-reserve'); $(".start-date").hide(); } else { html+='
  • 请选择日期
  • '; $(".start-date-op .select .t").html('请选择出发日期'); $("#data_list").css('height','auto'); $(".book_btn").addClass('off-reserve'); $(".start-date").hide(); } $('#data_list').html(html); $("#data_list li:first").trigger('click'); change_date(); } }) } }) //下拉日期改变 function change_date() { var obj = $(".start-date .select"); var adult = $(obj).attr('data-adult'); var child = $(obj).attr('data-child'); var old = $(obj).attr('data-old'); var room = $(obj).attr('data-room'); var people4 = $(obj).attr('data-people4'); var people5 = $(obj).attr('data-people5'); var people6 = $(obj).attr('data-people6'); var store = $(obj).data('store'); var adultnum = 1; if(store!=-1&&store<2) { adultnum = 1; } if(adult>0||child>0||old>0||room>0 || people4>0 || people5>0 || people6>0) { $('.start-pNumber').show(); $('.adult_num input').val(adultnum); $('.child_num input').val(0); $('.old_num input').val(0); $('.people4_num input').val(0); $('.people5_num input').val(0); $('.people6_num input').val(0); // $('.room_price .num-text').val(0); adult>0 ? $('.adult_num').show() : $('.adult_num').hide(); child>0 ? $('.child_num').show() : $('.child_num').hide(); old>0 ? $('.old_num').show() : $('.old_num').hide(); //room>0 ? $('.room_price').show() : $('.room_price').hide(); people4>0?$('.people4_num').show():$('.people4_num').hide(); people5>0?$('.people5_num').show():$('.people5_num').hide(); people6>0?$('.people6_num').show():$('.people6_num').hide(); $('.adult_num .price').text(CURRENCY_SYMBOL+adult); $('.child_num .price').text(CURRENCY_SYMBOL+child); $('.old_num .price').text(CURRENCY_SYMBOL+old); $('.people4_num .price').text(CURRENCY_SYMBOL+people4); $('.people5_num .price').text(CURRENCY_SYMBOL+people5); $('.people6_num .price').text(CURRENCY_SYMBOL+people6); // $('.room_price .h-label').text(CURRENCY_SYMBOL+room+'/人'); } else { $('.start-pNumber').hide(); } } function choose_day(obj) { var adult = $(obj).attr('data-adult'); var child = $(obj).attr('data-child'); var old = $(obj).attr('data-old'); var room = $(obj).attr('data-room'); var people4 = $(obj).attr('data-people4'); var people5 = $(obj).attr('data-people5'); var people6 = $(obj).attr('data-people6'); var sel = $(".start-date .select"); sel.attr('data-adult',$(obj).attr('data-adult')); sel.attr('data-child',$(obj).attr('data-child')); sel.attr('data-old',$(obj).attr('data-old')); sel.attr('data-people4',$(obj).attr('data-people4')); sel.attr('data-people5',$(obj).attr('data-people5')); sel.attr('data-people6',$(obj).attr('data-people6')); sel.text($(obj).attr('data-shortdate')); sel.attr('data-date',$(obj).attr('data-time')); change_date(); } function on_switch_month() { $(".tuanqi[data-time='"+$('.start-date .select').attr('data-date')+"']").addClass('on').siblings().removeClass('on'); }