wzy
2021-04-01 d388e2788b7ef088d7cd40f901b0acdcec460bc3
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
<!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/plugin/jquery-2.1.4.min.js}"></script>
<script type="text/javascript"
    th:src="@{/js/systools/MBase.js}"></script>
</head>
<body class="container-fluid">
<div class="pd-10">
    <!-- 搜索框部分start -->
            <div class="row form-head">
                <form class="form-inline" id="serchform">
                    <div class="input-group">
<!--                        <div class="btn-group search-list " data-for="search-text">-->
<!--                            <button type="button"-->
<!--                                class="btn btn-default dropdown-toggle searchlist"-->
<!--                                data-toggle="dropdown">-->
<!--                                用户姓名 <span class="caret "></span>-->
<!--                            </button>-->
<!--                            <ul class="dropdown-menu" role="menu">-->
<!--                                <li data-field="suName"><a>用户姓名</a></li>-->
<!--                                <li data-field="suAccount"><a>账号 </a></li>-->
<!--                            </ul>-->
<!--                        </div>-->
                        <div class="form-group mr-20 ml-20">
                            <input id="search-text" name="actName" placeholder="输入活动名称"
                                type="text" class="form-control">
                        </div>
                        <div class="form-group mr-20">
                            <label>时间</label>
                            <input autocomplete="off"   name="beginTime" type="text" class="form-control datetimepicker" id="beginTime">-
                            <input autocomplete="off"   name="endTime"  type="text" class="form-control datetimepicker" id="endTime">
                        </div>
 
                        <div class="form-group mr-20">
                            <label>活动类型</label>
                            <select class="form-control autoFull select2" name="actType">
                                <option value=''>请选择</option>
                                <option value=1>拼团</option>
                                <option value=2>秒杀</option>
                                <option value=3>沙龙</option>
                            </select>
                        </div>
                        <div class="form-group mr-20">
                            <label>状态</label>
                            <select class="form-control autoFull select2" name="actStatus">
                                <option value=''>请选择</option>
                                <option value=1>打开</option>
                                <option value=2>关闭</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <button onclick="myGrid.serchData(1)" type="button"
                                class="btn btn-info">
                                <i class="fa fa-search "></i> 搜索
                            </button>
                            <button type="reset" class="btn btn-info ">
                                <i class="fa fa-refresh "></i> 重置
                            </button>
                        </div>
                    </div>
                </form>
            </div>
                
    <div class="row mt-10" >
        <div id="option-bar">
            <!-- 功能按钮部分 -->
            <button  matrix:btn="activities-pt" onclick="openAdd(1)" type="button" class="btn btn-info btn-sm"><i class="fa fa-add" ></i>新建拼团</button>
            <button matrix:btn="activities-ms" onclick="openSecKill()" type="button" class="btn btn-info btn-sm"><i class="fa fa-add" ></i>新建秒杀</button>
            <button matrix:btn="activities-sl" onclick="openSalon()" type="button" class="btn btn-info btn-sm"><i class="fa fa-add" ></i>新建沙龙</button>
 
        </div>
        <table id="mgrid">
            <thead>
                <tr>
                    <th data-checkbox="true"></th>
                    <th data-formatter="MGrid.indexfn" data-align="center"  data-width="30px" >序号</th>
                    <th data-field="id" data-align="center" data-formatter="buidOperate">操作</th>
                    <th data-field="actType" data-align="center" data-formatter="formatterType">活动类型</th>
                    <th data-field="actName" data-align="center">活动名称</th>
                    <th data-field="actStatus" data-align="center" data-formatter="formatterActStatus">状态</th>
                    <th data-field="actBeginTime" data-formatter="MGrid.getTime" data-align="center">开始时间</th>
                    <th data-field="actEndTime" data-formatter="MGrid.getTime" data-align="center">结束时间</th>
                    <th data-field="createBy" data-align="center">创建人</th>
                </tr>
            </thead>
        </table>
    </div>
