supply.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  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. </head>
  45. <body layadmin-themealias="default">
  46. <div class="layui-fluid">
  47. <div class="layui-card">
  48. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">供应商列表</span></div>
  49. <div class="layui-card-body" style="padding:15px;">
  50. <div class="page-content">
  51. <form action="" method="get" class="form-horizontal form-search layui-form" role="form">
  52. <input type="hidden" name="c" value="supply" />
  53. <input type="hidden" name="a" value="index" />
  54. <div class="layui-form-item">
  55. <!-- <span class="layui-input-inline" style="width:280px;">
  56. {:tpl_form_field_daterange('time', array('sm'=>true, 'placeholder'=>'成为供应商时间'),true);}
  57. </span> -->
  58. <div class="layui-input-inline">
  59. <select name='comsiss_state' class="layui-input layui-unselect" style="width:80px;" >
  60. <option value=''>状态</option>
  61. <option value='0' <?php if( $comsiss_state=='0'){ ?>selected<?php } ?>>未审核</option>
  62. <option value='1' <?php if( $comsiss_state=='1'){ ?>selected<?php } ?>>已审核</option>
  63. </select>
  64. </div>
  65. <div class="layui-input-inline" style="width:280px;">
  66. <input type="text" class="layui-input" name="keyword" value="{$keyword}" placeholder="店铺姓名/手机号/供应商名称"/>
  67. </div>
  68. <div class="layui-input-inline layui-btn-group">
  69. <button class="layui-btn layui-btn-sm layui-btn-normal" type="submit"> 搜索</button>
  70. <button type="submit" name="export" value="1" class="layui-btn layui-btn-sm ">导出</button>
  71. </div>
  72. </div>
  73. </form>
  74. <form action="" class="layui-form" lay-filter="example" method="post" >
  75. <div class="row">
  76. <div class="col-md-12">
  77. <div class="page-table-header">
  78. <!-- <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" /> -->
  79. <span class="pull-right">
  80. <a href="{:U('supply/addsupply', array('ok' => 1))}" class="layui-btn layui-btn-sm"><i class="fa fa-plus"></i> 添加供应商</a>
  81. </span>
  82. <div class="btn-group">
  83. <a class='btn btn-default btn-sm btn-op btn-operation' data-toggle='batch' data-href="{:U('supply/agent_check',array('state'=>1,'ok' => 1))}" data-confirm='确认要审核通过?'>
  84. <i class="icow icow-shenhetongguo"></i>审核通过
  85. </a>
  86. <a class='btn btn-default btn-sm btn-op btn-operation' data-toggle='batch' data-href="{:U('supply/agent_check',array('state'=>0,'ok' => 1))}" data-confirm='确认要取消审核?'>
  87. <i class="icow icow-yiquxiao"></i>取消审核</a>
  88. <a style="display:none;" class="btn btn-default btn-sm btn-op btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:U('supply/deletehead')}">
  89. <i class='icow icow-shanchu1'></i> 删除
  90. </a>
  91. </div>
  92. </div>
  93. <table class="layui-table" lay-skin="line" lay-size="lg">
  94. <thead class="navbar-inner">
  95. <tr>
  96. <th style="width:25px;">
  97. <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  98. </th>
  99. <th style="width:60px;">ID</th>
  100. <th style="width:160px;">供应商类型</th>
  101. <th style="width:200px;">供应商名称</th>
  102. <th style="width:150px;">供应商标志</th>
  103. <th style="width:140px;">供应商联系人</th>
  104. <th style="width:120px;">联系方式</th>
  105. <th style='width:120px;'>商品数量</th>
  106. <th style="width:150px">申请时间</br>审核时间</th>
  107. <th style='width:135px;'>状态</th>
  108. <?php if($supply_is_open_mobilemanage == 1){ ?>
  109. <th style='width:150px;'>手机端管理</th>
  110. <?php } ?>
  111. <th style="text-align: center;">操作</th>
  112. </tr>
  113. </thead>
  114. <tbody>
  115. <?php foreach( $list as $row ){ ?>
  116. <tr>
  117. <td style="position: relative; ">
  118. <input type='checkbox' value="{$row['id']}" name="item_checkbox" lay-skin="primary"/>
  119. </td>
  120. <td>
  121. {$row['id']}
  122. </td>
  123. <td>
  124. <?php if($row['type'] == 1){ ?>
  125. <span class="text-primary">独立供应商</span>
  126. <?php }else{ ?>
  127. 平台供应商
  128. <?php } ?>
  129. </td>
  130. <td>
  131. {$row['shopname']}
  132. </td>
  133. <td style="cursor: pointer;" >
  134. <img src="{:tomedia($row['logo'])}" style="width:80px;" />
  135. </td>
  136. <td>
  137. {$row['name']}
  138. </td>
  139. <td>
  140. {$row['mobile']}
  141. </td>
  142. <td>
  143. {$row['goods_count']}
  144. </td>
  145. <td>{:date("Y-m-d",$row['addtime'])} {:date("H:i:s",$row['addtime'])}
  146. <br/>
  147. <?php if( !empty($row['apptime'])){ ?>
  148. {:date("Y-m-d",$row['apptime'])} {:date("H:i:s",$row['apptime'])}
  149. <?php } ?>
  150. </td>
  151. <td>
  152. <?php if( $row['state'] == 0 ){ ?>
  153. <a class='op layui-btn layui-btn-xs' data-toggle="ajaxModal" href="javascript:;" data-href="{:U('supply/agent_check_first', array('id' => $row['id'],'type'=>$row['type'] ))}"
  154. data-href2="{:U('supply/agent_check_first', array('id' => $row['id'] ))}">
  155. <i class="icow icow-yibiaoji" style="color: #999;display: inline-block;vertical-align: middle" title="点击审核,选择供应商类型" ></i>
  156. &nbsp;通&nbsp;过&nbsp;
  157. </a><br/>
  158. <input type="checkbox" name="" lay-filter="statewsitchunable" data-href="{:U('supply/agent_check', array('id'=>$row['id']))}" <?php if($row['state']==1){ ?>checked<?php } ?> lay-skin="switch" lay-text="已拒绝|拒绝">
  159. <?php }else if( $row['state'] == 1 ){ ?>
  160. <input type="checkbox" name="" lay-filter="statewsitch" data-href="{:U('supply/agent_check', array('id'=>$row['id']))}" <?php if($row['state']==1){ ?>checked<?php } ?> lay-skin="switch" lay-text="启用|禁用">
  161. <?php }else if( $row['state'] == 2 ){ ?>
  162. <p style="color: red;">已拒绝</p>
  163. <a data-toggle="ajaxModal" href="javascript:;" data-href="{:U('supply/agent_check_first', array('id' => $row['id']))}" >
  164. <p style="color: blue;">重新审核</p>
  165. </a>
  166. <?php }else if( $row['state'] == 3 ){ ?>
  167. <input type="checkbox" name="" lay-filter="statewsitch" data-href="{:U('supply/agent_check', array('id'=>$row['id']))}" <?php if($row['state']==1){ ?>checked<?php } ?> lay-skin="switch" lay-text="启用|禁用">
  168. <?php } ?>
  169. </td>
  170. <?php if($supply_is_open_mobilemanage == 1){ ?>
  171. <td>
  172. <?php if( $row['type'] == 1 ){ ?>
  173. <?php if( $row['state'] == 1 ){ ?>
  174. <input type="checkbox" name="" lay-filter="wsitchmobilemanage" data-href="{:U('supply/agent_mobilemanage', array('id'=>$row['id']))}" <?php if($row['is_open_mobilemanage']==1){ ?>checked<?php } ?> lay-skin="switch" lay-text="开启|关闭">
  175. <?php }else{?>
  176. <input type="checkbox" name="" lay-filter="wsitchmobilemanage" disabled="true" lay-skin="switch" lay-text="开启|关闭">
  177. <?php } ?>
  178. <?php }else{ ?>
  179. 平台供应商无手机端管理
  180. <?php } ?>
  181. </td>
  182. <?php } ?>
  183. <td style="overflow:visible;text-align: center;">
  184. <a class="layui-btn layui-btn-xs" href="{:U('supply/addsupply',array('id'=>$row['id'], 'ok'=>1));}">
  185. <i class="layui-icon layui-icon-edit"></i>编辑
  186. </a>
  187. <?php if( $row['state'] == 0 && $row['goods_count'] <= 0 ){ ?>
  188. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="{:U('supply/deletesupply',array('id' => $row['id']) )}" data-confirm='确认要删除吗?'>
  189. <i class="layui-icon">&#xe640;</i>删除
  190. </a>
  191. <?php } ?>
  192. </td>
  193. </tr>
  194. <?php } ?>
  195. </tbody>
  196. <tfoot>
  197. <tr>
  198. <td colspan="5">
  199. <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  200. <div class="btn-group">
  201. <a class='btn btn-default btn-sm btn-op btn-operation' data-toggle='batch' data-href="{:U('supply/agent_check',array('state'=>1))}" data-confirm='确认要审核通过?'>
  202. <i class="icow icow-shenhetongguo"></i>审核通过
  203. </a>
  204. <a class='btn btn-default btn-sm btn-op btn-operation' data-toggle='batch' data-href="{:U('supply/agent_check',array('state'=>0))}" data-confirm='确认要取消审核?'>
  205. <i class="icow icow-yiquxiao"></i>取消审核</a>
  206. <a style="display:none;" class="btn btn-default btn-sm btn-op btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:U('communityhead/deletehead')}">
  207. <i class='icow icow-shanchu1'></i> 删除
  208. </a>
  209. </div>
  210. </td>
  211. <td colspan="<?php if($supply_is_open_mobilemanage == 1){ ?>7<?php }else{ ?>6<?php } ?>" style="text-align: right">
  212. {$pager}
  213. </td>
  214. </tr>
  215. </tfoot>
  216. </table>
  217. </div>
  218. </div>
  219. </form>
  220. </div>
  221. </div>
  222. </div>
  223. <div id="ajaxModal" class="modal fade" style="display: none;">
  224. </div>
  225. <script language="javascript">
  226. require(['bootstrap'], function () {
  227. $("[rel=pop]").popover({
  228. trigger: 'manual',
  229. placement: 'right',
  230. title: $(this).data('title'),
  231. html: 'true',
  232. content: $(this).data('content'),
  233. animation: false
  234. }).on("mouseenter", function () {
  235. var _this = this;
  236. $(this).popover("show");
  237. $(this).siblings(".popover").on("mouseleave", function () {
  238. $(_this).popover('hide');
  239. });
  240. }).on("mouseleave", function () {
  241. var _this = this;
  242. setTimeout(function () {
  243. if (!$(".popover:hover").length) {
  244. $(_this).popover("hide")
  245. }
  246. }, 100);
  247. });
  248. });
  249. $("[data-toggle='ajaxModal']").click(function () {
  250. var s_url = $(this).attr('data-href');
  251. ajax_url = s_url;
  252. var s_url2 = $(this).attr('data-href2');
  253. ajax_url2 = s_url2;
  254. console.log(23);
  255. $.ajax({
  256. url:s_url,
  257. type:"get",
  258. success:function(shtml){
  259. $('#ajaxModal').html(shtml);
  260. $("#ajaxModal").modal();
  261. }
  262. })
  263. });
  264. $(document).delegate(".modal-footer .btn-primary","click",function(){
  265. var s_data = $('#ajaxModal form').serialize();
  266. $.ajax({
  267. url:ajax_url,
  268. type:'post',
  269. dataType:'json',
  270. data:s_data,
  271. success:function(info){
  272. if(info.status == 0)
  273. {
  274. layer.msg(info.result.message,{icon: 1,time: 2000});
  275. }else if(info.status == 1){
  276. var go_url = location.href;
  277. if( info.result.hasOwnProperty("url") )
  278. {
  279. go_url = info.result.url;
  280. }
  281. layer.msg('操作成功',{time: 1000,
  282. end:function(){
  283. location.href = info.result.url;
  284. }
  285. });
  286. }
  287. }
  288. })
  289. return false;
  290. })
  291. $("[data-toggle='batch-group'], [data-toggle='batch-level']").click(function () {
  292. var toggle = $(this).data('toggle');
  293. $("#modal-change .modal-title").text(toggle=='batch-group'?"批量修改分组":"批量修改会员等级");
  294. $("#modal-change").find("."+toggle).show().siblings().hide();
  295. $("#modal-change-btn").attr('data-toggle', toggle=='batch-group'?'group':'level');
  296. $("#modal-change").modal();
  297. });
  298. $("#modal-change-btn").click(function () {
  299. var _this = $(this);
  300. if(_this.attr('stop')){
  301. return;
  302. }
  303. var toggle = $(this).data('toggle');
  304. var ids = [];
  305. $(".checkone").each(function () {
  306. var checked = $(this).is(":checked");
  307. var id = $(this).val();
  308. if(checked && id){
  309. ids.push(id);
  310. }
  311. });
  312. if(ids.length<1){
  313. tip.msgbox.suc("请选择要批量操作的会员");
  314. return;
  315. }
  316. var option = $("#modal-change .batch-"+toggle+" option:selected");
  317. level = '';
  318. if (toggle=='group'){
  319. for(i=0;i<option.length;i++){
  320. if (level == ''){
  321. level += $(option[i]).val();
  322. }else{
  323. level += ','+$(option[i]).val();
  324. }
  325. }
  326. }else{
  327. var level = option.val();
  328. }
  329. var levelname = option.text();
  330. tip.confirm("确定要将选中会员移动到 "+levelname+" 吗?", function () {
  331. _this.attr('stop', 1).text("操作中...");
  332. $.post(biz.url('user/changelevel'),{
  333. level: level,
  334. ids: ids,
  335. toggle: toggle
  336. }, function (ret) {
  337. $("#modal-change").modal('hide');
  338. if(ret.status==1){
  339. tip.msgbox.suc("操作成功");
  340. setTimeout(function () {
  341. location.reload();
  342. },1000);
  343. }else{
  344. tip.msgbox.err(ret.result.message);
  345. }
  346. }, 'json')
  347. });
  348. });
  349. </script>
  350. <script src="/layuiadmin/layui/layui.js"></script>
  351. <script>
  352. layui.config({
  353. base: '/layuiadmin/' //静态资源所在路径
  354. }).extend({
  355. index: 'lib/index' //主入口模块
  356. }).use('index');
  357. </script>
  358. <script>
  359. var layer = layui.layer;
  360. var $;
  361. layui.use(['jquery', 'layer','form'], function(){
  362. $ = layui.$;
  363. var form = layui.form;
  364. $('.deldom').click(function(){
  365. var s_url = $(this).attr('data-href');
  366. layer.confirm($(this).attr('data-confirm'), function(index){
  367. $.ajax({
  368. url:s_url,
  369. type:'post',
  370. dataType:'json',
  371. success:function(info){
  372. if(info.status == 0)
  373. {
  374. layer.msg(info.result.message,{icon: 1,time: 2000});
  375. }else if(info.status == 1){
  376. var go_url = location.href;
  377. if( info.result.hasOwnProperty("url") )
  378. {
  379. go_url = info.result.url;
  380. }
  381. layer.msg('操作成功',{time: 1000,
  382. end:function(){
  383. location.href = info.result.url;
  384. }
  385. });
  386. }
  387. }
  388. })
  389. });
  390. })
  391. $('.btn-operation').click(function(){
  392. var ids_arr = [];
  393. var obj = $(this);
  394. var s_toggle = $(this).attr('data-toggle');
  395. var s_url = $(this).attr('data-href');
  396. $("input[name=item_checkbox]").each(function() {
  397. if( $(this).prop('checked') )
  398. {
  399. ids_arr.push( $(this).val() );
  400. }
  401. })
  402. if(ids_arr.length < 1)
  403. {
  404. layer.msg('请选择要操作的内容');
  405. }else{
  406. var can_sub = true;
  407. if( s_toggle == 'batch-remove' )
  408. {
  409. can_sub = false;
  410. layer.confirm($(obj).attr('data-confirm'), function(index){
  411. $.ajax({
  412. url:s_url,
  413. type:'post',
  414. dataType:'json',
  415. data:{ids:ids_arr},
  416. success:function(info){
  417. if(info.status == 0)
  418. {
  419. layer.msg(info.result.message,{icon: 1,time: 2000});
  420. }else if(info.status == 1){
  421. var go_url = location.href;
  422. if( info.result.hasOwnProperty("url") )
  423. {
  424. go_url = info.result.url;
  425. }
  426. layer.msg('操作成功',{time: 1000,
  427. end:function(){
  428. location.href = info.result.url;
  429. }
  430. });
  431. }
  432. }
  433. })
  434. });
  435. }else{
  436. $.ajax({
  437. url:s_url,
  438. type:'post',
  439. dataType:'json',
  440. data:{ids:ids_arr},
  441. success:function(info){
  442. if(info.status == 0)
  443. {
  444. layer.msg(info.result.message,{icon: 1,time: 2000});
  445. }else if(info.status == 1){
  446. var go_url = location.href;
  447. if( info.result.hasOwnProperty("url") )
  448. {
  449. go_url = info.result.url;
  450. }
  451. layer.msg('操作成功',{time: 1000,
  452. end:function(){
  453. location.href = info.result.url;
  454. }
  455. });
  456. }
  457. }
  458. })
  459. }
  460. }
  461. })
  462. form.on('switch(wsitchmobilemanage)', function(data){
  463. var s_url = $(this).attr('data-href')
  464. var s_value = 1;
  465. if(data.elem.checked)
  466. {
  467. s_value = 1;
  468. }else{
  469. s_value = 0;
  470. }
  471. $.ajax({
  472. url:s_url,
  473. type:'post',
  474. dataType:'json',
  475. data:{is_open_mobilemanage:s_value},
  476. success:function(info){
  477. if(info.status == 0)
  478. {
  479. layer.msg(info.result.message,{icon: 1,time: 2000});
  480. }else if(info.status == 1){
  481. var go_url = location.href;
  482. if( info.result.hasOwnProperty("url") )
  483. {
  484. go_url = info.result.url;
  485. }
  486. layer.msg('操作成功',{time: 1000,
  487. end:function(){
  488. location.href = info.result.url;
  489. }
  490. });
  491. }
  492. }
  493. })
  494. });
  495. form.on('switch(statewsitchunable)', function(data){
  496. var s_url = $(this).attr('data-href')
  497. var s_value = 2;
  498. $.ajax({
  499. url:s_url,
  500. type:'post',
  501. dataType:'json',
  502. data:{state:s_value},
  503. success:function(info){
  504. if(info.status == 0)
  505. {
  506. layer.msg(info.result.message,{icon: 1,time: 2000});
  507. }else if(info.status == 1){
  508. var go_url = location.href;
  509. if( info.result.hasOwnProperty("url") )
  510. {
  511. go_url = info.result.url;
  512. }
  513. layer.msg('操作成功',{time: 1000,
  514. end:function(){
  515. location.href = info.result.url;
  516. }
  517. });
  518. }
  519. }
  520. })
  521. });
  522. form.on('switch(statewsitch)', function(data){
  523. var s_url = $(this).attr('data-href')
  524. var s_value = 1;
  525. if(data.elem.checked)
  526. {
  527. s_value = 1;
  528. }else{
  529. s_value = 3;
  530. }
  531. $.ajax({
  532. url:s_url,
  533. type:'post',
  534. dataType:'json',
  535. data:{state:s_value},
  536. success:function(info){
  537. if(info.status == 3)
  538. {
  539. layer.msg(info.result.message,{icon: 1,time: 2000});
  540. }else if(info.status == 1){
  541. var go_url = location.href;
  542. if( info.result.hasOwnProperty("url") )
  543. {
  544. go_url = info.result.url;
  545. }
  546. layer.msg('操作成功',{time: 1000,
  547. end:function(){
  548. location.href = info.result.url;
  549. }
  550. });
  551. }
  552. }
  553. })
  554. });
  555. form.on('checkbox(checkboxall)', function(data){
  556. if(data.elem.checked)
  557. {
  558. $("input[name=item_checkbox]").each(function() {
  559. $(this).prop("checked", true);
  560. });
  561. $("input[name=checkall]").each(function() {
  562. $(this).prop("checked", true);
  563. });
  564. }else{
  565. $("input[name=item_checkbox]").each(function() {
  566. $(this).prop("checked", false);
  567. });
  568. $("input[name=checkall]").each(function() {
  569. $(this).prop("checked", false);
  570. });
  571. }
  572. form.render('checkbox');
  573. });
  574. //监听提交
  575. form.on('submit(formDemo)', function(data){
  576. $.ajax({
  577. url: data.form.action,
  578. type: data.form.method,
  579. data: data.field,
  580. dataType:'json',
  581. success: function (info) {
  582. if(info.status == 0)
  583. {
  584. layer.msg(info.result.message,{icon: 1,time: 2000});
  585. }else if(info.status == 1){
  586. var go_url = location.href;
  587. if( info.result.hasOwnProperty("url") )
  588. {
  589. go_url = info.result.url;
  590. }
  591. layer.msg('操作成功',{time: 1000,
  592. end:function(){
  593. location.href = info.result.url;
  594. }
  595. });
  596. }
  597. }
  598. });
  599. return false;
  600. });
  601. })
  602. </script>
  603. </body>
  604. </html>