consume.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view class="body pd16_15">
  3. <view class="jilu-box" v-show="list.length > 0">
  4. <view class="pb10 jilu-item" v-for="(item,key) in list" :key="key">
  5. <view class="jilu-item-box">
  6. <view class="jilu-items">
  7. <view class="lines">
  8. <text class="ft14" style="font-weight: bold;">{{item.video_name}}</text>
  9. <text class="ft12 jilu-txt">{{item.series_name}}</text>
  10. <text class="ft12 jilu-txt">{{item.created_at}}</text>
  11. </view>
  12. </view>
  13. <view class="lines">
  14. <text class="ft14 jilu-txt"
  15. style="text-align: right;font-weight: bold;color: #FF9800;">-{{item.coin_cost}}K币</text>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="empty-box" v-if="list.length < 1 && show">
  21. <image src="/static/img/orders/emty.png" mode=""></image>
  22. <p class="ft14 line-1-txt">暂无消费记录</p>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import {
  28. getUserConsumeRecord
  29. } from "@/common/apis/my.js"
  30. export default {
  31. data() {
  32. return {
  33. page: 1,
  34. hasMore: true,
  35. list: [],
  36. show: false
  37. }
  38. },
  39. onLoad() {
  40. },
  41. onShow() {
  42. this.page = 1;
  43. this.hasMore = true;
  44. this.getList();
  45. uni.hideLoading();
  46. },
  47. onPullDownRefresh() {
  48. this.page = 1;
  49. this.list = [];
  50. this.getList();
  51. uni.stopPullDownRefresh();
  52. },
  53. onReachBottom() {
  54. if (!this.hasMore) {
  55. return false;
  56. }
  57. this.getList();
  58. },
  59. methods: {
  60. async getList() {
  61. if (this.page <= 1) {
  62. this.show = false;
  63. }
  64. let res = await getUserConsumeRecord(this.page);
  65. if (res) {
  66. if (this.page >= res.last_page) {
  67. this.hasMore = false;
  68. } else {
  69. this.page++;
  70. }
  71. res.data.forEach((item, index) => {
  72. this.list.push(item);
  73. })
  74. }
  75. this.show = true;
  76. },
  77. }
  78. }
  79. </script>
  80. <style scoped lang="scss">
  81. @import url("style/consume.css");
  82. </style>