index.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <div class="layui-fluid">
  4. <div class="layui-row layui-col-space15" id="app">
  5. <div class="layui-col-md12">
  6. </div>
  7. <!--产品列表-->
  8. <div class="layui-col-md12">
  9. <div class="layui-card">
  10. <div class="layui-card-header">审核列表</div>
  11. <div class="layui-card-body">
  12. <table class="layui-hide" id="List" lay-filter="List"></table>
  13. <script type="text/html" id="icon">
  14. <img style="cursor: pointer;max-width: 50px;" lay-event='open_image' src="{{d.headimg}}">
  15. </script>
  16. <script type="text/html" id="act">
  17. <button type="button" class="layui-btn layui-btn-xs" onclick="dropdown(this)">操作 <span class="caret"></span></button>
  18. <ul class="layui-nav-child layui-anim layui-anim-upbit">
  19. <li>
  20. <a lay-event='pass' href="javascript:void(0)">
  21. <i class="fa fa-check"></i>通过认证
  22. </a>
  23. </li>
  24. <li>
  25. <a href="javascript:void(0)"onclick="$eb.createModalFrame(this.innerText,'{:Url(\'create\')}?uid={{d.uid}}')">
  26. <i class="fa fa-times"></i>拒绝认证
  27. </a>
  28. </li>
  29. </ul>
  30. </script>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  37. {/block}
  38. {block name="script"}
  39. <script>
  40. //实例化form
  41. layList.form.render();
  42. //加载列表
  43. layList.tableList('List',"{:Url('get_system_user_list')}",function (){
  44. return [
  45. {field: 'id', title: '编号', sort: true,event:'id',width:'6%',align:"center"},
  46. {field: 'uid', title: '用户id', sort: true,event:'id',width:'6%',align:"center"},
  47. {field: 'headimg', title: '企业头像',templet:'#icon',align:"center",width:'10%'},
  48. {field: 'name', title: '企业名',edit:'name',width:'6%',align:"center"},
  49. {field: 'type', title: '行业',edit:'type',width:'6%',align:"center"},
  50. {field: 'contacts', title: '联系人',edit:'contacts',width:'6%',align:"center"},
  51. {field: 'post', title: '职务',edit:'post',width:'6%',align:"center"},
  52. {field: 'phone', title: '电话',templet:'#is_auth',align:"center"},
  53. {field: 'right', title: '操作',align:'center',toolbar:'#act',width:'8%'},
  54. ];
  55. });
  56. //自定义方法
  57. var action= {
  58. set_value: function (field, id, value) {
  59. layList.baseGet(layList.Url({
  60. a: 'set_value',
  61. q: {field: field, id: id, value: value}
  62. }), function (res) {
  63. layList.msg(res.msg);
  64. });
  65. },
  66. }
  67. //查询
  68. layList.search('search',function(where){
  69. layList.reload(where,true);
  70. });
  71. layList.switch('is_show',function (odj,value) {
  72. if(odj.elem.checked==true){
  73. layList.baseGet(layList.Url({a:'set_show',p:{is_show:1,id:value}}),function (res) {
  74. layList.msg(res.msg);
  75. });
  76. }else{
  77. layList.baseGet(layList.Url({a:'set_show',p:{is_show:0,id:value}}),function (res) {
  78. layList.msg(res.msg);
  79. });
  80. }
  81. });
  82. //快速编辑
  83. layList.edit(function (obj) {
  84. var id=obj.data.id,value=obj.value;
  85. switch (obj.field) {
  86. case 'name':
  87. action.set_value('name',id,value);
  88. break;
  89. case 'grade':
  90. action.set_value('grade',id,value);
  91. break;
  92. case 'discount':
  93. action.set_value('discount',id,value);
  94. break;
  95. }
  96. });
  97. //监听并执行排序
  98. layList.sort(['id','sort'],true);
  99. //点击事件绑定
  100. layList.tool(function (event,data,obj) {
  101. switch (event) {
  102. case 'pass':
  103. var url=layList.U({a:'pass',q:{uid:data.uid,id:data.id,name:data.name}});
  104. $eb.axios.get(url).then(function(res){
  105. if(res.status == 200 && res.data.code == 200) {
  106. $eb.$swal('success',res.data.msg|| '审核成功');
  107. layList.reload();
  108. }else
  109. return Promise.reject(res.data.msg || '审核失败')
  110. }).catch(function(err){
  111. $eb.$swal('error',err);
  112. });
  113. break;
  114. case 'open_image':
  115. $eb.openImage(data.headimg);
  116. break;
  117. }
  118. })
  119. //下拉框
  120. $(document).click(function (e) {
  121. $('.layui-nav-child').hide();
  122. })
  123. function dropdown(that){
  124. var oEvent = arguments.callee.caller.arguments[0] || event;
  125. oEvent.stopPropagation();
  126. var offset = $(that).offset();
  127. var top=offset.top-$(window).scrollTop();
  128. var index = $(that).parents('tr').data('index');
  129. $('.layui-nav-child').each(function (key) {
  130. if (key != index) {
  131. $(this).hide();
  132. }
  133. })
  134. if($(document).height() < top+$(that).next('ul').height()){
  135. $(that).next('ul').css({
  136. 'padding': 10,
  137. 'top': - ($(that).parent('td').height() / 2 + $(that).height() + $(that).next('ul').height()/2),
  138. 'min-width': 'inherit',
  139. 'position': 'absolute'
  140. }).toggle();
  141. }else{
  142. $(that).next('ul').css({
  143. 'padding': 10,
  144. 'top':$(that).parent('td').height() / 2 + $(that).height(),
  145. 'min-width': 'inherit',
  146. 'position': 'absolute'
  147. }).toggle();
  148. }
  149. }
  150. </script>
  151. {/block}