communityhead.html 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949
  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="index" />
  111. <input type="hidden" name="type" value="{$type}" />
  112. <div class="layui-form-item">
  113. <div class="layui-inline">
  114. <div class="layui-input-inline" >
  115. <select name='comsiss_state' class='layui-input layui-unselect' style="width:80px;" >
  116. <option value=''>状态</option>
  117. <option value='0' <?php if( $comsiss_state=='0'){ ?>selected<?php } ?>>未审核</option>
  118. <option value='1' <?php if( $comsiss_state=='1'){ ?>selected<?php } ?>>已审核</option>
  119. <option value='2' <?php if( $comsiss_state=='2'){ ?>selected<?php } ?>>拒绝通过</option>
  120. </select>
  121. </div>
  122. <div class="layui-input-inline" >
  123. <input type="text" class="layui-input" name="keyword" value="{$keyword}" placeholder="会员昵称/团长姓名/手机号/小区名称"/>
  124. </div>
  125. <div class="layui-input-inline">
  126. <select name="level_id" class="layui-input layui-unselect">
  127. <option value="">团长等级</option>
  128. <?php foreach( $community_head_level as $level ){ ?>
  129. <option value="{$level['id']}" <?php if( $level_id == $level['id']){ ?>selected<?php } ?>>{$level['levelname']}</option>
  130. <?php } ?>
  131. </select>
  132. </div>
  133. <div class="layui-input-inline">
  134. <select name="group_id" class="layui-input layui-unselect">
  135. <option value="">团长分组</option>
  136. <?php foreach($group_list as $group){ ?>
  137. <option value="{$group['id']}" <?php if( $group_id == $group['id'] ){ ?>selected<?php } ?>>{$group['groupname']}</option>
  138. <?php } ?>
  139. </select>
  140. </div>
  141. <div class="layui-input-inline">
  142. <button class="layui-btn layui-btn-sm" type="submit"> 搜索</button>
  143. <button type="submit" name="export" value="1" class="btn btn-success ">导出</button>
  144. </div>
  145. </div>
  146. </div>
  147. </form>
  148. <form action="" class="layui-form" lay-filter="example" method="post" >
  149. <div class="row">
  150. <div class="col-md-12">
  151. <div class="page-table-header">
  152. <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  153. <span class="pull-right">
  154. <a href="{:U('communityhead/addhead', array('ok' => 1))}" class="layui-btn layui-btn-sm"><i class="fa fa-plus"></i> 添加团长</a>
  155. </span>
  156. <div class="btn-group">
  157. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('communityhead/agent_check',array('state'=>1))}" data-confirm='确认要审核通过?'>
  158. 审核通过
  159. </button>
  160. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('communityhead/agent_check',array('state'=>2))}" data-confirm='确认要拒绝通过?'>
  161. 拒绝通过
  162. </button>
  163. <button class="btn btn-default btn-sm " type="button" data-toggle="batch-group" data-href="{:U('communityhead/changelevel', array('toggle' => 'group'))}" > <i class="icow icow-fenzuqunfa"></i>修改分组</button>
  164. <a class="btn btn-default btn-sm btn-op" data-toggle="batch-level" > 修改等级</a>
  165. </div>
  166. </div>
  167. <table class="table table-responsive" lay-even lay-skin="line" lay-size="lg">
  168. <thead>
  169. <tr>
  170. <th style="width:25px;"></th>
  171. <th style="width:60px;">ID</th>
  172. <th style="min-width:50px;">小区名称</th>
  173. <th style="width: 200px;">团长</th>
  174. <th style="width: 100px;">上级团长<BR/>直推下级数量</th>
  175. <?php if($open_danhead_model == 1){ ?>
  176. <th style="">默认团长</th>
  177. <?php } ?>
  178. <th style="">商品数量</th>
  179. <th style='width:150px;'>佣金情况</th>
  180. <th style='width:100px;'>提货地址</th>
  181. <th style="">申请时间</br>审核时间</th>
  182. <th style='width:100px;'>是否休息</th>
  183. <th style='width:120px;'>状态</th>
  184. <th style="width: 300px;text-align: center;">操作</th>
  185. </tr>
  186. </thead>
  187. <tbody>
  188. <?php foreach( $list as $row ){ ?>
  189. <tr>
  190. <td style="position: relative; ">
  191. <input type='checkbox' name="item_checkbox" class="checkone" lay-skin="primary" value="{$row['id']}"/>
  192. </td>
  193. <td>
  194. {$row['id']}
  195. </td>
  196. <td>
  197. {$row['community_name']}<br/>
  198. <a href="javascript:void(0)" class="tg_community" community_id="{$row['id']}" style="color:#428bca;">推广二维码</a>
  199. </td>
  200. <td style="overflow: visible">
  201. <div style="display: flex">
  202. <img class="img-40" src="{$row['avatar']}" style='border-radius:50%;border:1px solid #efefef;' />
  203. <span style="display: flex;flex-direction: column;justify-content: center;align-items: flex-start;padding-left: 5px">
  204. <span class="nickname">
  205. 姓名:{$row['head_name']}
  206. <br/>
  207. 昵称:{$row['username']}
  208. <br/>当前团员数量: <span class="text-primary">{$row['member_count']}</span>
  209. <br/>
  210. <span class="text-warning">等级:{$level_id_to_name[$row['level_id']]}</span>
  211. <br/>
  212. <?php if(empty($row['groupname'])){ ?><span class="text-warning">默认分组<?php }else{ ?>{$row['groupname']}</span><?php } ?>
  213. </span>
  214. </span>
  215. </div>
  216. </td>
  217. <td>
  218. <?php if( !empty($row['agent_name']) ){ ?>
  219. {$row['agent_name']}
  220. <?php }else{ ?>
  221. 暂无上级
  222. <?php } ?>
  223. <br/>
  224. 直推团长:{$row['agent_count']}
  225. <br/>
  226. 电话:{$row['head_mobile']}
  227. </td>
  228. <?php if($open_danhead_model == 1){ ?>
  229. <td>
  230. <input type="checkbox" name="" lay-filter="defaultsitch" data-href="{:U('communityhead/default_check',array('id'=>$row['id']))}" <?php if( $row['is_default']==1 ){ ?>checked<?php } ?> lay-skin="switch" lay-text="是|否">
  231. </td>
  232. <?php } ?>
  233. <td>
  234. {$row['goods_count']}
  235. </td>
  236. <td>
  237. 待确认:<span class="text-warning">{$row['commission_info']['pre_total_money']}</span><br/>
  238. 可提现:<span class="text-warning"><?php echo empty($row['commission_info']['money']) ? 0: $row['commission_info']['money']; ?></span><br/>
  239. 已打款:<span class="text-warning"><?php echo empty($row['commission_info']['getmoney']) ?0:$row['commission_info']['getmoney']; ?></span><br/>
  240. 提现中:<span class="text-warning"><?php echo empty($row['commission_info']['dongmoney']) ? 0:$row['commission_info']['dongmoney']; ?></span><br/>
  241. 总收入:<span class="text-danger"><?php echo empty($row['commission_info']['commission_total']) ? 0:$row['commission_info']['commission_total']; ?></span><br/>
  242. </td>
  243. <td style="white-space:normal;">
  244. {$row['province_name']}{$row['city_name']}{$row['area_name']}{$row['country_name']}{$row['address']}
  245. </td>
  246. <td>{:date("Y-m-d",$row['addtime'])}<br/>{:date("H:i:s",$row['addtime'])}
  247. <br/>
  248. <?php if( !empty($row['apptime'])){ ?>
  249. {:date("Y-m-d",$row['apptime'])}<br/>{:date("H:i:s",$row['apptime'])}
  250. <?php } ?>
  251. </td>
  252. <td>
  253. <input type="checkbox" name="" lay-filter="restwsitch" data-href="{:U('communityhead/rest_check',array('id'=>$row['id']))}" <?php if( $row['rest']==1){ ?>checked<?php }else{ ?><?php } ?> lay-skin="switch" lay-text="是|否">
  254. </td>
  255. <td>
  256. <!--
  257. <?php if( $row[state] ==2){ ?>
  258. 已拒绝
  259. <?php }else{ ?>
  260. <input type="checkbox" name="" lay-filter="statewsitch" data-href="{:U('communityhead/agent_check',array('id'=>$row['id']))}" <?php if( $row['state']==1){ ?>checked<?php }else{ ?><?php } ?> lay-skin="switch" lay-text="已审核|未审核">
  261. <?php } ?>
  262. -->
  263. <?php if( $row['state'] == 0 ){ ?>
  264. <a class='op layui-btn layui-btn-xs' data-toggle="ajaxModal" href="javascript:;" data-href="{:U('communityhead/agent_check_first', array('id' => $row['id']))}" >
  265. <i class="icow icow-yibiaoji" style="color: #999;display: inline-block;vertical-align: middle" title="点击审核,选择供应商类型" ></i>
  266. &nbsp;通&nbsp;过&nbsp;
  267. </a><br/>
  268. <input type="checkbox" name="" lay-filter="statewsitchunable" data-href="{:U('communityhead/agent_check', array('id'=>$row['id']))}" <?php if($row['state']==1){ ?>checked<?php } ?> lay-skin="switch" lay-text="已拒绝|拒绝">
  269. <?php }else if( $row['state'] == 1 ){ ?>
  270. <!--<p style="color: red; display:inline;padding-right: 15px;" >审核已通过</p>-->
  271. <input type="checkbox" name="" lay-filter="enablewsitch" data-href="{:U('communityhead/enable_check',array('id'=>$row['id']))}" <?php if( $row['enable']==1){ ?>checked<?php }else{ ?><?php } ?> lay-skin="switch" lay-text="已启用|已禁用">
  272. <?php }else if( $row['state'] == 2 ){ ?>
  273. <p style="color: red;">已拒绝</p>
  274. <a data-toggle="ajaxModal" href="javascript:;" data-href="{:U('communityhead/agent_check_first', array('id' => $row['id']))}" >
  275. <p style="color: blue;">重新审核</p>
  276. </a>
  277. <?php } ?>
  278. </td>
  279. <td style="overflow:visible;text-align: center;">
  280. <div class="btn-group">
  281. <a class="layui-btn layui-btn-xs" href="{:U('communityhead/addhead',array('id' => $row['id'] , 'ok' => 1));}" title="">
  282. <i class="layui-icon layui-icon-edit"></i>编辑
  283. </a>
  284. <?php if( ($row['state'] == 0 || $row['state'] == 2) && $row['head_goods_count'] == 0 && $row['head_order_count'] == 0 ){ ?>
  285. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="{:U('communityhead/deletehead',array('id' => $row['id']) )}" data-confirm='确认要删除吗?'>
  286. <i class="layui-icon">&#xe640;</i>删除
  287. </a>
  288. <?php } ?>
  289. <a class="layui-btn layui-btn-xs" href="{:U('communityhead/distributionorder',array('headid' => $row['id']));}" target='_blank'>
  290. 推广订单
  291. </a>
  292. <a class="layui-btn layui-btn-xs" href="{:U('communityhead/communityorder',array('head_id' => $row['id']));}" target='_blank'>
  293. 收益明细
  294. </a>
  295. <a class="layui-btn layui-btn-xs" href="{:U('communityhead/goodslist',array('head_id' => $row['id'] , 'ok' => 1));}" target='_blank'>
  296. 查看在售商品
  297. </a>
  298. <a class="layui-btn layui-btn-xs" href="{:U('communityhead/lookcommunitymember',array('id' => $row['id'] , 'ok' => 1));}">
  299. 查看核销人员
  300. </a>
  301. </div>
  302. </td>
  303. </tr>
  304. <?php } ?>
  305. </tbody>
  306. <tfoot>
  307. <tr>
  308. <td colspan="5">
  309. <div class="page-table-header">
  310. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall">
  311. <div class="btn-group">
  312. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('communityhead/agent_check',array('state'=>1))}" data-confirm='确认要审核通过?'>
  313. 审核通过
  314. </button>
  315. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('communityhead/agent_check',array('state'=>2))}" data-confirm='确认要拒绝通过?'>
  316. 拒绝通过
  317. </button>
  318. <button class="btn btn-default btn-sm " type="button" data-toggle="batch-group" data-href="{:U('communityhead/changelevel', array('toggle' => 'group'))}" > <i class="icow icow-fenzuqunfa"></i>修改分组</button>
  319. <a class="btn btn-default btn-sm btn-op btn-operation" data-toggle="batch-level" disabled="disabled"><i class="icow icow-cengjiguanli"></i> 修改等级</a>
  320. </div>
  321. </div>
  322. </td>
  323. <td colspan="8" style="text-align: right">
  324. {$pager}
  325. </td>
  326. </tr>
  327. </tfoot>
  328. </table>
  329. </div>
  330. </div>
  331. </form>
  332. </div>
  333. </div>
  334. </div>
  335. <div id="ajaxModal" class="modal fade" style="display: none;">
  336. </div>
  337. <script src="/layuiadmin/layui/layui.js"></script>
  338. <script>
  339. layui.config({
  340. base: '/layuiadmin/' //静态资源所在路径
  341. }).extend({
  342. index: 'lib/index' //主入口模块
  343. }).use('index');
  344. </script>
  345. <script>
  346. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  347. var layer = layui.layer;
  348. var $;
  349. layui.use(['jquery', 'layer','form'], function(){
  350. $ = layui.$;
  351. var form = layui.form;
  352. $('.deldom').click(function(){
  353. var s_url = $(this).attr('data-href');
  354. layer.confirm($(this).attr('data-confirm'), function(index){
  355. $.ajax({
  356. url:s_url,
  357. type:'post',
  358. dataType:'json',
  359. success:function(info){
  360. if(info.status == 0)
  361. {
  362. layer.msg(info.result.message,{icon: 1,time: 2000});
  363. }else if(info.status == 1){
  364. var go_url = location.href;
  365. if( info.result.hasOwnProperty("url") )
  366. {
  367. go_url = info.result.url;
  368. }
  369. layer.msg('操作成功',{time: 1000,
  370. end:function(){
  371. location.href = info.result.url;
  372. }
  373. });
  374. }
  375. }
  376. })
  377. });
  378. })
  379. $('.btn-operation').click(function(){
  380. var ids_arr = [];
  381. var obj = $(this);
  382. var s_toggle = $(this).attr('data-toggle');
  383. var s_url = $(this).attr('data-href');
  384. $("input[name=item_checkbox]").each(function() {
  385. if( $(this).prop('checked') )
  386. {
  387. ids_arr.push( $(this).val() );
  388. }
  389. })
  390. if(ids_arr.length < 1)
  391. {
  392. layer.msg('请选择要操作的内容');
  393. }else{
  394. var can_sub = true;
  395. if( s_toggle == 'batch-remove' )
  396. {
  397. can_sub = false;
  398. layer.confirm($(obj).attr('data-confirm'), function(index){
  399. $.ajax({
  400. url:s_url,
  401. type:'post',
  402. dataType:'json',
  403. data:{ids:ids_arr},
  404. success:function(info){
  405. if(info.status == 0)
  406. {
  407. layer.msg(info.result.message,{icon: 1,time: 2000});
  408. }else if(info.status == 1){
  409. var go_url = location.href;
  410. if( info.result.hasOwnProperty("url") )
  411. {
  412. go_url = info.result.url;
  413. }
  414. layer.msg('操作成功',{time: 1000,
  415. end:function(){
  416. location.href = info.result.url;
  417. }
  418. });
  419. }
  420. }
  421. })
  422. });
  423. }else{
  424. $.ajax({
  425. url:s_url,
  426. type:'post',
  427. dataType:'json',
  428. data:{ids:ids_arr},
  429. success:function(info){
  430. if(info.status == 0)
  431. {
  432. layer.msg(info.result.message,{icon: 1,time: 2000});
  433. }else if(info.status == 1){
  434. var go_url = location.href;
  435. if( info.result.hasOwnProperty("url") )
  436. {
  437. go_url = info.result.url;
  438. }
  439. layer.msg('操作成功',{time: 1000,
  440. end:function(){
  441. location.href = info.result.url;
  442. }
  443. });
  444. }
  445. }
  446. })
  447. }
  448. }
  449. })
  450. form.on('switch(restwsitch)', function(data){
  451. var s_url = $(this).attr('data-href')
  452. var rest = 1;
  453. if(data.elem.checked)
  454. {
  455. rest = 1;
  456. }else{
  457. rest = 0;
  458. }
  459. $.ajax({
  460. url:s_url,
  461. type:'post',
  462. dataType:'json',
  463. data:{rest:rest},
  464. success:function(info){
  465. if(info.status == 0)
  466. {
  467. layer.msg(info.result.message,{icon: 1,time: 2000});
  468. }else if(info.status == 1){
  469. var go_url = location.href;
  470. if( info.result.hasOwnProperty("url") )
  471. {
  472. go_url = info.result.url;
  473. }
  474. layer.msg('操作成功',{time: 1000,
  475. end:function(){
  476. location.href = info.result.url;
  477. }
  478. });
  479. }
  480. }
  481. })
  482. });
  483. form.on('switch(enablewsitch)', function(data){
  484. var s_url = $(this).attr('data-href')
  485. var enable = 1;
  486. if(data.elem.checked)
  487. {
  488. enable = 1;
  489. }else{
  490. enable = 0;
  491. }
  492. $.ajax({
  493. url:s_url,
  494. type:'post',
  495. dataType:'json',
  496. data:{enable:enable},
  497. success:function(info){
  498. if(info.status == 0)
  499. {
  500. layer.msg(info.result.message,{icon: 1,time: 2000});
  501. }else if(info.status == 1){
  502. var go_url = location.href;
  503. if( info.result.hasOwnProperty("url") )
  504. {
  505. go_url = info.result.url;
  506. }
  507. layer.msg('操作成功',{time: 1000,
  508. end:function(){
  509. location.href = info.result.url;
  510. }
  511. });
  512. }
  513. }
  514. })
  515. });
  516. form.on('switch(defaultsitch)', function(data){
  517. var s_url = $(this).attr('data-href')
  518. var rest = 1;
  519. if(data.elem.checked)
  520. {
  521. rest = 1;
  522. }else{
  523. rest = 0;
  524. }
  525. $.ajax({
  526. url:s_url,
  527. type:'post',
  528. dataType:'json',
  529. data:{value:rest},
  530. success:function(info){
  531. if(info.status == 0)
  532. {
  533. layer.msg(info.result.message,{icon: 1,time: 2000});
  534. }else if(info.status == 1){
  535. var go_url = location.href;
  536. if( info.result.hasOwnProperty("url") )
  537. {
  538. go_url = info.result.url;
  539. }
  540. layer.msg('操作成功',{time: 1000,
  541. end:function(){
  542. location.href = info.result.url;
  543. }
  544. });
  545. }
  546. }
  547. })
  548. });
  549. form.on('switch(statewsitchunable)', function(data){
  550. var s_url = $(this).attr('data-href')
  551. var s_value = 2;
  552. $.ajax({
  553. url:s_url,
  554. type:'post',
  555. dataType:'json',
  556. data:{state:s_value},
  557. success:function(info){
  558. if(info.status == 0)
  559. {
  560. layer.msg(info.result.message,{icon: 1,time: 2000});
  561. }else if(info.status == 1){
  562. var go_url = location.href;
  563. if( info.result.hasOwnProperty("url") )
  564. {
  565. go_url = info.result.url;
  566. }
  567. layer.msg('操作成功',{time: 1000,
  568. end:function(){
  569. location.href = info.result.url;
  570. }
  571. });
  572. }
  573. }
  574. })
  575. });
  576. form.on('switch(statewsitch)', function(data){
  577. var s_url = $(this).attr('data-href')
  578. var state = 1;
  579. if(data.elem.checked)
  580. {
  581. state = 1;
  582. }else{
  583. state = 0;
  584. }
  585. $.ajax({
  586. url:s_url,
  587. type:'post',
  588. dataType:'json',
  589. data:{state:state},
  590. success:function(info){
  591. if(info.status == 0)
  592. {
  593. layer.msg(info.result.message,{icon: 1,time: 2000});
  594. }else if(info.status == 1){
  595. var go_url = location.href;
  596. if( info.result.hasOwnProperty("url") )
  597. {
  598. go_url = info.result.url;
  599. }
  600. layer.msg('操作成功',{time: 1000,
  601. end:function(){
  602. location.href = info.result.url;
  603. }
  604. });
  605. }
  606. }
  607. })
  608. });
  609. form.on('checkbox(checkboxall)', function(data){
  610. if(data.elem.checked)
  611. {
  612. $("input[name=item_checkbox]").each(function() {
  613. $(this).prop("checked", true);
  614. });
  615. $("input[name=checkall]").each(function() {
  616. $(this).prop("checked", true);
  617. });
  618. }else{
  619. $("input[name=item_checkbox]").each(function() {
  620. $(this).prop("checked", false);
  621. });
  622. $("input[name=checkall]").each(function() {
  623. $(this).prop("checked", false);
  624. });
  625. }
  626. form.render('checkbox');
  627. });
  628. //监听提交
  629. form.on('submit(formDemo)', function(data){
  630. $.ajax({
  631. url: data.form.action,
  632. type: data.form.method,
  633. data: data.field,
  634. dataType:'json',
  635. success: function (info) {
  636. if(info.status == 0)
  637. {
  638. layer.msg(info.result.message,{icon: 1,time: 2000});
  639. }else if(info.status == 1){
  640. var go_url = location.href;
  641. if( info.result.hasOwnProperty("url") )
  642. {
  643. go_url = info.result.url;
  644. }
  645. layer.msg('操作成功',{time: 1000,
  646. end:function(){
  647. location.href = info.result.url;
  648. }
  649. });
  650. }
  651. }
  652. });
  653. return false;
  654. });
  655. })
  656. </script>
  657. <div id="modal-change" class="modal fade form-horizontal" tabindex="-1">
  658. <div class="modal-dialog">
  659. <div class="modal-content">
  660. <div class="modal-header">
  661. <button data-dismiss="modal" class="close" type="button">×</button>
  662. <h4 class="modal-title"><?php if( !empty($group['id'])){ ?>编辑<?php }else{ ?>添加<?php } ?>标签组</h4>
  663. </div>
  664. <div class="modal-body">
  665. <div class="form-group batch-level" style="display: none;">
  666. <label class="col-sm-2 control-label must">团长等级</label>
  667. <div class="col-sm-9 col-xs-12">
  668. <select name="batch-level" class="form-control">
  669. <?php foreach( $community_head_level as $level ){ ?>
  670. <option value="{$level['id']}">{$level['levelname']}</option>
  671. <?php } ?>
  672. </select>
  673. </div>
  674. </div>
  675. <div class="form-group batch-group" style="display: none;">
  676. <label class="col-sm-2 control-label must">团长分组</label>
  677. <div class="col-sm-9 col-xs-12">
  678. <select name="batch-group[]" class="form-control select2" placeholder="会员会被加入指定的分组中" style="position:absolute;">
  679. <option value="0">默认分组</option>
  680. <?php foreach( $group_list as $group ){ ?>
  681. <option value="{$group['id']}">{$group['groupname']}</option>
  682. <?php } ?>
  683. </select>
  684. </div>
  685. </div>
  686. </div>
  687. <div class="modal-footer">
  688. <button class="btn btn-primary" type="submit" id="modal-change-btn">提交</button>
  689. <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
  690. </div>
  691. </div>
  692. </div>
  693. </div>
  694. <script language="javascript">
  695. $("[data-toggle='batch-group'], [data-toggle='batch-level']").click(function () {
  696. var toggle = $(this).data('toggle');
  697. $("#modal-change .modal-title").text(toggle=='batch-group'?"批量修改分组":"批量修改会员等级");
  698. $("#modal-change").find("."+toggle).show().siblings().hide();
  699. $("#modal-change-btn").attr('data-toggle', toggle=='batch-group'?'group':'level');
  700. $("#modal-change").modal();
  701. });
  702. $("#modal-change-btn").click(function () {
  703. var _this = $(this);
  704. if(_this.attr('stop')){
  705. return;
  706. }
  707. var toggle = $(this).data('toggle');
  708. var ids = [];
  709. $(".checkone").each(function () {
  710. var checked = $(this).is(":checked");
  711. var id = $(this).val();
  712. if(checked && id){
  713. ids.push(id);
  714. }
  715. });
  716. if(ids.length<1){
  717. alert("请选择要批量操作的团长");
  718. return;
  719. }
  720. var option = $("#modal-change .batch-"+toggle+" option:selected");
  721. level = '';
  722. if (toggle=='group'){
  723. for(i=0;i<option.length;i++){
  724. if (level == ''){
  725. level += $(option[i]).val();
  726. }else{
  727. level += ','+$(option[i]).val();
  728. }
  729. }
  730. }else{
  731. var level = option.val();
  732. }
  733. var levelname = option.text();
  734. if( confirm("确定要将选中团长移动到 "+levelname+" 吗?") )
  735. {
  736. _this.attr('stop', 1).text("操作中...");
  737. $.ajax({
  738. url:"{:U('communityhead/changelevel')}",
  739. type:"post",
  740. dataType:'json',
  741. data:{
  742. level: level,
  743. ids: ids,
  744. toggle: toggle
  745. },
  746. success:function(ret){
  747. $("#modal-change").modal('hide');
  748. if(ret.status==1){
  749. alert("操作成功");
  750. setTimeout(function () {
  751. location.reload();
  752. },1000);
  753. }else{
  754. alert(ret.result.message);
  755. }
  756. }
  757. })
  758. }
  759. });
  760. $('.tg_community').click(function(){
  761. var community_id = $(this).attr("community_id");
  762. layer.closeAll();
  763. layer.open({
  764. type: 2,
  765. title: false,
  766. closeBtn: 1,
  767. scrollbar: false,
  768. area: ['200px', '200px'],
  769. shadeClose: true,
  770. content: "{:U('communityhead/community_qrcode')}/community_id/"+community_id
  771. });
  772. });
  773. $("[data-toggle='ajaxModal']").click(function () {
  774. var s_url = $(this).attr('data-href');
  775. ajax_url = s_url;
  776. console.log(23);
  777. $.ajax({
  778. url:s_url,
  779. type:"get",
  780. success:function(shtml){
  781. $('#ajaxModal').html(shtml);
  782. $("#ajaxModal").modal();
  783. }
  784. })
  785. });
  786. $(document).delegate(".modal-footer .btn-primary","click",function(){
  787. var s_data = $('#ajaxModal form').serialize();
  788. $.ajax({
  789. url:ajax_url,
  790. type:'post',
  791. dataType:'json',
  792. data:s_data,
  793. success:function(info){
  794. if(info.status == 0)
  795. {
  796. layer.msg(info.result.message,{icon: 1,time: 2000});
  797. }else if(info.status == 1){
  798. var go_url = location.href;
  799. if( info.result.hasOwnProperty("url") )
  800. {
  801. go_url = info.result.url;
  802. }
  803. layer.msg('操作成功',{time: 1000,
  804. end:function(){
  805. location.href = info.result.url;
  806. }
  807. });
  808. }
  809. }
  810. })
  811. return false;
  812. })
  813. </script>
  814. </body>