integralLogsList.vue 3.8 KB

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