var msort = 1;
var page = 1;
var condition = 2;
var desc = 0;
var catId;
var keyword;
var isjiazai = 1;
var count = 1;
var goodsType;
function pullupRefresh() {
// setTimeout(function() {
// mui('#pullrefresh').pullRefresh().endPullupToRefresh();
count += 1;
var data_set = {
page: count,
pagesize: 10,
condition: condition,
desc: desc
}
// //console.log(order_class)
if (catId) {
data_set.catId = catId;
} else if (keyword) {
data_set.keyword = keyword;
}
if (goodsType) {
data_set.goodsType = goodsType;
}
mui.ajax(qlgUrl('app/Goods/pageQuery'), {
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('
没有更多商品
');
return;
}
$.each(data.Rows, function() {
html += ' +
')
自营' + this.goodsName + '
¥' + this.shopPrice +
' 满减
' + this.saleNum +
'人购买
优惠率 ' + this.discountRate +
'%

';
// html += ' + ')
自营' + this.goodsName + '
¥' + this.shopPrice + ' 满减
可用木吉抵扣20%货款

';
});
$('.recommend_con').append(html);
$('.rcb_img').height($('.rcb_img').width());
isjiazai = 1;
},
error: function(xhr, type, errorThrown) { //异常处理;
// mui.alert(type);
}
});
// }, 500);
}
/**
* 下拉刷新具体业务实现
*/
// function pulldownRefresh() {
// setTimeout(function() {
// window.location.reload();
// mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
// }, 1500);
// }
mui.plusReady(function() {
var costnum = 0;
var self = plus.webview.currentWebview();
catId = self.data_catId;
keyword = self.data_keyword;
goodsType = self.goodsType?self.goodsType :"";
$('.commoditylistnav').on('tap', '.nav_block', function() {
page = 1;
count = 1;
$(this).addClass('on').siblings().removeClass('on');
condition = $(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
}
var data = {
pagesize: 10,
page: 1,
condition: condition,
desc: desc,
goodsType :goodsType
}
if (catId) {
data.catId = catId;
} else if (keyword) {
data.keyword = keyword;
}
mui.ajax(qlgUrl('app/Goods/pageQuery'), {
data: data,
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
var data = toJson(data);
data = data.data;
var html = '';
$.each(data.Rows, function() {
html += ' +
')
自营' + this.goodsName + '
¥' + this.shopPrice +
' 满减
' + this.saleNum +
'人购买
优惠率 ' +
this.discountRate +
'%

';
// html += ' + ')
自营' + this.goodsName + '
¥' + this.shopPrice + ' 满减
可用木吉抵扣20%货款

';
});
$('.recommend_con').html(html);
$('.rcb_img').height($('.rcb_img').width());
},
error: function(xhr, type, errorThrown) { //异常处理;
// mui.alert(type);
}
});
})
var data_1 = {
pagesize: 10,
page: 1,
condition: 2,
desc: 0
}
if (catId) {
data_1.catId = catId;
} else if (keyword) {
data_1.keyword = keyword;
}
mui.ajax(qlgUrl('app/Goods/pageQuery'), {
data: data_1,
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
var data = toJson(data);
data = data.data;
var html = '';
$.each(data.Rows, function() {
html += ' +
')
自营' + this.goodsName + '
¥' + this.shopPrice +
' 满减
' + this.saleNum +
'人购买
优惠率 ' + this.discountRate +
'%

';
// html += ' + ')
自营' + this.goodsName + '
¥' + this.shopPrice + ' 满减
可用木吉抵扣20%货款

';
});
$('.recommend_con').html(html);
$('.rcb_img').height($('.rcb_img').width());
},
error: function(xhr, type, errorThrown) { //异常处理;
// mui.alert(type);
}
});
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
// //console.log(scroll.y);
// //console.log(scroll.maxScrollY);
if (scroll.y == scroll.maxScrollY) {
if (isjiazai == 1) {
isjiazai = 0;
pullupRefresh()
}
}
})
})
// setInterval(function() {
// $('.cnxh_block img').height($('.cnxh_block img').width());
// $('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
// }, 100)