profit.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view>
  3. <view class="content" v-if="list.length">
  4. <view class="list_box" v-for="item in list" :key="item.id">
  5. <view class="list_left">
  6. <view class="name">{{item.title}}</view>
  7. <view class="data">{{item.createTime}}</view>
  8. </view>
  9. <view class="list_right" style="color: red;" v-if="item.type==1">- {{item.money}}</view>
  10. <view class="list_right" style="color: #33D442;" v-if="item.type==2">+ {{item.money}}</view>
  11. </view>
  12. </view>
  13. <empty v-else ></empty>
  14. </view>
  15. </template>
  16. <script>
  17. import empty from '@/components/empty'
  18. export default {
  19. components: {
  20. empty
  21. },
  22. data() {
  23. return {
  24. page:1,
  25. limit:10,
  26. totalCount:0,
  27. list: []
  28. }
  29. },
  30. onLoad() {
  31. this.taskData()
  32. },
  33. methods: {
  34. // 获取任务数据
  35. taskData() {
  36. let userId = this.$queue.getData('userId');
  37. this.$Request.getT('/app/userMoney/profitDetailed',{
  38. userId:userId,
  39. page:this.page,
  40. limit:this.limit
  41. }).then(res => {
  42. if(res.code==0){
  43. if (this.page == 1) {
  44. this.list = res.data.data.list
  45. } else {
  46. this.list = this.list_box.concat(res.data.data.list)
  47. }
  48. this.totalCount = res.data.data.totalCount
  49. }
  50. console.log('res',res)
  51. });
  52. },
  53. },
  54. // 上拉加载
  55. onReachBottom: function() {
  56. if(this.page<this.totalCount){
  57. this.page = this.page + 1;
  58. }else{
  59. uni.showToast({
  60. title:'已经最后一页啦',
  61. icon:'none'
  62. })
  63. }
  64. this.taskData();
  65. }
  66. }
  67. </script>
  68. <style>
  69. body {
  70. background: #F5F5F5;
  71. }
  72. .content {
  73. width: 100%;
  74. background: #FFFFFF;
  75. margin-top: 20rpx;
  76. padding-bottom: 50rpx;
  77. padding-top: 20rpx;
  78. }
  79. .list_box {
  80. width: 90%;
  81. margin: 0 auto;
  82. display: flex;
  83. line-height: 45rpx;
  84. padding-top: 20rpx;
  85. }
  86. .list_left {
  87. flex: 2;
  88. }
  89. .name {
  90. font-size: 26rpx;
  91. color: #333333;
  92. font-weight: bold;
  93. letter-spacing: 2rpx;
  94. }
  95. .data {
  96. color: #999999;
  97. font-size: 24rpx;
  98. }
  99. .list_right {
  100. flex: 1;
  101. display: flex;
  102. justify-content: flex-end;
  103. align-items: center;
  104. font-size: 31rpx;
  105. }
  106. </style>