dashboard.js 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. isShowBeansAlet:true,
  20. bgImagePath:'',//根据类型显示图片标记
  21. beanNumber:100,
  22. beansType:1
  23. },
  24. methods: {
  25. GetMyPcCenterInfo:function(){
  26. var _self = this;
  27. UserApi.GetMyPcCenterInfo({userId:_self.userId},function (response) {
  28. if(response.code == 0){
  29. var data = response.data;
  30. _self.userInfo = data.user;
  31. _self.degree = data.degree;
  32. _self.unReadMessageCount = _self.showBadge(data.unReadMessageCount);
  33. _self.confirmedCount = _self.showBadge(data.confirmedCount);
  34. _self.paymentCount = _self.showBadge(data.paymentCount);
  35. _self.waitShipmentsCount = _self.showBadge(data.waitShipmentsCount);
  36. _self.shipmentsCount = _self.showBadge(data.shipmentsCount);
  37. _self.salesReturnCount = _self.showBadge(data.salesReturnCount);
  38. _self.productList = data.homePageAdvertiseList;
  39. _self.newsList = data.homePageInfoList;
  40. _self.isRequset = false;
  41. }else{
  42. CAIMEI.Alert(response.msg, '确定', false);
  43. _self.isRequset = false;
  44. }
  45. })
  46. },
  47. uploadUserPuploadAvatar: function(event){//上传头像
  48. var _self = this;
  49. var inputDOM = _self.$refs.clubUseLogo;
  50. var file = inputDOM.files;
  51. _self.formData.append('file', file[0]);
  52. PublicApi.uploadimg(_self.formData,function(response){
  53. _self.userInfo.image = response.data;
  54. event.target.value = '';
  55. UserApi.UserPuploadAvatar({userId:_self.userId,image:response.data},function(res){
  56. if(res.code==0){
  57. _self.GetMyPcCenterInfo();
  58. }
  59. })
  60. });
  61. },
  62. orderListPath:function(index){
  63. window.location.href='/user/order/list.html?state='+index;
  64. },
  65. showBadge:function(n){//处理标签
  66. var num ='';
  67. if(n>100){num = 99}else{num = n;}
  68. return num;
  69. },
  70. toFixedFn:function(text){//处理小数点后两位数
  71. return Number(text).toFixed(2);
  72. },
  73. handInitType:function(type){
  74. var _self = this;
  75. _self.bgImagePath ='/img/account/icon-beans-'+type+'@2x.png';
  76. console.log(this.bgImagePath)
  77. },
  78. handleClickCancel:function () {//关闭弹窗
  79. var _self = this;
  80. _self.isShowBeansAlet = false;
  81. }
  82. },
  83. mounted: function () {
  84. var _self = this;
  85. if(globalUserData){
  86. _self.userId = globalUserData.userId;
  87. _self.GetMyPcCenterInfo();
  88. _self.handInitType(_self.beansType)
  89. }
  90. }
  91. });