record.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view class="coll">
  3. <view class="kxjl">
  4. <view class="kxjl-item flexs" v-for="(item, index) in recordList" :key="index">
  5. <view class="kxjl-bg"><image :src="item.image" mode="aspectFill"></image></view>
  6. <view class="kxjl-info">
  7. <view class="kxjl-name">{{ item.box_name }}</view>
  8. <view class="kxjl-money">{{ item.coin_amount }}金币</view>
  9. <view class="kxjl-time">时间:{{ item.time }}</view>
  10. </view>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. data() {
  18. return {
  19. page: 1, //分页
  20. pages: 0, //总页数
  21. recordList: [] //记录列表
  22. };
  23. },
  24. methods: {
  25. //获取开箱记录
  26. loadData() {
  27. this.$api.openRecord({ page: this.page, msg: '数据加载中' }).then(res => {
  28. uni.stopPullDownRefresh();
  29. if (res.code === 1) {
  30. (this.recordList = this.page == 1 ? res.data.data : [...this.recordList, ...res.data.data]), (this.pages = res.data.last_page);
  31. }
  32. });
  33. }
  34. },
  35. onLoad() {
  36. this.loadData();
  37. },
  38. onPullDownRefresh() {
  39. this.page = 1;
  40. this.loadData();
  41. },
  42. onReachBottom() {
  43. if (this.page < this.pages) {
  44. this.page++;
  45. this.loadData();
  46. }
  47. }
  48. };
  49. </script>
  50. <style lang="scss">
  51. .kxjl {
  52. padding: 30rpx 30rpx 0 30rpx;
  53. .kxjl-item {
  54. padding: 30rpx;
  55. margin-bottom: 20rpx;
  56. background: #ffffff;
  57. border-radius: 20rpx;
  58. .kxjl-bg {
  59. image {
  60. width: 168rpx;
  61. height: 168rpx;
  62. border-radius: 10rpx;
  63. }
  64. margin-right: 20rpx;
  65. }
  66. .kxjl-name {
  67. font-size: 28rpx;
  68. display: -webkit-box;
  69. -webkit-box-orient: vertical;
  70. -webkit-line-clamp: 2;
  71. overflow: hidden;
  72. }
  73. .kxjl-money {
  74. color: #cf271b;
  75. font-size: 28rpx;
  76. margin: 15rpx 0;
  77. }
  78. .kxjl-time {
  79. color: #999999;
  80. font-size: 22rpx;
  81. }
  82. }
  83. }
  84. </style>