meOperate.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view>
  3. <view class="uni-container">
  4. <uni-table ref="table" :loading="loading" border stripe emptyText="暂无更多数据">
  5. <uni-tr>
  6. <uni-th align="center">姓名</uni-th>
  7. <uni-th align="center">积分变动</uni-th>
  8. <uni-th align="center">剩余积分</uni-th>
  9. <uni-th align="center">积分变动来源</uni-th>
  10. <uni-th align="center">时间</uni-th>
  11. </uni-tr>
  12. <uni-tr v-for="(item, index) in tableData" :key="index" style="height: 5em;">
  13. <uni-td>{{item.name == null || item.name == '' ? item.wechatName : item.name}}</uni-td>
  14. <uni-td>{{ item.scoreOperate }}</uni-td>
  15. <uni-td align="center">{{ item.scoreNum }}</uni-td>
  16. <uni-td align="center">{{ item.relevance }}</uni-td>
  17. <uni-td align="center">{{ item.createTime }}</uni-td>
  18. </uni-tr>
  19. </uni-table>
  20. <!-- <view class="uni-pagination-box">
  21. <uni-pagination show-icon :page-size="queryParams.pageSize" :current="queryParams.pageNum" :total="total" @change="change" />
  22. </view> -->
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import {listScoreInfo} from '@/api/me/meOperate.js';
  28. export default {
  29. data() {
  30. return {
  31. searchVal: '',
  32. tableData: [],
  33. // 数据总量
  34. total: 0,
  35. userId : null,
  36. queryParams:{
  37. // 当前页
  38. pageNum: 1,
  39. // 每页数据量
  40. pageSize: 15,
  41. //请求参数
  42. userId: getApp().globalData.userId
  43. },
  44. loading: false,
  45. };
  46. },
  47. onLoad() {
  48. // this.selectedIndexs = [];
  49. this.getData();
  50. },
  51. onReachBottom() {
  52. let pageNum = this.queryParams.pageNum;
  53. let pageSize = this.queryParams.pageSize;
  54. let total = this.total;
  55. if (pageNum * pageSize >= total) {
  56. uni.showToast({
  57. title: '暂无更多数据'
  58. });
  59. return;
  60. } else {
  61. this.queryParams.pageNum += 1;
  62. this.getData();
  63. }
  64. },
  65. methods: {
  66. // 分页触发
  67. /* change(e) {
  68. this.$refs.table.clearSelection();
  69. this.selectedIndexs.length = 0;
  70. this.getData(e.current);
  71. }, */
  72. // 获取数据
  73. getData() {
  74. this.loading = true;
  75. // this.queryParams.pageNum = pageNum;
  76. listScoreInfo(this.queryParams).then(res =>{
  77. this.tableData = [...this.tableData,...res.rows]
  78. // this.tableData = res.rows
  79. this.total = res.total
  80. this.loading = false;
  81. });
  82. }
  83. }
  84. };
  85. </script>
  86. <style>
  87. @import './meOperate.css';
  88. </style>