earningsList.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view class="page">
  3. <uni-nav-bar :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true" left-icon="left" title="我的收益" @clickLeft="back" />
  4. <view :style="{height:height}" class="list">
  5. <mescroll-uni ref="mescrollRef" @init="mescrollInit" :height="height" :down="downOption" @down="downCallback"
  6. :up="upOption" @up="upCallback" @emptyclick="emptyClick">
  7. <view class="flex-row justify-between item" v-for="(item,index) in 10">
  8. <view class="flex-row avatar">
  9. <image :src="'/static/ud4.png'"></image>
  10. </view>
  11. <view class="flex-col justify-between userMsg">
  12. <view class="flex-row justify-between">
  13. <text class="name">张辉</text>
  14. <text class="time">2024-01-29 12:00:00</text>
  15. </view>
  16. <view class="flex-row justify-between">
  17. <text class="indirect">
  18. 间推收益:<text class="number">+20</text>
  19. </text>
  20. <text class="indirect">
  21. 累计收益:<text class="number">200</text>
  22. </text>
  23. </view>
  24. </view>
  25. </view>
  26. </mescroll-uni>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  32. import MescrollMoreItemMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more-item.js"
  33. export default {
  34. mixins: [MescrollMixin, MescrollMoreItemMixin], // 注意此处还需使用MescrollMoreItemMixin (必须写在MescrollMixin后面)
  35. components: {},
  36. data() {
  37. return {
  38. height:'',
  39. downOption: {
  40. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  41. },
  42. upOption: {
  43. auto: false, // 不自动加载
  44. // page: {
  45. // num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  46. // size: 10 // 每页数据的数量
  47. // },
  48. noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  49. empty: {
  50. icon: '',
  51. tip: '暂无内容', // 提示
  52. // btnText: '去看看'
  53. },
  54. textNoMore: '没有更多了'
  55. },
  56. list: [],
  57. }
  58. },
  59. onLoad(e) {
  60. let sysInfo = uni.getSystemInfoSync()
  61. this.height = sysInfo.windowHeight - 70 + 'px' //除标题栏栏外的屏幕可用高度
  62. },
  63. methods: {
  64. back() {
  65. uni.navigateBack({
  66. delta: 1
  67. })
  68. },
  69. /*下拉刷新的回调 */
  70. downCallback() {
  71. // 这里加载你想下拉刷新的数据, 比如刷新轮播数据
  72. // loadSwiper();
  73. // 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 page.num=1, 再触发upCallback方法 )
  74. this.mescroll.resetUpScroll()
  75. },
  76. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  77. upCallback(page) {
  78. let status = this.index
  79. if (this.index === 3){
  80. status = 4
  81. }
  82. //联网加载数据
  83. this.mescroll.endSuccess(10, false);
  84. // this.$api.service.performanceList({
  85. // pageNum: page.num,
  86. // pageSize: 10,
  87. // type:this.index
  88. // }).then((res) => {
  89. // //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
  90. // this.mescroll.endSuccess(res.data.data.records.length, res.data.data.records.length === 10);
  91. // //设置列表数据
  92. // if (page.num === 1) this.list = []; //如果是第一页需手动制空列表
  93. // res.data.data.records.forEach(i=>{
  94. // if (i.avatar){
  95. // i.avatar = i.avatar.replace(/^http:/, "https:")
  96. // }
  97. // })
  98. // this.list = this.list.concat(res.data.data.records); //追加新数据
  99. // console.log(this.list)
  100. // }).catch((err) => {
  101. // //联网失败, 结束加载
  102. // this.mescroll.endErr();
  103. // })
  104. },
  105. //点击空布局按钮的回调
  106. emptyClick() {
  107. uni.showToast({
  108. title: '点击了按钮,具体逻辑自行实现'
  109. })
  110. },
  111. }
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. @import './index.rpx.css';
  116. </style>