distribulist.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
  6. <title><?php echo $shoname; ?></title>
  7. <link rel="shortcut icon" href="" />
  8. <meta name="renderer" content="webkit">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  11. <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  12. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
  18. <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
  19. <script type="text/javascript">
  20. window.sysinfo = {
  21. <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '{$_W['uniacid']}',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '{$_W['acid']}',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '{$_W['uid']}',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '{$_W['siteroot']}',
  27. 'siteurl': '{$_W['siteurl']}',
  28. 'attachurl': '{$_W['attachurl']}',
  29. 'attachurl_local': '{$_W['attachurl_local']}',
  30. 'attachurl_remote': '{$_W['attachurl_remote']}',
  31. 'module' : {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
  32. 'cookie' : {'pre': ''},
  33. 'account' : {:json_encode($_W['account'])},
  34. };
  35. </script>
  36. <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
  37. <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
  38. <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
  39. <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
  40. <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
  41. <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
  42. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  43. <link href="/static/css/snailfish.css" rel="stylesheet">
  44. <style>
  45. tbody tr td{
  46. position: relative;
  47. }
  48. tbody tr .icow-weibiaoti--{
  49. visibility: hidden;
  50. display: inline-block;
  51. color: #fff;
  52. height:18px;
  53. width:18px;
  54. background: #e0e0e0;
  55. text-align: center;
  56. line-height: 18px;
  57. vertical-align: middle;
  58. }
  59. tbody tr:hover .icow-weibiaoti--{
  60. visibility: visible;
  61. }
  62. tbody tr .icow-weibiaoti--.hidden{
  63. visibility: hidden !important;
  64. }
  65. .full .icow-weibiaoti--{
  66. margin-left:10px;
  67. }
  68. .full>span{
  69. display: -webkit-box;
  70. display: -webkit-flex;
  71. display: -ms-flexbox;
  72. display: flex;
  73. vertical-align: middle;
  74. align-items: center;
  75. }
  76. tbody tr .label{
  77. margin: 5px 0;
  78. }
  79. .goods_attribute a{
  80. cursor: pointer;
  81. }
  82. .newgoodsflag{
  83. width: 22px;height: 16px;
  84. background-color: #ff0000;
  85. color: #fff;
  86. text-align: center;
  87. position: absolute;
  88. bottom: 70px;
  89. left: 57px;
  90. font-size: 12px;
  91. }
  92. .a{cursor: pointer;}
  93. .img-40 {
  94. width: 40px;
  95. height: 40px;
  96. }
  97. .daterangepicker select.ampmselect, .daterangepicker select.hourselect, .daterangepicker select.minuteselect{
  98. width:auto!important;
  99. }
  100. </style>
  101. </head>
  102. <body layadmin-themealias="default">
  103. <table id="demo" lay-filter="test"></table>
  104. <div class="layui-fluid">
  105. <div class="layui-card">
  106. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">佣金申请列表</span></div>
  107. <div class="layui-card-body" style="padding:15px;">
  108. <form action="" method="get" class="form-horizontal form-search layui-form" role="form">
  109. <input type="hidden" name="c" value="communityhead" />
  110. <input type="hidden" name="a" value="distribulist" />
  111. <div class="layui-form-item">
  112. <div class="layui-inline">
  113. <span class="layui-input-inline">
  114. <select name='searchtime' class='form-control' style="width:100px;padding:0 5px;" id="searchtime">
  115. <option value=''>不按时间</option>
  116. <option value='create_time' <?php if( $_GPC['searchtime']=='create_time' ){ ?>selected<?php } ?>>申请时间</option>
  117. </select>
  118. </span>
  119. <div class="layui-input-inline" style="width:280px;">
  120. {:tpl_form_field_daterange('time', array( 'starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime) ,'sm'=>true, 'placeholder'=>'申请时间'),true);}
  121. </div>
  122. <div class="layui-input-inline" >
  123. <select name='comsiss_state' class='layui-input layui-unselect' style="width:80px;" >
  124. <option value=''>状态</option>
  125. <option value='0' <?php if( $comsiss_state =='0'){ ?>selected<?php } ?>>未审核</option>
  126. <option value='1' <?php if( $comsiss_state =='1'){ ?>selected<?php } ?>>已审核</option>
  127. <option value='2' <?php if( $comsiss_state =='2'){ ?>selected<?php } ?>>拒绝通过</option>
  128. </select>
  129. </div>
  130. <div class="layui-input-inline" >
  131. <input type="text" class="layui-input" name="keyword" value="{$keyword}" placeholder="申请订单id"/>
  132. </div>
  133. <div class="layui-input-inline">
  134. <button class="layui-btn layui-btn-sm" type="submit"> 搜索</button>
  135. <button type="submit" name="export" value="1" class="btn btn-success layui-btn layui-btn-sm">导出</button>
  136. </div>
  137. </div>
  138. </div>
  139. </form>
  140. <form action="" class="layui-form" lay-filter="example" method="post" >
  141. <div class="row">
  142. <div class="col-md-12">
  143. <div class="page-table-header">
  144. <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  145. <div class="btn-group">
  146. <button class='btn btn-default btn-sm btn-op btn-operation' type="button" data-toggle='batch' data-href="{:U('communityhead/agent_check_apply',array('state'=>1))}" data-confirm='确认要审核通过,已打款?'>
  147. 审核通过
  148. </button>
  149. <button class='btn btn-default btn-sm btn-op btn-operation' type="button" data-toggle='batch' data-href="{:U('communityhead/agent_check_apply',array('state'=>2))}" data-confirm='确认要拒绝通过?'>
  150. 拒绝通过
  151. </button>
  152. </div>
  153. </div>
  154. <table class="table table-responsive" lay-even lay-skin="line" lay-size="lg">
  155. <thead>
  156. <tr>
  157. <th style="width:25px;"></th>
  158. <th style="width:60px;">ID</th>
  159. <th style="">小区名称</th>
  160. <th style="width: 150px;">团长</th>
  161. <th style="">联系方式</th>
  162. <th style="">提现方式</br>提现账户</th>
  163. <th style=''>申请提现金额</br>手续费</br>到账金额</th>
  164. <th style="">申请时间</br>审核时间</th>
  165. <th style='width:170px;'>状态</th>
  166. <th style="width: 300px;text-align: center;">操作</th>
  167. </tr>
  168. </tr>
  169. </thead>
  170. <tbody>
  171. <?php foreach( $list as $row ){ ?>
  172. <tr>
  173. <td style="position: relative; ">
  174. <input type='checkbox' name="item_checkbox" class="checkone" lay-skin="primary" value="{$row['id']}"/>
  175. </td>
  176. <td>
  177. {$row['id']}
  178. </td>
  179. <td>
  180. {$row['community_head']['community_name']}
  181. </td>
  182. <td style="overflow: visible">
  183. {$row['community_head']['head_name']}
  184. </td>
  185. <td>
  186. {$row['community_head']['head_mobile']}
  187. </td>
  188. <td>
  189. <?php if($row['type'] > 0){ ?>
  190. <?php if( $row['type'] == 1 ){ ?>
  191. 会员余额
  192. <?php }else if($row['type'] == 2){ ?>
  193. 微信零钱<br/>
  194. 真实姓名:<br/>
  195. <a href='javascript:;' data-toggle='ajaxEdit' data-href="{:U('distribution/changename',array('type'=>'bankusername','id'=>$row['id']))}" >
  196. <text class='text-primary'>{$row['bankusername']}</text>
  197. </a>
  198. <?php }else if($row['type'] == 3){ ?>
  199. 支付宝<br/>
  200. <text class='text-primary'>真实姓名:{$row['bankusername']}</text><br/>
  201. <text class='text-danger'>{$row['bankaccount']}</text>
  202. <?php }else if($row['type'] == 4){ ?>
  203. 银行卡<br/>
  204. <text class='text-primary'>开户行:{$row['bankname']}</text><br/>
  205. <text class='text-danger'>卡号:{$row['bankaccount']}</text><br/>
  206. <text class='text-danger'>持卡人姓名:{$row['bankusername']}</text>
  207. <?php } ?>
  208. <?php }else{ ?>
  209. {$row['community_head_commiss']['bankname']}<br/>
  210. <text class='text-primary'>{$row['community_head_commiss']['bankaccount']}</text><br/>
  211. <text class='text-danger'>{$row['community_head_commiss']['bankusername']}</text>
  212. <?php } ?>
  213. </td>
  214. <td>
  215. {$row['money']}<br/><text class='text-primary'>{$row['service_charge']}</text><br/>
  216. <text class='text-danger'><?php echo $row['money']-$row['service_charge'];?></text>
  217. </td>
  218. <td>{:date("Y-m-d",$row['addtime'])}<br/>{:date("H:i:s",$row['addtime'])}
  219. <br/>
  220. <?php if( !empty($row['shentime'])){ ?>
  221. {:date("Y-m-d",$row['shentime'])}<br/>{:date("H:i:s",$row['shentime'])}
  222. <?php } ?>
  223. </td>
  224. <td>
  225. <?php if( $row[state] ==2 ){ ?>
  226. 已拒绝
  227. <?php }elseif( $row[state] ==1 ){ ?>
  228. <text class='text-danger'>已打款</text>
  229. <?php }else{ ?>
  230. <input type="checkbox" name="" lay-filter="statewsitch" tx_type="<?php echo $row['type'];?>" data-href="{:U('communityhead/agent_check_apply',array('id'=>$row['id']))}" <?php if( $row[state]==1){ ?>checked<?php }else{ ?><?php } ?> lay-skin="switch" lay-text="已审核|未审核">
  231. <input type="checkbox" name="" lay-filter="statewsitchunable" data-href="{:U('communityhead/agent_check_apply',array('id'=>$row['id']))}" <?php if( $row['state']==1 ){ ?>checked<?php } ?> lay-skin="switch" lay-text="已拒绝|点击拒绝审核">
  232. <?php } ?>
  233. <br/>
  234. </td>
  235. <td style="overflow:visible;text-align: center;">
  236. <div class="btn-group">
  237. <a class="btn btn-op " href="{:U('order/index',array('headid' => $row['head_id']));}" >
  238. 推广订单
  239. </a>
  240. <a class="btn btn-op " href="{:U('communityhead/goodslist',array('head_id' => $row['head_id']));}">
  241. 查看在售商品
  242. </a>
  243. </div>
  244. </td>
  245. </tr>
  246. <?php } ?>
  247. </tbody>
  248. <tfoot>
  249. <tr>
  250. <td colspan="5">
  251. <div class="page-table-header">
  252. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall">
  253. <div class="btn-group">
  254. <button class='btn btn-default btn-sm btn-op btn-operation' type="button" data-toggle='batch' data-href="{:U('communityhead/agent_check_apply',array('state'=>1))}" data-confirm='确认要审核通过,已打款?'>
  255. 审核通过
  256. </button>
  257. <button class='btn btn-default btn-sm btn-op btn-operation' type="button" data-toggle='batch' data-href="{:U('communityhead/agent_check_apply',array('state'=>2))}" data-confirm='确认要拒绝通过?'>
  258. 拒绝通过
  259. </button>
  260. </div>
  261. </div>
  262. </td>
  263. <td colspan="4" style="text-align: right">
  264. {$pager}
  265. </td>
  266. </tr>
  267. </tfoot>
  268. </table>
  269. </div>
  270. </div>
  271. </form>
  272. </div>
  273. </div>
  274. </div>
  275. <script src="/layuiadmin/layui/layui.js"></script>
  276. <script>
  277. layui.config({
  278. base: '/layuiadmin/' //静态资源所在路径
  279. }).extend({
  280. index: 'lib/index' //主入口模块
  281. }).use('index');
  282. </script>
  283. <script>
  284. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  285. var layer = layui.layer;
  286. var $;
  287. layui.use(['jquery', 'layer','form'], function(){
  288. $ = layui.$;
  289. var form = layui.form;
  290. $('.deldom').click(function(){
  291. var s_url = $(this).attr('data-href');
  292. layer.confirm($(this).attr('data-confirm'), function(index){
  293. $.ajax({
  294. url:s_url,
  295. type:'post',
  296. dataType:'json',
  297. success:function(info){
  298. if(info.status == 0)
  299. {
  300. layer.msg(info.result.message,{icon: 1,time: 2000});
  301. }else if(info.status == 1){
  302. var go_url = location.href;
  303. if( info.result.hasOwnProperty("url") )
  304. {
  305. go_url = info.result.url;
  306. }
  307. layer.msg('操作成功',{time: 1000,
  308. end:function(){
  309. location.href = info.result.url;
  310. }
  311. });
  312. }
  313. }
  314. })
  315. });
  316. })
  317. $(document).on("click", '[data-toggle="ajaxEdit"]', function(e) {
  318. var obj = $(this),
  319. url = obj.data('href') || obj.attr('href'),
  320. data = obj.data('set') || {},
  321. html = $.trim(obj.text()),
  322. required = obj.data('required') || true,
  323. edit = obj.data('edit') || 'input';
  324. var oldval = $.trim($(this).text());
  325. e.preventDefault();
  326. submit = function() {
  327. e.preventDefault();
  328. var val = $.trim(input.val());
  329. if (required) {
  330. if (val == '') {
  331. layer.msg(tip.lang.empty);
  332. return
  333. }
  334. }
  335. if (val == html) {
  336. input.remove(), obj.html(val).show();
  337. return
  338. }
  339. if (url) {
  340. $.post(url, {
  341. value: val
  342. }, function(ret) {
  343. ret = eval("(" + ret + ")");
  344. if (ret.status == 1) {
  345. obj.html(val).show()
  346. } else {
  347. layer.msg(ret.result.message, ret.result.url)
  348. }
  349. input.remove()
  350. }).fail(function() {
  351. input.remove(), layer.msg(tip.lang.exception)
  352. })
  353. } else {
  354. input.remove();
  355. obj.html(val).show()
  356. }
  357. obj.trigger('valueChange', [val, oldval])
  358. }, obj.hide().html('<i class="fa fa-spinner fa-spin"></i>');
  359. var input = $('<input type="text" class="form-control input-sm" style="width: 80%;display: inline;" />');
  360. if (edit == 'textarea') {
  361. input = $('<textarea type="text" class="form-control" style="resize:none" rows=3 ></textarea>')
  362. }
  363. obj.after(input);
  364. input.val(html).select().blur(function() {
  365. submit(input)
  366. }).keypress(function(e) {
  367. if (e.which == 13) {
  368. submit(input)
  369. }
  370. })
  371. })
  372. $('.btn-operation').click(function(){
  373. var ids_arr = [];
  374. var obj = $(this);
  375. var s_toggle = $(this).attr('data-toggle');
  376. var s_url = $(this).attr('data-href');
  377. $(obj).attr('disabled',true);
  378. $("input[name=item_checkbox]").each(function() {
  379. if( $(this).prop('checked') )
  380. {
  381. ids_arr.push( $(this).val() );
  382. }
  383. })
  384. if(ids_arr.length < 1)
  385. {
  386. layer.msg('请选择要操作的内容');
  387. $(obj).attr('disabled',false);
  388. }else{
  389. var can_sub = true;
  390. if( s_toggle == 'batch-remove' )
  391. {
  392. can_sub = false;
  393. $(obj).attr('disabled',false);
  394. layer.confirm($(obj).attr('data-confirm'), function(index){
  395. $.ajax({
  396. url:s_url,
  397. type:'post',
  398. dataType:'json',
  399. data:{ids:ids_arr},
  400. success:function(info){
  401. if(info.status == 0)
  402. {
  403. layer.msg(info.result.message,{icon: 1,time: 2000});
  404. }else if(info.status == 1){
  405. var go_url = location.href;
  406. if( info.result.hasOwnProperty("url") )
  407. {
  408. go_url = info.result.url;
  409. }
  410. layer.msg('操作成功',{time: 1000,
  411. end:function(){
  412. location.href = info.result.url;
  413. }
  414. });
  415. }
  416. }
  417. })
  418. });
  419. }else{
  420. $.ajax({
  421. url:s_url,
  422. type:'post',
  423. dataType:'json',
  424. data:{ids:ids_arr},
  425. success:function(info){
  426. if(info.status == 0)
  427. {
  428. layer.msg(info.result.msg,{icon: 1,time: 2000,
  429. end:function(){
  430. $(obj).attr('disabled',false);
  431. }});
  432. }else if(info.status == 1){
  433. var go_url = location.href;
  434. if( info.result.hasOwnProperty("url") )
  435. {
  436. go_url = info.result.url;
  437. }
  438. layer.msg('操作成功',{time: 1000,
  439. end:function(){
  440. location.href = info.result.url;
  441. }
  442. });
  443. }
  444. }
  445. })
  446. }
  447. }
  448. })
  449. form.on('switch(restwsitch)', function(data){
  450. var s_url = $(this).attr('data-href')
  451. var rest = 1;
  452. if(data.elem.checked)
  453. {
  454. rest = 1;
  455. }else{
  456. rest = 0;
  457. }
  458. $.ajax({
  459. url:s_url,
  460. type:'post',
  461. dataType:'json',
  462. data:{rest:rest},
  463. success:function(info){
  464. if(info.status == 0)
  465. {
  466. layer.msg(info.result.message,{icon: 1,time: 2000});
  467. }else if(info.status == 1){
  468. var go_url = location.href;
  469. if( info.result.hasOwnProperty("url") )
  470. {
  471. go_url = info.result.url;
  472. }
  473. layer.msg('操作成功',{time: 1000,
  474. end:function(){
  475. location.href = info.result.url;
  476. }
  477. });
  478. }
  479. }
  480. })
  481. });
  482. form.on('switch(enablewsitch)', function(data){
  483. var s_url = $(this).attr('data-href')
  484. var enable = 1;
  485. if(data.elem.checked)
  486. {
  487. enable = 1;
  488. }else{
  489. enable = 0;
  490. }
  491. $.ajax({
  492. url:s_url,
  493. type:'post',
  494. dataType:'json',
  495. data:{enable:enable},
  496. success:function(info){
  497. if(info.status == 0)
  498. {
  499. layer.msg(info.result.message,{icon: 1,time: 2000});
  500. }else if(info.status == 1){
  501. var go_url = location.href;
  502. if( info.result.hasOwnProperty("url") )
  503. {
  504. go_url = info.result.url;
  505. }
  506. layer.msg('操作成功',{time: 1000,
  507. end:function(){
  508. location.href = info.result.url;
  509. }
  510. });
  511. }
  512. }
  513. })
  514. });
  515. form.on('switch(statewsitchunable)', function(data){
  516. var s_url = $(this).attr('data-href')
  517. var state = 0;
  518. if(data.elem.checked)
  519. {
  520. state = 2;
  521. }
  522. $.ajax({
  523. url:s_url,
  524. type:'post',
  525. dataType:'json',
  526. data:{state:state},
  527. success:function(info){
  528. if(info.status == 0)
  529. {
  530. layer.msg(info.result.message,{icon: 1,time: 2000});
  531. }else if(info.status == 1){
  532. var go_url = location.href;
  533. if( info.result.hasOwnProperty("url") )
  534. {
  535. go_url = info.result.url;
  536. }
  537. layer.msg('操作成功',{time: 1000,
  538. end:function(){
  539. location.href = info.result.url;
  540. }
  541. });
  542. }
  543. }
  544. })
  545. });
  546. form.on('switch(statewsitch)', function(data){
  547. var loadingIndex = layer.load();
  548. var s_url = $(this).attr('data-href');
  549. var x=data.elem.checked;
  550. var tx_type = $(this).attr('tx_type');
  551. var lock = false;
  552. var tip_msg = '确认审核通过,已经打款?';
  553. if(tx_type == 1){
  554. //系统余额
  555. tip_msg = '确认审核通过,该会员个人中心余额会立即收到,只能用于小程序消费。';
  556. }else if(tx_type == 2){
  557. //1、微信余额
  558. tip_msg = '确认审核通过,将立即从微信支付商户扣款打到该会员微信零钱中。';
  559. }else if(tx_type == 3){
  560. //支付宝
  561. tip_msg = '请确认已手动转账到对方支付宝账户。';
  562. }else if(tx_type == 4){
  563. //银行卡
  564. tip_msg = '请确认已手动转账到对方银行卡账户。';
  565. }
  566. layer.confirm(tip_msg,{
  567. btn:['确定','取消'],
  568. },function () {
  569. var state = 1;
  570. if (data.elem.checked) {
  571. state = 1;
  572. } else {
  573. state = 0;
  574. }
  575. if(!lock) {
  576. lock = true;
  577. $.ajax({
  578. url: s_url,
  579. type: 'post',
  580. dataType: 'json',
  581. data: {state: state},
  582. success: function (info) {
  583. if (info.status == 0) {
  584. layer.msg(info.result.msg, {
  585. icon: 1, time: 2000,
  586. end: function () {
  587. location.href = location.href;
  588. }
  589. });
  590. layer.close(loadingIndex);
  591. } else if (info.status == 1) {
  592. var go_url = location.href;
  593. if (info.result.hasOwnProperty("url")) {
  594. go_url = info.result.url;
  595. }
  596. layer.msg('操作成功', {
  597. time: 1000,
  598. end: function () {
  599. location.href = info.result.url;
  600. }
  601. });
  602. }
  603. }
  604. })
  605. }
  606. },function(){
  607. data.elem.checked=!x;
  608. layer.close(loadingIndex);
  609. form.render();
  610. })
  611. });
  612. form.on('checkbox(checkboxall)', function(data){
  613. if(data.elem.checked)
  614. {
  615. $("input[name=item_checkbox]").each(function() {
  616. $(this).prop("checked", true);
  617. });
  618. $("input[name=checkall]").each(function() {
  619. $(this).prop("checked", true);
  620. });
  621. }else{
  622. $("input[name=item_checkbox]").each(function() {
  623. $(this).prop("checked", false);
  624. });
  625. $("input[name=checkall]").each(function() {
  626. $(this).prop("checked", false);
  627. });
  628. }
  629. form.render('checkbox');
  630. });
  631. //监听提交
  632. form.on('submit(formDemo)', function(data){
  633. $.ajax({
  634. url: data.form.action,
  635. type: data.form.method,
  636. data: data.field,
  637. dataType:'json',
  638. success: function (info) {
  639. if(info.status == 0)
  640. {
  641. layer.msg(info.result.message,{icon: 1,time: 2000});
  642. }else if(info.status == 1){
  643. var go_url = location.href;
  644. if( info.result.hasOwnProperty("url") )
  645. {
  646. go_url = info.result.url;
  647. }
  648. layer.msg('操作成功',{time: 1000,
  649. end:function(){
  650. location.href = info.result.url;
  651. }
  652. });
  653. }
  654. }
  655. });
  656. return false;
  657. });
  658. })
  659. </script>
  660. </body>