account.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ;
  2. var helpSuggestion = new Vue({
  3. el: "#dashboard",
  4. data: {
  5. btnLoading: false,
  6. isRequset:true,
  7. userId: 0,
  8. degree:'',
  9. userInfo:{},
  10. formData:new FormData(),
  11. unReadMessageCount:'',//消息数
  12. confirmedCount:'',//待確認數量
  13. paymentCount:'',//待付款
  14. waitShipmentsCount:'',//待发货
  15. shipmentsCount:'',//已发货
  16. salesReturnCount:'',//退货款
  17. productList:[],//推荐商品
  18. newsList:[],//新闻动态
  19. },
  20. methods: {
  21. GetMyPcCenterInfo:function(){
  22. var _self = this;
  23. UserApi.GetMyPcCenterInfo({userId:_self.userId},function (response) {
  24. if(response.code == 0){
  25. var data = response.data;
  26. _self.userInfo = data.user;
  27. _self.degree = data.degree;
  28. _self.unReadMessageCount = _self.showBadge(data.unReadMessageCount);
  29. _self.confirmedCount = _self.showBadge(data.confirmedCount);
  30. _self.paymentCount = _self.showBadge(data.paymentCount);
  31. _self.waitShipmentsCount = _self.showBadge(data.waitShipmentsCount);
  32. _self.shipmentsCount = _self.showBadge(data.shipmentsCount);
  33. _self.salesReturnCount = _self.showBadge(data.salesReturnCount);
  34. _self.productList = data.homePageAdvertiseList;
  35. _self.newsList = data.homePageInfoList;
  36. _self.isRequset = false;
  37. }else{
  38. CAIMEI.Alert(response.msg, '确定', false);
  39. _self.isRequset = false;
  40. }
  41. })
  42. },
  43. uploadUserPuploadAvatar: function(event){//上传头像
  44. var _self = this;
  45. var inputDOM = _self.$refs.clubUseLogo;
  46. var file = inputDOM.files;
  47. _self.formData.append('file', file[0]);
  48. PublicApi.uploadimg(_self.formData,function(response){
  49. _self.userInfo.image = response.data;
  50. event.target.value = '';
  51. UserApi.UserPuploadAvatar({userId:_self.userId,image:response.data},function(res){
  52. if(res.code==0){
  53. _self.GetMyPcCenterInfo();
  54. }
  55. })
  56. });
  57. },
  58. orderListPath:function(index){
  59. window.location.href='/user/order/list.html?state='+index;
  60. },
  61. showBadge:function(n){//处理标签
  62. var num ='';
  63. if(n>100){num = 99}else{num = n;}
  64. return num;
  65. },
  66. toFixedFn:function(text){//处理小数点后两位数
  67. return Number(text).toFixed(2);
  68. },
  69. },
  70. mounted: function () {
  71. if(globalUserData){
  72. this.userId = globalUserData.userId;
  73. this.GetMyPcCenterInfo();
  74. }
  75. }
  76. });