gongyiList.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view class="main">
  3. <view class="list-box-h">
  4. <empty v-if="loaded === true && list.length == 0"></empty>
  5. <view v-for="(item, index) in list" :key="index" class="guess-item" @click="navToDetailPage(item)">
  6. <image :src="item.image"></image>
  7. <view class="guess-box">
  8. <view class="title clamp2">{{ item.store_name }}</view>
  9. <view class="flex itemContent">
  10. <view>
  11. <view class="price-box flex">
  12. <view class="yuanprice">{{ item.ot_price }}</view>
  13. <!-- <image src="../../static/img/jiantou.png" mode=""></image> -->
  14. <!-- <view class="jiang">直降{{ (item.ot_price - item.price).toFixed(2) }}元</view> -->
  15. </view>
  16. <view class="price" >¥{{ item.price }}</view>
  17. </view>
  18. <view class="btn">立即购买</view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <uni-load-more :status="loadingType"></uni-load-more>
  24. </view>
  25. </template>
  26. <script>
  27. import empty from '@/components/empty';
  28. import {
  29. getProducts
  30. } from '@/api/product.js';
  31. export default {
  32. components: {
  33. empty
  34. },
  35. data() {
  36. return {
  37. list: [],
  38. page: 1,
  39. limit: 10,
  40. loadingType: 'more',
  41. loaded: false
  42. }
  43. },
  44. onLoad(opt) {
  45. this.getArticleList()
  46. },
  47. methods: {
  48. navToDetailPage(item) {
  49. uni.navigateTo({
  50. url: '/pages/product/product?id=' + item.id
  51. });
  52. },
  53. getArticleList() {
  54. let obj = this
  55. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  56. return
  57. }
  58. obj.loadingType = 'loading'
  59. getProducts({
  60. page: obj.page,
  61. limit: obj.limit,
  62. // is_gp:1 ,//设置是否vip商品
  63. // sid:obj.sid
  64. cid:6
  65. }).then(({
  66. data
  67. }) => {
  68. obj.list = obj.list.concat(data)
  69. obj.page++
  70. if (data.length == obj.limit) {
  71. obj.loadingType = 'more'
  72. } else {
  73. obj.loadingType = 'noMore'
  74. }
  75. obj.loaded = true
  76. })
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. page {
  83. background-color: #fff;
  84. min-height: 100%;
  85. }
  86. .list-box-h {
  87. padding: 20rpx;
  88. }
  89. .guess-item {
  90. padding: 10rpx;
  91. display: flex;
  92. min-width: 100%;
  93. width: 0;
  94. margin-bottom: 20rpx;
  95. background: #ffffff;
  96. border-radius: 10rpx;
  97. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  98. image {
  99. width: 200rpx;
  100. height: 200rpx;
  101. border-radius: 10rpx;
  102. flex-shrink: 0;
  103. }
  104. .guess-box {
  105. width: 100%;
  106. padding: 5px;
  107. position: relative;
  108. .itemContent {
  109. position: absolute ;
  110. width: 100%;
  111. padding: 20rpx 10rpx;
  112. bottom: 0;
  113. right: 0;
  114. }
  115. .title {
  116. font-size: 30rpx;
  117. font-weight: bold;
  118. color: #333333;
  119. height: 2.5em;
  120. line-height: 1.25em;
  121. }
  122. .price-box {
  123. justify-content: flex-start;
  124. .yuanprice {
  125. font-size: 26rpx;
  126. font-family: PingFang SC;
  127. font-weight: 500;
  128. text-decoration: line-through;
  129. color: #999999;
  130. padding-right: 6rpx;
  131. }
  132. image {
  133. width: 14rpx;
  134. height: 16rpx;
  135. }
  136. .jiang {
  137. padding-left: 2rpx;
  138. font-size: 24rpx;
  139. font-family: PingFang SC;
  140. font-weight: bold;
  141. color: #b59467;
  142. }
  143. }
  144. .price {
  145. font-size: 36rpx;
  146. font-family: PingFang SC;
  147. font-weight: bold;
  148. color: #FF6F0F;
  149. }
  150. .btn {
  151. background: #16cc9f;
  152. border-radius: 28rpx;
  153. font-size: 28rpx;
  154. font-weight: 500;
  155. color: #ffffff;
  156. float: right;
  157. padding: 10rpx 20rpx;
  158. }
  159. }
  160. }
  161. </style>