bill_detail.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!-- +---------------------------------------------------------------------- -->
  2. <!-- | CRMEB [ CRMEB赋能开发者,助力企业发展 ] -->
  3. <!-- +---------------------------------------------------------------------- -->
  4. <!-- | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. -->
  5. <!-- +---------------------------------------------------------------------- -->
  6. <!-- | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 -->
  7. <!-- +---------------------------------------------------------------------- -->
  8. <!-- | Author: CRMEB Team <admin@crmeb.com> -->
  9. <!-- +---------------------------------------------------------------------- -->
  10. {extend name="public/container"}
  11. {block name="title"}账单明细{/block}
  12. {block name="head_top"}
  13. <style>
  14. body {
  15. background-color: #f5f5f5;
  16. }
  17. .section {
  18. position: relative;
  19. }
  20. .loading {
  21. font-size: .4rem;
  22. text-align: center;
  23. color: #999;
  24. }
  25. .loaded {
  26. font-size: .28rem;
  27. line-height: .72rem;
  28. text-align: center;
  29. color: #999;
  30. }
  31. .nothing {
  32. position: absolute;
  33. top: 30%;
  34. left: 50%;
  35. width: 4.14rem;
  36. height: 3.36rem;
  37. -webkit-transform: translateX(-50%);
  38. transform: translateX(-50%);
  39. }
  40. </style>
  41. {/block}
  42. {block name="content"}
  43. <div v-cloak id="app">
  44. <div class="bill">
  45. <div class="header">
  46. <div class="cont">
  47. 余额
  48. <div class="num">{$userInfo.now_money}</div>
  49. </div>
  50. </div>
  51. <div class="main">
  52. <div class="nav-bar">
  53. <div v-for="(item, index) in navs" :key="index" :class="{ active: navActive === index }" class="item" @click="navActives(index)">{{ item }}</div>
  54. </div>
  55. <div class="nav-cont">
  56. <div class="section">
  57. <div class="list">
  58. <div v-for="(item, index) in billList" :key="index" class="item">
  59. <div class="text">
  60. <div class="name">{{ item.title }}</div>
  61. <div class="time">{{ item.add_time }}</div>
  62. </div>
  63. <div class="nums" v-if="item.pm>0">+{{ item.number }}</div>
  64. <div class="num" v-else>-{{ item.number }}</div>
  65. </div>
  66. </div>
  67. <div v-show="loading" class="loading">
  68. <span class="fa fa-spinner"></span>
  69. </div>
  70. <div v-if="loadend && billList.length" class="loaded">{{loadTitle}}</div>
  71. <div v-if="!billList.length && !loading">
  72. <img class="nothing" src="/wap/first/zsff/images/no_data_available.png">
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <quick-menu></quick-menu>
  79. </div>
  80. <script>
  81. require(['vue', 'store', 'helper', 'quick'], function (Vue, app, helper) {
  82. new Vue({
  83. el: '#app',
  84. data: {
  85. navs: ['全部', '支出', '收入'],
  86. billList: [],
  87. navActive: 0,
  88. limit: 20,
  89. page: 1,
  90. loadend:false,
  91. loading:false,
  92. },
  93. computed: {},
  94. watch: {
  95. navActive: function () {
  96. this.index = 1;
  97. }
  98. },
  99. mounted: function () {
  100. var that = this;
  101. that.getBillList();
  102. this.$nextTick(function () {
  103. window.addEventListener('scroll', function () {
  104. var clientHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
  105. scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight,
  106. scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  107. if (clientHeight + scrollTop >= scrollHeight) {
  108. that.getBillList();
  109. }
  110. });
  111. });
  112. },
  113. methods: {
  114. navActives:function(index){
  115. var that=this;
  116. that.navActive=index;
  117. that.page=1;
  118. that.loading=false;
  119. that.loadend=false;
  120. that.billList=[];
  121. that.getBillList();
  122. },
  123. getBillList: function () {
  124. var that = this;
  125. if(this.loadend) return;
  126. if(this.loading) return;
  127. this.loading = true;
  128. app.baseGet($h.U({c:'auth_api',a:'user_balance_list',p:{index:that.navActive,first:that.page,limit:that.limit}}), function (res) {
  129. var list=res.data.data;
  130. var billList=$h.SplitArray(list,that.billList);
  131. that.loading=false;
  132. that.loadend=list.length < that.limit;
  133. that.page=that.page + 1;
  134. that.loadTitle = that.loadend ? '已全部加载' : '上拉加载更多';
  135. that.$set(that,'billList',billList);
  136. }, function (params) {
  137. that.loadTitle = '上拉加载更多';
  138. that.loading=false;
  139. });
  140. }
  141. }
  142. });
  143. });
  144. </script>
  145. {/block}