index.vue
4.03 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
193
194
195
196
197
198
199
200
201
202
203
204
205
<template>
<div class="home">
<head-view></head-view>
<div class="btn-back" @click="backHandler"></div>
<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);
this.model.drawResult = item;
let type = item.prizeType;
switch (type) {
case "real":
this.model.drawResult.readonly = this.model.drawResult.contactName ? true : false
break;
}
this.model.show = true;
},
backHandler(){
window.history.go(-1);
},
},
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;
position: relative;
z-index: 1000;
}
.empty {
padding-top: 100px;
height: 300px;
.empty-icon {
font-size: 60px;
color: #a1a1a1;
}
.empty-message {
font-size: 24px;
color: #a1a1a1;
}
}
.btn-back {
width: 170px;
height: 52px;
background: url(../../assets/imgs/list-btn-back.png) no-repeat;
background-size: 100%;
position: fixed;
left: 0;
top: 30px;
z-index: 100;
}
</style>