cm-order-prodcut.vue 4.2 KB

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