cm-order-prodcut.vue 3.9 KB

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