123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <template>
- <div>
- <div>
- <slot name="top"></slot>
- </div>
- <div
- :style="[{ borderRadius: radius + 'px', marginBottom: marginBottom + 'px' }]"
- class="ss-order-card-warp flex items-stretch justify-between bg-white"
- >
- <div class="img-box mr-24px">
- <el-image
- :initial-index="0"
- :preview-src-list="[picUrl]"
- :src="picUrl"
- class="order-img"
- fit="contain"
- preview-teleported
- />
- </div>
- <div
- :style="[{ width: titleWidth ? titleWidth + 'px' : '' }]"
- class="box-right flex flex-col justify-between"
- >
- <div v-if="title" class="title-text ss-line-2">{{ title }}</div>
- <div v-if="skuString" class="spec-text mt-8px mb-12px">{{ skuString }}</div>
- <div class="groupon-box">
- <slot name="groupon"></slot>
- </div>
- <div class="flex">
- <div class="flex items-center">
- <div
- v-if="price && Number(price) > 0"
- :style="[{ color: priceColor }]"
- class="price-text flex items-center"
- >
- ¥{{ fenToYuan(price) }}
- </div>
- <div v-if="num" class="total-text flex items-center">x {{ num }}</div>
- <slot name="priceSuffix"></slot>
- </div>
- </div>
- <div class="tool-box">
- <slot name="tool"></slot>
- </div>
- <div>
- <slot name="rightBottom"></slot>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import { fenToYuan } from '@/utils'
- defineOptions({ name: 'ProductItem' })
- const props = defineProps({
- picUrl: {
- type: String,
- default: 'https://img1.baidu.com/it/u=1601695551,235775011&fm=26&fmt=auto'
- },
- title: {
- type: String,
- default: ''
- },
- titleWidth: {
- type: Number,
- default: 0
- },
- skuText: {
- type: [String, Array],
- default: ''
- },
- price: {
- type: [String, Number],
- default: ''
- },
- priceColor: {
- type: [String],
- default: ''
- },
- num: {
- type: [String, Number],
- default: 0
- },
- score: {
- type: [String, Number],
- default: ''
- },
- radius: {
- type: [String],
- default: ''
- },
- marginBottom: {
- type: [String],
- default: ''
- }
- })
- /** SKU 展示字符串 */
- const skuString = computed(() => {
- if (!props.skuText) {
- return ''
- }
- if (typeof props.skuText === 'object') {
- return props.skuText.join(',')
- }
- return props.skuText
- })
- </script>
- <style lang="scss" scoped>
- .ss-order-card-warp {
- padding: 20px;
- border-radius: 10px;
- border: 1px #6a6a6a solid;
- background-color: var(--app-content-bg-color);
- .img-box {
- width: 80px;
- height: 80px;
- border-radius: 10px;
- overflow: hidden;
- .order-img {
- width: 80px;
- height: 80px;
- }
- }
- .box-right {
- flex: 1;
- position: relative;
- .tool-box {
- position: absolute;
- right: 0px;
- bottom: -10px;
- }
- }
- .title-text {
- font-size: 13px;
- font-weight: 500;
- line-height: 20px;
- }
- .spec-text {
- font-size: 10px;
- font-weight: 400;
- color: #999999;
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- }
- .price-text {
- font-size: 11px;
- font-weight: 500;
- font-family: OPPOSANS;
- }
- .total-text {
- font-size: 10px;
- font-weight: 400;
- line-height: 16px;
- color: #999999;
- margin-left: 8px;
- }
- }
- .ss-line {
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- &-1 {
- -webkit-line-clamp: 1;
- }
- &-2 {
- -webkit-line-clamp: 2;
- }
- }
- </style>
|