s-goods-item.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view>
  3. <view>
  4. <slot name="top"></slot>
  5. </view>
  6. <view
  7. class="ss-order-card-warp ss-flex ss-col-stretch ss-row-between bg-white"
  8. :style="[{ borderRadius: radius + 'rpx', marginBottom: marginBottom + 'rpx' }]"
  9. >
  10. <view class="img-box ss-m-r-24">
  11. <image class="order-img" :src="sheep.$url.cdn(img)" mode="aspectFill"></image>
  12. </view>
  13. <view
  14. class="box-right ss-flex-col ss-row-between"
  15. :style="[{ width: titleWidth ? titleWidth + 'rpx' : '' }]"
  16. >
  17. <view class="title-text ss-line-2" v-if="title">{{ title }}</view>
  18. <view v-if="skuString" class="spec-text ss-m-t-8 ss-m-b-12">{{ skuString }}</view>
  19. <view class="groupon-box">
  20. <slot name="groupon"></slot>
  21. </view>
  22. <view class="ss-flex">
  23. <view class="ss-flex ss-col-center">
  24. <!-- v-if="price && Number(price) > 0" -->
  25. <view
  26. class="price-text ss-flex ss-col-center"
  27. :style="[{ color: priceColor }]"
  28. >
  29. <view class="points-red" v-if="areaId == 1"></view>
  30. <view class="points-green" v-if="areaId == 2 || areaId == 3"></view>
  31. {{ fen2yuan(price) }}
  32. </view>
  33. <view v-if="num" class="total-text ss-flex ss-col-center">x {{ num }}</view>
  34. <slot name="priceSuffix"></slot>
  35. </view>
  36. </view>
  37. <view class="tool-box">
  38. <slot name="tool"></slot>
  39. </view>
  40. <view>
  41. <slot name="rightBottom"></slot>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script setup>
  48. import sheep from '@/sheep';
  49. import { computed } from 'vue';
  50. import { fen2yuan,fen2yuan6 } from '@/sheep/hooks/useGoods';
  51. /**
  52. * 订单卡片
  53. *
  54. * @property {String} img - 图片
  55. * @property {String} title - 标题
  56. * @property {Number} titleWidth = 0 - 标题宽度,默认0,单位rpx
  57. * @property {String} skuText - 规格
  58. * @property {String | Number} price - 价格
  59. * @property {String} priceColor - 价格颜色
  60. * @property {Number | String} num - 数量
  61. *
  62. */
  63. const props = defineProps({
  64. img: {
  65. type: String,
  66. default: 'https://img1.baidu.com/it/u=1601695551,235775011&fm=26&fmt=auto',
  67. },
  68. title: {
  69. type: String,
  70. default: '',
  71. },
  72. titleWidth: {
  73. type: Number,
  74. default: 0,
  75. },
  76. skuText: {
  77. type: [String, Array],
  78. default: '',
  79. },
  80. price: {
  81. type: [String, Number],
  82. default: '',
  83. },
  84. priceColor: {
  85. type: [String],
  86. default: '',
  87. },
  88. num: {
  89. type: [String, Number],
  90. default: 0,
  91. },
  92. score: {
  93. type: [String, Number],
  94. default: '',
  95. },
  96. radius: {
  97. type: [String],
  98. default: '',
  99. },
  100. marginBottom: {
  101. type: [String],
  102. default: '',
  103. },
  104. areaId:{
  105. type:[Number],
  106. default:0
  107. }
  108. });
  109. const skuString = computed(() => {
  110. if (!props.skuText) {
  111. return '';
  112. }
  113. if (typeof props.skuText === 'object') {
  114. return props.skuText.join(',');
  115. }
  116. return props.skuText;
  117. });
  118. </script>
  119. <style lang="scss" scoped>
  120. .score-img {
  121. width: 36rpx;
  122. height: 36rpx;
  123. margin: 0 4rpx;
  124. }
  125. .ss-order-card-warp {
  126. padding: 20rpx;
  127. .img-box {
  128. width: 164rpx;
  129. height: 164rpx;
  130. border-radius: 10rpx;
  131. overflow: hidden;
  132. .order-img {
  133. width: 164rpx;
  134. height: 164rpx;
  135. }
  136. }
  137. .box-right {
  138. flex: 1;
  139. // width: 500rpx;
  140. // height: 164rpx;
  141. position: relative;
  142. .tool-box {
  143. position: absolute;
  144. right: 0rpx;
  145. bottom: -10rpx;
  146. }
  147. }
  148. .title-text {
  149. font-size: 28rpx;
  150. font-weight: 500;
  151. line-height: 40rpx;
  152. }
  153. .spec-text {
  154. font-size: 24rpx;
  155. font-weight: 400;
  156. color: $dark-9;
  157. min-width: 0;
  158. overflow: hidden;
  159. text-overflow: ellipsis;
  160. display: -webkit-box;
  161. -webkit-line-clamp: 1;
  162. -webkit-box-orient: vertical;
  163. }
  164. .price-text {
  165. font-size: 24rpx;
  166. font-weight: 500;
  167. font-family: OPPOSANS;
  168. }
  169. .total-text {
  170. font-size: 24rpx;
  171. font-weight: 500;
  172. line-height: 24rpx;
  173. color: #ff3000;
  174. margin-left: 8rpx;
  175. font-family: OPPOSANS;
  176. }
  177. }
  178. </style>