cm-product-price.vue 3.6 KB

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