Acontlist.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,index) in list" :key="index">
  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==2">- {{item.money}}</view>
  10. <view class="list_right" style="color: #33D442;" v-if="item.type==1">+ {{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. list: [],
  25. page: 1,
  26. totalCount: 0
  27. }
  28. },
  29. onLoad() {
  30. this.taskData()
  31. },
  32. methods: {
  33. // 获取任务数据
  34. taskData() {
  35. this.$Request.getT('/app/userinfo/findMoneyDetails?classify=3&page='+this.page+'&limit=15').then(res => {
  36. if(res.code==0){
  37. // this.list = res.data.list
  38. if (this.page == 1) {
  39. this.list = res.data.list
  40. } else {
  41. this.list = this.list.concat(res.data.list)
  42. }
  43. this.totalCount = res.data.totalPage
  44. }
  45. console.log('res',res)
  46. uni.stopPullDownRefresh();
  47. });
  48. },
  49. },
  50. // 上拉加载
  51. onReachBottom: function() {
  52. if (this.page < this.totalCount) {
  53. this.page += 1;
  54. this.taskData();
  55. } else {
  56. uni.showToast({
  57. title: '已经最后一页啦',
  58. icon: 'none'
  59. })
  60. }
  61. },
  62. onPullDownRefresh: function() {
  63. this.page = 1;
  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>