bill.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <div class="layui-fluid" style="background: #fff;margin-top: -10px;">
  4. <div class="layui-row layui-col-space15" id="app">
  5. <div class="layui-col-md12">
  6. <div class="layui-card">
  7. <div class="layui-card-body">
  8. <form class="layui-form layui-form-pane" action="">
  9. <div class="layui-form-item">
  10. <div class="layui-inline">
  11. <label class="layui-form-label">门店:</label>
  12. <div class="layui-input-inline">
  13. <select name="store_id" lay-verify="store">
  14. <option value="0">全部</option>
  15. {volist name="store" id="v"}
  16. <option value="{$v.id}">{$v.name}</option>
  17. {/volist}
  18. </select>
  19. </div>
  20. </div>
  21. <div class="layui-inline">
  22. <label class="layui-form-label">状态:</label>
  23. <div class="layui-input-inline">
  24. <select name="status" lay-verify="status">
  25. <option value="-2">全部</option>
  26. <option value="0">待审核</option>
  27. <option value="1">通过</option>
  28. <option value="-1">拒绝</option>
  29. </select>
  30. </div>
  31. </div>
  32. <div class="layui-inline">
  33. <label class="layui-form-label">商品条型码</label>
  34. <div class="layui-input-block">
  35. <input type="text" name="key" class="layui-input" placeholder="条型码">
  36. </div>
  37. </div>
  38. <div class="layui-inline">
  39. <div class="layui-input-inline">
  40. <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search"
  41. lay-filter="search">
  42. <i class="layui-icon layui-icon-search"></i>搜索
  43. </button>
  44. </div>
  45. </div>
  46. </div>
  47. </form>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="layui-btn-group conrelTable">
  52. <button class="layui-btn layui-btn-sm layui-btn-normal" type="button" data-type="set_group"><i
  53. class="fa fa-check-circle-o"></i>批量审核
  54. </button>
  55. </div>
  56. <!--商品列表-->
  57. <div class="layui-col-md12">
  58. <div class="layui-card">
  59. <div class="layui-card-body">
  60. <table class="layui-hide" id="List" lay-filter="List"></table>
  61. <!--图片-->
  62. <script type="text/html" id="image">
  63. <img style="cursor: pointer" lay-event="open_image" src="{{d.image}}">
  64. </script>
  65. <!--商品名称-->
  66. <script type="text/html" id="store_name">
  67. <h4>{{d.store_name}}</h4>
  68. <p>价格:<font color="red">{{d.price}}</font></p>
  69. </script>
  70. <script type="text/html" id="in_stock">
  71. {{# if(type == 1){ }}
  72. <b style="color: #00aa00">+{{d.in_stock}}</b>
  73. {{# }else{ }}
  74. <b style="color: #aa0000">-{{d.in_stock}}</b>
  75. {{# } }}
  76. </script>
  77. <!--操作-->
  78. <script type="text/html" id="act">
  79. <button type="button" class="layui-btn layui-btn-xs" onclick="dropdown(this)">操作 <span
  80. class="caret"></span></button>
  81. <ul class="layui-nav-child layui-anim layui-anim-upbit">
  82. <li>
  83. <a href="javascript:void(0);" lay-event='auth'>
  84. <i class="fa fa-trash"></i> 审核
  85. </a>
  86. </li>
  87. </ul>
  88. </script>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  95. <script>
  96. //实例化form
  97. layList.form.render();
  98. //加载列表
  99. layList.tableList('List', "{:Url('bill_lst')}", function () {
  100. var join = new Array();
  101. join = [
  102. {type: 'checkbox'},
  103. {field: 'id', title: 'ID', sort: true, event: 'id', width: '6%'},
  104. {field: 'store', title: '门店', width: '10%'},
  105. {field: 'image', title: '商品图片', templet: '#image', width: '10%'},
  106. {field: 'store_name', title: '商品名称', templet: '#store_name'},
  107. {field: 'in_stock', title: '入库', width: '8%', templet: '#in_stock'},
  108. {field: 'add_time', title: '入库时间', width: '8%'},
  109. {field: 'status', title: '状态', templet: "#checkboxstatus", width: '8%'},
  110. {field: 'right', title: '操作', align: 'center', toolbar: '#act', width: '14%'},
  111. ];
  112. return join;
  113. })
  114. //下拉框
  115. $(document).click(function (e) {
  116. $('.layui-nav-child').hide();
  117. })
  118. function dropdown(that) {
  119. var oEvent = arguments.callee.caller.arguments[0] || event;
  120. oEvent.stopPropagation();
  121. var offset = $(that).offset();
  122. var top = offset.top - $(window).scrollTop();
  123. var index = $(that).parents('tr').data('index');
  124. $('.layui-nav-child').each(function (key) {
  125. if (key != index) {
  126. $(this).hide();
  127. }
  128. })
  129. if ($(document).height() < top + $(that).next('ul').height()) {
  130. $(that).next('ul').css({
  131. 'padding': 10,
  132. 'top': -($(that).parent('td').height() / 2 + $(that).height() + $(that).next('ul').height() / 2),
  133. 'min-width': 'inherit',
  134. 'position': 'absolute'
  135. }).toggle();
  136. } else {
  137. $(that).next('ul').css({
  138. 'padding': 10,
  139. 'top': $(that).parent('td').height() / 2 + $(that).height(),
  140. 'min-width': 'inherit',
  141. 'position': 'absolute'
  142. }).toggle();
  143. }
  144. }
  145. //快速编辑
  146. layList.edit(function (obj) {
  147. var id = obj.data.id, value = obj.value;
  148. switch (obj.field) {
  149. case 'price':
  150. action.set_product('price', id, value);
  151. break;
  152. case 'stock':
  153. action.set_product('stock', id, value);
  154. break;
  155. case 'sort':
  156. action.set_product('sort', id, value);
  157. break;
  158. case 'ficti':
  159. action.set_product('ficti', id, value);
  160. break;
  161. }
  162. });
  163. //上下加商品
  164. layList.switch('is_show', function (odj, value) {
  165. if (odj.elem.checked == true) {
  166. layList.baseGet(layList.Url({
  167. c: 'store.store_product',
  168. a: 'set_show',
  169. p: {is_show: 1, id: value}
  170. }), function (res) {
  171. layList.msg(res.msg, function () {
  172. layList.reload();
  173. });
  174. });
  175. } else {
  176. layList.baseGet(layList.Url({
  177. c: 'store.store_product',
  178. a: 'set_show',
  179. p: {is_show: 0, id: value}
  180. }), function (res) {
  181. layList.msg(res.msg, function () {
  182. layList.reload();
  183. });
  184. });
  185. }
  186. });
  187. //点击事件绑定
  188. layList.tool(function (event, data, obj) {
  189. switch (event) {
  190. case 'auth':
  191. $eb.createModalFrame('编辑', layList.Url({a: 'audit', p: {id: data.id}}));
  192. break;
  193. }
  194. })
  195. //排序
  196. layList.sort(function (obj) {
  197. var type = obj.type;
  198. switch (obj.field) {
  199. case 'id':
  200. layList.reload({order: layList.order(type, 'id')}, true, null, obj);
  201. break;
  202. case 'sales':
  203. layList.reload({order: layList.order(type, 'sales')}, true, null, obj);
  204. break;
  205. }
  206. });
  207. //查询
  208. layList.search('search', function (where) {
  209. layList.reload(where, true);
  210. });
  211. //自定义方法
  212. var action = {
  213. set_product: function (field, id, value) {
  214. layList.baseGet(layList.Url({
  215. c: 'store.store_product',
  216. a: 'set_product',
  217. q: {field: field, id: id, value: value}
  218. }), function (res) {
  219. layList.msg(res.msg);
  220. });
  221. },
  222. show: function () {
  223. var ids = layList.getCheckData().getIds('id');
  224. if (ids.length) {
  225. layList.basePost(layList.Url({
  226. c: 'store.store_product',
  227. a: 'product_show'
  228. }), {ids: ids}, function (res) {
  229. layList.msg(res.msg);
  230. layList.reload();
  231. });
  232. } else {
  233. layList.msg('请选择要上架的商品');
  234. }
  235. },
  236. "set_group": function () {
  237. var ids = layList.getCheckData().getIds('id');
  238. if (ids.length) {
  239. var str = ids.join(',');
  240. $eb.createModalFrame('批量设置分组', layList.Url({a: 'batch_audit', p: {id: str}}), {w: 500, h: 300});
  241. } else {
  242. layList.msg('请选择要批量设置分组的会员');
  243. }
  244. }
  245. };
  246. //多选事件绑定
  247. $('.layui-btn-container').find('button').each(function () {
  248. var type = $(this).data('type');
  249. $(this).on('click', function () {
  250. action[type] && action[type]();
  251. })
  252. });
  253. $('.conrelTable').find('button').each(function () {
  254. var type = $(this).data('type');
  255. $(this).on('click', function () {
  256. action[type] && action[type]();
  257. })
  258. })
  259. </script>
  260. {/block}