fix
wzy
2021-12-27 75601245b7fe12b793b9b128845d4d64ba55eb7c
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
<!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">
                <div class="col-md-2 col-xs-12">
                    <!-- 功能按钮部分 -->
                    <div class="">
                        <button onclick="myGrid.delItems('id')" type="button"
                            class="btn btn-danger btn-sm"
                                matrix:btn="coupon-dels">
                            <i class="fa fa-trash"></i>批量删除
                        </button>
                        <button onclick="openAdd()" type="button"
                            class="btn btn-success btn-sm"
                                matrix:btn="coupon-add">
                            <i class="fa fa-plus"></i> 新增
                        </button>
                        <button onclick="batchStartUsing()" type="button"
                                class="btn btn-success btn-sm"
                                matrix:btn="coupon-start">
                            <!--                            <i class="fa fa-plus"></i> -->
                            启用
                        </button>
                        <button onclick="batchBlockUp()" type="button"
                                class="btn btn-success btn-sm"
                                matrix:btn="coupon-stop">
                            <!--                            <i class="fa fa-plus"></i> -->
                            停用
                        </button>
                    </div>
                </div>
                <div class="col-md-10 col-xs-12">
                    <div class="row">
                        <div class="col-md-11" style="text-align: right">
                            <form class="form-inline" id="serchform">
 
                                <div class="input-group">
                                    <div class="form-group mr-20 mt-10">
                                        <label >所属门店</label>
                                        <select class="form-control autoFull"
                                                th:data-url="@{/hiveErp/shopInfo/findShopByRole}"
                                                data-value="id"
                                                data-filed="shopName"
                                                name="shopId"
                                                id="shopId" >
                                            <option value="">--请选择门店--</option>
                                        </select>
                                    </div>
 
                                    <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="cName"><a>优惠券名称</a></li>
                                        </ul>
                                    </div>
                                    <div class="form-group mr-20 ml-20">
                                        <input autocomplete="off"   id="search-text" name="cName" placeholder="输入查询关键词"
                                               type="text" class="form-control">
                                    </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>
                                <!-- 高级搜索 -->
                                <div class="senior-content">
                                    <!-- <div><a class="serch-close closestyle">×</a></div> -->
                                    <div class="serch-headline">高级搜索</div>
                                    <div>
 
                                        <div style="margin-bottom: 20px!important;">
                                            <div class="col-sm-6" style="text-align: right!important;">
                                                <label class="col-sm-12 control-label">
                                                    开始日期:
                                                </label>
                                            </div>
                                            <div class="col-sm-6">
                                                <input autocomplete="off"   name="couponBeginTime" readonly="readonly"
                                                       type="text" class="form-control datetimepicker" style="width: 98%">
                                            </div>
                                        </div>
 
                                        <div style="margin-bottom: 20px!important;">
                                            <div class="col-sm-6" style="text-align: right!important;">
                                                <label class="col-sm-12 control-label">
                                                    结束日期:
                                                </label>
                                            </div>
                                            <div class="col-sm-6">
                                                <input autocomplete="off"   name="couponEndTime" readonly="readonly"
                                                       type="text" class="form-control datetimepicker" style="width: 98%">
                                            </div>
                                        </div>
 
                                        <div style="margin-bottom: 20px!important;">
                                            <div class="col-sm-6" style="text-align: right!important;">
                                                <label class="col-sm-12 control-label">
                                                    领取限制:
                                                </label>
                                            </div>
                                            <div class="col-sm-6">
                                                <select name="getLimit" placehoder="领取限制"
                                                        class="form-control select2" style="width: 98%">
                                                    <option value="">请选择</option>
                                                    <option value="1">所有人</option>
                                                    <option value="2">仅新人</option>
                                                </select>
                                            </div>
                                        </div>
 
                                        <div style="margin-bottom: 20px!important;">
                                            <div class="col-sm-6" style="text-align: right!important;">
                                                <label class="col-sm-12 control-label">
                                                    优惠券状态:
                                                </label>
                                            </div>
                                            <div class="col-sm-6">
                                                <select name="couponStatus" placehoder="优惠券状态"
                                                        class="form-control select2" style="width: 98%">
                                                    <option value="">请选择</option>
                                                    <option value="1">未开始</option>
                                                    <option value="2">进行中</option>
                                                    <option value="3">已结束</option>
                                                </select>
                                            </div>
                                        </div>
 
                                        <div style="margin-bottom: 20px!important;">
                                            <div class="col-sm-6" style="text-align: right!important;">
                                                <label class="col-sm-12 control-label">
                                                    启用状态:
                                                </label>
                                            </div>
                                            <div class="col-sm-6">
                                                <select name="isOpen" placehoder="启用状态"
                                                        class="form-control select2" style="width: 98%">
                                                    <option value="">请选择</option>
                                                    <option value="1">启用</option>
                                                    <option value="2">停用</option>
                                                </select>
                                            </div>
                                        </div>
 
                                        <div style="margin-bottom: 20px!important;">
                                            <div class="col-sm-6" style="text-align: right!important; padding-left: 0px">
                                                <label class="col-sm-12 control-label">
                                                    是否所有产品可用:
                                                </label>
                                            </div>
                                            <div class="col-sm-6">
                                                <select name="isAll" placehoder="是否所有产品可用"
                                                        class="form-control select2" style="width: 98%">
                                                    <option value="">请选择</option>
                                                    <option value="1">是</option>
                                                    <option value="2">否</option>
                                                </select>
                                            </div>
                                        </div>
 
                                    </div>
                                    <div class="button col-sm-12">
                                        <button type="button" class="btn btn-sm btn-info mr20" onclick="myGrid.serchData()">确认</button>
                                        <button type="button" class="btn btn-warning serch-close">取消</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="col-md-1 text-r layui-anim" data-anim="layui-anim-up">
                            <a class="senior-serch">高级搜索</a>
                        </div>
                    </div>
                </div>
            </div>
                
    <div class="row" >
        <div class="col-sm-12" >
        <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="cname" >优惠券名称</th>
                    <th data-field="shopName" >门店</th>
                    <th data-field="minAmount" >最低消费金额(满减)</th>
                    <th data-field="offsetAmount" >抵消金额</th>
                    <th data-field="beginTime" data-formatter="MGrid.getTime">开始时间</th>
                    <th data-field="endTime" data-formatter="MGrid.getTime">结束时间</th>
                    <th data-field="maxQuantity" >最大发券数量</th>
                    <th data-field="getLimit" data-formatter="buildGetLimit">领取限制</th>
                    <th data-field="quantityReceive" >已领取数量</th>
                    <th data-field="couponStatus" data-formatter="buildStatus">优惠券状态</th>
                    <th data-field="isOpen" data-formatter="buildIsOpen">是否启用</th>
                    <th data-field="isAll" data-formatter="buildIsAll">是否所有产品可用</th>
                    <th data-align="center"  data-width="195px" data-field="id" data-formatter="buidOperate">操作</th>
                </tr>
            </thead>
        </table>
    </div>
