鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
2.7 KiB

  1. <template>
  2. <view class="product">
  3. <image class="product-img" :src="data.image" mode="aspectFill"></image>
  4. <view class="flex flex-column product-info">
  5. <view class="product-info-top">
  6. <view class="product-name text-ellipsis-2">{{ data.name }}</view>
  7. <view class="product-desc text-ellipsis">{{ data.desc }}</view>
  8. </view>
  9. <view class="flex product-info-bottom">
  10. <view class="product-detail">
  11. <view class="flex product-price">
  12. <view class="product-price-val">
  13. <text>¥</text>
  14. <text class="highlight">{{ priceInt }}</text>
  15. <text>{{ `${priceFrac}` }}</text>
  16. </view>
  17. <view class="product-price-bef" v-if="data.originalPrice">
  18. {{ `¥${data.originalPrice}` }}
  19. </view>
  20. </view>
  21. <view class="product-registered">
  22. {{ `${data.registered}人已报名` }}
  23. </view>
  24. </view>
  25. <button class="btn">报名</button>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. props: {
  33. data: {
  34. type: Object,
  35. default() {
  36. return {}
  37. }
  38. }
  39. },
  40. computed: {
  41. priceInt() {
  42. return parseInt(this.data.currentPrice)
  43. },
  44. priceFrac() {
  45. return (this.data.currentPrice % this.priceInt).toFixed(2).slice(1)
  46. },
  47. },
  48. }
  49. </script>
  50. <style scoped lang="scss">
  51. .product {
  52. height: 464rpx;
  53. background: #FFFFFF;
  54. border: 2rpx solid #FFFFFF;
  55. border-radius: 32rpx;
  56. overflow: hidden;
  57. font-size: 0;
  58. &-img {
  59. width: 100%;
  60. height: 220rpx;
  61. }
  62. &-info {
  63. height: 244rpx;
  64. padding: 16rpx 16rpx 24rpx 16rpx;
  65. box-sizing: border-box;
  66. justify-content: space-between;
  67. &-top {
  68. }
  69. &-bottom {
  70. width: 100%;
  71. justify-content: space-between;
  72. }
  73. }
  74. &-name {
  75. font-size: 28rpx;
  76. font-weight: 500;
  77. color: #000000;
  78. }
  79. &-desc {
  80. margin-top: 8rpx;
  81. font-size: 24rpx;
  82. color: #8B8B8B;
  83. }
  84. &-detail {
  85. }
  86. &-price {
  87. justify-content: flex-start;
  88. align-items: baseline;
  89. column-gap: 6rpx;
  90. &-val {
  91. font-size: 24rpx;
  92. font-weight: 500;
  93. color: #FF4800;
  94. .highlight {
  95. font-size: 32rpx;
  96. }
  97. }
  98. &-bef {
  99. text-decoration: line-through;
  100. font-size: 24rpx;
  101. color: #8B8B8B;
  102. }
  103. }
  104. &-registered {
  105. font-size: 24rpx;
  106. color: #8B8B8B;
  107. }
  108. .btn {
  109. padding: 11rpx 16rpx;
  110. font-size: 26rpx;
  111. font-weight: 500;
  112. color: #FFFFFF;
  113. background: #00A9FF;
  114. border-radius: 24rpx;
  115. }
  116. }
  117. </style>