xiaoyong931011
2021-04-12 a13a93a493e7e94e28b2225c26e7e13b52d3288c
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!-- 本框架基本脚本和样式 -->
    <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script>
    <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}">
    <link rel="stylesheet" th:href="@{/plugin/bootstrap-3.3.5/css/bootstrap.min.css}">
    <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/>
 
    <!-- 富文本编辑器 -->
    <script type="text/javascript" charset="utf-8"
            th:src="@{/plugin/beditor/ueditor.config.js}"></script>
    <script type="text/javascript" charset="utf-8"
            th:src="@{/plugin/beditor/ueditor.all.js}">
    </script>
    <script type="text/javascript" charset="utf-8"
            th:src="@{/plugin/beditor/lang/zh-cn/zh-cn.js}"></script>
    <style>
        .panel-body{
            overflow: hidden;
        }
        .paginationStyle{
            background: #ffffff;
            padding: 10px 10px;
            margin: 0px 0px 10px 0px;
            text-align: right;
        }
    </style>
</head>
 
<body>
<div class="panel-body" id="app" v-cloak>
    <el-row>
        <el-row justify="space-between" type="flex">
                    <el-col>
                        <el-form ref="form" :model="form" inline >
                            <el-form-item prop="hdmc" >
                                <el-input v-model="form.hdmc" placeholder="活动名称"></el-input>
                            </el-form-item>
                            <el-form-item label="活动状态" prop="hdzt">
                                <el-select v-model="form.hdzt" placeholder="活动状态">
                                    <el-option
                                            v-for="item in hdztList"
                                            :key="item.value"
                                            :label="item.label"
                                            :value="item.value"
                                    >
                                    </el-option>
                                </el-select>
                            </el-form-item>
                            <el-button type="primary" @click="searchFormActivitys" >搜索</el-button>
                            <el-button @click="resetFormActivitys('form')">重置</el-button>
                        </el-form>
                    </el-col>
                </el-row>
 
                <el-row class="table-style" >
                    <el-table ref="multipleTable"
                              :data="activitysList.rows"
                              :height="height"
                              stripe:true
                              @sort-change="sortChange"
                              @selection-change="handleSelectionChange">
                        <el-table-column
                                type="selection">
                        </el-table-column>
                        <el-table-column
                                prop="actName"
                                label="活动名称"
                                show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column
                                prop="actCode"
                                label="活动编号"
                                show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column
                                label="活动类型">
                            <template slot-scope="scope">
                                <span v-if="scope.row.actType == 1">团购</span>
                                <span v-if="scope.row.actType == 2">秒杀</span>
                                <span v-if="scope.row.actType == 3">沙龙</span>
                                <span v-if="scope.row.actType == 4">每日签到</span>
                            </template>
                        </el-table-column>
                        <el-table-column
                                label="状态">
                            <template slot-scope="scope">
 
                                <div v-if="scope.row.actType == 4">
                                    <span v-if="scope.row.actStatus == 1">未发布</span>
                                </div>
                                <div v-if="scope.row.actType != 4">
                                    <span v-if="scope.row.actStatus == 1">开启</span>
                                </div>
                                <div v-if="scope.row.actType == 4">
                                    <span v-if="scope.row.actStatus == 2">未开始</span>
                                </div>
                                <div v-if="scope.row.actType != 4">
                                    <span v-if="scope.row.actStatus == 2">关闭</span>
                                </div>
                                <span v-if="scope.row.actStatus == 3">进行中</span>
                                <span v-if="scope.row.actStatus == 4">已结束</span>
                                <span v-if="scope.row.actStatus == 5">已删除</span>
                            </template>
                        </el-table-column>
                        <el-table-column
                                prop="actBeginTime"
                                label="开始时间"
                                show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column
                                prop="actEndTime"
                                label="结束时间"
                                show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column
                                prop="createBy"
                                label="创建人"
                                show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column
                                prop="actRemark"
                                label="备注"
                                show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column label="操作" width="400">
                            <template slot-scope="scope">
                                <el-row style="display:flex;" v-if="scope.row.actType == 4">
                                    <el-button type="primary" v-if="scope.row.actStatus == 1" size="mini" @click="beReady(scope.row)">发布</el-button>
                                    <el-button type="primary" v-if="[1,2,3].includes(scope.row.actStatus)" @click="beUpdate(scope.row)" size="mini">修改</el-button>
                                    <el-button type="primary" v-if="scope.row.actStatus == 3" size="mini">推广</el-button>
                                    <el-button type="primary" v-if="[3,4,5].includes(scope.row.actStatus)" @click="openSignReceive(scope.row)" size="mini">活动统计</el-button>
                                    <el-button type="primary" v-if="scope.row.actStatus == 3" @click="beClose(scope.row)" size="mini">关闭</el-button>
                                    <el-button type="danger" v-if="scope.row.actStatus != 5" size="mini" @click="delRow(scope.row)">删除</el-button>
                                </el-row>
                                <el-row style="display:flex;" v-if="scope.row.actType != 4">
                                    <el-button type="primary" @click="openEdit(scope.row)" size="mini">编辑</el-button>
                                    <el-button type="primary" @click="activityStatistics(scope.row)" size="mini">活动统计</el-button>
                                    <el-button type="primary" @click="closeAct(scope.row)" size="mini">关闭</el-button>
                                    <el-button type="danger" @click="delAct(scope.row)" size="mini">删除</el-button>
                                </el-row>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-row>
                <el-row class="paginationStyle"  >
                    <el-pagination background
                                   @size-change="changePageSizeActivitys"
                                   @current-change="changeCurrentPageActivitys"
                                   :current-page="activitysList.currentPage"
                                   :page-sizes="[10, 20, 30, 50]"
                                   :page-size="activitysList.pageSize"
                                   layout="total, sizes, prev, pager, next, jumper"
                                   :total="activitysList.total">
                    </el-pagination>
                </el-row>
    </el-row>
