2019-09-06 23:53:10 +08:00

73 lines
2.6 KiB
JavaScript
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

$('.title').html('更多');
document.write('<link rel="stylesheet" type="text/css" href="' + localStorage.getItem("cssUrl") + 'recommend.css?ver=' + localStorage.getItem("version") + '"/>');
document.write('<script type="text/javascript" src="' + localStorage.getItem("jsUrl") + 'recommend.js?ver=' + localStorage.getItem('version') + '"></scr' + 'ipt>');
var page = 1;
var pageSize = 10;
var isjiazai = 1;
function getData(page, pageSize) {
if(isjiazai == 0) {
return;
} else {
isjiazai = 0;
}
var data_ = {
page: page ? page : 1,
pageSize: pageSize ? pageSize : 10
}
mui.ajax(llUrl('addon/selfmarket-selfmarket-selfMore'), { 
data: 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) {
$('.con_').html('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;margin-top:20px;">没有更多商品</p>');
} else {
$('.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: inline-block;">自营</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) {
$('.con_').html(html);
} else {
$('.con_').append(html);
}
isjiazai = 1;
$('.rcb_img').height($('.rcb_img').width());
},
error: function(xhr, type, errorThrown) {           //异常处理;  
//alert(type);    
}  
}); 
}
mui.plusReady(function() {
getData(page, pageSize);
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
if(isjiazai == 1) {
page++;
getData(page, pageSize);
}
}
})
})