$('.t_con').css('display', 'none'); var html_li='<p class="title"></p>'; $('.header_con').append(html_li); $('.header_con .title').css('display','none'); var topTypeId = ''; var isBrand = 0; var secTypeId = ''; var pageSize = 10; var page = 1; var lxy_num = 0; var header_class = ''; var nav_class = ''; var lxy_top = ''; var isjiazai = 1; function lxy_(topTypeId, secTypeId, page, pageSize) { if(isjiazai == 0) { return; } else { isjiazai = 0; } var lxy_data_ = { topTypeId: topTypeId ? topTypeId : '', secTypeId: secTypeId ? secTypeId : '', isBrand:isBrand, page: page ? page : 1, pageSize: pageSize ? pageSize : 10 } mui.ajax(kxUrl('addon/hyhlimitactive-Hyhlimitactive-actGoodsList'), { data: lxy_data_, dataType: 'json', //服务器返回json格式数据 type: 'post', //HTTP请求类型 timeout: 10000, //超时时间设置为10秒; success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功; // console.log(data.data.goodsFavoritesNum) // console.log(data.data.Rows) // var data = toJson(data); var data = data.data var html = ''; if(data.Rows == '') { if(page==1){ $('#recommend_con').html('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;margin-top:20px;">没有更多商品</p>'); }else{ $('#recommend_con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;margin-top:20px;">没有更多商品</p>'); } isjiazai = 0; return; } $.each(data.Rows, function() { html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId + '"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) + '" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display: none;">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice + ' <span style="display:none;">满减</span></div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div><img class="icon_icon" src="../img/icon_sscl.png"alt=""style="display:none;"/></div>' }); if(page == 1) { $('#recommend_con').html(html); } else { $('#recommend_con').append(html); } isjiazai = 1; $('.rcb_img').height($('.rcb_img').width()); }, error: function(xhr, type, errorThrown) { //异常处理; //alert(type); } }); } mui.plusReady(function() { var self = plus.webview.currentWebview(); var adUrl = self.adURLId; if(adUrl.indexOf('brandId') >= 0){ isBrand = 1; } topTypeId = self.adURLId.split('=')[1]; // console.log(topTypeId) if(topTypeId == '45' && isBrand == 0) { lxy_num = 0; } else if(topTypeId == '46' && isBrand == 0) { lxy_num = 1; } else if(topTypeId == '47' && isBrand == 0) { lxy_num = 2; } else if(topTypeId == '48' && isBrand == 0) { lxy_num = 3; } else if(topTypeId == '49' && isBrand == 0) { lxy_num = 4; } else if(topTypeId == '50' && isBrand == 0) { lxy_num = 5; } else { lxy_num = null; } if(lxy_num == null) { $('.header_con .title').css('display','block'); $('.mui-action-back').css('color','black'); } else { header_class = 'header' + lxy_num; nav_class = 'lxy' + lxy_num; lxy_top = 'top' + lxy_num; $('.header').addClass(header_class); var html_lxy = '<img src="'+ hyhImgUrl('static/app2/img/family_log_' + topTypeId + '.png') +'" class="oc_logo" />'; $('.header_con').append(html_lxy); $('#timer_swiper .nav').addClass(nav_class); $('.top').addClass(lxy_top); } mui.ajax(kxUrl('addon/hyhlimitactive-Hyhlimitactive-actList'), { data: { topTypeId: topTypeId, isBrand:isBrand }, dataType: 'json', //服务器返回json格式数据 type: 'post', //HTTP请求类型 timeout: 10000, //超时时间设置为10秒; success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功; // console.log(data.data.goodsFavoritesNum) // console.log(data.data.Rows) // var data = toJson(data); if(data.status == 1) { // console.log(isBrand+JSON.stringify(data) ); var data = data.data var html = ''; var len = 0; $.each(data.lists, function(num) { html += '<div class="swiper-slide nav_block" data-secTypeId="' + this.secTypeId + '"><p class="p1">' + this.secTypeName + '</p></div>'; len = num + 1; }); $('.nav').html(html); $('.header_con .title').html(data.title); $('.nav_block').eq(0).addClass('on'); if(len == 0) { // mui.back(); } else if(len == 1) { } else { $('.t_con').css('display', 'block'); } if(len > 5) { len = 4.5 } else { len = len; } var swiper = new Swiper('#timer_swiper', { slidesPerView: len, paginationClickable: true, spaceBetween: 0, freeMode: true }); secTypeId = $('.nav_block').eq(0).attr('data-secTypeId'); lxy_(topTypeId, secTypeId, 1, 10); } }, error: function(xhr, type, errorThrown) { //异常处理; //alert(type); } }); mui('.nav').on('tap', '.nav_block', function() { secTypeId = $(this).attr('data-secTypeId'); isjiazai = 1; page = 1; lxy_(topTypeId, secTypeId, page, 10); }) document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) { if(scroll.y == scroll.maxScrollY) { if(isjiazai == 1) { page++; lxy_(topTypeId, secTypeId, page, pageSize); } } }) })