StoreGoods.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view v-if="goodsData" class="store-goods-container">
  3. <view style="max-height: 440upx;min-height: 120upx;overflow: hidden;">
  4. <tui-lazyload-img
  5. class="goods-img" :mode="picMode" :width="picWidth" :height="picHeight"
  6. :src="common.seamingImgUrl(goodsData.picUrl)" @click="$emit('click-content', goodsData)"
  7. ></tui-lazyload-img>
  8. </view>
  9. <view style="flex: 1;width: 0;padding: 0 20upx;font-size: 32upx;">
  10. <view class="store-goods-name" @click="$emit('click-content', goodsData)">
  11. {{ goodsData.name }}
  12. </view>
  13. <view @click="$emit('click-content', goodsData)">
  14. <view
  15. v-if="showMsg"
  16. style="display: flex;justify-content: space-between;padding: 14upx 0 0;font-size: 26upx;color: #777777;"
  17. >
  18. <text>{{ goodsData.browse }}浏览量</text>
  19. <text>销量 {{ goodsData.sales }}</text>
  20. </view>
  21. <view v-if="showSn">商品编号:{{ goodsData.goodsSn }}</view>
  22. <view
  23. v-if="showVoucher && goodsData.supportVoucher"
  24. style="width: fit-content;margin-top: 8upx;margin-right: 8upx;padding: 4upx 8upx;border: 0.25px solid #51cc46;border-radius: 12upx;font-size: 28upx;font-weight: bold;color: #51cc46;"
  25. >
  26. 支持代金券
  27. </view>
  28. </view>
  29. <view class="time">
  30. <view class="wrapper" @click="$emit('click-content', goodsData)">
  31. <view v-if="showTag && goodsData.isHot" class="price-tag">热卖</view>
  32. <view class="price-text">¥{{ goodsData.counterPrice }}</view>
  33. </view>
  34. <!-- <BeeIcon
  35. v-if="showIcon" :size="28" :src="require('../../static/brand/detail/add-icon.png')"
  36. @click="$emit('add-car', goodsData)"
  37. ></BeeIcon> -->
  38. <view v-if="showIcon" style="padding: 10upx;background-color: #ffe500;border-radius: 50%;line-height: 1;">
  39. <tui-icon name="plus" color="#000000" size="28" unit="upx" bold @click="$emit('add-car', goodsData)"></tui-icon>
  40. </view>
  41. <slot name="button"></slot>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. name: 'StoreGoods',
  49. props: {
  50. goodsData: {
  51. type: Object,
  52. required: true
  53. },
  54. picMode: {
  55. type: String,
  56. default: 'widthFix'
  57. },
  58. picWidth: {
  59. type: String,
  60. default: '210rpx'
  61. },
  62. picHeight: {
  63. type: String,
  64. default: 'auto'
  65. },
  66. showIcon: {
  67. type: Boolean,
  68. default: true
  69. },
  70. showTag: {
  71. type: Boolean,
  72. default: true
  73. },
  74. showMsg: {
  75. type: Boolean,
  76. default: true
  77. },
  78. showSn: {
  79. type: Boolean,
  80. default: false
  81. },
  82. showVoucher: {
  83. type: Boolean,
  84. default: false
  85. }
  86. },
  87. methods: {
  88. }
  89. }
  90. </script>
  91. <style lang="less" scoped>
  92. .store-goods-container {
  93. display: flex;
  94. justify-content: space-between;
  95. align-items: center;
  96. width: 100%;
  97. margin-bottom: 15upx;
  98. box-sizing: border-box;
  99. .store-goods-name {
  100. color: #3d3d3d;
  101. font-weight: bold;
  102. // width: 340upx;
  103. overflow: hidden;
  104. text-overflow: ellipsis;
  105. white-space: nowrap;
  106. }
  107. .time {
  108. display: flex;
  109. align-items: center;
  110. justify-content: space-between;
  111. flex-wrap: wrap;
  112. margin: 10upx 0 18upx;
  113. .wrapper {
  114. .price-text {
  115. color: #fa5151;
  116. font-weight: bold;
  117. font-size: 28upx;
  118. }
  119. .price-tag {
  120. width: fit-content;
  121. margin-bottom: 4upx;
  122. padding: 0 10upx;
  123. border: 1upx solid #fa5151;
  124. font-size: 20upx;
  125. color: #fa5151;
  126. border-radius: 8upx;
  127. margin-left: 9upx;
  128. }
  129. }
  130. }
  131. }
  132. </style>