record.vue 1.8 KB

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