var msort = 1;
var page = 1;
var condition = 1;
var desc = 0;
var keyword;
var isjiazai = 1;
var count = 1;
var pagesize = 10;
var ct1;
var ct2;
var goodsName = '';
function pullupRefresh(shopId, msort, desc, pagesize, page, goodsName, ct1, ct2) {
// setTimeout(function() {
// mui('#pullrefresh').pullRefresh().endPullupToRefresh();
var data_set = {
page: page,
pagesize: pagesize,
shopId: shopId,
mdesc: desc,
msort: msort,
goodsName: goodsName
}
// console.log(order_class)
if(isjiazai == 0) {
return;
}else{
isjiazai = 0;
}
mui.ajax(hyhUrl('app/Shops/getShopGoods'), {
data: data_set,
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);
data = data.data;
var html = '';
if(data.Rows == '') {
$('.mui-scroll').append('
没有更多商品
');
isjiazai = 0;
return;
}
$.each(data.Rows, function() {
html += ' + ')
自营' + this.goodsName + '
¥' + this.shopPrice + ' 满减
可用木吉抵扣20%货款

';
});
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);
}
});
// }, 500);
}
mui.plusReady(function() {
var shopId = localStorage.getItem('shopId')
var costnum = 0;
var self = plus.webview.currentWebview();
goodsName = self.data_keyword;
pullupRefresh(shopId, msort, desc, pagesize, page, goodsName, ct1, ct2)
$('.commoditylistnav').on('tap', '.nav_block', function() {
page = 1;
isjiazai = 1;
$(this).addClass('on').siblings().removeClass('on');
msort = $(this).attr('data-condition');
if($('#cost_btn').hasClass('on')) {
costnum += 1;
if(costnum % 2 == 1) {
$('#cost_btn').html('价格
');
desc = 1;
} else if(costnum % 2 == 0) {
$('#cost_btn').html('价格
');
desc = 0;
}
} else {
$('#cost_btn').html('价格
')
costnum = 0;
desc = 0
}
pullupRefresh(shopId, msort, desc, pagesize, page, goodsName, ct1, ct2)
})
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
if(isjiazai == 1) {
page++;
pullupRefresh(shopId, msort, desc, pagesize, page, goodsName, ct1, ct2);
}
}
})
})
// setInterval(function() {
// $('.cnxh_block img').height($('.cnxh_block img').width());
// $('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
// }, 100)