productItemSkline.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view
  3. class="product-list"
  4. >
  5. <view
  6. class="product-item"
  7. :style="{width:itemWidth+'px',marginTop:gap+'px'}"
  8. v-for="(item,index) in list"
  9. :key="item.id"
  10. @click="toDetail(item)">
  11. <view>
  12. <image mode="aspectFit" :src="item.productImage+'?x-oss-process=image/resize,p_30'" style="height: 140px;width: 100%;"></image>
  13. <view class="back-price xiajia" v-if="item.status==0||!item.status">下架</view>
  14. <view class="back-price xiajia" v-else-if="item.dealerScopeFlag==0">售罄</view>
  15. <view class="product-code"><text :max-lines="1" overflow="ellipsis">{{item.productCode}}</text></view>
  16. </view>
  17. <view>
  18. <view class="product-name"><text :max-lines="2" overflow="ellipsis">{{item.productName}}</text></view>
  19. <view class="product-guige"><text :max-lines="2" overflow="ellipsis">{{item.productOrigCode}}</text></view>
  20. <view class="product-button">
  21. <view class="price-txt">
  22. ¥<text>{{item.priceStr[0]}}</text>.{{item.priceStr[1]}}
  23. </view>
  24. <view class="flex align_center rebate-tag" v-if="item.promoType=='BUY_PROD_GIVE_VALID'">
  25. 返<text>{{item.resultValue}}</text>元
  26. </view>
  27. <view class="flex align_center rebate-tag" v-if="item.promoType=='BUY_PROD_GIVE_PROD'">
  28. 买{{item.conditionValue}}赠{{item.resultValue}}
  29. </view>
  30. <view class="flex align_center tejia-tag" v-if="item.promoType=='PROMO_PROD'">
  31. 特价<text>¥{{item.orginPrice}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. name: 'productItemSkline',
  41. props: {
  42. list: {
  43. type: Array,
  44. default: () => []
  45. },
  46. index:{
  47. type: [Number,String],
  48. default: 0
  49. },
  50. gap:{
  51. type: [Number,String],
  52. default: 10
  53. },
  54. itemWidth:{
  55. type: [Number,String],
  56. default: 0
  57. }
  58. },
  59. data() {
  60. return {
  61. }
  62. },
  63. methods: {
  64. toDetail(item){
  65. this.$emit('detail',item)
  66. }
  67. },
  68. }
  69. </script>
  70. <style lang="less">
  71. .product-list{
  72. display:flex;
  73. flex-wrap: wrap;
  74. justify-content: space-between;
  75. padding: 0 2%;
  76. }
  77. .product-item{
  78. background: #ffffff;
  79. border-radius: 10upx;
  80. box-shadow: 1px 1px 3px #EEEEEE;
  81. width: 48%;
  82. margin: 10px 0 0 0;
  83. display: flex;
  84. flex-direction: column;
  85. .price-txt{
  86. color: red;
  87. display: flex;
  88. align-items: baseline;
  89. font-size: 12px;
  90. text{
  91. font-size: 36rpx;
  92. }
  93. }
  94. .back-price{
  95. zoom: calc(0.8);
  96. padding: 6rpx 65rpx;
  97. position: absolute;
  98. top: 18rpx;
  99. right: -45rpx;
  100. z-index: 2;
  101. font-size: 20rpx;
  102. text-align: center;
  103. transform: rotate(40deg);
  104. display: flex;
  105. align-items: center;
  106. text{
  107. font-size: 28rpx;
  108. margin: 0 5rpx;
  109. }
  110. }
  111. .xiajia{
  112. background: #ececec;
  113. color: #5f5f5f;
  114. }
  115. .fantext{
  116. background: rgba(255 ,87 ,34 , 1);
  117. color: #fff;
  118. font-size: 8px;
  119. }
  120. > view{
  121. &:first-child{
  122. position: relative;
  123. overflow: hidden;
  124. .product-code{
  125. color: #666;
  126. position: absolute;
  127. width: 100%;
  128. left:0;
  129. bottom:0;
  130. background: rgba(255,255,255,0.7);
  131. text-align: center;
  132. }
  133. }
  134. &:last-child{
  135. position: relative;
  136. flex-grow: 1;
  137. padding: 10px 10px 35px;
  138. .product-name{
  139. font-size: 28rpx;
  140. color: #333;
  141. }
  142. .product-guige{
  143. margin: 10rpx 0;
  144. color: #2196F3;
  145. }
  146. }
  147. .product-button{
  148. position: absolute;
  149. left: 5%;
  150. bottom: 0;
  151. width: 90%;
  152. padding: 5px 0 10px;
  153. display: flex;
  154. align-items: center;
  155. .rebate-tag{
  156. background: #ffe7df;
  157. color: #E91E63;
  158. padding: 2px 5px;
  159. font-size: 10px;
  160. border-radius: 3px;
  161. margin-left: 6px;
  162. }
  163. .tejia-tag{
  164. color: #E91E63;
  165. margin-left: 6px;
  166. font-size: 12px;
  167. text{
  168. font-size: 12px;
  169. color: #999;
  170. margin-left: 5px;
  171. text-decoration: line-through;
  172. }
  173. }
  174. }
  175. }
  176. }
  177. </style>