}); function get_line(page){ var start_city = $('#start_city').val(); var dest_city = $('#dest_city').val(); var supper_id = $('#supper_id').val(); var ship_id = $('#ship_id').val(); var date = $('#date').val(); $.post(SITEURL+'ship/ajax_list_data',{'start_city':start_city,'dest_city':dest_city,'supper_id':supper_id,'ship_id':ship_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'); } //条件数据切换 function check_ship_data(type){ var _id = $('#'+type).val(); $.post(SITEURL+'ship/get_next_data',{'id':_id,'type':type},function (data){ if(data.status){ if(type == 'supper_id'){ var html = '全部'; if(data.list){ $.each(data.list,function(index,item){ html += ''+item.title+''; }); } $('#supplier_ship').html(html); if(ship_id == 0){ $('.ship_id').remove(); $('#ship_id').val(''); }else{ if(ship_id > 0){ $('#ship_id_'+ship_id).click(); } } ship_id = 0; }else{ if(data.count > 0){ if(type == 'start_city'){ var html = '全部'; $.each(data.list,function(index,item){ html += ''+item.kindname+''; }); $('#start_list').html(html); } if(type == 'dest_city'){ var html = '全部'; $.each(data.list,function(index,item){ html += ''+item.kindname+''; }); $('#dest_list').html(html); } } } }else{ layer.msg(data.msg); return false; } },'json'); }