cm-product-price.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <!-- 价格区域 -->
  3. <view class="cm-product-price">
  4. <view class="price">
  5. <text class="small">¥</text><text class="big">{{ bigPrice }}</text
  6. ><text class="small">{{ smallPrice }}</text>
  7. </view>
  8. <view class="tags">
  9. <view class="tag type1" v-if="productInfo.heUserId !== 0">促销</view>
  10. <template v-if="productInfo.activeStatus === 1">
  11. <view class="tag type2" v-if="productInfo.ladderList" @click="drawerVisible = true">活动价</view>
  12. </template>
  13. </view>
  14. <cm-drawer :visible="drawerVisible" position="bottom" @close="drawerClose">
  15. <scroll-view scroll-y="true" class="scroll-box">
  16. <cm-activity-info :productInfo="productInfo"></cm-activity-info>
  17. <view class="btn" @click="drawerVisible = false">了解</view>
  18. </scroll-view>
  19. </cm-drawer>
  20. </view>
  21. </template>
  22. <script>
  23. import CmDrawer from '@/components/cm-module/cm-drawer/cm-drawer.vue'
  24. import CmActivityInfo from '@/components/cm-module/cm-activity-info/cm-activity-info.vue'
  25. export default {
  26. components: {
  27. CmDrawer,
  28. CmActivityInfo
  29. },
  30. data() {
  31. return {
  32. drawerVisible: false
  33. }
  34. },
  35. props: {
  36. productInfo: {
  37. type: Object,
  38. default: () => {}
  39. }
  40. },
  41. computed: {
  42. price() {
  43. return Number(this.productInfo.price).toFixed(2)
  44. },
  45. bigPrice() {
  46. return this.price.split('.')[0]
  47. },
  48. smallPrice() {
  49. return '.' + this.price.split('.')[1]
  50. }
  51. },
  52. methods: {
  53. drawerClose() {
  54. this.drawerVisible = false
  55. }
  56. }
  57. }
  58. </script>
  59. <style scoped lang="scss">
  60. .cm-product-price {
  61. position: relative;
  62. display: flex;
  63. justify-content: flex-start;
  64. align-items: center;
  65. padding: 12rpx 0;
  66. .price {
  67. color: #ff457b;
  68. .small {
  69. font-size: 36rpx;
  70. }
  71. .big {
  72. font-size: 48rpx;
  73. }
  74. }
  75. .tags {
  76. display: flex;
  77. justify-content: flex-start;
  78. align-items: center;
  79. margin-left: 24rpx;
  80. .tag {
  81. display: flex;
  82. justify-content: center;
  83. align-items: center;
  84. height: 30rpx;
  85. margin-right: 8rpx;
  86. font-size: 22rpx;
  87. &.type1 {
  88. width: 56rpx;
  89. background: #ff457b;
  90. border-radius: 4rpx;
  91. color: #ffffff;
  92. }
  93. &.type2 {
  94. width: 80rpx;
  95. background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png) top center no-repeat;
  96. background-size: 80rpx 30rpx;
  97. color: #f83c6c;
  98. }
  99. }
  100. }
  101. }
  102. .scroll-box {
  103. height: 500rpx;
  104. box-sizing: border-box;
  105. padding: 70rpx 0 24rpx;
  106. .btn {
  107. width: 100%;
  108. height: 88rpx;
  109. margin-top: 24rpx;
  110. background: #ff457b;
  111. line-height: 88rpx;
  112. text-align: center;
  113. color: #ffffff;
  114. font-size: 28rpx;
  115. border-radius: 44rpx;
  116. }
  117. }
  118. </style>