bill_detail.html 5.0 KB

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