index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view :style="viewColor">
  3. <view class='bill-details'>
  4. <view class='nav acea-row'>
  5. <view class='item' :class='type==0 ? "on":""' @click='changeType(0)'>全部</view>
  6. <view class='item' :class='type==1 ? "on":""' @click='changeType(1)'>消费</view>
  7. <view class='item' :class='type==2 ? "on":""' @click='changeType(2)'>充值</view>
  8. </view>
  9. <view class='sign-record'>
  10. <view class='list' v-for="(item,index) in userBillList" :key="index">
  11. <view class='item'>
  12. <!-- <view class='data'>{{item.time}}</view> -->
  13. <view class='listn'>
  14. <view class='itemn acea-row row-between-wrapper'>
  15. <view>
  16. <view class='name line1'>{{item.title}}</view>
  17. <view>{{item.create_time}}</view>
  18. </view>
  19. <view class='num' v-if="item.pm ==1">+{{item.number}}</view>
  20. <view class='num p-color' v-else>-{{item.number}}</view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class='loadingicon acea-row row-center-wrapper' v-if="userBillList.length>0">
  26. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  27. </view>
  28. <view v-if="userBillList.length == 0">
  29. <emptyPage title="暂无账单的记录哦~"></emptyPage>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. // +----------------------------------------------------------------------
  37. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  38. // +----------------------------------------------------------------------
  39. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  40. // +----------------------------------------------------------------------
  41. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  42. // +----------------------------------------------------------------------
  43. // | Author: CRMEB Team <admin@crmeb.com>
  44. // +----------------------------------------------------------------------
  45. import { getCommissionInfo } from '@/api/user.js';
  46. import { mapGetters } from "vuex";
  47. import emptyPage from '@/components/emptyPage.vue'
  48. import { toLogin } from '@/libs/login.js';
  49. export default {
  50. components: {
  51. emptyPage
  52. },
  53. data() {
  54. return {
  55. loadTitle: '加载更多',
  56. loading: false,
  57. loadend: false,
  58. page: 1,
  59. limit: 15,
  60. type: 0,
  61. userBillList: [],
  62. };
  63. },
  64. computed: mapGetters(['isLogin','viewColor']),
  65. onShow() {
  66. if (this.isLogin) {
  67. this.getUserBillList();
  68. } else {
  69. toLogin()
  70. }
  71. },
  72. /**
  73. * 生命周期函数--监听页面加载
  74. */
  75. onLoad: function(options) {
  76. this.type = options.type || 0;
  77. },
  78. /**
  79. * 页面上拉触底事件的处理函数
  80. */
  81. onReachBottom: function() {
  82. this.getUserBillList();
  83. },
  84. methods: {
  85. /**
  86. * 获取账户明细
  87. */
  88. getUserBillList: function() {
  89. let that = this;
  90. if (that.loadend) return;
  91. if (that.loading) return;
  92. that.loading = true;
  93. that.loadTitle = "";
  94. let data = {
  95. page: that.page,
  96. limit: that.limit,
  97. type:that.type
  98. }
  99. getCommissionInfo(data).then(function(res) {
  100. let list = res.data.list,
  101. loadend = list.length < that.limit;
  102. that.userBillList = that.$util.SplitArray(list, that.userBillList);
  103. that.$set(that, 'userBillList', that.userBillList);
  104. that.loadend = loadend;
  105. that.loading = false;
  106. that.loadTitle = loadend ? "哼😕~我也是有底线的~" : "加载更多";
  107. that.page = that.page + 1;
  108. }, function(res) {
  109. that.loading = false;
  110. that.loadTitle = '加载更多';
  111. });
  112. },
  113. /**
  114. * 切换导航
  115. */
  116. changeType: function(type) {
  117. this.type = type;
  118. this.loadend = false;
  119. this.page = 1;
  120. this.$set(this, 'userBillList', []);
  121. this.getUserBillList();
  122. },
  123. }
  124. }
  125. </script>
  126. <style scoped lang='scss'>
  127. .bill-details .nav {
  128. background-color: #fff;
  129. height: 90rpx;
  130. width: 100%;
  131. line-height: 90rpx;
  132. }
  133. .bill-details .nav .item {
  134. flex: 1;
  135. text-align: center;
  136. font-size: 30rpx;
  137. color: #282828;
  138. }
  139. .bill-details .nav .item.on {
  140. color: var(--view-theme);
  141. border-bottom: 3rpx solid var(--view-theme);
  142. }
  143. .p-color {
  144. color: var(--view-priceColor)!important;
  145. }
  146. </style>