bill.php 9.8 KB

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