NewGoods.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view
  3. v-if="data" class="goods-container" :style="{ width: width * 2 + 'upx' }"
  4. @click="$jump('/pages/prod/prod?goodsId=' + data.id)"
  5. >
  6. <tui-lazyload-img
  7. width="100%" :height="height" mode="scaleToFill" radius="20rpx 20rpx 0 0"
  8. :src="common.seamingImgUrl(data.picUrl)"
  9. ></tui-lazyload-img>
  10. <view class="goods-info">
  11. <view class="goods-name hiden-text">
  12. {{ data.name }}
  13. </view>
  14. <view v-if="showTags" class="tags">
  15. <view class="tag">七天无理由退货</view>
  16. <view class="tag">品牌正品</view>
  17. </view>
  18. <view v-if="showDetailBtn" class="item">
  19. <view class="price-text">
  20. ¥<text>{{ data.counterPrice }}</text>
  21. </view>
  22. <button class="bee-btn">查看详情</button>
  23. </view>
  24. <view v-else>
  25. <view class="price-text">
  26. ¥<text>{{ data.counterPrice }}</text>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. props: {
  35. width: {
  36. type: Number,
  37. default: 174
  38. },
  39. height: {
  40. type: String,
  41. default: '300rpx'
  42. },
  43. data: {
  44. type: Object,
  45. required: true
  46. },
  47. showTags: {
  48. type: Boolean,
  49. default: true
  50. },
  51. showDetailBtn: {
  52. type: Boolean,
  53. default: true
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="less" scoped>
  59. .goods-container {
  60. // border-radius: 20upx;
  61. // overflow: hidden;
  62. background-color: #fff;
  63. .goods-info {
  64. padding: 14upx 22upx;
  65. box-sizing: border-box;
  66. background-color: #fff;
  67. .goods-name {
  68. color: #3d3d3d;
  69. font-size: 24upx;
  70. }
  71. .price-text {
  72. color: #fa5151;
  73. font-weight: bold;
  74. text {
  75. font-size: 36upx;
  76. }
  77. }
  78. }
  79. .tags {
  80. display: flex;
  81. align-items: center;
  82. justify-content: flex-start;
  83. font-size: 20upx;
  84. color: #777;
  85. margin: 12upx 0 26upx 0;
  86. .tag {
  87. padding: 2upx 6upx;
  88. border: 1upx solid #777;
  89. white-space: nowrap;
  90. border-radius: 10upx;
  91. font-size: 20upx;
  92. &:nth-child(1) {
  93. margin-right: 20upx;
  94. }
  95. }
  96. }
  97. .item {
  98. display: flex;
  99. align-items: center;
  100. justify-content: space-between;
  101. .bee-btn {
  102. color: #fff;
  103. font-size: 24upx;
  104. background-color: #fa5151;
  105. padding: 6upx 14upx;
  106. border-radius: 10upx;
  107. }
  108. }
  109. }
  110. </style>