personcenter.js 2.4 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);
            })
        },
        //分享页面
        share:function(){
            var that=this;
            that.shareimg=true;
        },
        sharewrap:function(){
            var that=this;
            that.shareimg=false;

        },
        //立即邀请
        righnow:function(){
            var that=this;
            that.shareimg=false;
            that.rowshare=true;
        },

        shareorner:function(){

            var that=this;
            that.rowshare=false;

        },
		//关于我们
		aboutus:function(){
			window.location.href="/index.php?g=&m=template&a=about";
		},
		jump:function(obj){
			console.log(obj);
			var status=obj.status;
			var state="";
			if(status=="未付款"){
				state=1;
				window.location.href='/index.php?g=&m=template&a=myorder&state='+state;
			}else if(status=="制作中"){
				state=2;
				window.location.href='/index.php?g=&m=template&a=myorder&state='+state;
			}else if(status=="待取货"){
				state=3;
				window.location.href='/index.php?g=&m=template&a=myorder&state='+state;
			}else if(status=="待评价"){
				state=4;
				window.location.href='/index.php?g=&m=template&a=myorder&state='+state;
			}else if(status=="已完成"){
				state=5;
				window.location.href='/index.php?g=&m=template&a=myorder&state='+state;
			}
			
		}
		
		
	}
	
	
})