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