liveGoods.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="goods" v-if="isShow" @click.stop="goShop">
  3. <view class="top">
  4. <view class="left">
  5. <image class="icon" src="/static/images/live/signal.png" />
  6. 讲解中
  7. </view>
  8. <image @click.stop="close" class="close-icon " src="/static/images/live/del_black.png" />
  9. </view>
  10. <image class="photo" :src="goodsData.imgUrl" />
  11. <view class="item">
  12. <view class="price">
  13. <text class="red">¥{{ goodsData.price }}</text>
  14. <text class="del">¥{{ goodsData.otPrice }}</text>
  15. </view>
  16. <view class="title oneline-hide">{{ goodsData.productName }}</view>
  17. <view class="button">立即抢购</view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. name: "LiveGoods",
  24. props: {
  25. // 控制组件显示
  26. isShow: {
  27. type: Boolean,
  28. default: false
  29. },
  30. // 商品数据
  31. goodsData: {
  32. type: Object,
  33. default: () => ({})
  34. }
  35. },
  36. methods: {
  37. // 点击商品,通知父组件跳转
  38. goShop() {
  39. this.$emit('goShop', this.goodsData);
  40. },
  41. // 关闭商品卡片,通知父组件
  42. close() {
  43. this.$emit('close');
  44. }
  45. }
  46. }
  47. </script>
  48. <style scoped lang="scss">
  49. .goods {
  50. position: fixed;
  51. bottom: 140rpx;
  52. right: 104rpx;
  53. z-index: 5;
  54. background-color: #fff;
  55. border-radius: 20rpx;
  56. overflow: hidden;
  57. width: 280rpx;
  58. padding: 4rpx;
  59. .top {
  60. position: absolute;
  61. top: 4rpx;
  62. display: flex;
  63. justify-content: space-between;
  64. align-items: center;
  65. color: #fff;
  66. width: 100%;
  67. padding-right: 10rpx;
  68. box-sizing: border-box;
  69. .close-icon {
  70. width: 40rpx;
  71. height: 40rpx;
  72. margin-left: 10rpx;
  73. }
  74. .left {
  75. background-color: rgba(0, 0, 0, 0.8);
  76. padding: 12rpx;
  77. font-size: 22rpx;
  78. display: flex;
  79. justify-content: space-between;
  80. align-items: center;
  81. border-radius: 10rpx;
  82. .icon {
  83. width: 30rpx;
  84. height: 30rpx;
  85. margin-right: 8rpx;
  86. }
  87. }
  88. }
  89. .photo {
  90. width: 100%;
  91. height: 180rpx;
  92. border-radius: 16rpx 16rpx 0 0;
  93. overflow: hidden;
  94. }
  95. .item {
  96. padding: 4rpx;
  97. .price {
  98. font-size: 30rpx;
  99. .red {
  100. color: #ff5701;
  101. font-weight: 600;
  102. margin-right: 10rpx;
  103. }
  104. .del {
  105. color: #828282;
  106. font-weight: 500;
  107. font-size: 28rpx;
  108. text-decoration: line-through;
  109. }
  110. }
  111. .title {
  112. font-weight: 500;
  113. font-size: 30rpx;
  114. margin: 10rpx 0 12rpx;
  115. }
  116. .button {
  117. background: linear-gradient(270deg, #ff4702 0%, #fe6304 100%);
  118. color: #fff;
  119. text-align: center;
  120. padding: 16rpx 0;
  121. border-radius: 10rpx;
  122. font-weight: 500;
  123. font-size: 30rpx;
  124. }
  125. }
  126. }
  127. </style>