index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view :style="colorStyle">
  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' v-for="(vo,indexn) in item.list" :key="indexn">
  15. <view>
  16. <view class='name line1'>{{vo.title}}</view>
  17. <view>{{vo.add_time}}</view>
  18. </view>
  19. <view class='num' v-if="vo.pm">+{{vo.number}}</view>
  20. <view class='num font-color' v-else>-{{vo.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. <!-- #ifdef MP -->
  34. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  35. <!-- #endif -->
  36. <!-- #ifndef MP -->
  37. <home></home>
  38. <!-- #endif -->
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. getCommissionInfo
  44. } from '@/api/user.js';
  45. import {
  46. toLogin
  47. } from '@/libs/login.js';
  48. import {
  49. mapGetters
  50. } from "vuex";
  51. // #ifdef MP
  52. import authorize from '@/components/Authorize';
  53. // #endif
  54. import emptyPage from '@/components/emptyPage.vue';
  55. import home from '@/components/home';
  56. import colors from "@/mixins/color";
  57. export default {
  58. components: {
  59. // #ifdef MP
  60. authorize,
  61. // #endif
  62. emptyPage,
  63. home
  64. },
  65. mixins: [colors],
  66. data() {
  67. return {
  68. loadTitle: '加载更多',
  69. loading: false,
  70. loadend: false,
  71. page: 1,
  72. limit: 10,
  73. type: 0,
  74. userBillList: [],
  75. isAuto: false, //没有授权的不会自动授权
  76. isShowAuth: false //是否隐藏授权
  77. };
  78. },
  79. computed: mapGetters(['isLogin']),
  80. onShow() {
  81. if (this.isLogin) {
  82. this.getUserBillList();
  83. } else {
  84. toLogin();
  85. }
  86. },
  87. /**
  88. * 生命周期函数--监听页面加载
  89. */
  90. onLoad: function(options) {
  91. this.type = options.type || 0;
  92. },
  93. /**
  94. * 页面上拉触底事件的处理函数
  95. */
  96. onReachBottom: function() {
  97. this.getUserBillList();
  98. },
  99. methods: {
  100. /**
  101. * 授权回调
  102. */
  103. onLoadFun: function() {
  104. this.getUserBillList();
  105. },
  106. // 授权关闭
  107. authColse: function(e) {
  108. this.isShowAuth = e
  109. },
  110. /**
  111. * 获取账户明细
  112. */
  113. getUserBillList: function() {
  114. let that = this;
  115. if (that.loadend) return;
  116. if (that.loading) return;
  117. that.loading = true;
  118. that.loadTitle = "";
  119. let data = {
  120. page: that.page,
  121. limit: that.limit
  122. }
  123. getCommissionInfo(data, that.type).then(function(res) {
  124. let list = res.data,
  125. loadend = list.length < that.limit;
  126. that.userBillList = that.$util.SplitArray(list, that.userBillList);
  127. that.$set(that, 'userBillList', that.userBillList);
  128. that.loadend = loadend;
  129. that.loading = false;
  130. that.loadTitle = loadend ? "哼😕~我也是有底线的~" : "加载更多";
  131. that.page = that.page + 1;
  132. }, function(res) {
  133. that.loading = false;
  134. that.loadTitle = '加载更多';
  135. });
  136. },
  137. /**
  138. * 切换导航
  139. */
  140. changeType: function(type) {
  141. this.type = type;
  142. this.loadend = false;
  143. this.page = 1;
  144. this.$set(this, 'userBillList', []);
  145. this.getUserBillList();
  146. },
  147. }
  148. }
  149. </script>
  150. <style scoped lang='scss'>
  151. .bill-details .nav {
  152. background-color: #fff;
  153. height: 90rpx;
  154. width: 100%;
  155. line-height: 90rpx;
  156. }
  157. .bill-details .nav .item {
  158. flex: 1;
  159. text-align: center;
  160. font-size: 30rpx;
  161. color: #282828;
  162. }
  163. .bill-details .nav .item.on {
  164. color: var(--view-theme);
  165. border-bottom: 3rpx solid var(--view-theme);
  166. }
  167. </style>