var puch_html = '
';
$('body').html(puch_html);
(function($){
$(".mui-scroll-wrapper").scroll({
bounce: true,//滚动条是否有弹力默认是true
indicators: false, //是否显示滚动条,默认是true
});
})(mui);
document.write('');
mui.plusReady(function(){
var topId = $('.nav_block').first().attr('data-type');
var secTypeId=0;
var page = 1;
getTitle();
mui(".nav").on('tap', '.nav_block', function() {
page=1;
topId = $(this).attr('data-type');
$(this).addClass('on').siblings().removeClass('on');
getTitle();
})
mui(".nav").on('tap', '.nav_block_a', function() {
page=1;
secTypeId = $(this).attr('data-type');
$(this).addClass('on').siblings().removeClass('on');
getData();
})
function getTitle(){
mui.ajax(hyhUrl('addon/shuff-Shuff-actList'), {
dataType: 'json', //服务器返回json格式数据
type: 'get', //HTTP请求类型
data:{'topTypeId':topId},
timeout: 10000, //超时时间设置为10秒
success: function(data) {
var data = toJson(data, 1);
var html = '';
$.each(data.data, function() {
html+=''+this.secTypeName+'
';
});
$('.nav').eq(1).html(html);
$('.nav_block_a').first().addClass('on');
secTypeId = $('.nav_block_a').first().attr('data-type');
getData();
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type);
}
});
}
function getData() {
if(isjiazai == 0) {
return;
}else{
isjiazai = 0;
}
// mui('').pullRefresh().scroll(0, 0, 0);
//backTop();
var data_set = {
'secTypeId': secTypeId,
'topTypeId': topId,
'pageSize':10,
'page':page
};
mui.ajax(hyhUrl('addon/shuff-Shuff-activits'), {
data: data_set,
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
//服务器返回响应,根据响应结果,分析是否登录成功;
var data = toJson(data, 1);
if(data.status == 1) {
data = data.data;
//console.log(JSON.stringify(data))
var html = '';
if(data.list.Rows != ''){
$.each(data.list.Rows, function() {
// console.log(ectImgUrl(this.goodsImg))
html += '+')
满减'+this.goodsName+'
'+this.shopPrice+'
可用木吉抵扣20%货款
';
});
}else{
//html='没有更多商品
';
}
if(page == 1) {
$('#recommend_con').html(html);
} else {
$('#recommend_con').append(html);
}
isjiazai=1;
} else {
//console.log(data);
}
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type);
}
});
}
$("#keyword").on('keypress', function(e) {
var keycode = e.keyCode;
var searchName = $(this).val();
var url = '';
if(keycode == '13') {
JZL.openWindow('ac2.html', 'ac2.html',{'data_keyword': searchName,'topTypeId':($('.nav_block').eq(0).attr('data-type')+','+$('.nav_block').eq(1).attr('data-type'))});
}
});
var issx = 0;
var isjiazai = 1;
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY) {
if(isjiazai == 1) {
page++;
getData();
}
} else if(scroll.y > 100 && issx == 0) {
issx = 1;
setTimeout(function() {
location.reload()
}, 1000)
}
})
// window.addEventListener('refresh', function(e) { //执行刷新
// location.reload();
//
// });
mui("body").on('tap', '.recommend_con_block', function() {
var data_id = this.attributes["data-goodsId"].nodeValue;
JZL.openWindow('details.html', 'details.html'+data_id,{data_id: data_id});
});
//puchase的html_lxy_2018/12/08
//var lxy_puch_html = '';
//$('body').append(lxy_puch_html);
})