133 lines
3.0 KiB
Vue
133 lines
3.0 KiB
Vue
<template>
|
|
<view class="order-item-content" :class="size === 'large' ? 'size-large' : ''">
|
|
<view class="order-item-product-info">
|
|
<image
|
|
:src="productImg"
|
|
mode="aspectFit"
|
|
class="order-item-product-cover"
|
|
/>
|
|
<view class="order-item-product-name" v-html="title"></view>
|
|
</view>
|
|
<view class="order-item-product-price">
|
|
<view class="price">{{ price }} {{ t('global.coin') }}</view>
|
|
<view class="count">x {{ 1 }}</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed } from 'vue'
|
|
import { t } from '@/utils/i18n'
|
|
import type { IGoods } from '@/types/order'
|
|
interface Props {
|
|
data: IGoods
|
|
type: string
|
|
size?: 'small' | 'large'
|
|
}
|
|
const props = defineProps<Props>()
|
|
|
|
const productImg = computed(() => {
|
|
console.log(props.data)
|
|
switch (props.type) {
|
|
case 'order':
|
|
return props.data?.productImages || ''
|
|
case 'abroadBook':
|
|
return props.data?.images || ''
|
|
case 'vip':
|
|
return '/static/vip.png'
|
|
case 'abroadVip':
|
|
return '/static/vip.png'
|
|
case 'point':
|
|
return '/static/jifen.png'
|
|
default:
|
|
return ''
|
|
}
|
|
})
|
|
const title = computed(() => {
|
|
switch (props.type) {
|
|
case 'order':
|
|
return (props.data?.goodsType == '02' ? '(电子书)' : '') + props.data?.productName || ''
|
|
case 'abroadBook':
|
|
return '(电子书)' + props.data?.name || ''
|
|
case 'vip':
|
|
return props.data?.title + '<text style="color: #ff4703; font-weight: bold;">(' + props.data?.year + '年)</text>' || ''
|
|
case 'abroadVip':
|
|
return '电子书VIP' + props.data?.title + '<text style="color: #ff4703; font-weight: bold;">(' + props.data?.days + '天)</text>' || ''
|
|
case 'point':
|
|
return ''
|
|
default:
|
|
return ''
|
|
}
|
|
})
|
|
const price = computed(() => {
|
|
switch (props.type) {
|
|
case 'order':
|
|
return props.data?.price || 0
|
|
case 'abroadBook':
|
|
return props.data?.abroadPrice || 0
|
|
case 'vip':
|
|
return props.data?.fee || 0
|
|
case 'abroadVip':
|
|
return props.data?.money || 0
|
|
case 'point':
|
|
return ''
|
|
default:
|
|
return ''
|
|
}
|
|
})
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.order-item-content {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
font-size: 14px;
|
|
|
|
.order-item-product-info {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: flex-start;
|
|
align-items: center;
|
|
|
|
.order-item-product-cover {
|
|
margin-right: 12px;
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 4px;
|
|
background-color: #f5f5f5;
|
|
}
|
|
|
|
.order-item-product-name {
|
|
color: #333;
|
|
}
|
|
}
|
|
.order-item-product-price {
|
|
font-weight: bold;
|
|
color: #333;
|
|
text-align: right;
|
|
font-size: 12px;
|
|
white-space: nowrap;
|
|
|
|
.count {
|
|
font-weight: normal;
|
|
color: #999;
|
|
}
|
|
}
|
|
}
|
|
|
|
.order-item-content.size-large {
|
|
.order-item-product-cover {
|
|
width: 70px;
|
|
height: 70px;
|
|
}
|
|
.order-item-product-name {
|
|
font-size: 16px;
|
|
}
|
|
.order-item-product-price {
|
|
font-size: 14px;
|
|
}
|
|
}
|
|
</style> |