cm-product-price.vue 4.0 KB

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