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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
| <template>
| <div class="custom-scroll">
| <v-header
| title="抽奖活动管理"
| :bar="bar"
| search
| @on-search="onSearch"
| ></v-header>
| <div class="add fl-al mr-b-10">
| <el-button size="small" type="primary" @click.stop="clickHandle('add')"
| >新增</el-button
| >
| </div>
| <div class="tab">
| <v-table :trs="trs" :tds="tds">
| <template v-slot:status="item">
| <span v-if="item.scope.status === 0">未开始</span>
| <span v-if="item.scope.status === 1">报名中</span>
| <span v-if="item.scope.status === 2">待开奖</span>
| <span v-if="item.scope.status === 3">已开奖</span>
| </template>
| <template v-slot:sTime="item">
| <span>{{ item.scope.startTime }}~{{ item.scope.stopTime }}</span>
| </template>
| <template v-slot:rTime="item">
| <span
| >{{ item.scope.raffleStartTime }}~{{
| item.scope.raffleStopTime
| }}</span
| >
| </template>
| <template v-slot:btn="{ scope }">
| <el-button
| v-if="scope.status === 0"
| @click="clickHandle('edit', scope)"
| type="text"
| >编辑</el-button
| >
| <el-button
| v-if="scope.status === 2"
| @click="clickHandle('look', scope)"
| type="text"
| >查看</el-button
| >
| <el-button
| v-if="scope.status === 0 || scope.status === 1"
| @click="clickHandle('delete', scope)"
| type="text"
| >删除</el-button
| >
| <el-button
| v-if="scope.status === 3"
| @click="clickHandle('award', scope)"
| type="text"
| >获奖名单</el-button
| >
| </template>
| </v-table>
| </div>
| <v-tool-page :item="paged" @on-page="onPage"></v-tool-page>
| </div>
| </template>
|
| <script>
| import { mapState } from "vuex";
| export default {
| props: {},
| components: {},
| data() {
| return {
| dialogVisible: false,
| bar: [
| { title: "关键字", name: "keyword" },
| {
| title: "状态",
| name: "status",
| type: "select",
| list: [
| {
| value: 0,
| label: "未开始",
| },
| {
| value: 1,
| label: "报名中",
| },
| {
| value: 2,
| label: "待开奖",
| },
| {
| value: 3,
| label: "已开奖",
| },
| ],
| },
| ],
| trs: [
| { text: "序号", val: "id", width: "60px" },
| { text: "活动名称", val: "name", width: "100px" },
| { text: "奖品数量", val: "prizeCount", width: "100px" },
| { text: "参与人数", val: "joinCount", width: "100px" },
| { text: "中奖人数", val: "raffleCount", width: "100px" },
| {
| text: "待兑换奖品数量",
| val: "waitRaffleCount",
| width: "130px",
| },
| { text: "报名时间", val: "btn", slot: "sTime", width: "270px" },
| { text: "开奖时间", val: "lotteryTime", width: "140px" },
| { text: "兑奖时间", val: "btn", slot: "rTime", width: "270px" },
| { text: "创建人", val: "createName" },
| { text: "状态", val: "btn", slot: "status" },
| {
| text: "操作",
| val: "btn",
| slot: "btn",
| width: "125px",
| fixed: "right",
| },
| ],
| tds: [],
| paged: { page: 0, total: 0, r: 0, limit: 10 },
| search: {},
| };
| },
| computed: {
| ...mapState({ vuex_page: "pageReset" }),
| },
| watch: {
| vuex_page: {
| handler(n) {
| if (n.page === this.$route.path) {
| this.init();
| }
| },
| deep: true,
| },
| },
| methods: {
| handleClose() {
| this.dialogVisible = false;
| },
| onSearch(v) {
| this.search = demo.copy(v);
| this.paged.page = 1;
| this.init();
| },
| // 分页点击
| onPage(v) {
| if (v.page === this.paged.page && v.page && !v.reset) {
| return 0;
| }
| this.paged.page = v.page;
| this.paged.limit = v.limit;
| this.init();
| },
| // 获取数据
| init() {
| let v = demo.copy(
| Object.assign(this.search, {
| page: this.paged.page,
| size: this.paged.limit,
| })
| );
| this.$api.post("comActRaffle/queryAll", v, (e) => {
| this.paged.total = e.total;
| this.paged.r++;
| this.tds = e.records || [];
| });
| },
| // 页面操作
| clickHandle(type, row) {
| switch (type) {
| case "add": {
| this.$router.push("/addDraw");
| break;
| }
| case "edit": {
| this.$router.push("/addDraw?id=" + row.id);
| break;
| }
| case "look": {
| this.$router.push("/drawDetals?id=" + row.id);
| break;
| }
| case "award": {
| this.$router.push("/awardList?id=" + row.id);
| break;
| }
| case "delete": {
| this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
| confirmButtonText: "确定",
| cancelButtonText: "取消",
| type: "warning",
| }).then(() => {
| this.$api.get("comActRaffle/del", { id: row.id }, () => {
| demo.toast("删除成功");
| this.init();
| });
| return;
| });
| break;
| }
| default: {
| break;
| }
| }
| },
| },
| mounted() {},
| };
| </script>
| <style scoped>
| .custom-scroll {
| overflow: scroll;
| }
| .text-label {
| width: 150px;
| text-align: right;
| }
| .text-box {
| width: 200px;
| }
| </style>
|
|