</div>
<script type="text/javascript"
    th:src="@{/js/systools/MJsBase.js}"></script>
    <script type="text/javascript">
         var myGrid;
        $(function(){
            MTools.ininDatetimepicker(".datetimepicker");
            var delUrl="";
            delUrl=basePath+"/admin/shopActivities/del" ;
            myGrid=MGrid.initGrid({
                 url:basePath+"/admin/shopActivities/showList",
                 delUrl:delUrl,
             });
            
        });
 
 
        function del() {
            var i = $("#mgrid").bootstrapTable('getSelections').length;
            if (i > 1) {
                layer.msg("仅可选择一条记录", {
                    icon: 5
                });
                return false;
            }
            myGrid.delItems();
        }
 
         var btns=[];
         btns[0]="",btns[1]="",btns[2]="",btns[3]="";
         function buidOperate(value, row, index){
            var html = "";
            var type = row.actType;
            var name = row.actName;
            html+= btns[0].replace('VALUE',value).replace('TYPE',type)
            + btns[1].replace('VALUE',value).replace('TYPE',type).replace('NAME',name)
            + btns[2].replace('VALUE',value)
            + btns[3].replace('VALUE',value);
            return html; 
        } 
        // 打新增拼团界面
        function openAdd(value) {
            layer.full(layer.open({
                type : 2,
                title : "新建拼团",
                area : [ MUI.SIZE_L, MUI.SIZE_L ],
                maxmin : true,
                content : [ basePath+'/admin/redirect/shop/activities/activitiesGroupBuy-form']
            }));
        }
 
        // 打开新增秒杀界面
        function openSecKill() {
            layer.full(layer.open({
                type : 2,
                title : "新建秒杀",
                area : [ MUI.SIZE_L, MUI.SIZE_L ],
                maxmin : true,
                content : [ basePath+'/admin/redirect/shop/activities/activitiesSecKill-form']
            }));
        }
 
        // 打开新增沙龙界面
        function openSalon() {
             layer.full(layer.open({
                 type : 2,
                 title : "新建秒杀",
                 area : [ MUI.SIZE_L, MUI.SIZE_L ],
                 maxmin : true,
                 content : [ basePath+'/admin/redirect/shop/activities/activitiesSalon-form']
             }));
        }
 
        // 活动统计
        function activityStatistics(id, type, name) {
            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]
                }));
            }
        }
 
        //打开编辑界面
        function openEdit(id, type) {
            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) {
                editSecKill(id);
            } else if (type == 3) {
                editSalon(id);
            }
        };
 
        function editSecKill(id) {
            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]
            }));
        }
 
        function editSalon(id) {
            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]
            }));
        }
 
        function closeAct(value) {
            $.AjaxProxy().invoke(basePath + "/admin/shopActivities/closeAct?id="+value, function(loj) {
                if (loj[0].result.status == '200') {
                    layer.msg(loj[0].result.info, {
                        icon: 1
                    });
                }
                myGrid.serchData();
            })
        }
 
        function formatterActStatus(value) {
            if (value == 1) {
                return "开启";
            } else if (value == 2) {
                return "关闭";
            } else {
                return "-";
            }
        }
 
        function formatterType(value) {
            if (value == 1) {
                return "拼团";
            } else if (value == 2) {
                return "秒杀";
            } else if (value == 3) {
                return "沙龙";
            } else {
                return "-";
            }
        }
    </script>
 
 
 
<script matrix:btn="activities-look"  >
    btns[0]=' <button class="btn btn-default btn-sm mr-5" onClick="openEdit(\'VALUE\',\'TYPE\')"  title="编辑"><i class="fa fa-edit fa-trash-o">编辑</i></buttoun>'
</script>
<script matrix:btn="activities-payment"  >
    btns[1]='<button class="btn btn-default btn-sm mr-5" onclick="activityStatistics(\'VALUE\',\'TYPE\',\'NAME\')" title=活动统计"><i class="fa fa-sign-in">活动统计</i></button>'
</script>
<script matrix:btn="activities-gathering"  >
    btns[2]='<button class="btn btn-default btn-sm mr-5" onclick="closeAct(\'VALUE\')" title="关闭"><i class="fa fa-edit">关闭</i></button>'
</script>
<script matrix:btn="activities-edit"  >
    btns[3]=' <button class="btn btn-default btn-sm mr-5" onclick="myGrid.delItem(\'VALUE\')" title="删除"><i class="fa fa-edit">删除</i></button>'
</script>
 
 
 
</body>
</html>