bill.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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. {{d.type}}{{d.in_stock}}
  72. </script>
  73. <!--操作-->
  74. <script type="text/html" id="act">
  75. <button type="button" class="layui-btn layui-btn-xs" onclick="dropdown(this)">操作 <span
  76. class="caret"></span></button>
  77. <ul class="layui-nav-child layui-anim layui-anim-upbit">
  78. <li>
  79. <a href="javascript:void(0);" lay-event='auth'>
  80. <i class="fa fa-trash"></i> 审核
  81. </a>
  82. </li>
  83. </ul>
  84. </script>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  91. <script>
  92. //实例化form
  93. layList.form.render();
  94. //加载列表
  95. layList.tableList('List', "{:Url('bill_lst')}", function () {
  96. var join = new Array();
  97. join = [
  98. {type: 'checkbox'},
  99. {field: 'id', title: 'ID', sort: true, event: 'id', width: '6%'},
  100. {field: 'store', title: '门店', width: '10%'},
  101. {field: 'image', title: '商品图片', templet: '#image', width: '10%'},
  102. {field: 'store_name', title: '商品名称', templet: '#store_name'},
  103. {field: 'in_stock', title: '入库', width: '8%', templet: '#in_stock'},
  104. {field: 'add_time', title: '入库时间', width: '8%'},
  105. {field: 'status', title: '状态', templet: "#checkboxstatus", width: '8%'},
  106. {field: 'right', title: '操作', align: 'center', toolbar: '#act', width: '14%'},
  107. ];
  108. return join;
  109. })
  110. //下拉框
  111. $(document).click(function (e) {
  112. $('.layui-nav-child').hide();
  113. })
  114. function dropdown(that) {
  115. var oEvent = arguments.callee.caller.arguments[0] || event;
  116. oEvent.stopPropagation();
  117. var offset = $(that).offset();
  118. var top = offset.top - $(window).scrollTop();
  119. var index = $(that).parents('tr').data('index');
  120. $('.layui-nav-child').each(function (key) {
  121. if (key != index) {
  122. $(this).hide();
  123. }
  124. })
  125. if ($(document).height() < top + $(that).next('ul').height()) {
  126. $(that).next('ul').css({
  127. 'padding': 10,
  128. 'top': -($(that).parent('td').height() / 2 + $(that).height() + $(that).next('ul').height() / 2),
  129. 'min-width': 'inherit',
  130. 'position': 'absolute'
  131. }).toggle();
  132. } else {
  133. $(that).next('ul').css({
  134. 'padding': 10,
  135. 'top': $(that).parent('td').height() / 2 + $(that).height(),
  136. 'min-width': 'inherit',
  137. 'position': 'absolute'
  138. }).toggle();
  139. }
  140. }
  141. //快速编辑
  142. layList.edit(function (obj) {
  143. var id = obj.data.id, value = obj.value;
  144. switch (obj.field) {
  145. case 'price':
  146. action.set_product('price', id, value);
  147. break;
  148. case 'stock':
  149. action.set_product('stock', id, value);
  150. break;
  151. case 'sort':
  152. action.set_product('sort', id, value);
  153. break;
  154. case 'ficti':
  155. action.set_product('ficti', id, value);
  156. break;
  157. }
  158. });
  159. //上下加商品
  160. layList.switch('is_show', function (odj, value) {
  161. if (odj.elem.checked == true) {
  162. layList.baseGet(layList.Url({
  163. c: 'store.store_product',
  164. a: 'set_show',
  165. p: {is_show: 1, id: value}
  166. }), function (res) {
  167. layList.msg(res.msg, function () {
  168. layList.reload();
  169. });
  170. });
  171. } else {
  172. layList.baseGet(layList.Url({
  173. c: 'store.store_product',
  174. a: 'set_show',
  175. p: {is_show: 0, id: value}
  176. }), function (res) {
  177. layList.msg(res.msg, function () {
  178. layList.reload();
  179. });
  180. });
  181. }
  182. });
  183. //点击事件绑定
  184. layList.tool(function (event, data, obj) {
  185. switch (event) {
  186. case 'auth':
  187. $eb.createModalFrame('编辑', layList.Url({a: 'audit', p: {id: data.id}}));
  188. break;
  189. }
  190. })
  191. //排序
  192. layList.sort(function (obj) {
  193. var type = obj.type;
  194. switch (obj.field) {
  195. case 'id':
  196. layList.reload({order: layList.order(type, 'id')}, true, null, obj);
  197. break;
  198. case 'sales':
  199. layList.reload({order: layList.order(type, 'sales')}, true, null, obj);
  200. break;
  201. }
  202. });
  203. //查询
  204. layList.search('search', function (where) {
  205. layList.reload(where, true);
  206. });
  207. //自定义方法
  208. var action = {
  209. set_product: function (field, id, value) {
  210. layList.baseGet(layList.Url({
  211. c: 'store.store_product',
  212. a: 'set_product',
  213. q: {field: field, id: id, value: value}
  214. }), function (res) {
  215. layList.msg(res.msg);
  216. });
  217. },
  218. show: function () {
  219. var ids = layList.getCheckData().getIds('id');
  220. if (ids.length) {
  221. layList.basePost(layList.Url({
  222. c: 'store.store_product',
  223. a: 'product_show'
  224. }), {ids: ids}, function (res) {
  225. layList.msg(res.msg);
  226. layList.reload();
  227. });
  228. } else {
  229. layList.msg('请选择要上架的商品');
  230. }
  231. },
  232. "set_group": function () {
  233. var ids = layList.getCheckData().getIds('id');
  234. if (ids.length) {
  235. var str = ids.join(',');
  236. $eb.createModalFrame('批量设置分组', layList.Url({a: 'batch_audit', p: {id: str}}), {w: 500, h: 300});
  237. } else {
  238. layList.msg('请选择要批量设置分组的会员');
  239. }
  240. }
  241. };
  242. //多选事件绑定
  243. $('.layui-btn-container').find('button').each(function () {
  244. var type = $(this).data('type');
  245. $(this).on('click', function () {
  246. action[type] && action[type]();
  247. })
  248. });
  249. $('.conrelTable').find('button').each(function () {
  250. var type = $(this).data('type');
  251. $(this).on('click', function () {
  252. action[type] && action[type]();
  253. })
  254. })
  255. </script>
  256. {/block}