jqMultipleShow("click", ".navList", ".tab", ".con");
var helpSuggestion = new Vue({
    el: "#dashboard",
    data: {
        btnLoading: false,
        isRequset:false,
        userId: 0,
        degree:'',
        userInfo:{},
        formData:new FormData(),
        unReadMessageCount:'',//消息数
        confirmedCount:'',//待確認數量
        paymentCount:'',//待付款
        waitShipmentsCount:'',//待发货
        shipmentsCount:'',//已发货
        salesReturnCount:'',//退货款
        productList:[],//推荐商品
        newsList:[],//新闻动态
    },
    methods: {
        GetMyPcCenterInfo:function(){
            var _self = this;
            UserApi.GetMyPcCenterInfo({userId:_self.userId},function (response) {
                if(response.code == 0){
                    var data = response.data;
                    _self.userInfo = data.user;
                    _self.degree = data.degree;
                    _self.unReadMessageCount = _self.showBadge(data.unReadMessageCount);
                    _self.confirmedCount = _self.showBadge(data.confirmedCount);
                    _self.paymentCount = _self.showBadge(data.paymentCount);
                    _self.waitShipmentsCount = _self.showBadge(data.waitShipmentsCount);
                    _self.shipmentsCount = _self.showBadge(data.shipmentsCount);
                    _self.salesReturnCount = _self.showBadge(data.salesReturnCount);
                    _self.productList = data.homePageAdvertiseList;
                    _self.newsList = data.homePageInfoList;
                    _self.isRequset = true;
                }else{
                    CAIMEI.Alert(response.msg, '确定', false);
                }
            })
        },
        uploadUserPuploadAvatar: function(event){//上传头像
            var _self = this;
            var inputDOM = _self.$refs.clubUseLogo;
            var file = inputDOM.files;
            _self.formData.append('file', file[0]);
            PublicApi.uploadimg(_self.formData,function(response){
                _self.userInfo.image = response.data;
                event.target.value = '';
                UserApi.UserPuploadAvatar({userId:_self.userId,image:response.data},function(res){
                    if(res.code==0){
                        _self.GetMyPcCenterInfo();
                    }
                })
            });
        },
        orderListPath:function(index){
            window.location.href='/user/order/list.html?state='+index;
        },
        showBadge:function(n){//处理标签
            var num ='';
            if(n>100){num = 99}else{num = n;}
            return num;
        },
        toFixedFn:function(text){//处理小数点后两位数
            return Number(text).toFixed(2);
        },
    },
    mounted: function () {
        if(globalUserData){
            this.userId = globalUserData.userId;
            this.GetMyPcCenterInfo();
        }
    }
});
