commissionLogsList.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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="logs-item" v-for="(item,index) in dataList" :key="index">
  6. <view class="left">
  7. <text class="title" >
  8. 芳华币兑换
  9. </text>
  10. <view class="time">芳华币:{{item.integral}}</view>
  11. </view>
  12. <view class="right">
  13. <text class="money origin">兑换+{{item.commission}}</text>
  14. <text class="remark">{{item.createTime}}</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 {getUserInfo,exchangDetail} from '@/api/user'
  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: 20 // 每页数据的数量,默认10
  41. },
  42. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  43. textNoMore:"已经到底了",
  44. empty: {
  45. icon:'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  46. tip: '暂无数据'
  47. }
  48. },
  49. dataList: []
  50. }
  51. },
  52. onLoad() {
  53. //this.getDictByKey("sys_integral_log_type");
  54. this.user = this.$getUserInfo();
  55. },
  56. methods: {
  57. getDictByKey(key){
  58. var data={key:key}
  59. getDictByKey(data).then(
  60. res => {
  61. if(res.code==200){
  62. this.typeOptions=res.data;
  63. }
  64. },
  65. err => {
  66. }
  67. );
  68. },
  69. getUserInfo(){
  70. let that=this;
  71. getUserInfo().then(res => {
  72. if(res.code==200){
  73. if(res.user!=null){
  74. uni.setStorageSync('userInfo',JSON.stringify(res.user));
  75. this.user=res.user;
  76. }
  77. else{
  78. uni.showToast({
  79. icon:'none',
  80. title: res.msg,
  81. });
  82. }
  83. }
  84. },
  85. rej => {}
  86. );
  87. },
  88. mescrollInit(mescroll) {
  89. this.mescroll = mescroll;
  90. },
  91. /*下拉刷新的回调 */
  92. downCallback(mescroll) {
  93. mescroll.resetUpScroll()
  94. },
  95. upCallback(page) {
  96. //联网加载数据
  97. var that = this;
  98. var data = {
  99. userId:this.user.userId,
  100. page: page.num,
  101. limit: page.size
  102. };
  103. uni.showLoading({
  104. title:"加载中..."
  105. })
  106. exchangDetail(data).then(res => {
  107. uni.hideLoading()
  108. if(res.code==200){
  109. //设置列表数据
  110. if (page.num == 1) {
  111. that.dataList = res.data.rows;
  112. } else {
  113. that.dataList = that.dataList.concat(res.data.rows);
  114. }
  115. that.mescroll.endBySize(res.data.rows.length,res.data.total);
  116. }else{
  117. uni.showToast({
  118. icon:'none',
  119. title: "请求失败",
  120. });
  121. that.dataList = null;
  122. that.mescroll.endErr();
  123. }
  124. });
  125. },
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped>
  130. .page{
  131. }
  132. .content{
  133. .logs-item{
  134. width: 100%;
  135. background-color: #fff;
  136. padding:24rpx;
  137. display: flex;
  138. align-items: flex-start;
  139. justify-content: space-between;
  140. border-top: 1rpx solid #efefef;
  141. .left{
  142. display: flex;
  143. flex-direction: column;
  144. align-items: flex-start;
  145. justify-content: flex-start;
  146. .title{
  147. font-size: 28rpx;
  148. color: #111;
  149. }
  150. .time{
  151. margin-top: 20rpx;
  152. font-size: 24rpx;
  153. color: #a5a5a5;
  154. }
  155. }
  156. .right{
  157. display: flex;
  158. flex-direction: column;
  159. align-items: flex-end;
  160. justify-content: flex-end;
  161. .money{
  162. font-size: 28rpx;
  163. font-weight: bold;
  164. color: #111;
  165. }
  166. .green{
  167. color: green;
  168. }
  169. .red{
  170. color:#ff0000;
  171. }
  172. .origin{
  173. color: #FF5C03;
  174. font-weight: 600;
  175. }
  176. .remark{
  177. margin-top: 20rpx;
  178. font-size: 24rpx;
  179. color: #a5a5a5;
  180. .green{
  181. color: green;
  182. }
  183. .red{
  184. color: red;
  185. }
  186. }
  187. }
  188. }
  189. }
  190. </style>