personcenter.js 1.9 KB

new Vue({
	el:'#personcenter',
	data: {	
	persontype:[],
	personinfo:[],
    cartnum:0

	},
	created: function() {
		this.details();
        this.num();
	},
	methods: {
		//获取信息
		details: function() {
			var that = this;
			var url = '/UserCenter/index'
			var params = {
				
				unique_id: localStorage.getItem('unique_id')
			}
			ajaxsend(url, params, function(res) {
				/*console.log(JSON.stringify(res))*/
				console.log(res);
				var data=res.data;
				var icon=data.icon;
				that.persontype=icon;
				that.personinfo=data.user_info;
				console.log(that.personinfo);
			})
		},
        //购物车数量
        num:function(){
            var that=this;
            var url='/CountNum/countCart';
            var params = {
                unique_id: localStorage.getItem('unique_id')

            }
            ajaxsend(url, params, function(res) {
                /*console.log(JSON.stringify(res))*/
                console.log(res);
                var data=res.data;
                console.log(data[0].count)
                that.cartnum=data[0].count;
                console.log(that.cartnum);
            })
        },
		//关于我们
		aboutus:function(){
			window.location.href=linkPath+'/about.html'
		},
		jump:function(obj){
			console.log(obj);
			var status=obj.status;
			var state="";
			if(status=="未付款"){
				state=1;
				window.location.href=linkPath+'/myorder/myorder.html?state='+state;
			}else if(status=="制作中"){
				state=2;
				window.location.href=linkPath+'/myorder/myorder.html?state='+state;
			}else if(status=="待取货"){
				state=3;
				window.location.href=linkPath+'/myorder/myorder.html?state='+state;
			}else if(status=="待评价"){
				state=4;
				window.location.href=linkPath+'/myorder/myorder.html?state='+state;
			}else if(status=="已完成"){
				state=5;
				window.location.href=linkPath+'/myorder/myorder.html?state='+state;
			}
			
		}
		
		
	},
	
	
})