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. this.getList()
  42. },
  43. onReady() {
  44. },
  45. methods: {
  46. getList(type) {
  47. let that = this
  48. if (type == 'tab' && that.loaded) {
  49. return
  50. }
  51. if (that.loadingType == 'loading' || that.loadingType == 'nomore') {
  52. return
  53. }
  54. that.loadingType = 'loading'
  55. that.$u.api.getYhkList({
  56. page: that.page,
  57. pageSize: that.pageSize,
  58. }).then(({
  59. data
  60. }) => {
  61. that.list = that.list.concat(data)
  62. that.page++
  63. if (data.length == that.pageSize) {
  64. that.loadingType = 'loadmore'
  65. } else {
  66. that.loadingType = 'nomore'
  67. }
  68. })
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss">
  74. .good-list {
  75. display: flex;
  76. justify-content: space-between;
  77. flex-wrap: wrap;
  78. padding: 20rpx 28rpx;
  79. .good {
  80. width: 336rpx;
  81. height: 482rpx;
  82. background: #FFFFFF;
  83. box-shadow: 0px 0px 6rpx 0px rgba(0, 0, 0, 0.1);
  84. border-radius: 14rpx;
  85. margin-bottom: 20rpx;
  86. position: relative;
  87. .good-image {
  88. width: 336rpx;
  89. height: 336rpx;
  90. background-color: #999999;
  91. border-radius: 14rpx 14rpx 0 0;
  92. }
  93. .good-name {
  94. font-size: 28rpx;
  95. font-weight: bold;
  96. color: #333333;
  97. padding: 0 20rpx;
  98. }
  99. .good-price {
  100. display: flex;
  101. width: 336rpx;
  102. justify-content: space-between;
  103. font-size: 28rpx;
  104. font-weight: bold;
  105. color: #FF1A1A;
  106. position: absolute;
  107. bottom: 20rpx;
  108. padding: 0 20rpx;
  109. .xl{
  110. font-size: 20rpx;
  111. font-weight: bold;
  112. color: #999999;
  113. }
  114. }
  115. }
  116. }
  117. </style>