/*手机端通用获取商品列表*/
$(document).ready(function(){

	$("#load_mores").click(function(){
		page++;
		get_service_list(page);
	});
	$("#list_load_mores").click(function(){
		page++;
		get_services_list(page);
	});
});
var querydata = new Object;
var page = 1;
function get_service_list(page){
	page=parseInt(page);if(!page)page=1;
	querydata['page']=page;
	var shop_id = $("#s_id").val();
	var package = $("#package").val();
	if(package == 1)querydata['package']=package;
	querydata['shop_id']=shop_id;
	$.ajax({
		url: queryurl,
		type: "post",
		data: querydata,
		dataType: "json",
		success: function (ret) {
			// alert(JSON.stringify(ret));
			if (ret.status) {
				if(page==1){
					$('#guessList').html(ret.data);
				}else{
					$('#guessList').append(ret.data);
				}
			}else{
				if(page==1){
                    $('#guessList').html('');
					$('#no-content').html('<div class="buy-none"><i class="hc-iconfont">&#xe70a;</i><h3>暂无数据</h3></div>');
				}
				$.showSuccess('没有更多的数据了',1,'hc');
			}
		}
	});
}
function get_services_list(page){
	page=parseInt(page);if(!page)page=1;
	querydata['page']=page;
	var catid = $("#catid").val();//分类
	var shopid = $("#shopid").val();//分类
	var sell_count = $("#sell_count").val();//分类
	var price = $("#price").val();//分类
	var package = $("#package").val();
	if(package == 1)querydata['package']=package;
	if(catid!=undefined && catid!="" && catid!=null){  
		querydata['catid']=catid;
	}
	if(shopid!=undefined && shopid!="" && shopid!=null){  
		querydata['shopid']=shopid;
	}
	if(sell_count!=undefined && sell_count!="" && sell_count!=null){  
		querydata['sell_count']=sell_count;
	}
	if(price!=undefined && price!="" && price!=null){  
		querydata['price']=price;
	}
	$.ajax({
		url: queryurl,
		type: "post",
		data: querydata,
		dataType: "json",
		success: function (ret) {
			if (ret.status) {
				if(page==1){
					$('#guessList').html(ret.data);
				}else{
					$('#guessList').append(ret.data);
				}
			}else{
				if(page==1){
                    $('#guessList').html('');
					$('#no-content').html('<div class="buy-none"><i class="hc-iconfont">&#xe70a;</i><h3>暂无数据</h3></div>');
				}
				$.showSuccess('没有更多的数据了',1,'hc');
			}
		}
	});
}
