liveGoods.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="goods" v-if="isShow" @click.stop="goShop">
  3. <view class="top">
  4. <view class="left">
  5. <image class="w30 h30 mr8" src="/static/images/signal.png" />
  6. 讲解中
  7. </view>
  8. <image @click.stop="close" class="w40 h40 mr10" src="/static/images/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. .left {
  70. background-color: rgba(0, 0, 0, 0.8);
  71. padding: 12rpx;
  72. font-size: 22rpx;
  73. display: flex;
  74. justify-content: space-between;
  75. align-items: center;
  76. border-radius: 10rpx;
  77. }
  78. }
  79. .photo {
  80. width: 100%;
  81. height: 180rpx;
  82. border-radius: 16rpx 16rpx 0 0;
  83. overflow: hidden;
  84. }
  85. .item {
  86. padding: 4rpx;
  87. .price {
  88. font-size: 30rpx;
  89. .red {
  90. color: #ff5701;
  91. font-weight: 600;
  92. margin-right: 10rpx;
  93. }
  94. .del {
  95. color: #828282;
  96. font-weight: 500;
  97. font-size: 28rpx;
  98. text-decoration: line-through;
  99. }
  100. }
  101. .title {
  102. font-weight: 500;
  103. font-size: 30rpx;
  104. margin: 10rpx 0 12rpx;
  105. }
  106. .button {
  107. background: linear-gradient(270deg, #ff4702 0%, #fe6304 100%);
  108. color: #fff;
  109. text-align: center;
  110. padding: 16rpx 0;
  111. border-radius: 10rpx;
  112. font-weight: 500;
  113. font-size: 30rpx;
  114. }
  115. }
  116. }
  117. </style>