info-card.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view class="info-card">
  3. <view class="title-row">
  4. <text class="book-title">{{ product.bookName }}</text>
  5. </view>
  6. <view class="price-row">
  7. <text class="currency">¥</text>
  8. <text class="price">{{ product.sellPrice || product.price }}</text>
  9. <view class="balance-tag" v-if="displayBalanceMoney">
  10. <text>余额价 ¥{{ displayBalanceMoney }}</text>
  11. </view>
  12. </view>
  13. <view class="meta-row">
  14. <text class="label">原价:</text>
  15. <text class="original-price">¥{{ product.price }}</text>
  16. </view>
  17. <view class="author-row">
  18. <text class="author">作者:{{ product.author }}</text>
  19. <view class="works-link" @click="goToAuthorWorks">
  20. <text>作品</text>
  21. <u-icon name="arrow-right" size="24" color="#F2950A"></u-icon>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. name: 'InfoCard',
  29. props: {
  30. product: {
  31. type: Object,
  32. default: () => ({})
  33. }
  34. },
  35. computed: {
  36. displayBalanceMoney() {
  37. if (this.product.skuList && this.product.skuList.length > 0) {
  38. // 获取所有sku中的最低余额价
  39. const goods = this.product.skuList.find(sku => sku.price == this.product.sellPrice);
  40. return goods.balanceMoney;
  41. }
  42. return null;
  43. }
  44. },
  45. methods: {
  46. goToAuthorWorks() {
  47. if (!this.product.author) return;
  48. uni.navigateTo({
  49. url: `/pages-sell/pages/search-result?keyword=${encodeURIComponent(this.product.author)}`
  50. });
  51. }
  52. }
  53. }
  54. </script>
  55. <style lang="scss" scoped>
  56. .info-card {
  57. background: #fff;
  58. border-radius: 24rpx 24rpx 0 0;
  59. padding: 30rpx;
  60. .title-row {
  61. margin-bottom: 20rpx;
  62. .book-title {
  63. font-size: 40rpx;
  64. font-weight: bold;
  65. color: #333;
  66. }
  67. }
  68. .price-row {
  69. display: flex;
  70. align-items: center;
  71. margin-bottom: 10rpx;
  72. .currency {
  73. font-size: 32rpx;
  74. color: #D81A00;
  75. font-weight: bold;
  76. }
  77. .price {
  78. font-size: 48rpx;
  79. color: #D81A00;
  80. font-weight: bold;
  81. margin-right: 20rpx;
  82. }
  83. .balance-tag {
  84. background: #38C148;
  85. border-radius: 20rpx;
  86. padding: 2rpx 16rpx;
  87. text {
  88. font-size: 24rpx;
  89. color: #fff;
  90. }
  91. }
  92. }
  93. .meta-row {
  94. margin-bottom: 20rpx;
  95. font-size: 26rpx;
  96. color: #999;
  97. .original-price {
  98. text-decoration: line-through;
  99. margin-left: 10rpx;
  100. }
  101. }
  102. .author-row {
  103. display: flex;
  104. justify-content: space-between;
  105. align-items: center;
  106. font-size: 28rpx;
  107. color: #F2950A;
  108. .author {
  109. flex: 1;
  110. }
  111. .works-link {
  112. display: flex;
  113. align-items: center;
  114. }
  115. }
  116. }
  117. </style>