index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="record" :style="colorStyle">
  3. <timeSlot @changeTime="changeTime"></timeSlot>
  4. <view class="list" v-if="list.length">
  5. <view class="item acea-row row-between row-top" v-for="(item,index) in list" :key="index">
  6. <view class="acea-row row-top">
  7. <text class="icon iconfont icon-xiaofeijilu1" v-if="item.type==1"></text>
  8. <text class="icon iconfont icon-fufeihuiyuan1" v-else-if="item.type==7"></text>
  9. <text class="icon iconfont icon-xiaofeijilu-rongcuo" v-else></text>
  10. <view class="txt">
  11. <view class="line1">{{item.title}}</view>
  12. <view class="exp record">{{item.type_name}}</view>
  13. <view class="time">{{item.day}}</view>
  14. </view>
  15. </view>
  16. <view class="num">-{{item.price}}</view>
  17. </view>
  18. </view>
  19. <view class="list" v-else>
  20. <emptyPage title="暂无消费记录~"></emptyPage>
  21. </view>
  22. <view class='loadingicon acea-row row-center-wrapper' v-if="list.length">
  23. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  24. </view>
  25. <!-- #ifdef MP -->
  26. <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
  27. <!-- #endif -->
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. toLogin
  33. } from '@/libs/login.js';
  34. import {
  35. mapGetters
  36. } from "vuex";
  37. import {
  38. moneyList
  39. } from '@/api/user.js';
  40. import emptyPage from '@/components/emptyPage.vue'
  41. import timeSlot from '@/components/timeSlot/index.vue';
  42. import colors from '@/mixins/color.js';
  43. export default {
  44. components: {
  45. timeSlot,
  46. emptyPage
  47. },
  48. mixins: [colors],
  49. computed: mapGetters(['isLogin']),
  50. data(){
  51. return {
  52. page: 1,
  53. limit: 15,
  54. start: 0,
  55. stop: 0,
  56. loading: false,
  57. loadend: false,
  58. loadTitle: '加载更多',
  59. list:[],
  60. isShowAuth: false
  61. }
  62. },
  63. onLoad(){
  64. if (this.isLogin) {
  65. this.getUserBillList();
  66. }
  67. },
  68. onShow(){
  69. if(!this.isLogin){
  70. toLogin()
  71. }
  72. },
  73. methods:{
  74. onLoadFun(){
  75. this.getUserBillList();
  76. this.isShowAuth = false;
  77. },
  78. authColse: function(e) {
  79. this.isShowAuth = e
  80. },
  81. changeTime(time) {
  82. this.start = time.start
  83. this.stop = time.stop
  84. this.page = 1;
  85. this.loadend = false;
  86. this.list = [];
  87. this.getUserBillList()
  88. },
  89. getUserBillList(){
  90. let that = this;
  91. if (that.loading) return;
  92. if (that.loadend) return;
  93. that.loading = true;
  94. that.loadTitle = '';
  95. moneyList({
  96. page: this.page,
  97. limit: this.limit,
  98. start: this.start,
  99. stop: this.stop
  100. },9).then(res=>{
  101. let list = res.data.list;
  102. let loadend = list.length < that.limit;
  103. that.list = that.$util.SplitArray(list, that.list);
  104. that.$set(that, 'list', that.list);
  105. that.loadend = loadend;
  106. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  107. that.page = that.page + 1;
  108. that.loading = false;
  109. }).catch(err=>{
  110. that.loading = false;
  111. that.loadTitle = '加载更多';
  112. })
  113. }
  114. },
  115. onReachBottom: function() {
  116. this.getUserBillList();
  117. }
  118. }
  119. </script>
  120. <style lang="scss">
  121. .record{
  122. .list{
  123. width: 690rpx;
  124. background-color: #fff;
  125. border-radius: 14rpx;
  126. margin: 20rpx auto 0 auto;
  127. padding-top: 42rpx;
  128. .item{
  129. padding: 0 24rpx 26rpx 24rpx;
  130. position: relative;
  131. margin-bottom: 34rpx;
  132. .icon{
  133. font-size: 72rpx;
  134. color: #E7C993;
  135. }
  136. .num{
  137. color: #282828;
  138. font-size: 32rpx;
  139. font-weight: 600;
  140. }
  141. .pictrue{
  142. width: 76rpx;
  143. height: 76rpx;
  144. background-color: #FDF8EE;
  145. border-radius: 50%;
  146. .iconfont{
  147. color: #F7B942;
  148. }
  149. }
  150. .txt{
  151. font-weight: 400;
  152. color: #282828;
  153. font-size: 28rpx;
  154. margin-left: 24rpx;
  155. .line1{
  156. width: 320rpx;
  157. }
  158. .exp{
  159. color: #999999;
  160. font-size: 22rpx;
  161. margin-top: 2rpx;
  162. &.record{
  163. margin-top: 8rpx;
  164. }
  165. image{
  166. color: #999999;
  167. margin-right: 10rpx;
  168. width: 22rpx;
  169. height: 22rpx;
  170. }
  171. }
  172. .time{
  173. color: #999999;
  174. font-size: 22rpx;
  175. margin-top: 8rpx;
  176. }
  177. }
  178. .bnt{
  179. width: 112rpx;
  180. height: 44rpx;
  181. background: #F4DBAB;
  182. border-radius: 26rpx;
  183. color: #755214;
  184. font-size: 24rpx;
  185. }
  186. &::before{
  187. position: absolute;
  188. content: '';
  189. width: 542rpx;
  190. height: 1px;
  191. background: #EEEEEE;
  192. bottom: 0rpx;
  193. right: 24rpx;
  194. }
  195. }
  196. }
  197. }
  198. </style>