| <!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-4 col-xs-12"> | 
|                     <!-- 功能按钮部分 --> | 
|   | 
|                 </div> | 
|                 <div class="col-md-8 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="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="title"><a>产品名称</a></li> | 
|                                             <li data-field="brand"><a>产品品牌 </a></li> | 
|                                         </ul> | 
|                                     </div> | 
|                                     <div class="form-group mr-20 ml-20"> | 
|                                         <input autocomplete="off"   id="search-text" name="title" 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 class="serch-headline">高级搜索</div> | 
|                                     <div> | 
|                                             <span class="serch-title">上架状态:</span> | 
|                                             <select class="form-control  select2" size="1" | 
|                                                     name="status" | 
|                                                     id="status" style="width: 50%"> | 
|                                                 <option value="">请选择</option> | 
|                                                 <option value="1" >是</option> | 
|                                                 <option value="2" >否</option> | 
|                                             </select> | 
|                                     </div> | 
|                                     <div> | 
|                                         <span class="serch-title">是否为服务项目:</span> | 
|                                         <select class="form-control  select2" size="1" | 
|                                                 name="isService" | 
|                                                 id="isService" style="width: 50%"> | 
|                                             <option value="">请选择</option> | 
|                                             <option value="1" >是</option> | 
|                                             <option value="2" >否</option> | 
|                                         </select> | 
|                                     </div> | 
|                                     <div> | 
|                                             <span class="serch-title">产品属性:</span> | 
|                                             <select class="form-control  select2" size="1" name="attrs" style="width: 50%" | 
|                                                     id="parentId"> | 
|                                             </select> | 
|                                     </div> | 
|                                     <div> | 
|                                             <span class="serch-title">产品分类:</span> | 
|                                             <select class="form-control  select2" size="1" name="categoryId" style="width: 50%" | 
|                                                     id="categoryId"> | 
|                                             </select> | 
|   | 
|                                     </div> | 
|                                     <div class="button"> | 
|                                         <button type="button" class="btn btn-sm btn-info mr20" onclick="myGrid.serchData()">确认 | 
|                                         </button> | 
|                                         <button type="button" class="btn btn-sm btn-warning serch-close">取消</button> | 
|                                     </div> | 
|                                 </div> | 
|                             </form> | 
|                         </div> | 
|                         <div class="col-md-1 col-xs-12 text-r layui-anim" data-anim="layui-anim-up"> | 
|                             <a class="senior-serch" onclick="showAttr()">高级搜索</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">序号</th> | 
| <!--                    <th data-field="id" data-align="center">产品ID</th>--> | 
|                     <th data-field="title" data-align="center">产品名称</th> | 
|                     <th data-field="imgMobile" data-align="center" data-formatter="MGrid.getImage" >产品图片</th> | 
|                     <th data-field="attrValues"data-align="center" data-formatter="formatAttr"  >产品属性</th> | 
|                     <th data-field="price" data-align="center">价格</th> | 
|                     <th data-field="score" data-align="center">积分</th> | 
|                     <th data-field="status" data-align="center" data-formatter="isStatus">是否上架</th> | 
|                     <th data-field="dsVolume" data-align="center">展示销量</th> | 
|                     <th data-field="rsVolume" data-align="center">真实销量</th> | 
|                 </tr> | 
|             </thead> | 
|         </table> | 
|         </div> | 
|     </div> | 
|   | 
|     <div class="row" > | 
|         <button class="btn btn-success center-block" onclick="selectoption()" >确认选择</button> | 
|     </div> | 
| </div> | 
|   | 
|   | 
| <script type="text/javascript" | 
|     th:src="@{/js/systools/MJsBase.js}"></script> | 
|     <script type="text/javascript"> | 
|          var myGrid; | 
|          $(".select2").select2(); | 
|         $(function(){ | 
|             var delUrl=""; | 
|             delUrl=basePath+"/admin/shopProduct/del" ; | 
|             myGrid=MGrid.initGrid({ | 
|                  url:basePath+"/admin/shopProduct/showList?isService=2", | 
|                  delUrl:delUrl, | 
|                 height:600, | 
|              }); | 
|   | 
|         }); | 
|   | 
|         var falg = true; | 
|          /** | 
|           * 点击搜索按钮,初始化搜索条件 | 
|           */ | 
|         function showAttr(){ | 
|             if(falg){ | 
|                 initAttrsSeclect("#parentId"); | 
|                 initCategorySeclect("#categoryId"); | 
|                 falg = false; | 
|             } | 
|         } | 
|   | 
|         function formatDate(value, row, index) { | 
|             if(row.buyLimit != null && row.limitCycle != null){ | 
|                 return row.buyLimit + "/" + row.limitCycle; | 
|             }else if(row.buyLimit != null  && row.limitCycle == null){ | 
|                 return row.buyLimit + "/" | 
|             }else if(row.buyLimit == null  && row.limitCycle != null){ | 
|                 return  "/" + row.limitCycle; | 
|             } | 
|   | 
|         } | 
|   | 
|          function isCanComment(value, row, index){ | 
|              if(value == "1"){ | 
|                  return "是"; | 
|              }else{ | 
|                  return "否"; | 
|              } | 
|          } | 
|   | 
|          function isStatus(value, row, index){ | 
|              if(value == "1"){ | 
|                  return "是"; | 
|              }else{ | 
|                  return "否"; | 
|              } | 
|          } | 
|   | 
|          function isPrescrip(value, row, index){ | 
|              if(value == "1"){ | 
|                  return "是"; | 
|              }else{ | 
|                  return "否"; | 
|              } | 
|          } | 
|   | 
|          //初始化分类下拉选 | 
|          function initCategorySeclect(seler,def){ | 
|              $.AjaxProxy().invoke(basePath+"/admin/shopProductAttribute/showSonAttribute?attrCode=cpfl&status=1", | 
|                      function(loj) { | 
|                          $(seler).createSelectTree( | 
|                                  loj.attr("result").rows, | 
|                                  {    id : "attrId", | 
|                                      parent : "parentId", | 
|                                      value : "attrName", | 
|                                      append : false, | 
|                                      defaultValue : def, | 
|                                      defaultHtml : '<option value="" selected="selected">请选择产品分类</option>' | 
|                                  }); | 
|                      }); | 
|          } | 
|   | 
|          //初始化属性下拉选 | 
|          function initAttrsSeclect(seler,def){ | 
|              $.AjaxProxy().invoke(basePath+"/admin/shopProductAttribute/showSonAttribute?attrCode=cpfl", | 
|                      function(loj) { | 
|                          $(seler).createSelectTree( | 
|                                  loj.attr("result").rows, | 
|                                  {    id : "attrId", | 
|                                      parent : "parentId", | 
|                                      value : "attrName", | 
|                                      append : false, | 
|                                      defaultValue : def, | 
|                                      defaultHtml : '<option value="" selected="selected">请选择产品属性</option>' | 
|                                  }); | 
|                      }); | 
|          } | 
|   | 
|          /** | 
|           * 格式化属性 | 
|           */ | 
|          function formatAttr(value, row, index) { | 
|              var html = ""; | 
|              if(value != ""){ | 
|                  var values = value.split(","); | 
|                  for(var i=0;i<values.length;i++){ | 
|                      html += "<span class='label label-warning mr-5'>"+values[i]+"</span>" | 
|                 } | 
|              } | 
|              return html; | 
|          } | 
|   | 
|          /** | 
|           * 格式化品种编码 | 
|           */ | 
|          function getSplitString(str, row, index){ | 
|              // 空白(空格、换行、tab)和逗号分隔的字符串,变成用逗号分隔 | 
|              if(str != "" && str != null){ | 
|                  var arr = str.split(","); | 
|                  var resources = ""; | 
|                  for (var i = 0; i < arr.length; i++) { | 
|                      var arr1 = arr[i].split(/\s+/); | 
|   | 
|                      for (var j = 0; j < arr1.length; j++) { | 
|                          if (jQuery.trim(arr1[j]) != "") { | 
|                              resources += jQuery.trim(arr1[j]) + ","; | 
|                          } | 
|                      } | 
|                  } | 
|                  resources = (resources.substring(resources.length - 1) == ',') ? resources.substring(0, resources.length - 1) : resources; | 
|                  return resources; | 
|              } | 
|   | 
|          } | 
|   | 
|          function selectoption(){ | 
|              var type = $.query.get("type"); | 
|              var arr=myGrid.initParam.$table.bootstrapTable('getSelections'); | 
|              if (type == null || type == '') { | 
|                 if (arr.length > 1) { | 
|                     layer.msg("只能选择一条数据", { | 
|                         icon: 2 | 
|                     }); | 
|                     return false; | 
|                 } | 
|                 parent.vm.selectGoods(arr[0]); | 
|             } else { | 
|                 parent.vm.selectGoods(arr); | 
|             } | 
|              parent.layer.close(parent.layer.getFrameIndex(window.name)); | 
|          } | 
|   | 
|     </script> | 
|   | 
| </body> | 
| </html> |