template-product.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="floor-item ad_04 clearfix" @click.stop="navToDetailPage(data)">
  3. <image class="item-img tui-skeleton-fillet" :src="data.image" mode="aspectFill"></image>
  4. <template-Type :product="data"></template-Type>
  5. <view class="floor-item-content">
  6. <view class="title tui-skeleton-rect">
  7. <text class="mclap-tag" v-if="data.beautyActFlag == '1'">美博会</text>
  8. <text class="mclap" :class="data.beautyActFlag == '1' ? 'indent' : ''"
  9. >{{ data.name }}
  10. </text>
  11. </view>
  12. <view class="floor-item-price">
  13. <template>
  14. <template-Tags :product="data"></template-Tags>
  15. </template>
  16. <view v-if="hasLogin">
  17. <template-Price :product="data"></template-Price>
  18. </view>
  19. <view v-else class="no-price">
  20. <view class="p-stars">
  21. <text class="p-no">¥</text>
  22. <uni-grader
  23. :grade="Number(data.priceGrade)"
  24. :margin="14"
  25. ></uni-grader>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import { mapState, mapMutations } from 'vuex'
  34. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  35. import templateTags from '@/components/cm-module/pageTemplate/templateTags.vue'
  36. import templatePrice from '@/components/cm-module/pageTemplate/templatePrice.vue'
  37. import templateType from '@/components/cm-module/pageTemplate/templateType.vue'
  38. export default {
  39. name: 'TemplateProduct',
  40. components: {
  41. uniGrader,
  42. templateTags,
  43. templatePrice,
  44. templateType
  45. },
  46. props: {
  47. data: {
  48. type: Object,
  49. default: () => {}
  50. }
  51. },
  52. computed: {
  53. ...mapState(['hasLogin', 'userInfo', 'isActivity']),
  54. },
  55. methods: {
  56. // 跳转商品详情
  57. navToDetailPage(pros) {
  58. this.$api.navigateTo(`/pages/goods/product?id=${pros.productId}`)
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .floor-item {
  65. width: 332rpx;
  66. height: 516rpx;
  67. font-size: $font-size-24;
  68. color: $text-color;
  69. background: #ffffff;
  70. line-height: 36rpx;
  71. border-radius: 16rpx;
  72. margin-right: 10rpx;
  73. margin-bottom: 10rpx;
  74. float: left;
  75. box-sizing: border-box;
  76. position: relative;
  77. &:nth-child(2n) {
  78. margin-right: 0;
  79. }
  80. .item-img {
  81. width: 330rpx;
  82. height: 330rpx;
  83. border-radius: 16rpx 16rpx 0 0;
  84. display: block;
  85. margin-bottom: 8rpx;
  86. }
  87. .floor-item_tag {
  88. width: 100%;
  89. height: 32rpx;
  90. float: left;
  91. margin: 20rpx 0;
  92. padding: 0 20rpx;
  93. box-sizing: border-box;
  94. text {
  95. display: inline-block;
  96. padding: 0 8rpx;
  97. border: 1px solid #e3ebf7;
  98. border-radius: 8rpx;
  99. color: #9aa5b5;
  100. font-size: $font-size-22;
  101. line-height: 32rpx;
  102. text-align: center;
  103. float: left;
  104. }
  105. }
  106. .floor-item-content {
  107. width: 100%;
  108. padding: 0 20rpx;
  109. box-sizing: border-box;
  110. }
  111. .floor-item-act {
  112. display: block;
  113. width: 100%;
  114. height: 32rpx;
  115. text-align: center;
  116. box-sizing: border-box;
  117. }
  118. .title-none {
  119. font-size: $font-size-26;
  120. color: #ff2a2a;
  121. line-height: 54rpx;
  122. }
  123. .title {
  124. width: 100%;
  125. height: 70rpx;
  126. display: flex;
  127. line-height: 35rpx;
  128. flex-direction: column;
  129. margin: 8rpx 0;
  130. padding: 0;
  131. position: relative;
  132. .mclap {
  133. width: 100%;
  134. line-height: 35rpx;
  135. text-overflow: ellipsis;
  136. display: -webkit-box;
  137. word-break: break-all;
  138. -webkit-box-orient: vertical;
  139. -webkit-line-clamp: 2;
  140. overflow: hidden;
  141. font-size: 26rpx;
  142. &.indent {
  143. text-indent: 95rpx;
  144. }
  145. }
  146. .mclap-tag {
  147. display: block;
  148. width: 84rpx;
  149. height: 32rpx;
  150. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  151. border-radius: 4rpx 48rpx 4px 4px;
  152. line-height: 32rpx;
  153. font-size: $font-size-22;
  154. color: #ffffff;
  155. text-align: center;
  156. position: absolute;
  157. left: 0;
  158. top: 0;
  159. }
  160. }
  161. .no-price {
  162. height: 54rpx;
  163. line-height: 54rpx;
  164. display: flex;
  165. box-sizing: border-box;
  166. .p-no {
  167. line-height: 54rpx;
  168. font-size: $font-size-28;
  169. color: $text-color;
  170. display: inline-block;
  171. float: left;
  172. }
  173. .p-stars {
  174. float: left;
  175. }
  176. }
  177. .price {
  178. color: #ff2a2a;
  179. line-height: 54rpx;
  180. &.none {
  181. text-decoration: line-through;
  182. color: #999999;
  183. }
  184. .sm {
  185. font-size: $font-size-24;
  186. }
  187. .big {
  188. font-size: $font-size-28;
  189. }
  190. }
  191. }
  192. </style>