index.vue 2.6 KB

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