123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- // 头部导航----------------------------
- $(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>';
- if (data.panorama != 0 && data.panorama != '' && data.panorama != null && data.panorama != undefined) {
- html += '<img class="m_lpList_vr" src="/image/lp_vr.png" alt="">';
- }
- 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="/house/' + data.id + '"><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 += '<i style="position:absolute;top:87px;right:155px;font-size: 12px; size:16px;color:#c2bfbf;">有效期:2018/12/01-2020/03/01</i>';
- 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);
- let nowTime = new Date(timeid) - new Date;
- let minutes = parseInt(nowTime / 1000 / 60 % 60, 10);//计算剩余的分钟
- let seconds = parseInt(nowTime / 1000 % 60, 10);//计算剩余的秒数
- minutes = checkTime(minutes);
- seconds = checkTime(seconds);
- let days = parseInt(nowTime / 1000 / 60 / 60 / 24, 10); //计算剩余的天数
- let hours = parseInt(nowTime / 1000 / 60 / 60 % 24, 10); //计算剩余的小时
- days = checkTime(days);
- hours = checkTime(hours);
- // document.getElementById('m_time').innerHTML=days + "天" + hours + "小时" + minutes + "分" + seconds + "秒";
- // 判断当前时间
- var Set_up = new Date(timeid);
- var current = new Date;
- if (Set_up > current) {
- that.find('.m_xgsj_time').html('<i>' + days + '</i> 天 <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> 分 <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>';
- if (data.panorama != 0 && data.panorama != '' && data.panorama != null && data.panorama != undefined) {
- html += '<img class="m_lpList_vr" src="/image/lp_vr.png" alt="">';
- }
- 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="/house/' + data.id + '"><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 += '<i style="position:absolute;top:87px;right:155px;font-size: 12px; size:16px;color:#c2bfbf;">有效期:2018/12/01-2020/03/01</i>';
- 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();
- }
- // 处理资讯详情页面的底部一个月的有效日期
- var myDate = new Date;
- var year = myDate.getFullYear(); //获取当前时间年份
- var yue = myDate.getMonth() + 1;//获取当前时间月份
- if (yue < 10) {
- yue = '0' + yue;
- } else if (yue == 13) {
- yue = '01';
- }
- ;
- // 返回下个月有多少天数
- function mGetDate(yue) {
- var date = new Date();
- var year = date.getFullYear();
- var d = new Date(year, parseInt(yue), 0);
- return d.getDate();
- }
- var htmltime = year + '/' + yue + '/' + '01' + '-' + year + '/' + yue + '/' + mGetDate(yue);
- $('.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);
- let nowTime = new Date(timeid) - new Date;
- let minutes = parseInt(nowTime / 1000 / 60 % 60, 10);//计算剩余的分钟
- let seconds = parseInt(nowTime / 1000 % 60, 10);//计算剩余的秒数
- minutes = checkTime(minutes);
- seconds = checkTime(seconds);
- let days = parseInt(nowTime / 1000 / 60 / 60 / 24, 10); //计算剩余的天数
- let hours = parseInt(nowTime / 1000 / 60 / 60 % 24, 10); //计算剩余的小时
- days = checkTime(days);
- hours = checkTime(hours);
- // document.getElementById('m_time').innerHTML=days + "天" + hours + "小时" + minutes + "分" + seconds + "秒";
- // 判断当前时间
- var Set_up = new Date(timeid);
- var current = new Date;
- if (Set_up > current) {
- that.find('.m_xgsj_time').html('<i>' + days + '</i> 天 <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> 分 <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();
- }
- });
- }
- });
- }
|