var isFirst=true,per_page=0;
var App=new Vue({
	el:"#App",
	data:function(){
		return {
			pageLoad:false,
			pageData:{},
			catid:0,
			tabSelectBox:"",
			order:"",
			sc_id:0,
			filter:"",
			scarea_label:"区域",
			cat_label:"全部",
			order_label:"排序",
			choice_label:"筛选"
		}
	},
	created:function(){
		this.catid=catid;
		this.getPage();
	},	
	methods:{
		goShop:function(shopid){
			window.location="/module.php?m=b2b_shop&shopid="+shopid
		},
		getPage:function(){
			var that=this;
			$.ajax({
				url:"/module.php?m=b2b_shoplist&a=list&ajax=1",
				data:{
					catid:that.catid,
					filter:this.filter,
					orderby:this.order,
					sc_id:this.sc_id
				},
				dataType:"json",
				success:function(res){
					per_page=res.data.per_page;
					isFirst=false;
					that.pageData=res.data;
					that.pageLoad=true;
				}
			})
		},
		getList:function(){
			var that=this;
			$.ajax({
				url:"/module.php?m=b2b_shoplist&a=list&ajax=1",
				data:{
					catid:that.catid,
					filter:this.filter,
					orderby:this.order,
					sc_id:this.sc_id
				},
				dataType:"json",
				success:function(res){
					per_page=res.data.per_page;
					that.pageData=res.data;
					that.pageLoad=true;
				}
			})
		},
		showSelect:function(tab){
			if(this.tabSelectBox==tab){
				this.tabSelectBox="";
			}else{
				this.tabSelectBox=tab
			}
		},
		hideSelect:function(){
			this.tabSelectBox="";
		},
		setCat:function(cid,title){
			this.catid=cid;
			isFirst=true;
			this.cat_label=title;
			this.getPage();
			this.hideSelect();
		},
		setScarea:function(sc_id,title){
			this.sc_id=sc_id;
			isFirst=true;
			this.scarea_label=title;
			this.getPage();
			this.hideSelect();
		},
		setOrder:function(index,title){
			this.order=index;
			isFirst=true;
			this.order_label=title;
			this.getPage();
			this.hideSelect();
		}
		
	}
});