cm-order-prodcut.vue 4.7 KB

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