myteam.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view>
  3. <view class="padding bg-themeRed">
  4. <view class="text-center padding-tb">
  5. <view class="text-sl padding-bottom-xs">{{redmoneyarr.status0}}</view>
  6. <view>累计获得奖励(积分)</view>
  7. </view>
  8. <view class="flex solid-bottom padding-top justify-between">
  9. <view>待发放:<text>{{redmoneyarr.status2}}</text> 积分</view>
  10. <view>已发放:<text>{{redmoneyarr.status3}}</text> 积分</view>
  11. </view>
  12. </view>
  13. <scroll-view scroll-x class="bg-white nav solid-bottom">
  14. <view class="flex text-center">
  15. <view class="cu-item flex-sub" :class="status==0?'text-red cur':''" @tap="tabSelect" data-status="0">全部</view>
  16. <view class="cu-item flex-sub" :class="status==1?'text-red cur':''" @tap="tabSelect" data-status="1">未入职</view>
  17. <view class="cu-item flex-sub" :class="status==2?'text-red cur':''" @tap="tabSelect" data-status="2">已入职</view>
  18. <view class="cu-item flex-sub" :class="status==3?'text-red cur':''" @tap="tabSelect" data-status="3">已发放</view>
  19. </view>
  20. </scroll-view>
  21. <view class="cu-list menu-avatar">
  22. <view class="cu-item" v-for="(item,index) in plist" :key="index">
  23. <view class="cu-avatar round lg" :style="'background-image:url('+item.user.avatar+');'"></view>
  24. <view class="content">
  25. <view class="text-grey">{{item.user.nickname}}</view>
  26. <view class="text-gray text-sm flex">{{item.createtime}}</view>
  27. </view>
  28. <view class="action" v-if="item.status>=2">
  29. <view class="text-red text-lg">{{item.redmoney}}积分</view>
  30. </view>
  31. </view>
  32. </view>
  33. <uni-load-more :status="pstatus"></uni-load-more>
  34. </view>
  35. </template>
  36. <script>
  37. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  38. var _this;
  39. export default {
  40. components: {
  41. uniLoadMore
  42. },
  43. data() {
  44. return {
  45. userinfo: {},
  46. redmoneyarr: [],
  47. status: 0,
  48. pstatus: 'more',
  49. ppage: 1,
  50. psize: 20,
  51. plist: []
  52. };
  53. },
  54. onLoad: function(){
  55. _this = this;
  56. _this.userinfo = _this.checkLogin("/pages/my/myteam");
  57. if (_this.userinfo===false){
  58. return false;
  59. }
  60. _this.$req.ajax({
  61. path: "my/myteam",
  62. data: {
  63. userid: _this.userinfo.id
  64. }
  65. }).then((data) => {
  66. _this.redmoneyarr = data.redmoneyarr;
  67. console.log(": " + JSON.stringify(_this.redmoneyarr));
  68. _this.getMore();
  69. }).catch((err) => {
  70. uni.showModal({
  71. title: '信息提示',
  72. content: err,
  73. showCancel: false
  74. });
  75. });
  76. },
  77. onPullDownRefresh: function() {
  78. _this.ppage = 1;
  79. _this.pstatus = 'more';
  80. _this.plist = [];
  81. _this.getMore();
  82. },
  83. onReachBottom: function() {
  84. if (_this.pstatus !== 'more') {
  85. return;
  86. }
  87. _this.getMore();
  88. },
  89. methods: {
  90. getMore: function() {
  91. _this.$req.ajax({
  92. path: "my/getteam",
  93. data: {
  94. ppage: _this.ppage,
  95. psize: _this.psize,
  96. userid: _this.userinfo.id,
  97. status: _this.status
  98. }
  99. }).then((data) => {
  100. _this.pstatus = data.pstatus;
  101. _this.plist = _this.plist.concat(data.plist);
  102. _this.ppage += 1;
  103. uni.stopPullDownRefresh();
  104. }).catch((err) => {
  105. uni.showModal({
  106. title: '信息提示',
  107. content: err,
  108. showCancel: false
  109. });
  110. });
  111. },
  112. pageRefresh: function() {
  113. _this.pstatus = 'more';
  114. _this.ppage = 1;
  115. _this.plist = [];
  116. _this.getMore();
  117. },
  118. tabSelect: function(e) {
  119. _this.status = e.currentTarget.dataset.status;
  120. _this.pageRefresh();
  121. },
  122. }
  123. }
  124. </script>
  125. <style>
  126. </style>