</div>
</body>
<script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
<script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script>
<script type="text/javascript" th:src="@{/plugin/bootstrap-3.3.5/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script>
<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script>
<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script>
<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script>
<script type="text/javascript" th:src="@{/plugin/layer/layer.js}"></script>
<script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script>
 
<script>
    var app = new Vue({
        el: '#app',
        data: {
            height:'calc(100vh - 200px)',
            // 条件查询
            hdztList:[
                {value:'',label:'全部'},
                {value:1,label:'未发布'},
                {value:2,label:'未开始'},
                {value:3,label:'进行中'},
                {value:4,label:'已结束'},
                {value:5,label:'已删除'},
            ],
            form:{
                hdmc:'',
                hdzt:'',
                order:'',
                sort:''
            },
            //活动列表
            activitysList:{
                rows:[],
                total:0,
                pageSize:10,
                currentPage:1,
            },
        },
        created: function () {
            this.loadInfo();
        },
        mounted: function () {
        },
        methods: {
            //加载分类
            loadInfo() {
                let _this = this;
                _this.loadActivitysList();
            },
            //删除
            delAct(row){
                let _this = this;
                _this.$confirm('确认删除活动吗?', '删除', {
                    distinguishCancelAndClose: true,//设置关闭按钮和不通过按钮的区别
                    confirmButtonText: '确认',
                    cancelButtonText: '取消',
                    type: 'info'
                }).then(() => {
                    //通过
                    let id = row.id;
                    $.AjaxProxy().invoke(basePath + "/admin/shopActivities/del?keys="+id, function(loj) {
                        if (loj[0].result.status == '200') {
                            _this.loadActivitysList();
                        }
                    });
                }).catch(action => {
                    //不通过
                    if(action === 'cancel'){
                        console.log("cancel");
                    }else{
                        //关闭按钮
                        console.log("close");
                    }
                });
            },
            //关闭
            closeAct(row){
                let _this = this;
                _this.$confirm('确认关闭活动吗?', '关闭', {
                    distinguishCancelAndClose: true,//设置关闭按钮和不通过按钮的区别
                    confirmButtonText: '确认',
                    cancelButtonText: '取消',
                    type: 'info'
                }).then(() => {
                    //通过
                    let id = row.id;
                    $.AjaxProxy().invoke(basePath + "/admin/shopActivities/closeAct?id="+id, function(loj) {
                        if (loj[0].result.status == '200') {
                            layer.msg(loj[0].result.info, {
                                icon: 1
                            });
                        }
                    });
                    _this.loadActivitysList();
                }).catch(action => {
                    //不通过
                    if(action === 'cancel'){
                        console.log("cancel");
                    }else{
                        //关闭按钮
                        console.log("close");
                    }
                });
            },
            // 活动统计
            activityStatistics(row) {
                let type = row.actType;
                let id = row.id;
                let name = row.actName;
                console.log("-------");
                if (type == 2) {
                    layer.full(layer.open({
                        type : 2,
                        title : name + "-活动统计",
                        area : [ MUI.SIZE_L, MUI.SIZE_L ],
                        maxmin : true,
                        content : [ basePath+'/admin/redirect/shop/activities/shopActivitiesSecKill-list?id=' + id]
                    }));
                }
 
                if (type == 1) {
                    layer.full(layer.open({
                        type : 2,
                        title : name + "-活动统计",
                        area : [ MUI.SIZE_L, MUI.SIZE_L ],
                        maxmin : true,
                        content : [ basePath+'/admin/redirect/shop/activities/shopActivitiesGroupBuy-list?id=' + id]
                    }));
                }
 
                if (type == 3) {
                    layer.full(layer.open({
                        type : 2,
                        title : name + "-活动统计",
                        area : [ MUI.SIZE_L, MUI.SIZE_L ],
                        maxmin : true,
                        content : [ basePath+'/admin/redirect/shop/activities/shopActivitiesSalon-list?id=' + id]
                    }));
                }
            },
            //打开编辑界面
            openEdit(row) {
                let type = row.actType;
                let id = row.id;
                if (type == 1) {
                    layer.full(layer.open({
                        type : 2,
                        title : "编辑拼团",
                        area : [ MUI.SIZE_L, MUI.SIZE_L ],
                        maxmin : true,
                        content : [ basePath+'/admin/redirect/shop/activities/activitiesGroupBuy-form?id=' + id]
                    }));
                } else if (type == 2) {
                    layer.full(layer.open({
                        type : 2,
                        title : "编辑秒杀",
                        area : [ MUI.SIZE_L, MUI.SIZE_L ],
                        maxmin : true,
                        content : [ basePath+'/admin/redirect/shop/activities/activitiesSecKill-form?id=' + id]
                    }));
                } else if (type == 3) {
                    layer.full(layer.open({
                        type : 2,
                        title : "编辑沙龙",
                        area : [ MUI.SIZE_L, MUI.SIZE_L ],
                        maxmin : true,
                        content : [ basePath+'/admin/redirect/shop/activities/activitiesSalon-form?id=' + id]
                    }));
                }
            },
            //修改
            beUpdate(row){
                layer.full(layer.open({
                    type: 2,
                    title: "修改",
                    maxmin: true,
                    area: [MUI.SIZE_L, '500px'],
                    content : [ basePath + '/admin/redirect/activity/activity-sign-update?actId=' + row.id]
                }));
            },
            //活动统计
            openSignReceive(row){
                layer.full(layer.open({
                    type: 2,
                    title: "活动统计",
                    maxmin: true,
                    area: [MUI.SIZE_L, '500px'],
                    content : [ basePath + '/admin/redirect/activity/activity-sign-receive?actId=' + row.id]
                }));
            },
            //发布
            beReady(row){
                let _this = this;
                let actState = row.actStatus;
                if(actState !== 1){
                    this.$notify({
                        title: '提示',
                        message: '状态为【未发布】才能发布',
                        type: 'warning'
                    });
                }
                _this.$confirm('确认发布活动吗?', '发布', {
                    distinguishCancelAndClose: true,//设置关闭按钮和不通过按钮的区别
                    confirmButtonText: '确认',
                    cancelButtonText: '取消',
                    type: 'info'
                }).then(() => {
                    //通过
                    let id = row.id;
                    let obj = {
                        actId: id,
                    }
                    AjaxProxy.requst({
                        app: _this,
                        data:obj,
                        url: basePath + '/admin/activitySignAwardSet/beReady',
                        callback: function (data) {
                            _this.$message.success(data.info);
                            _this.loadActivitysList();
                        }
                    });
                }).catch(action => {
                    //不通过
                    if(action === 'cancel'){
                        console.log("cancel");
                    }else{
                        //关闭按钮
                        console.log("close");
                    }
                });
            },
            //关闭
            beClose(row){
                let _this = this;
                _this.$confirm('确认关闭活动吗?', '关闭', {
                    distinguishCancelAndClose: true,//设置关闭按钮和不通过按钮的区别
                    confirmButtonText: '确认',
                    cancelButtonText: '取消',
                    type: 'info'
                }).then(() => {
                    //通过
                    let id = row.id;
                    let obj = {
                        actId: id,
                    }
                    AjaxProxy.requst({
                        app: _this,
                        data:obj,
                        url: basePath + '/admin/activitySignAwardSet/beClose',
                        callback: function (data) {
                            _this.$message.success(data.info);
                            _this.loadActivitysList();
                        }
                    });
                }).catch(action => {
                    //不通过
                    if(action === 'cancel'){
                        console.log("cancel");
                    }else{
                        //关闭按钮
                        console.log("close");
                    }
                });
            },
            //删除
            delRow(row){
                let _this = this;
                _this.$confirm('确认删除活动吗?', '删除', {
                    distinguishCancelAndClose: true,//设置关闭按钮和不通过按钮的区别
                    confirmButtonText: '确认',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    //通过
                    let id = row.id;
                    let obj = {
                        actId: id,
                    }
                    AjaxProxy.requst({
                        app: _this,
                        data:obj,
                        url: basePath + '/admin/activitySignAwardSet/delRow',
                        callback: function (data) {
                            _this.$message.success(data.info);
                            _this.loadActivitysList();
                        }
                    });
                }).catch(action => {
                    //不通过
                    if(action === 'cancel'){
                        console.log("cancel");
                    }else{
                        //关闭按钮
                        console.log("close");
                    }
                });
            },
 
            //--活动列表
            loadActivitysList() {
                let _this = this;
                let data=_this.getRequestParamActivitys();
                data.pageSize=_this.activitysList.pageSize;
                data.pageNum=_this.activitysList.currentPage;
                AjaxProxy.requst({
                    app: _this,
                    data:data,
                    url: basePath + '/admin/activitySignAwardSet/findActivitiesList',
                    callback: function (data) {
                        _this.activitysList.rows = data.rows;
                        _this.activitysList.total = data.total;
                    }
                });
            },//查询参数
            getRequestParamActivitys(){
                let _this = this;
                return   {
                    hdmc:_this.form.hdmc,
                    hdzt:_this.form.hdzt,
                    order:_this.form.order,
                    sort:_this.form.sort,
                }
            },
            //查询
            searchFormActivitys:function(){
                this.activitysList.currentPage=1;
                this.loadActivitysList();
            },
            //重置
            resetFormActivitys(formName) {
                this.$refs[formName].resetFields();
            },
            changePageSizeActivitys(val) {
                this.activitysList.pageSize = val;
                this.loadActivitysList();
            },
            changeCurrentPageActivitys(val) {
                this.activitysList.currentPage = val;
                this.loadActivitysList();
            },
            //排序
            sortChange:function (column){
                if(column.order){
                    if(column.order.indexOf("desc")){
                        this.form.order="desc";
                    }else{
                        this.form.order="asc";
                    }
                    this.form.sort=column.prop;
                    this.loadInfo();
                }
            },
            //选择
            handleSelectionChange(val) {
                let _this = this;
                _this.multipleSelection = val;
            },
        }
    })
</script>
 
</body>
</html>