index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view style="height: 100vh">
  3. <view class="good-list">
  4. <view class="good" v-for="item in list" @click="navto('/pages/goods_details/indexs?id=' + item.product_id + '&server_card_id=' + item.id)">
  5. <image :src="item.image" mode="" class="good-image"></image>
  6. <view class="good-name ">
  7. <view class="clamp2">
  8. {{item.card_name}}
  9. </view>
  10. </view>
  11. <view class="good-price">
  12. <view class="price">
  13. {{item.card_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. import {
  26. getSeverCardList
  27. } from '@/api/store.js';
  28. export default {
  29. data() {
  30. return {
  31. page: 1,
  32. pageSize: 10,
  33. loaded: false,
  34. loadingType: 'loadmore',
  35. list: []
  36. }
  37. },
  38. onLoad(opt) {
  39. },
  40. onShow() {
  41. this.getList()
  42. },
  43. onReachBottom() {
  44. this.getList()
  45. },
  46. onReady() {
  47. },
  48. methods: {
  49. getList(type) {
  50. let that = this
  51. if (type == 'tab' && that.loaded) {
  52. return
  53. }
  54. if (that.loadingType == 'loading' || that.loadingType == 'nomore') {
  55. return
  56. }
  57. that.loadingType = 'loading'
  58. getSeverCardList({
  59. page: that.page,
  60. limit: that.pageSize,
  61. }).then(({
  62. data
  63. }) => {
  64. that.list = that.list.concat(data.list)
  65. that.page++
  66. if (data.list.length == that.pageSize) {
  67. that.loadingType = 'loadmore'
  68. } else {
  69. that.loadingType = 'nomore'
  70. }
  71. })
  72. },
  73. navto(url) {
  74. uni.navigateTo({
  75. url,
  76. fail() {
  77. uni.switchTab({
  78. url
  79. })
  80. }
  81. })
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss">
  87. .good-list {
  88. display: flex;
  89. justify-content: space-between;
  90. flex-wrap: wrap;
  91. padding: 20rpx 28rpx;
  92. .good {
  93. width: 336rpx;
  94. height: 482rpx;
  95. background: #FFFFFF;
  96. box-shadow: 0px 0px 6rpx 0px rgba(0, 0, 0, 0.1);
  97. border-radius: 14rpx;
  98. margin-bottom: 20rpx;
  99. position: relative;
  100. .good-image {
  101. width: 336rpx;
  102. height: 336rpx;
  103. border-radius: 14rpx 14rpx 0 0;
  104. }
  105. .good-name {
  106. font-size: 28rpx;
  107. font-weight: bold;
  108. color: #333333;
  109. padding: 0 20rpx;
  110. }
  111. .good-price {
  112. display: flex;
  113. width: 336rpx;
  114. justify-content: space-between;
  115. font-size: 28rpx;
  116. font-weight: bold;
  117. color: #FF1A1A;
  118. position: absolute;
  119. bottom: 20rpx;
  120. padding: 0 20rpx;
  121. .xl{
  122. font-size: 20rpx;
  123. font-weight: bold;
  124. color: #999999;
  125. }
  126. }
  127. }
  128. }
  129. </style>