product.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <extend name="$_admin_public_layout"/>
  2. <extend name="$_admin_public_layout"/>
  3. <block name="style">
  4. <link rel="stylesheet" href="__PUBLIC__/libs/layui/css/layui.css" media="all">
  5. <link rel="stylesheet" href="__PUBLIC__/libs/css/page.css" media="all">
  6. </block>
  7. <block name="script">
  8. <script src="__PUBLIC__/libs/guide/bootstrap-tour.js"></script>
  9. <script src="__PUBLIC__/libs/guide/guide.js?_t=2016121401"></script>
  10. </block>
  11. <block name="main">
  12. <!-- <fieldset name="meta_title" class="layui-elem-field layui-field-title" style="margin-top: 20px;">-->
  13. <!-- <legend>{$meta_title}</legend>-->
  14. <!-- </fieldset>-->
  15. <div style="margin-left: 30px;">
  16. <button class="layui-btn layui-btn-fluid layui-btn-radius large-add">增加产品</button>
  17. <!-- <button class="layui-btn layui-btn-radius layui-btn-warm large-edit">修改</button>-->
  18. <button class="layui-btn layui-btn-radius layui-btn-danger large-del">删除产品</button>
  19. <!-- <button class="layui-btn layui-btn-fluid layui-btn-radius large-print">打印</button>-->
  20. <!-- <button class="layui-btn layui-btn-fluid layui-btn-radius large-export">导出</button>-->
  21. <div class="bg">
  22. <!-- <form action="" autocomplete="off" method="GET" >-->
  23. <input type="text" name="keyword" value="<?php echo isset($search)?$search:'';?>" placeholder="请输入名称或者编码" class="easyui-textbox serch" style="width:250px;height:35px;">
  24. <select name="classification" id="classification" style="width:250px;height:35px;">
  25. <option value="03">============选择=============</option>
  26. <volist name="product_classification" id="val">
  27. <if condition="$classification eq $val['code']">
  28. <option value="{$val.code}" selected>{$val.code}-{$val.name}</option>
  29. <else />
  30. <option value="{$val.code}">{$val.code}-{$val.name}</option>
  31. </if>
  32. </volist>
  33. </select>
  34. <!-- <button type="submit" class="layui-btn layui-btn-radius layui-btn-normal submit" >立即搜索</button>-->
  35. <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchBthFun()">查询</a>
  36. <!-- </form>-->
  37. </div>
  38. </div>
  39. <div class="builder-table">
  40. <!-- 列表 -->
  41. <table class="layui-table">
  42. <colgroup>
  43. <col width="150">
  44. <col width="200">
  45. <col>
  46. </colgroup>
  47. <thead>
  48. <tr>
  49. <th><input class="qut" id="checkAll" type="checkbox" /></th>
  50. <th>ID</th>
  51. <th>名称</th>
  52. <th>编码</th>
  53. <th>规格</th>
  54. </tr>
  55. </thead>
  56. <notempty name="page">
  57. <tfoot>
  58. <tr><td colspan="14"><div class="pages">{$page}</div></td></tr>
  59. </tfoot>
  60. </notempty>
  61. <tbody>
  62. <empty name="list">
  63. <tr><td colspan="14">亲,暂时还没数据</td></tr>
  64. <else/>
  65. <volist name="list" id="v">
  66. <tr>
  67. <td >
  68. <input type="checkbox" name="id[]" value="{$v.id}">
  69. </td>
  70. <td class="update" data-id = {$v.id}>{$v.id}</td>
  71. <td>{$v.product_name}</td>
  72. <td >{$v.product_code}</td>
  73. <td >{$v.product_size}</td>
  74. </tr>
  75. </volist>
  76. </empty>
  77. </tbody>
  78. </table>
  79. <notempty name="bach_page">
  80. <ul class="pagination">{$task_page}</ul>
  81. </notempty>
  82. <h1 style="color: red">已选中产品列表</h1>
  83. <!--下面是已选择生产产品表格-->
  84. <table class="layui-table">
  85. <colgroup>
  86. <col width="150">
  87. <col width="200">
  88. <col>
  89. </colgroup>
  90. <thead>
  91. <tr>
  92. <th></th>
  93. <th>ID</th>
  94. <th>名称</th>
  95. <th>编码</th>
  96. <th>规格</th>
  97. </tr>
  98. </thead>
  99. <tbody>
  100. <empty name="list">
  101. <tr><td colspan="14">亲,暂时还没数据</td></tr>
  102. <else/>
  103. <volist name="data" id="vol">
  104. <tr>
  105. <td> <input type="checkbox" name="id[]" value="{$vol.id}" checked></td>
  106. <td class="update" data-id = {$vol.id}>{$vol.id}</td>
  107. <td>{$vol.product_name}</td>
  108. <td>{$vol.product_code}</td>
  109. <td>{$vol.product_size}</td>
  110. </tr>
  111. </volist>
  112. </empty>
  113. </tbody>
  114. </table>
  115. </div>
  116. <script src="__PUBLIC__/libs/layui/layui.js"></script>
  117. <script src="__PUBLIC__/libs/jquery/2.x/jquery.js"></script>
  118. <script>
  119. <if condition="C('ismobile') eq 1">width=$('.container').width() * 0.9;<else/>width=800;</if>
  120. layui.use('form', function(){
  121. var form = layui.form;
  122. });
  123. function searchBthFun(){
  124. var keyword = $('.serch').val();
  125. var classification = $("#classification option:selected").val();
  126. window.location.href = 'index.php?s=/Admin/Qcode/product/keyword/'+keyword+'/classification/'+classification;
  127. }
  128. $('.large-add').click(function(){
  129. $this = $('input[type=checkbox]:checked');
  130. $len = $this .length;
  131. if($len==0){
  132. layer.msg('请选择一个选项');
  133. return false;
  134. }else{
  135. var Id = '';
  136. $.each($('input:checkbox:checked'),function(){
  137. Id = Id+','+$(this).val();
  138. });
  139. Id = Id.slice(1);
  140. $.ajax({
  141. url: "{:U('Qcode/updateProduct')}",
  142. type: 'POST',
  143. data: {
  144. id:Id,
  145. status:1,
  146. },
  147. timeout: 5000,//1秒
  148. dataType: 'json',
  149. success: function (data) {
  150. layer.msg(data.msg);
  151. parent.location.reload();
  152. },
  153. error:function(data){
  154. layer.msg(data.msg);
  155. // location.reload();
  156. }
  157. });
  158. }
  159. });
  160. $('.large-del').click(function(){
  161. $this = $('input[type=checkbox]:checked');
  162. $len = $this .length;
  163. if($len==0){
  164. $.ajax({
  165. url: "{:U('Qcode/updateProduct')}",
  166. type: 'POST',
  167. data: {
  168. id:'',
  169. status:2,
  170. },
  171. timeout: 5000,//1秒
  172. dataType: 'json',
  173. success: function (data) {
  174. layer.msg(data.msg);
  175. parent.location.reload();
  176. },
  177. error:function(data){
  178. layer.msg(data.msg);
  179. // location.reload();
  180. }
  181. });
  182. }else{
  183. var Id = '';
  184. $.each($('input:checkbox:checked'),function(){
  185. Id = Id+','+$(this).val();
  186. });
  187. Id = Id.slice(1);
  188. $.ajax({
  189. url: "{:U('Qcode/updateProduct')}",
  190. type: 'POST',
  191. data: {
  192. id:Id,
  193. status:2,
  194. },
  195. timeout: 5000,//1秒
  196. dataType: 'json',
  197. success: function (data) {
  198. layer.msg(data.msg);
  199. parent.location.reload();
  200. },
  201. error:function(data){
  202. layer.msg(data.msg);
  203. // location.reload();
  204. }
  205. });
  206. }
  207. })
  208. // //全选与反选
  209. // $("#checkAll").click(function () {
  210. // $("[name=prIds]:checkbox").prop('checked', this.checked);
  211. // });
  212. //
  213. // $("[name=prIds]:checkbox").click(function () {
  214. // var flag = true;
  215. // $("[name=prIds]:checkbox").each(function () {
  216. // if (!this.checked) {
  217. // flag = false;
  218. // }
  219. // });
  220. // $("#checkAll").prop('checked', flag);
  221. // });
  222. //
  223. // //批量处理
  224. // var $items = $("[name=prIds]:checkbox:checked");
  225. // if ($items.length == 0) {
  226. // alert("请选择");
  227. // return;
  228. // }
  229. </script>
  230. </block>