Filter').on('click', '.search-item .item', function (e) { var hasClass = $(this).hasClass('on') if (!hasClass) { $(this).addClass('on').siblings().removeClass('on') } }) // 选择日期 $('#productDateGroup').on('click', '.item', function () { $(this).addClass('active').siblings().removeClass('active'); var date = $(this).attr('data-date'); $('#date').val(date); get_line(); }); var calendarTemp = `
以下价格为1成人起价,计价可能有延迟,请以下单时为准
` // 日历数据 var calendarData = [{"date":"2024-07-19","price":1069,"week":"\u5468\u4e94","day":"07-19"},{"date":"2024-07-20","price":699,"week":"\u5468\u516d","day":"07-20"},{"date":"2024-07-21","price":969,"week":"\u5468\u65e5","day":"07-21"},{"date":"2024-07-26","price":1069,"week":"\u5468\u4e94","day":"07-26"},{"date":"2024-07-27","price":699,"week":"\u5468\u516d","day":"07-27"},{"date":"2024-07-28","price":969,"week":"\u5468\u65e5","day":"07-28"},{"date":"2024-08-03","price":1029,"week":"\u5468\u516d","day":"08-03"},{"date":"2024-08-04","price":1099,"week":"\u5468\u65e5","day":"08-04"},{"date":"2024-08-05","price":1409,"week":"\u5468\u4e00","day":"08-05"},{"date":"2024-08-09","price":1029,"week":"\u5468\u4e94","day":"08-09"},{"date":"2024-08-10","price":1029,"week":"\u5468\u516d","day":"08-10"},{"date":"2024-08-11","price":1099,"week":"\u5468\u65e5","day":"08-11"},{"date":"2024-08-12","price":1159,"week":"\u5468\u4e00","day":"08-12"},{"date":"2024-08-17","price":1029,"week":"\u5468\u516d","day":"08-17"},{"date":"2024-08-18","price":1099,"week":"\u5468\u65e5","day":"08-18"},{"date":"2024-08-19","price":1159,"week":"\u5468\u4e00","day":"08-19"},{"date":"2024-08-24","price":1029,"week":"\u5468\u516d","day":"08-24"},{"date":"2024-08-25","price":1099,"week":"\u5468\u65e5","day":"08-25"},{"date":"2024-08-26","price":1159,"week":"\u5468\u4e00","day":"08-26"},{"date":"2024-08-31","price":1299,"week":"\u5468\u516d","day":"08-31"},{"date":"2024-10-13","price":1198,"week":"\u5468\u65e5","day":"10-13"}]; $('#moreDateCalendar').click(function () { var layerCalendar = layer.open({ title: false, content: calendarTemp, area: ['900px', '684px'], btn: [], success: function () { // 更多日历 var myCalendarDate = $('#calendarContainer').CalendarDate({ month: 6, // 显示月份数量 data: calendarData, // 基础数据 switchMode: 2, // 两种展示方式 1=>首页展示方式 2 => 普通日历展示 onClickPrev: function (data) { // 上一月回调 }, onClickNext: function (data) { // 下一月回调 }, onClickDownSelect: function (data) { // 下拉选择回调 }, onClickDate: function (data) { // click回调 $('#productDateGroup li').each(function (index,item){ if(index == ($('#productDateGroup li').length - 1)){ $(this).addClass('active').siblings().removeClass('active'); $(this).attr('data-date',data.date); $(this).find('.num').html(data.price); $(this).find('.txt').html(data.day+' '+data.week); $('#date').val(data.date); get_line(); } }); layer.close(layerCalendar) } }) } }) }); $(document).on('click','.condition',function(){ if(!$(this).hasClass('on')){ $(this).addClass('on').siblings().removeClass('on'); } //获取属性数据 var data_name = $(this).attr('data-type'); var data_val = $(this).attr('data-id'); //赋值 var title = $(this).html(); var _item_id = ''; $('#'+data_name).val(data_val); _item_id = data_name+'_'+data_val; //条件处理 if($('#co_'+_item_id).length == 0){ var html = ''+title+''; $('.'+data_name).remove(); $('.clear').before(html); } get_line(); }).on('click','.icon-close',function (){ var _this = $(this).parent(); var data_pid = _this.attr('data-pid'); var data_name = $('#'+data_pid).attr('data-name'); $('#'+data_name).val(''); $('#'+data_pid).removeClass('on'); $('#'+data_name+'_0').addClass('on'); _this.remove(); get_line(); }).on('click','.clear',function(){ $('.icon-close').each(function(){ var _this = $(this).parent(); var data_pid = _this.attr('data-pid'); var data_type = $('#'+data_pid).attr('data-type'); var data_name = $('#'+data_pid).attr('data-name'); $('#'+data_type).val(''); $('#'+data_pid).removeClass('on'); $('#'+data_name+'_0').addClass('on'); _this.remove(); get_line(); }); }); if(dest_id > 0){ $('#dest_city_'+dest_id).click(); } if(start_id > 0){ $('#start_city_'+start_id).click(); } if(supplier_id > 0){ $('#supper_id_'+supplier_id).click(); } get_line(); }); function get_line(page){ var start_city = $('#start_city').val(); var dest_city = $('#dest_city').val(); var supper_id = $('#supper_id').val(); var date = $('#date').val(); $.post(SITEURL+'ship/ajax_list_data',{'start_city':start_city,'dest_city':dest_city,'supper_id':supper_id,'page':page,'date':date},function (data){ var html = ''; if(data.status){ $.each(data.list,function(index,item){ html += '
  • '; html += '
    '+item.ship_name+'
    '; html += '
    '; html += '
    '; html += ''+item.start_time+''; html += ''+item.startcity_text+''; html += '
    '; html += '
    '; html += ''+item.day_num+'天'+item.night+'晚'; html += '
    '; html += '单程'; html += '
    '; html += '
    '; html += ''+item.end_time+''; html += ''+item.finaldest_text+''; html += '
    '; html += '
    '; html += ''; html += ''+item.price+'人/起'; html += ''; html += '立即预订'; html += '
    '; html += '
    '; html += '
  • '; }); $('#line_list_data').html(html); if(data.total > 0){ let pages = Math.ceil(data.total/data.page_size); //翻页 laypage({ cont: $('#page'), pages: pages, skip: false, skin: '#00468c', groups: pages > 5 ? 5 : pages, first: '首页', last: '尾页', curr: location.hash.replace('#!fenye=', ''), //获取起始页 hash: 'fenye', //自定义hash值 jump: function(p, first){ //obj包含了当前分页的所有参数,比如: //console.log(p.curr); //得到当前页,以便向服务端请求对应页的数据。 //首次不执行 if(!first){ get_line(p.curr); } } }); }else{ $('#page').html(''); } } },'json'); }