cm-order-prodcut.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="cm-order-prodcut">
  3. <image :src="goodsData.productImage" class="cover"></image>
  4. <view class="content">
  5. <view class="title">{{ goodsData.name}}</view>
  6. <view class="unit">规格:{{ goodsData.productUnit }}</view>
  7. <view class="tags">
  8. <view class="tag type1">促销</view>
  9. <view class="tag type1">自营</view>
  10. <view class="tag type3">拼团价</view>
  11. <view class="tag type2">活动价</view>
  12. <view class="tag type2">优惠券</view>
  13. </view>
  14. <view class="price">
  15. <text>¥{{ goodsData.price | formatPrice }}</text>
  16. <text class="delete">单买价:¥400.00</text>
  17. </view>
  18. </view>
  19. <text class="count" v-if="countVisible">×{{ goodsData.num }}</text>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. props:{
  25. countVisible: {
  26. type: Boolean,
  27. default: true
  28. },
  29. goodsData: {
  30. type: Object,
  31. default:()=>{}
  32. }
  33. },
  34. filters:{
  35. formatPrice(price){
  36. if(!price) return ''
  37. return Number(price).toFixed(2)
  38. }
  39. },
  40. data() {
  41. return {}
  42. }
  43. }
  44. </script>
  45. <style lang="scss" scoped>
  46. /* scss中可以用mixin来扩展 */
  47. @mixin ellipsis($line: 1) {
  48. overflow: hidden;
  49. text-overflow: ellipsis;
  50. display: -webkit-box;
  51. -webkit-line-clamp: $line;
  52. -webkit-box-orient: vertical;
  53. }
  54. .cm-order-prodcut {
  55. position: relative;
  56. display: flex;
  57. justify-content: space-between;
  58. align-items: center;
  59. padding: 0 24rpx;
  60. overflow: hidden;
  61. .count{
  62. position: absolute;
  63. font-size: 26rpx;
  64. color: #333333;
  65. right: 24rpx;
  66. bottom: 0;
  67. }
  68. .cover {
  69. display: block;
  70. width: 180rpx;
  71. height: 180rpx;
  72. border-radius: 8rpx;
  73. box-sizing: border-box;
  74. border: 1px solid #F7F7F7;
  75. }
  76. .content {
  77. flex: 1;
  78. margin-left: 24rpx;
  79. .title {
  80. @include ellipsis(2);
  81. font-size: 26rpx;
  82. color: #333333;
  83. text-align: justify;
  84. line-height: 1.6;
  85. height: 80rpx;
  86. }
  87. .unit {
  88. margin-bottom: 8rpx;
  89. font-size: 20rpx;
  90. color: #999999;
  91. }
  92. .price {
  93. margin-top: 4rpx;
  94. font-size: 26rpx;
  95. color: #ff457b;
  96. .delete {
  97. margin-left: 32rpx;
  98. font-size: 20rpx;
  99. color: #999999;
  100. }
  101. }
  102. .tags {
  103. display: flex;
  104. justify-content: flex-start;
  105. align-items: center;
  106. width: 100%;
  107. height: 30rpx;
  108. .tag {
  109. margin-right: 8rpx;
  110. font-size: 22rpx;
  111. height: 30rpx;
  112. line-height: 30rpx;
  113. text-align: center;
  114. &.type1{
  115. padding: 0 8rpx;
  116. background: #f83c6c;
  117. border-radius: 4rpx;
  118. color: #fff;
  119. }
  120. &.type2 {
  121. width: 80rpx;
  122. color: #f83c6c;
  123. background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png) top center
  124. no-repeat;
  125. background-size: contain;
  126. }
  127. &.type3 {
  128. width: 80rpx;
  129. background: linear-gradient(270deg, #ff457b 0%, #b03bb8 51%, #6431f2 100%);
  130. color: #fff;
  131. border-radius: 4rpx;
  132. }
  133. }
  134. }
  135. }
  136. }
  137. </style>