普兆健康管家前端代码仓库
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.

135 lines
2.9 KiB

  1. <template>
  2. <view class="card product-card__view" :style="cardStyle">
  3. <view class="card-img flex" :style="imgStyle">
  4. <image class="img" :src="data.url" mode="scaleToFill"></image>
  5. </view>
  6. <view class="card-detail">
  7. <view class="product-name">{{ data.productName }}</view>
  8. <view class="product-sales" v-if="data.sales">{{ `已售出${data.sales}+` }}</view>
  9. <view class="flex product-price">
  10. <view>
  11. <view class="product-price-val">
  12. <text>¥</text>
  13. <text class="highlight">{{ data.productPriceVal }}</text>
  14. <text>/</text>
  15. </view>
  16. <view class="product-price-bef">
  17. {{ `¥${data.productPriceBef}/份` }}
  18. </view>
  19. </view>
  20. <button class="btn flex" @click="addToCart(data.id)">
  21. <image class="btn-img" src="@/pages_order/static/report/plus.png" mode="widthFix"></image>
  22. </button>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. props: {
  30. data: {
  31. type: Object,
  32. default() {
  33. return {}
  34. },
  35. },
  36. cardStyle: {
  37. type: String,
  38. default: '',
  39. },
  40. imgStyle: {
  41. type: String,
  42. default: '',
  43. }
  44. },
  45. methods: {
  46. addToCart(id) {
  47. // todo
  48. },
  49. },
  50. }
  51. </script>
  52. <style scoped lang="scss">
  53. .card {
  54. font-size: 0;
  55. height: 420rpx;
  56. background-image: linear-gradient(#FAFAFF, #F3F3F3);
  57. border: 2rpx solid #FFFFFF;
  58. border-radius: 32rpx;
  59. overflow: hidden;
  60. &-img {
  61. width: 100%;
  62. height: 220rpx;
  63. .img {
  64. width: 100%;
  65. height: 100%;
  66. }
  67. }
  68. &-detail {
  69. padding: 16rpx 24rpx 0 24rpx;
  70. .product {
  71. &-name {
  72. font-family: PingFang SC;
  73. font-weight: 600;
  74. font-size: 28rpx;
  75. line-height: 1.4;
  76. color: #000000;
  77. }
  78. &-sales {
  79. margin-top: 8rpx;
  80. font-family: PingFang SC;
  81. font-weight: 400;
  82. font-size: 24rpx;
  83. line-height: 1;
  84. color: #8B8B8B;
  85. }
  86. &-price {
  87. margin-top: 16rpx;
  88. justify-content: space-between;
  89. &-val {
  90. font-family: PingFang SC;
  91. font-weight: 600;
  92. font-size: 24rpx;
  93. line-height: 1.4;
  94. color: $uni-color;
  95. .highlight {
  96. font-size: 32rpx;
  97. margin: 0 8rpx;
  98. }
  99. }
  100. &-bef {
  101. margin-top: 4rpx;
  102. text-decoration: line-through;
  103. font-family: PingFang SC;
  104. font-weight: 400;
  105. font-size: 24rpx;
  106. line-height: 1;
  107. color: #8B8B8B;
  108. }
  109. .btn {
  110. width: 56rpx;
  111. height: 56rpx;
  112. border-radius: 50%;
  113. background: $uni-color;
  114. &-img {
  115. width: 20rpx;
  116. height: 20rpx;
  117. }
  118. }
  119. }
  120. }
  121. }
  122. }
  123. </style>