recommend.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="all">
  3. <image src="@/static/img/i-t.png"></image>
  4. <view class="title">
  5. <text>为你推荐</text>
  6. </view>
  7. <view class="list">
  8. <view class="item" v-for="b in bastList">
  9. <view class="item-img">
  10. <!-- <image :src=b.image mode="" v-if="b.image"></image> -->
  11. <image :src = "b.image" :onerror="defaultImg"></image>
  12. </view>
  13. <view class="item-right">
  14. <view class="name">
  15. {{b.store_name}}
  16. </view>
  17. <view class="item-price">
  18. <view class="">
  19. <text class="ot-price">¥{{b.ot_price}}</text>
  20. <image src="../../../static/icon/decline.png" v-if="b.ot_price - b.price > 0"></image>
  21. <text v-if="b.ot_price - b.price > 0">直降{{b.ot_price - b.price}}元</text><br>
  22. <text class="price">¥{{b.price}}</text>
  23. </view>
  24. <view class="button" @click="navToDetailPage(b)">立即购买</view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. defaultImg: 'this.src="' + require('@/static/error/errorImage.jpg') + '"',
  36. }
  37. },
  38. methods: {
  39. //详情页
  40. navToDetailPage(item) {
  41. this.$parent.$parent.$parent.navToDetailPage(item)
  42. },
  43. },
  44. mounted() {
  45. // this.getList()
  46. },
  47. props: ["bastList"]
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .all {
  52. text-align: center;
  53. padding-bottom: 30rpx;
  54. }
  55. image {
  56. width: 350rpx;
  57. height: 30rpx;
  58. }
  59. .title {
  60. position: relative;
  61. top: -45rpx;
  62. color: #438BED ;
  63. font-size: 30rpx;
  64. font-weight: bold;
  65. }
  66. .list {
  67. padding: 0 5%;
  68. .item {
  69. display: flex;
  70. padding: 20rpx;
  71. box-shadow:0 0 20rpx 6rpx #f1f1f1;
  72. border-radius: 20rpx;
  73. margin-bottom: 20rpx;
  74. .item-img {
  75. margin-right: 40rpx;
  76. image {
  77. width: 200rpx;
  78. height: 200rpx;
  79. }
  80. }
  81. .item-right {
  82. width: 100%;
  83. text-align: left;
  84. display: grid;
  85. align-content: space-between;
  86. .name {
  87. color: #333333;
  88. font-size: 30rpx;
  89. font-weight: bold;
  90. font-family: PingFang-SC-Bold;
  91. overflow: hidden;
  92. text-overflow: ellipsis;
  93. display: -webkit-box;
  94. -webkit-box-orient: vertical;
  95. -webkit-line-clamp: 2;
  96. }
  97. text {
  98. color: #FFB238;
  99. font-size: 20rpx;
  100. }
  101. .item-price {
  102. display: flex;
  103. justify-content: space-between;
  104. image {
  105. width: 20rpx;
  106. height: 20rpx;
  107. margin-right: 5rpx;
  108. }
  109. .ot-price {
  110. color: #999999;
  111. text-decoration: line-through;
  112. margin-right: 15rpx;
  113. }
  114. .price {
  115. color: #EF3A55;
  116. font-size: 35rpx;
  117. }
  118. .button {
  119. background: linear-gradient(90deg, #438BED 0%, #44BFEC 100%);
  120. background-color: #438BED;
  121. height: 50rpx;
  122. border-radius: 20rpx;
  123. padding: 10rpx 15rpx;
  124. color: #fff;
  125. font-size: 25rpx;
  126. position: relative;
  127. top: 30rpx;
  128. }
  129. }
  130. }
  131. }
  132. }
  133. </style>