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
<template>
<div class="lists">
<div v-for="(item, index) of active" :key="index">
<van-swipe-cell>
<div class="list" @click="listClick(index, item)">
<div class="list-logos">
<img class="list-logo" :src="item.logo" />
</div>
<div class="list-infos">
<div class="list-title">{{item.templateName}}</div>
<div class="list-dsc">{{item.des}}</div>
</div>
</div>
<template #right v-if="index > 1">
<van-button square type="danger" text="删除" @click="deleteTemplate(item.id, index)" />
</template>
</van-swipe-cell>
</div>
<span class="more" v-if="active.length && !list_finished" @click="handleMore">
查看更多
<span class="icon">></span>
</span>
</div>
</template>
<script>
// ZKit
// const log = console.log.bind(console)
import * as API_Active from "@/api/active";
export default {
name: "discountIndex",
data() {
return {
list_finished: false,
active: [
{
templateName: "大转盘活动",
activityType: "wheel",
logo: "/mainSale/icon-active-1.png",
des: "有各种物质组成的举行球状天体,叫做星球。星球有一定的形状。",
reDirect: "turntableDetail"
},
{
templateName: "送券活动",
activityType: "coupon",
logo: "/mainSale/icon-active-2.png",
des: "有各种物质组成的举行球状天体,叫做星球。星球有一定的形状。",
reDirect: "couponDetail"
}
],
params: {
pageNo: 1,
pageSize: 10
}
};
},
created() {
this.getTemplate(this.params);
},
methods: {
deleteTemplate(tem_id, index) {
API_Active.deleteTemplate(id).then(res=>{
if(res.result === 'success') {
this.active.splice(index, 1);
this.$toast('删除成功!');
}
})
},
handleMore() {
this.params.pageNo += 1;
this.getTemplate(this.params);
},
// 获取模板
getTemplate(params) {
API_Active.getTemplate(params).then(res => {
this.active.push(...res.data.list);
if (res.data.list === []) {
this.list_finished = true;
}
});
},
listClick(inIndex, item) {
// log('--->click: inIndex =', inIndex)
// log('--->click: reDirect =', this.list.active[inIndex].reDirect)
if (inIndex < 2) {
this.$router.push(this.active[inIndex].reDirect);
} else {
this.$router.push({
path: `/createBigWheelActive`,
query: {
activityId: item.activityId,
activityType: item.activityType,
templateId: item.id
}
});
}
}
}
};
</script>
<style scoped>
.more {
font-size: 12px;
float: right;
}
.lists {
padding: 4px 16px 20px 16px;
}
.list {
padding: 12px 0px;
display: flex;
flex-direction: row;
justify-content: start;
align-items: center;
border-bottom: 1px solid #eeeeee;
}
.list-logos {
width: 80px;
height: 80px;
background-color: #f8f8f8;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.list-logo {
width: 56px;
height: 56px;
}
.list-infos {
width: 251px;
height: 80px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: start;
margin-left: 12px;
}
.list-title {
font-size: 14px;
height: 16px;
line-height: 16px;
font-weight: bold;
color: #2d476a;
width: 100%;
text-align: left;
margin-bottom: 8px;
}
.list-dsc {
font-size: 12px;
height: 14px;
line-height: 14px;
font-weight: normal;
color: #2d476a;
width: 100%;
text-align: left;
overflow: auto;
}
</style>