yhk.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view :class="['qn-page-' + theme]" style="height: 100vh">
  3. <view class="good-list">
  4. <view class="good" v-for="item in list" @click="goPage('/pagesT/unit/itemdetail?id=' + item.id + '&isyhk=1')">
  5. <image :src="item.image" mode="" class="good-image"></image>
  6. <view class="good-name ">
  7. <view class="clamp2">
  8. {{item.name}}
  9. </view>
  10. </view>
  11. <view class="good-price">
  12. <view class="price">
  13. {{item.price}}
  14. </view>
  15. <view class="xl">
  16. 销量:{{item.sold}}
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. <u-loadmore :status="loadingType" />
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. page: 1,
  29. pageSize: 10,
  30. loaded: false,
  31. loadingType: 'loadmore',
  32. list: []
  33. }
  34. },
  35. onLoad(opt) {
  36. },
  37. onShow() {
  38. this.getList()
  39. },
  40. onReachBottom() {
  41. },
  42. onReady() {
  43. },
  44. methods: {
  45. getList(type) {
  46. let that = this
  47. if (type == 'tab' && that.loaded) {
  48. return
  49. }
  50. if (that.loadingType == 'loading' || that.loadingType == 'nomore') {
  51. return
  52. }
  53. that.loadingType = 'loading'
  54. that.$u.api.getYhkList({
  55. page: that.page,
  56. pageSize: that.pageSize,
  57. }).then(({
  58. data
  59. }) => {
  60. that.list = that.list.concat(data)
  61. that.page++
  62. if (data.length == that.pageSize) {
  63. that.loadingType = 'loadmore'
  64. } else {
  65. that.loadingType = 'nomore'
  66. }
  67. })
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss">
  73. .good-list {
  74. display: flex;
  75. justify-content: space-between;
  76. flex-wrap: wrap;
  77. padding: 20rpx 28rpx;
  78. .good {
  79. width: 336rpx;
  80. height: 482rpx;
  81. background: #FFFFFF;
  82. box-shadow: 0px 0px 6rpx 0px rgba(0, 0, 0, 0.1);
  83. border-radius: 14rpx;
  84. margin-bottom: 20rpx;
  85. position: relative;
  86. .good-image {
  87. width: 336rpx;
  88. height: 336rpx;
  89. background-color: #999999;
  90. border-radius: 14rpx 14rpx 0 0;
  91. }
  92. .good-name {
  93. font-size: 28rpx;
  94. font-weight: bold;
  95. color: #333333;
  96. padding: 0 20rpx;
  97. }
  98. .good-price {
  99. display: flex;
  100. width: 336rpx;
  101. justify-content: space-between;
  102. font-size: 28rpx;
  103. font-weight: bold;
  104. color: #FF1A1A;
  105. position: absolute;
  106. bottom: 20rpx;
  107. padding: 0 20rpx;
  108. .xl{
  109. font-size: 20rpx;
  110. font-weight: bold;
  111. color: #999999;
  112. }
  113. }
  114. }
  115. }
  116. </style>