index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view>
  3. <Nav title="列表组件演示"></Nav>
  4. <pagingList ref="likeGoodsList" @getList="getGoodsList">
  5. <template v-slot:listInfo="{pagingData}">
  6. <view class="goods-list">
  7. <view class="goods-item" v-for="item in pagingData">
  8. <view class="goods-item-left">
  9. <image class="goods-item-img" :src="item.cover_img" mode="aspectFill"></image>
  10. </view>
  11. <view class="goods-item-right">
  12. <view class="goods-item-name">{{item.good_name}}</view>
  13. <view class="goods-item-price goods-item-zh" v-if="item.p_type===1">
  14. <view class="item-price">
  15. <enPrice :currentPrice="item.price" :originalPrice="item.original_price"></enPrice>
  16. </view>
  17. <view class="item-market">
  18. <text class="iconfont">&#xe61a;</text>
  19. <text>5.0评分</text>
  20. <text>2W+人付款</text>
  21. </view>
  22. </view>
  23. <view class="goods-item-price goods-item-tp" v-else>
  24. <view class="goods-item-platform">
  25. <text class="goods-item-tp" v-if="item.p_type===2">天猫好物</text>
  26. <text class="goods-item-jd" v-else>京东优选</text>
  27. </view>
  28. <view class="item-price">
  29. <enPrice :currentPrice="item.price" :originalPrice="item.original_price"></enPrice>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. </pagingList>
  37. </view>
  38. </template>
  39. <script>
  40. import Black from '@/components/en-utils/en-blank/en-blank'
  41. import pagingList from '@/components/en-list/en-list'
  42. import enPrice from '@/components/en-utils/en-price/en-price'
  43. import {likeGoods} from "@/api/goods";
  44. export default {
  45. components:{
  46. Black,
  47. pagingList,
  48. enPrice,
  49. },
  50. methods:{
  51. getGoodsList(page){
  52. likeGoods({'page':page}).then((res)=>{
  53. if(res.code===1){
  54. this.$refs.likeGoodsList.setList(res.data.list,res.data.total)
  55. }
  56. })
  57. }
  58. }
  59. }
  60. </script>
  61. <style scoped lang="scss">
  62. @font-face {
  63. font-family: 'iconfont';
  64. src: url('/components/static/icon/iconfont.ttf') format('truetype');
  65. }
  66. .iconfont {
  67. font-family: "iconfont" !important;
  68. font-style: normal;
  69. -webkit-font-smoothing: antialiased;
  70. -moz-osx-font-smoothing: grayscale;
  71. }
  72. .goods-list{
  73. background-color: #F5F5F5;
  74. margin: 0 24rpx;
  75. .goods-item{
  76. width: 100%;
  77. height: 364rpx;
  78. background-color: #FFFFFF;
  79. border-radius: 20rpx;
  80. margin: 20rpx 0;
  81. display: flex;
  82. .goods-item-left{
  83. padding: 24rpx;
  84. .goods-item-img{
  85. width:316rpx;
  86. height:316rpx;
  87. border-radius: 16rpx;
  88. }
  89. }
  90. .goods-item-right{
  91. width:100%;
  92. height:300rpx;
  93. padding:32rpx 30rpx 32rpx 0;
  94. position:relative;
  95. //display: flex;
  96. //align-content: space-between;
  97. .goods-item-name{
  98. color: #333333;
  99. font-size: 30rpx;
  100. font-weight: 600;
  101. display: -webkit-box;
  102. -webkit-line-clamp: 2;
  103. -webkit-box-orient: vertical;
  104. overflow: hidden;
  105. }
  106. .goods-item-price{
  107. position:absolute;
  108. bottom: 32rpx;
  109. .item-price{
  110. }
  111. .item-market{
  112. text{
  113. color: #999999;
  114. font-size: 24rpx;
  115. line-height: 34rpx;
  116. padding: 0 20rpx 0 0;
  117. }
  118. .iconfont{
  119. padding: 0;
  120. }
  121. }
  122. }
  123. .goods-item-platform{
  124. height: 32rpx;
  125. margin-bottom: 10rpx;
  126. .goods-item-tp{
  127. padding: 4rpx 8rpx;
  128. color: #975BFE;
  129. width: 90rpx;
  130. height: 30rpx;
  131. font-size: 24rpx;
  132. line-height: 28rpx;
  133. border: 2rpx solid #985DFF;
  134. border-radius: 4rpx;
  135. }
  136. .goods-item-jd{
  137. padding: 4rpx 8rpx;
  138. border-radius: 6rpx;
  139. color: #FFFFFF;
  140. font-size: 24rpx;
  141. line-height: 28rpx;
  142. background: linear-gradient(90deg, #FD3229 0%, #FC7A28 100%);
  143. }
  144. }
  145. .goods-item-zh{
  146. }
  147. }
  148. }
  149. }
  150. </style>