integralRecord.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="container">
  3. <view class="massage" v-for="(item, index) in list">
  4. <!-- <view class="time">
  5. {{ item.createTime }}
  6. </view> -->
  7. <view class="info">
  8. <view class="title row">
  9. <span>{{ item.eventDesc }}</span>
  10. <span>{{ item.inOut == 1 ? '+' : '-' }}{{ item.integral }}</span>
  11. </view>
  12. <view class="text row">
  13. <span>{{ item.createTime }}</span>
  14. <!-- <span>积分余额:{{ 5 }}</span> -->
  15. </view>
  16. </view>
  17. </view>
  18. <uni-load-more
  19. v-if="list.length > 0"
  20. :status="loadMore"
  21. @clickLoadMore="load"
  22. :contentText="contentText"
  23. ></uni-load-more>
  24. <noData v-else />
  25. </view>
  26. </template>
  27. <script>
  28. import noData from '@/component/noData.vue'
  29. import { integralListApi } from '@/api/integralRecord.js'
  30. export default {
  31. components: {
  32. noData,
  33. },
  34. data() {
  35. return {
  36. value: 1,
  37. // more/loading/noMore
  38. loadMore: 'more',
  39. contentText: {
  40. contentdown: '点击加载更多',
  41. },
  42. params: {
  43. limit: 10,
  44. page: 1,
  45. },
  46. list: [],
  47. }
  48. },
  49. onShow() {
  50. this.getList()
  51. },
  52. methods: {
  53. load() {
  54. if (this.loadMore == 'more') {
  55. this.params.page += 1
  56. this.getList()
  57. }
  58. },
  59. getList() {
  60. this.loadMore = 'loading'
  61. integralListApi(this.params).then(res => {
  62. this.list.push(...res.data.list)
  63. // 判断是否还有更多数据
  64. let listNum = this.params.limit * this.params.page
  65. let total = res.data.total
  66. if (total > listNum) {
  67. this.loadMore = 'more'
  68. } else {
  69. this.loadMore = 'noMore'
  70. }
  71. })
  72. },
  73. },
  74. }
  75. </script>
  76. <style scoped lang="scss">
  77. .container {
  78. height: 100vh;
  79. .massage {
  80. margin: 10rpx 20rpx;
  81. .time {
  82. font-size: 24rpx;
  83. padding: 12rpx 0;
  84. text-align: center;
  85. }
  86. .info {
  87. background: #fff;
  88. border-radius: 10rpx;
  89. padding: 20rpx;
  90. .row {
  91. display: flex;
  92. justify-content: space-between;
  93. }
  94. .title {
  95. font-size: 32rpx;
  96. // font-weight: 600;
  97. padding: 10rpx 0;
  98. }
  99. .text {
  100. font-size: 24rpx;
  101. color: #9999;
  102. }
  103. }
  104. }
  105. }
  106. </style>