index.vue
3.79 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<template>
<div class="home">
<head-view></head-view>
<div class="sys-container-panel content">
<div class="container-title">{{title}}</div>
<div class="head-line"></div>
<div class="prize-container">
<div
class="prize-item"
v-for="(item,index) in prizeList"
:key="index"
:class="{'prize-coupon-bg':item.prizeType=='coupon','prize-normal-bg':item.prizeType!='coupon'}"
>
<div class="prize-name">{{item.prizeName}}</div>
<div
class="prize-btn"
@click="viewDetailHandler(item)"
>{{item.prizeType == 'real' ? '提交信息' : '查看详情'}}</div>
</div>
<div class="empty" v-if="init && prizeList.length == 0">
<div class="empty-icon">
<van-icon name="warn-o" />
</div>
<div class="empty-message">您还没有任何奖品 !</div>
</div>
</div>
</div>
<div class="bottom-line"></div>
<bottom-tool v-model="activityIndex"></bottom-tool>
<draw-model v-if="model.show" v-model="model" v-on:submitSuccess="model.show = false"></draw-model>
</div>
</template>
<script>
let urls = {
prizeList: "/jiajiaCHApi/app/prize/list"
};
import { httpGet } from "@/api/fetch-api";
import BottomTool from "@/components/bottom-tools/bottom-tools";
import DrawModel from "@/components/biz-model/draw-model";
import HeadView from "@/components/plugins/head";
import Vue from "vue";
import { Toast } from "vant";
import { Icon } from "vant";
Vue.use(Icon);
Vue.use(Toast);
export default {
name: "home",
data() {
return {
init: false,
activityIndex: 4,
title: "我的奖品",
remainDrawTime: 0,
model: {
show: false,
drawResult: {}
},
indexForm: {},
prizeList: []
};
},
methods: {
initActivity() {
Toast.loading({
mask: true,
message: "加载中..."
});
httpGet({ url: urls.prizeList, data: null }).then(res => {
Toast.clear();
this.init = true;
this.prizeList = res;
});
},
viewDetailHandler(item) {
console.log(item);
let type = item.prizeType;
switch (type) {
case "real":
this.model.drawResult = item;
this.model.show = true;
break;
case "coupon":
location.href = global_view_coupon_url;
break;
default:
location.href = global_view_integral_url;
break;
}
}
},
components: {
BottomTool,
DrawModel,
HeadView
},
mounted() {
this.initActivity();
}
};
</script>
<style lang="scss" scoped>
.content {
margin: 85px auto 60px auto;
padding-bottom: 60px;
min-height: 500px;
}
.container-title {
font-size: 30px;
}
.head-line {
height: 60px;
}
.bottom-line {
height: 150px;
background-color: transparent;
}
.prize-container {
width: 700;
margin: auto;
}
.prize-item {
margin: auto;
display: flex;
align-items: center;
justify-content: space-between;
width: 590px;
height: 140px;
border-radius: 15px;
padding: 0 30px;
}
.prize-coupon-bg {
background: url(../../assets/imgs/prize-item-coupon-bg.png);
background-size: 100%;
}
.prize-normal-bg {
background: url(../../assets/imgs/prize-item-normal-bg.png);
background-size: 100%;
}
.prize-name {
font-size: 24px;
color: #fff;
font-weight: bold;
line-height: 140px;
height: 140px;
}
.prize-btn {
font-size: 22px;
font-weight: 600;
text-align: center;
width: 140px;
height: 40px;
line-height: 40px;
border-radius: 26px;
background-color: #f6b843;
}
.empty {
padding-top: 100px;
height: 300px;
.empty-icon {
font-size: 60px;
color: #a1a1a1;
}
.empty-message {
font-size: 24px;
color: #a1a1a1;
}
}
</style>