bill.php 11 KB

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