123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- // 头部导航----------------------------
- $(function(){
- //demo示例六 通过id调取
- $('#demo06').navbarscroll({
- defaultSelect:0,
- scrollerWidth:6,
- fingerClick:1,
- endClickScroll:function(obj){
- // console.log(obj.text())
- }
- });
- });
- //--------------------------------------
- // 楼盘ajax切换--------------------------------
- // 页数
- var page = 0;
- // 每页展示5个
- var size = 5;
- var IdData = $('.m_switch li').eq(0).attr("dataid"); //默认传全国ID
- ajax_lp();
-
- $('.m_switch li').on('click',function(){
- var _this = $(this);
- page = 1;
- IdData = _this.attr("dataid");
- $('.dropload-down').remove();
- $.ajax({
- type: 'GET',
- url: '/timelimitsgroup/gethouselist',
- data:{id:IdData,page:page,limit:size,csrf_token_f:csrfToken},
- dataType: 'json',
- async:false,
- success: function(data){
- // Qalert(data.count);
- if (data.code == 200) {
- var data = data.data.data;
- if(data != null){
- console.log(data);
- var html = "";
- $('.m_lpList_box').html("");
- $.each(data, function (i, data) {
- html+= '<div class="m_lpList">';
- html+= '<div class="m_lpList_img">';
- html+= '<a href="/house/'+data.id+'/"><img src="'+data.thumb+'/pfgwatermark" alt=""></a>';
- html+= '<div class="m_lpList_xgsj c">';
- html+= '<div class="m_xgsj_title"><img src="/overseas/img/timelimitsgroup/lp_list3.png" alt=""><span>限时团购</span></div>';
- html+= '<div class="m_xgsj_time" start-time="'+data.start_time+'"></div>';
- html+= '<span class="m_xgsj_ms"></span>';
- html+= '</div>';
- html+= '<div class="m_lpList_gz">'+data.click+'人已关注</div>';
- html+= '<div class="m_lpList_qg">'+data.group_num+'人已抢<img src="/overseas/img/timelimitsgroup/lp_list6.png" alt=""></div>';
- html+= '</div>';
- html+= '<div class="m_lpList_text">';
- html+= '<div class="m_lpList_text_title c"><a href=""><img src="/overseas/img/timelimitsgroup/lp_list7.png" alt=""><span>'+data.name+'</span></a></div>';
- html+= '<div class="m_lpList_text_jzmj">建筑面积:'+data.main_units+'</div>';
- html+= '<div class="m_lpList_text_jg">';
- if(data.group_price!=null && data.group_price!=0 && data.group_price!=""){
- html+= '<em><i>¥'+data.group_price+'</i></em>';
- }else{
- html+= '<em><i>待定</i></em>';
- }
- if(data.sale_price!=null && data.sale_price!=0 && data.sale_price!=""){
- html+= '<span>¥'+data.sale_price+''+data.price_unit+'</span>';
- }
- html+= '</div>';
- html+= '<div class="m_lpList_text_style">';
- $.each(data.style,function(k,v){
- html +='<i>'+v+'</i>';
- })
- html+= '</div>';
- html+= '<div class="m_lpList_dh"><a href="tel:'+data.citytel+'"><img src="/image/index/tel_calltu.png" alt=""></a></div>';
- html+= '</div>';
- html+= '</div>';
- })
-
- $('.m_lpList_box').append(html);
- ajax_lp();
- $('.m_lpList').each(function(){
- var that = $(this);
- var timeid = that.find('.m_xgsj_time').attr('start-time');
- // console.log(timeid);
- setInterval(function(){
- let nowTime = new Date(timeid) - new Date;
- // console.log(nowTime);
- let minutes = parseInt(nowTime / 1000 / 60 % 60, 10);//计算剩余的分钟
- // console.log(minutes);
- let seconds = parseInt(nowTime / 1000 % 60, 10);//计算剩余的秒数
- minutes = checkTime(minutes);
- seconds = checkTime(seconds);
- let hours = parseInt(nowTime / ( 1000 * 60 * 60), 10); //计算剩余的小时
- hours = checkTime(hours);
- // 判断当前时间
- var Set_up = new Date(timeid);
- var current = new Date;
- if (Set_up > current) {
- that.find('.m_xgsj_time').html( '<i>'+hours+'</i> : <i>'+ minutes +'</i> : <i>'+seconds+'</i>');
- }else{
- that.find('.m_xgsj_time').html( '<i>00</i> : <i>00</i> : <i>00</i>');
- }
- },1000);
- function checkTime(i) { //将0-9的数字前面加上0,例1变为01
- if (i < 10) {
- i = "0" + i;
- }
- return i;
- }
- })
- }
- }
-
-
- }
- });
- $(document).scrollTop(0);
- })
- function ajax_lp(){
- $('.m_lpList_box').dropload({
- scrollArea : window,
- loadDownFn : function(me,da){
- $('.dropload-down').remove();
- page++;
- // 拼接HTML
- var html = '';
- $.ajax({
- type: 'GET',
- url: '/timelimitsgroup/gethouselist',
- data:{id:IdData,page:page,limit:size,csrf_token_f:csrfToken},
- // dataType: 'json',
- async:false,
- success: function(data){
- // Qalert(data.count);
- if (data.code == 200) {
- var data = data.data.data;
- if(data != null){
- console.log(data);
-
- $.each(data, function (i, data) {
- html+= '<div class="m_lpList">';
- html+= '<div class="m_lpList_img">';
- html+= '<a href="/house/'+data.id+'/"><img src="'+data.thumb+'/pfgwatermark" alt=""></a>';
- html+= '<div class="m_lpList_xgsj c">';
- html+= '<div class="m_xgsj_title"><img src="/overseas/img/timelimitsgroup/lp_list3.png" alt=""><span>限时团购</span></div>';
- html+= '<div class="m_xgsj_time" start-time="'+data.start_time+'"></div>';
- html+= '<span class="m_xgsj_ms"></span>';
- html+= '</div>';
- html+= '<div class="m_lpList_gz">'+data.click+'人已关注</div>';
- html+= '<div class="m_lpList_qg">'+data.group_num+'人已抢<img src="/overseas/img/timelimitsgroup/lp_list6.png" alt=""></div>';
- html+= '</div>';
- html+= '<div class="m_lpList_text">';
- html+= '<div class="m_lpList_text_title c"><a href=""><img src="/overseas/img/timelimitsgroup/lp_list7.png" alt=""><span>'+data.name+'</span></a></div>';
- html+= '<div class="m_lpList_text_jzmj">建筑面积:'+data.main_units+'</div>';
- html+= '<div class="m_lpList_text_jg">';
- if(data.group_price!=null && data.group_price!=0 && data.group_price!=""){
- html+= '<em><i>¥'+data.group_price+'</i></em>';
- }else{
- html+= '<em><i>待定</i></em>';
- }
- if(data.sale_price!=null && data.sale_price!=0 && data.sale_price!=""){
- html+= '<span>¥'+data.sale_price+''+data.price_unit+'</span>';
- }
- html+= '</div>';
- html+= '<div class="m_lpList_text_style">';
- $.each(data.style,function(k,v){
- html +='<i>'+v+'</i>';
- })
- html+= '</div>';
- html+= '<div class="m_lpList_dh"><a href="tel:'+data.citytel+'"><img src="/image/index/tel_calltu.png" alt=""></a></div>';
- html+= '</div>';
- html+= '</div>';
- })
- // 如果没有数据
- }
- }else{
- // 锁定
- me.lock();
- // 无数据
- me.noData();
- }
- $('.m_lpList_box').append(html);
- // 每次数据插入,必须重置
- me.resetload();
- $('.m_lpList').each(function(){
- var that = $(this);
- var timeid = that.find('.m_xgsj_time').attr('start-time');
- // console.log(timeid);
- setInterval(function(){
- let nowTime = new Date(timeid) - new Date;
- // console.log(nowTime);
- let minutes = parseInt(nowTime / 1000 / 60 % 60, 10);//计算剩余的分钟
- // console.log(minutes);
- let seconds = parseInt(nowTime / 1000 % 60, 10);//计算剩余的秒数
- minutes = checkTime(minutes);
- seconds = checkTime(seconds);
- let hours = parseInt(nowTime / ( 1000 * 60 * 60), 10); //计算剩余的小时
- hours = checkTime(hours);
- // 判断当前时间
- var Set_up = new Date(timeid);
- var current = new Date;
-
-
- if (Set_up > current) {
- that.find('.m_xgsj_time').html( '<i>'+hours+'</i> : <i>'+ minutes +'</i> : <i>'+seconds+'</i>');
- }else{
- that.find('.m_xgsj_time').html( '<i>00</i> : <i>00</i> : <i>00</i>');
- }
- },1000);
-
- function checkTime(i) { //将0-9的数字前面加上0,例1变为01
- if (i < 10) {
- i = "0" + i;
- }
- return i;
- }
- })
- },
- error: function(xhr, type){
- // alert('Ajax error!');
- // 即使加载出错,也得重置
- me.resetload();
- }
- });
- }
- });
- }
|