carCard.vue
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<template>
<view class="carCard" @click="skip">
<slot name="header"></slot>
<slot name="center"></slot>
<view class="rowLine"></view>
<slot name="footer"></slot>
<view class="tip" :style="{backgroundColor: bgColor, color: fontColor}">{{ carInfo?.policyStatus ?? tipContent }}</view>
</view>
</template>
<script setup>
import { computed } from 'vue';
const props = defineProps({
carInfo: {
type: Object,
require: true
},
tipContent: {
type: String,
default: ''
}
})
const bgColor = computed(() => {
let index = props.carInfo?.policyStatus || 0
let objColor = {
'进行中': '#D5E5FF',
'已完成': '#dbf1e1',
'已作废': '#FFD5D5'
}
return objColor[index] || '#D5E5FF'
})
const fontColor = computed(() => {
let index = props.carInfo?.policyStatus || 0
let objColor = {
'进行中': '#3680FE',
'已完成': '#19be6b',
'已作废': '#C81515'
}
return objColor[index] || '#3680FE'
})
</script>
<style lang="scss" scoped>
.carCard{
position: relative;
padding: 20rpx 30rpx 34rpx;
box-shadow: 0rpx 8rpx 40rpx 0rpx rgba(10,22,44,0.06);
background: #fff;
border-radius: 20rpx;
.rowLine{
width: 100%;
height: 2rpx;
background-color: #eee;
margin: 20rpx 0;
}
.tip{
position: absolute;
top: 0;
right: 0;
padding: 0 20rpx;
text-align: center;
font-size: 20rpx;
line-height: 40rpx;
border-radius: 0rpx 20rpx 0rpx 20rpx;
color: #3680FE;
background-color: #D5E5FF;
}
}
</style>