</div>
</div>
<script type="text/javascript"
    th:src="@{/js/systools/MJsBase.js}"></script>
    <script type="text/javascript">
        MTools.autoFullSelect();
        $(".select2").select2();
         var myGrid;
        $(function(){
            MTools.ininDatetimepicker(".datetimepicker");
            var delUrl="";
            delUrl=basePath+"/admin/shopCoupon/del" ;
            myGrid=MGrid.initGrid({
                 url:basePath+"/admin/shopCoupon/showList",
                 delUrl:delUrl,
             });
            
        });
 
         function buildStatus(value, row, index) {
             if (value == 1 || value == '1') {
                 return '未开始'
             }
             if (value == 2 || value == '2') {
                 return '进行中'
             }
             return '已过期'
         }
 
        function buildIsOpen(value, row, index) {
             if (value == 1 || value == '1') {
                 return '启用'
             }
             return '停用'
         }
 
         function buildIsAll(value, row, index) {
             if (value == 1 || value == '1') {
                 return '是'
             }
             return '否'
         }
 
         function buildGetLimit(value, row, index) {
             if (value == 1 || value == '1') {
                 return '所有人'
             }
             return '仅新人'
         }
 
        var btns = [];
        btns[0] = "", btns[1] = "";
 
         function buidOperate(value, row, index){
            var html = "";
            html += '<div class="btn-group">'
                    + '<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">'
                    + '操作 <span class="caret"></span>' + '</button>'
                    + '<ul class="dropdown-menu" role="menu">'
                    + btns[0].replace('VALUE',value)
                    + btns[1].replace('VALUE',value)
                    + '</ul>' + '</div>';
            html += '';
            return html; 
        } 
        //打开添加界面
        function openAdd() {
            layer.open({
                type : 2,
                title : "添加优惠券",
                area : [ MUI.SIZE_L, '400px' ],
                maxmin : true,
                content : [ basePath+'/admin/shopCoupon/editForm']
            }); 
        }
        
        //打开编辑界面
        function openEdit(id) {
            layer.open({
                type : 2,
                title : "编辑优惠券",
                area : [ MUI.SIZE_L, '400px' ],
                maxmin : true,
                content : [ basePath+'/admin/shopCoupon/editForm?id=' + id]
            });
        }
 
         //批量启用
         function batchStartUsing () {
             var key = myGrid.getSelectItemsIds("id")
             if (!key) {
                 layer.msg("请选择您要更新的数据", {
                     icon : 5
                 });
                 return false;
             }
             var _this = this;
             MTools.handleItem(basePath + "/admin/shopCoupon/startUsing" + "?keys="
                     + key, "确认要启用这些优惠券吗?",
                     function() {
                         myGrid.serchData()
                     }
             );
         }
 
         //批量停用
         function batchBlockUp () {
             var key = myGrid.getSelectItemsIds("id")
             if (!key) {
                 layer.msg("请选择您要更新的数据", {
                     icon : 5
                 });
                 return false;
             }
             var _this = this;
             MTools.handleItem(basePath + "/admin/shopCoupon/blockUp" + "?keys="
                     + key, "确认要停用这些优惠券吗?",
                     function() {
                         myGrid.serchData()
                     }
             );
         }
 
    </script>
<!--权限按钮-->
<script matrix:btn="coupon-edit">
    btns[0] = '<li><a href="javascript:void(0)" onClick="openEdit(\'VALUE\')" title="编辑">编辑</a></li>'
</script>
<script matrix:btn="coupon-del">
    btns[1] = '<li><a href="javascript:void(0)" onClick="myGrid.delItem(\'VALUE\')" title="删除">删除</a></li>'
</script>
</body>
</html>