productItemSkline.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 ? item.productImage+'?x-oss-process=image/resize,p_30':'/static/def_imgs.png'" 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 class="flex align_center tejia-tag" v-if="item.shopProductSubsidy&&item.shopProductSubsidy.subsidyAmount<item.price&&!item.shopPromoProduct">
  34. 可抵扣<text>¥{{item.shopProductSubsidy.subsidyAmount}}</text>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. name: 'productItemSkline',
  44. props: {
  45. list: {
  46. type: Array,
  47. default: () => []
  48. },
  49. index:{
  50. type: [Number,String],
  51. default: 0
  52. },
  53. gap:{
  54. type: [Number,String],
  55. default: 10
  56. },
  57. itemWidth:{
  58. type: [Number,String],
  59. default: 0
  60. }
  61. },
  62. data() {
  63. return {
  64. }
  65. },
  66. methods: {
  67. toDetail(item){
  68. this.$emit('detail',item)
  69. }
  70. },
  71. }
  72. </script>
  73. <style lang="less">
  74. .product-list{
  75. display:flex;
  76. flex-wrap: wrap;
  77. justify-content: space-between;
  78. padding: 0 2%;
  79. }
  80. .product-item{
  81. background: #ffffff;
  82. border-radius: 10upx;
  83. box-shadow: 1px 1px 3px #EEEEEE;
  84. width: 48%;
  85. margin: 10px 0 0 0;
  86. display: flex;
  87. flex-direction: column;
  88. .price-txt{
  89. color: red;
  90. display: flex;
  91. align-items: baseline;
  92. font-size: 12px;
  93. text{
  94. font-size: 36rpx;
  95. }
  96. }
  97. .back-price{
  98. zoom: calc(0.8);
  99. padding: 6rpx 65rpx;
  100. position: absolute;
  101. top: 18rpx;
  102. right: -45rpx;
  103. z-index: 2;
  104. font-size: 20rpx;
  105. text-align: center;
  106. transform: rotate(40deg);
  107. display: flex;
  108. align-items: center;
  109. text{
  110. font-size: 28rpx;
  111. margin: 0 5rpx;
  112. }
  113. }
  114. .xiajia{
  115. background: #ececec;
  116. color: #5f5f5f;
  117. }
  118. .fantext{
  119. background: rgba(255 ,87 ,34 , 1);
  120. color: #fff;
  121. font-size: 8px;
  122. }
  123. > view{
  124. &:first-child{
  125. position: relative;
  126. overflow: hidden;
  127. .product-code{
  128. color: #666;
  129. position: absolute;
  130. width: 100%;
  131. left:0;
  132. bottom:0;
  133. background: rgba(255,255,255,0.7);
  134. text-align: center;
  135. }
  136. }
  137. &:last-child{
  138. position: relative;
  139. flex-grow: 1;
  140. padding: 10px 10px 35px;
  141. .product-name{
  142. font-size: 28rpx;
  143. color: #333;
  144. }
  145. .product-guige{
  146. margin: 10rpx 0;
  147. color: #2196F3;
  148. }
  149. }
  150. .product-button{
  151. position: absolute;
  152. left: 5%;
  153. bottom: 0;
  154. width: 90%;
  155. padding: 5px 0 10px;
  156. display: flex;
  157. align-items: center;
  158. .rebate-tag{
  159. background: #ffe7df;
  160. color: #E91E63;
  161. padding: 2px 5px;
  162. font-size: 10px;
  163. border-radius: 3px;
  164. margin-left: 6px;
  165. }
  166. .tejia-tag{
  167. color: #E91E63;
  168. margin-left: 6px;
  169. font-size: 12px;
  170. text{
  171. font-size: 12px;
  172. color: #999;
  173. margin-left: 5px;
  174. text-decoration: line-through;
  175. }
  176. }
  177. }
  178. }
  179. }
  180. </style>