index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. 振合
  15. </view>
  16. <view class="goods-item-price goods-item-tp" v-else>
  17. <view class="goods-item-platform">
  18. <text class="goods-item-tp" v-if="item.p_type===2">天猫好物</text>
  19. <text class="goods-item-jd" v-else>京东优选</text>
  20. </view>
  21. <view class="item-price">
  22. <enPrice :currentPrice="item.price" :originalPrice="item.original_price"></enPrice>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. </pagingList>
  30. </view>
  31. </template>
  32. <script>
  33. import Black from '@/components/en-utils/en-blank/en-blank'
  34. import pagingList from '@/components/en-list/en-list'
  35. import enPrice from '@/components/en-utils/en-price/en-price'
  36. import {likeGoods} from "@/api/goods";
  37. export default {
  38. components:{
  39. Black,
  40. pagingList,
  41. enPrice,
  42. },
  43. methods:{
  44. getGoodsList(page){
  45. likeGoods({'page':page}).then((res)=>{
  46. if(res.code===1){
  47. this.$refs.likeGoodsList.setList(res.data.list,res.data.total)
  48. }
  49. })
  50. }
  51. }
  52. }
  53. </script>
  54. <style scoped lang="scss">
  55. .goods-list{
  56. background-color: #F5F5F5;
  57. margin: 0 24rpx;
  58. .goods-item{
  59. width: 100%;
  60. height: 364rpx;
  61. background-color: #FFFFFF;
  62. border-radius: 20rpx;
  63. margin: 20rpx 0;
  64. display: flex;
  65. .goods-item-left{
  66. padding: 24rpx;
  67. .goods-item-img{
  68. width:316rpx;
  69. height:316rpx;
  70. border-radius: 16rpx;
  71. }
  72. }
  73. .goods-item-right{
  74. width:100%;
  75. height:300rpx;
  76. padding:32rpx 30rpx 32rpx 0;
  77. position:relative;
  78. //display: flex;
  79. //align-content: space-between;
  80. .goods-item-name{
  81. color: #333333;
  82. font-size: 30rpx;
  83. font-weight: 600;
  84. display: -webkit-box;
  85. -webkit-line-clamp: 2;
  86. -webkit-box-orient: vertical;
  87. overflow: hidden;
  88. }
  89. .goods-item-price{
  90. position:absolute;
  91. bottom: 32rpx;
  92. .item-price{
  93. .item-current-price{
  94. color: #ED301D;
  95. font-size: 40rpx;
  96. }
  97. .item-original-price{
  98. margin-left: 12rpx;
  99. color: #999999;
  100. font-size: 24rpx;
  101. text-decoration: line-through;
  102. }
  103. }
  104. }
  105. .goods-item-platform{
  106. height: 32rpx;
  107. margin-bottom: 10rpx;
  108. .goods-item-tp{
  109. padding: 4rpx 8rpx;
  110. color: #975BFE;
  111. width: 90rpx;
  112. height: 30rpx;
  113. font-size: 24rpx;
  114. line-height: 28rpx;
  115. border: 2rpx solid #985DFF;
  116. border-radius: 4rpx;
  117. }
  118. .goods-item-jd{
  119. padding: 4rpx 8rpx;
  120. border-radius: 6rpx;
  121. color: #FFFFFF;
  122. font-size: 24rpx;
  123. line-height: 28rpx;
  124. background: linear-gradient(90deg, #FD3229 0%, #FC7A28 100%);
  125. }
  126. }
  127. .goods-item-zh{
  128. }
  129. }
  130. }
  131. }
  132. </style>