cm-cart-product.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="cart-product">
  3. <image class="cover" :src="productInfo.productImage" mode="widthFix"></image>
  4. <view class="content">
  5. <view class="name">{{ productInfo.name }}</view>
  6. <template v-if="isExpired">
  7. <view class="tip">商品已下架</view>
  8. </template>
  9. <template v-else>
  10. <view class="unit">规格:{{ productInfo.productUnit }}</view>
  11. <view class="tags">
  12. <!-- 拼团价 活动价 限时特价 券后价 -->
  13. <view class="tag cx" v-if="userId === productInfo.heUserId">促销</view>
  14. <view class="tag cx" v-else>自营</view>
  15. <view class="tag pt" v-if="productInfo.collageStatus > 0">拼团价</view>
  16. <view class="tag hd" v-else-if="productInfo.activeStatus > 0">活动价</view>
  17. <view class="tag other" v-else-if="productInfo.discountStatus > 0">限时特价</view>
  18. <!-- <view class="tag other" v-else-if="productInfo.couponStatus > 1">{{ productInfo.couponInfo }}</view> -->
  19. <!-- <view class="tag other" v-else-if="productInfo.couponStatus > 0">券后价</view> -->
  20. </view>
  21. <view class="price">
  22. <text>¥{{ productInfo.price | priceFormat }}</text>
  23. <!-- <text class="delete" v-if="productInfo.normalPrice">
  24. ¥{{ productInfo.normalPrice | priceFormat }}
  25. </text> -->
  26. </view>
  27. <cm-number-box class="numberbox" v-model="productInfo.num" @change="change"></cm-number-box>
  28. </template>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. name: 'cm-cart-product',
  35. props: {
  36. isExpired: {
  37. type: Boolean,
  38. default: false
  39. },
  40. productInfo: {
  41. type: Object,
  42. default: () => {}
  43. },
  44. tagsList: {
  45. type: Array,
  46. default: () => []
  47. }
  48. },
  49. computed: {
  50. userId() {
  51. return this.$store.getters.userId
  52. }
  53. },
  54. methods: {
  55. change(value) {
  56. this.$emit('countChange', {
  57. cartId: this.productInfo.cartId,
  58. count: value
  59. })
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. .cart-product {
  66. @extend .cm-flex-between;
  67. .cover {
  68. width: 180rpx;
  69. height: 180rpx;
  70. box-sizing: border-box;
  71. border: 1rpx dashed #e1e1e1;
  72. }
  73. .content {
  74. position: relative;
  75. display: flex;
  76. flex-direction: column;
  77. justify-content: center;
  78. flex: 1;
  79. margin-left: 16rpx;
  80. }
  81. .name {
  82. @include ellipsis(2);
  83. max-width: 440rpx;
  84. min-height: 68rpx;
  85. font-size: 26rpx;
  86. color: #333333;
  87. }
  88. .tip {
  89. margin-top: 80rpx;
  90. font-size: 26rpx;
  91. color: #f83c6c;
  92. }
  93. .unit {
  94. min-height: 28rpx;
  95. font-size: 20rpx;
  96. color: #999999;
  97. }
  98. .tags {
  99. min-height: 30rpx;
  100. }
  101. .price {
  102. font-size: 26rpx;
  103. font-weight: 600;
  104. color: #f83c6c;
  105. .delete {
  106. font-size: 22rpx;
  107. color: #999999;
  108. font-weight: normal;
  109. text-decoration: line-through;
  110. margin-left: 8rpx;
  111. }
  112. }
  113. .numberbox {
  114. position: absolute;
  115. right: 0;
  116. bottom: 0;
  117. }
  118. }
  119. </style>