integralLogsList.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view class="page">
  3. <view class="content">
  4. <mescroll-body ref="mescrollRef" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback">
  5. <view class="item" v-for="(item) in dataList">
  6. <view class="left">
  7. <text class="title" >
  8. 完课积分领取记录
  9. <!-- {{utils.getDictLabel2Name(typeOptions,item.logType)}} -->
  10. </text>
  11. <view class="time">{{item.createTime}}</view>
  12. </view>
  13. <view class="right">
  14. <text :class="item.integral>0?'money green':'money red'">{{item.integral}}</text>
  15. <text class="remark">剩余积分:{{item.balance}}</text>
  16. </view>
  17. </view>
  18. </mescroll-body>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import {getDictByKey} from '@/api/common.js'
  24. import {getUserIntegralLogsList} from '@/api/integral.js'
  25. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  26. export default {
  27. mixins: [MescrollMixin], // 使用mixin
  28. data() {
  29. return {
  30. typeOptions:[],
  31. mescroll:null,
  32. downOption: {
  33. auto:false//不要自动加载
  34. },
  35. upOption: {
  36. onScroll:false,
  37. use: true, // 是否启用上拉加载; 默认true
  38. page: {
  39. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  40. size: 10 // 每页数据的数量,默认10
  41. },
  42. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  43. textNoMore:"已经到底了",
  44. empty: {
  45. icon:'https://hdtobs.obs.cn-north-4.myhuaweicloud.com/hdt/empty_icon.png',
  46. tip: '暂无数据'
  47. }
  48. },
  49. dataList: []
  50. }
  51. },
  52. onLoad() {
  53. this.getDictByKey("sys_integral_log_type");
  54. },
  55. methods: {
  56. getDictByKey(key){
  57. var data={key:key}
  58. getDictByKey(data).then(
  59. res => {
  60. if(res.code==200){
  61. this.typeOptions=res.data;
  62. }
  63. },
  64. err => {
  65. }
  66. );
  67. },
  68. mescrollInit(mescroll) {
  69. this.mescroll = mescroll;
  70. },
  71. /*下拉刷新的回调 */
  72. downCallback(mescroll) {
  73. mescroll.resetUpScroll()
  74. },
  75. upCallback(page) {
  76. //联网加载数据
  77. var that = this;
  78. var data = {
  79. pageNum: page.num,
  80. pageSize: page.size
  81. };
  82. // uni.showLoading({
  83. // title:"加载中..."
  84. // })
  85. getUserIntegralLogsList(data).then(res => {
  86. uni.hideLoading()
  87. if(res.code==200){
  88. //设置列表数据
  89. if (page.num == 1) {
  90. that.dataList = res.data.list;
  91. } else {
  92. that.dataList = that.dataList.concat(res.data.list);
  93. }
  94. that.mescroll.endBySize(res.data.list.length, res.data.total);
  95. }else{
  96. uni.showToast({
  97. icon:'none',
  98. title: "请求失败",
  99. });
  100. that.dataList = null;
  101. that.mescroll.endErr();
  102. }
  103. });
  104. },
  105. }
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. .page{
  110. }
  111. .content{
  112. display: flex;
  113. flex-direction: column;
  114. .item{
  115. background-color: #fff;
  116. padding: 20rpx 10rpx;
  117. display: flex;
  118. align-items: flex-start;
  119. justify-content: space-between;
  120. border-top: 1rpx solid #efefef;
  121. .left{
  122. display: flex;
  123. flex-direction: column;
  124. align-items: flex-start;
  125. justify-content: flex-start;
  126. .title{
  127. font-size: 26rpx;
  128. color: #111;
  129. }
  130. .time{
  131. margin-top: 20rpx;
  132. font-size: 24rpx;
  133. color: #a5a5a5;
  134. }
  135. }
  136. .right{
  137. display: flex;
  138. flex-direction: column;
  139. align-items: flex-end;
  140. justify-content: flex-end;
  141. .money{
  142. font-size: 28rpx;
  143. font-weight: bold;
  144. color: #111;
  145. }
  146. .green{
  147. color: green;
  148. }
  149. .red{
  150. color:#ff0000;
  151. }
  152. .remark{
  153. margin-top: 20rpx;
  154. font-size: 24rpx;
  155. color: #a5a5a5;
  156. .green{
  157. color: green;
  158. }
  159. .red{
  160. color: red;
  161. }
  162. }
  163. }
  164. }
  165. }
  166. </style>