RedEnvelopeItem.vue
2.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<template>
<div
@click="chooseRed(data.id,data.activityName)"
:class="['item',{'disabled':disabled},{'active':configForm.rewardId == data.id}]"
>
<div class="radio">
<img src="@/assets/red-radio.png" />
</div>
<div class="icon">
<img src="@/assets/activity-1.png" />
</div>
<div class="title">{{ data.activityName }}</div>
<div class="type">活动形式:{{ {0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[data.activityType] }}</div>
<div class="time">活动时间:{{dayjs(data.activityStartTime).format('YYYY/MM/DD')}}-{{dayjs(data.activityEndTime).format('YYYY/MM/DD')}}</div>
<div class="status">状态:{{ {0: '活动待进行', 1: '活动进行中', 2: '红包已用完', 3: '活动已结束' }[data.activityStatus] }}</div>
</div>
</template>
<script type='text/ecmascript-6'>
import * as dayjs from 'dayjs'
export default {
name: '',
props: {
data: {
type: Object,
default: () => { }
},
configForm: {
type: Object,
default: () => { }
},
disabled: Boolean
},
data () {
return {
dayjs,
}
},
mounted () {
},
methods: {
chooseRed (rewardId, rewardName) {
const { disabled } = this
if (disabled) return
this.$emit('choose', {
rewardId,
rewardName
})
}
}
}
</script>
<style scoped lang='scss'>
.item {
width: 100%;
height: 96px;
background: #fff;
border-radius: 4px;
box-sizing: border-box;
cursor: pointer;
padding: 0 16px;
font-size: 12px;
color: #999999;
line-height: 17px;
position: relative;
user-select: none;
.radio {
display: none;
}
.icon {
position: absolute;
right: 0;
bottom: 0;
width: 28px;
height: 28px;
}
.title {
font-weight: 500;
font-size: 14px;
color: #333333;
padding: 10px 0 7px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&:hover {
opacity: 0.95;
}
}
.active {
border-color: #5850ff;
.radio {
display: block;
position: absolute;
right: 0;
top: 0;
width: 16px;
height: 16px;
background-color: #5850ff;
border-radius: 0 0 0 4px;
overflow: hidden;
}
&::after {
content: '';
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border: 1px solid #5850ff;
box-sizing: border-box;
}
}
.disabled {
cursor: not-allowed;
}
</style>