| <!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> |