cm-product-price.vue 3.2 KB

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