; var helpSuggestion = new Vue({ el: "#dashboard", data: { btnLoading: false, isRequset:true, userId: 0, degree:'', userInfo:{}, formData:new FormData(), unReadMessageCount:'',// 消息数 confirmedCount:'',// 待確認數量 paymentCount:'',// 待付款 waitShipmentsCount:'',// 待发货 shipmentsCount:'',// 已发货 salesReturnCount:'',// 退货款 productList:[],// 推荐商品 newsList:[],// 新闻动态 isShowBeansAlet:false, bgImagePath:'',// 根据类型显示图片标记 beanNumber:100, couponNum:0,// 优惠券数量 beansType:1 }, 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.couponNum = data.couponNum; _self.isRequset = false; }else{ CAIMEI.Alert(response.msg, '确定', false); _self.isRequset = false; } }) }, GetUserClubHome(){}, 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); }, GetInitBeansInfo:function(){//初始化采美豆信息 var _self = this; UserApi.GetUserObtainBeans({userId:_self.userId},function(response){ if(response.code==0){ _self.beansType = response.data.beansType; _self.beanNumber = response.data.num; _self.isShowBeansAlet = true; _self.handInitType(_self.beansType); }else{ console.log('@=========>用户暂无采美豆推送~') } }); }, handInitType:function(type){//根据类型判断弹窗背景 var _self = this; if(isPC){ _self.bgImagePath ='/img/account/icon-beans-'+type+'@2x.png'; }else { _self.bgImagePath ='/img/account/icon-beans-h5-'+type+'@2x.png'; } console.log(this.bgImagePath) }, handleClickCancel:function () {//关闭弹窗 var _self = this; _self.isShowBeansAlet = false; } }, mounted: function () { var _self = this; if(globalUserData){ _self.userId = globalUserData.userId; _self.GetMyPcCenterInfo(); _self.GetInitBeansInfo(); _self.isShowBeansAlet = false; } } });