jqMultipleShow("click", ".navList", ".tab", ".con");
var helpSuggestion = new Vue({
    el: "#dashboard",
    data: {
        btnLoading: false,
        isRequset:false,
        userId: 0,
        degree:'',
        isCheckedAll:false,
        messagesList:[
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false},
            {title:'您有一笔订单等待支付，快去订单列表进行支付吧^_^。',addTime:' 2020-09-01 16:42:29',isCheck:false}
        ],//新闻动态
    },
    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);
                }
            })
        },
        checkedAllFn :function(){
            var _self = this;
            _self.isCheckedAll = !_self.isCheckedAll;
            _self.updateBothCheckBtn();
        },
        checkedItemFn :function(item){
            var _self = this;
            item.isCheck = !item.isCheck;
            _self.updateCheckAllBtn();
        },
        updateBothCheckBtn:function() {// 全选勾选
            var _self = this;
            _self.messagesList.forEach(function(item){
                item.isCheck = _self.isCheckedAll ;
         })
        },
        updateCheckAllBtn:function() {// 全选勾选判断
            var _self = this;
            var goodsCheckedLength = 0,
                messagesList = _self.messagesList;
            _self.messagesList.forEach(function(item){
                if(item.isCheck) { goodsCheckedLength++; }
            });
            _self.isCheckedAll = goodsCheckedLength === messagesList.length;
        },
        deleteMessageFn: function(){//删除消息

        },
        signMessageFn: function(){//标记为已读

        },
        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();
        }
    }
});
