index.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. <link href="{__FRAME_PATH}css/plugins/iCheck/custom.css" rel="stylesheet">
  4. <script src="{__PLUG_PATH}moment.js"></script>
  5. <link rel="stylesheet" href="{__PLUG_PATH}daterangepicker/daterangepicker.css">
  6. <script src="{__PLUG_PATH}daterangepicker/daterangepicker.js"></script>
  7. <script src="{__ADMIN_PATH}frame/js/plugins/iCheck/icheck.min.js"></script>
  8. <link href="{__FRAME_PATH}css/plugins/footable/footable.core.css" rel="stylesheet">
  9. <script src="{__PLUG_PATH}sweetalert2/sweetalert2.all.min.js"></script>
  10. <script src="{__FRAME_PATH}js/plugins/footable/footable.all.min.js"></script>
  11. <style>
  12. .on-tag{background-color: #eea91e;}
  13. .height-auto{height: 300px;}
  14. .tag{border: solid 1px #eee;}
  15. </style>
  16. {/block}
  17. {block name="content"}
  18. <div class="row">
  19. <div class="col-sm-12">
  20. <div class="ibox">
  21. <!--<div class="ibox-title">
  22. <button type="button" class="btn btn-w-m btn-primary grant">发放优惠券</button>
  23. <button type="button" class="btn btn-w-m btn-primary" onclick="$eb.createModalFrame(this.innerText,'{:Url('store.storeCoupon/grant_subscribe')}',{'w':800})">给关注的用户发放优惠券</button>
  24. <button type="button" class="btn btn-w-m btn-primary" onclick="$eb.createModalFrame(this.innerText,'{:Url('store.storeCoupon/grant_all')}',{'w':800})">给所有用户发放优惠券</button>
  25. <button type="button" class="btn btn-w-m btn-primary" onclick="$eb.createModalFrame(this.innerText,'{:Url('store.storeCoupon/grant_group')}',{'w':800})">给分组用户发放优惠券</button>
  26. <button type="button" class="btn btn-w-m btn-primary" onclick="$eb.createModalFrame(this.innerText,'{:Url('store.storeCoupon/grant_tag')}',{'w':800})">给标签用户发放优惠券</button>
  27. </div>-->
  28. <div class="ibox-content">
  29. <div class="row">
  30. <div class="m-b m-l">
  31. <form action="" class="form-inline" id="form" method="get">
  32. <div class="search-item" data-name="data">
  33. <span>选择时间:</span>
  34. <button type="button" class="btn btn-outline btn-link" data-value="">全部</button>
  35. <button type="button" class="btn btn-outline btn-link" data-value="{$limitTimeList.today}">今天</button>
  36. <button type="button" class="btn btn-outline btn-link" data-value="{$limitTimeList.week}">本周</button>
  37. <button type="button" class="btn btn-outline btn-link" data-value="{$limitTimeList.month}">本月</button>
  38. <button type="button" class="btn btn-outline btn-link" data-value="{$limitTimeList.quarter}">本季度</button>
  39. <button type="button" class="btn btn-outline btn-link" data-value="{$limitTimeList.year}">本年</button>
  40. <div class="datepicker" style="display: inline-block;">
  41. <button type="button" class="btn btn-outline btn-link" data-value="{$where.data?:'no'}">自定义时间</button>
  42. </div>
  43. <input class="search-item-value" type="hidden" name="data" value="{$where.data}" />
  44. <input class="search-item-value" type="hidden" name="groupid" value="{$where.groupid}" />
  45. <input class="search-item-value" type="hidden" name="tagid_list" value="{$where.tagid_list}" />
  46. <input class="search-item-value" type="hidden" name="sex" value="{$where.sex}" />
  47. <input class="search-item-value" type="hidden" name="subscribe" value="{$where.subscribe}" />
  48. <input class="search-item-value" type="hidden" name="stair" value="" />
  49. <input class="search-item-value" type="hidden" name="second" value="" />
  50. <input class="search-item-value" type="hidden" name="order_stair" value="" />
  51. <input class="search-item-value" type="hidden" name="order_second" value="" />
  52. <input class="search-item-value" type="hidden" name="now_money" value="" />
  53. <input class="search-item-value" type="hidden" id="batch" name="batch" value="" />
  54. </div>
  55. <hr>
  56. <div class="tag-item" data-name="tagid_list">
  57. <span>用户标签:</span>
  58. {volist name="tagList" id="vo"}
  59. <button type="button" class="btn btn-outline btn-link tag" data-value="{$vo.id}">{$vo.name}</button>
  60. {/volist}
  61. <input class="tag-item-value" type="hidden" name="tagid_list" value="{$where.tagid_list}" />
  62. </div>
  63. <hr>
  64. <div class="btn-group">
  65. <button data-toggle="dropdown" class="btn btn-white btn-xs dropdown-toggle" style="padding: 5px 15px;"
  66. aria-expanded="false">批量操作
  67. <span class="caret"></span>
  68. </button>
  69. <ul class="dropdown-menu left">
  70. <li>
  71. <a class="save_mark grant" href="javascript:void(0);" >
  72. <i class="fa fa-space-shuttle"></i> 发放优惠券
  73. </a>
  74. </li>
  75. <li>
  76. <a class="save_mark news" href="javascript:void(0);" >
  77. <i class="fa fa-space-shuttle"></i> 发送消息
  78. </a>
  79. </li>
  80. </ul>
  81. </div>
  82. <div class="input-group" style="float: right">
  83. <input type="text" name="nickname" value="{$where.nickname}" placeholder="请输入会员名称" class="input-sm form-control">
  84. <input type="hidden" name="export" value="{$where.export}" />
  85. <span class="input-group-btn">
  86. <button type="submit" class="btn btn-sm btn-primary"> <i class="fa fa-search"></i>搜索</button>
  87. <button style="margin: 0 16px" type="submit" id="export" class="btn btn-sm btn-info btn-outline"> <i class="fa fa-exchange" ></i> Excel导出</button>
  88. <script>
  89. $('#export').on('click',function(){
  90. $('input[name=export]').val(1);
  91. });
  92. $('#no_export').on('click',function(){
  93. $('input[name=export]').val(0);
  94. });
  95. </script>
  96. </span>
  97. </div>
  98. </form>
  99. </div>
  100. </div>
  101. <div class="table-responsive">
  102. <table class="table table-striped table-bordered" data-page-size="20">
  103. <thead>
  104. <tr>
  105. <th class="text-cente">
  106. <div class="btn-group">
  107. <button data-toggle="dropdown" class="btn btn-white btn-xs dropdown-toggle" style="font-weight: bold;background-color: #f5f5f6;border: solid 0;"
  108. aria-expanded="false">
  109. 选择
  110. <span class="caret"></span>
  111. </button>
  112. <ul class="dropdown-menu left">
  113. <li class="this-page">
  114. <a class="save_mark" href="javascript:void(0);" >
  115. <i class="fa fa-check-square-o"></i>本页用户
  116. </a>
  117. </li>
  118. <li class="this-all">
  119. <a class="save_mark" href="javascript:void(0);">
  120. <i class="fa fa-check-square"></i>全部用户
  121. </a>
  122. </li>
  123. <li class="this-up">
  124. <a class="save_mark" href="javascript:void(0);">
  125. <i class="fa fa-square-o"></i>取消选择
  126. </a>
  127. </li>
  128. </ul>
  129. </div>
  130. </th>
  131. <th class="text-center">编号</th>
  132. <th class="text-center">微信用户名称</th>
  133. <th class="text-center">头像</th>
  134. <th class="text-center">
  135. <div class="btn-group">
  136. <button data-toggle="dropdown" class="btn btn-white btn-xs dropdown-toggle" style="font-weight: bold;background-color: #f5f5f6;border: solid 0;"
  137. aria-expanded="false">性别
  138. <span class="caret"></span>
  139. </button>
  140. <ul class="dropdown-menu search-item" data-name="sex">
  141. <li data-value="">
  142. <a class="save_mark" href="javascript:void(0);" >
  143. <i class="fa fa-venus-mars"></i>全部
  144. </a>
  145. </li>
  146. <li data-value="1">
  147. <a class="save_mark" href="javascript:void(0);" >
  148. <i class="fa fa-mars"></i>男
  149. </a>
  150. </li>
  151. <li data-value="2">
  152. <a class="save_mark" href="javascript:void(0);">
  153. <i class="fa fa-venus"></i>女
  154. </a>
  155. </li>
  156. <li data-value="0">
  157. <a class="save_mark" href="javascript:void(0);">
  158. <i class="fa fa-transgender"></i>保密
  159. </a>
  160. </li>
  161. </ul>
  162. </div>
  163. </th>
  164. <th class="text-center no-sort">地区</th>
  165. <th class="text-center">
  166. <div class="btn-group">
  167. <button data-toggle="dropdown" class="btn btn-white btn-xs dropdown-toggle" style="font-weight: bold;background-color: #f5f5f6;border: solid 0;"
  168. aria-expanded="false">是否关注公众号
  169. <span class="caret"></span>
  170. </button>
  171. <ul class="dropdown-menu search-item" data-name="subscribe">
  172. <li data-value="">
  173. <a class="save_mark" href="javascript:void(0);" >
  174. 全部
  175. </a>
  176. </li>
  177. <li data-value="1">
  178. <a class="save_mark" href="javascript:void(0);" >
  179. 关注
  180. </a>
  181. </li>
  182. <li data-value="0">
  183. <a class="save_mark" href="javascript:void(0);">
  184. 未关注
  185. </a>
  186. </li>
  187. </ul>
  188. </div>
  189. </th>
  190. <th class="text-center">
  191. <div class="btn-group">
  192. <button data-toggle="dropdown" class="btn btn-white btn-xs dropdown-toggle" style="font-weight: bold;padding: 6px 50px;background-color: #f5f5f6;border: solid 0;"
  193. aria-expanded="false">用户分组
  194. <span class="caret"></span>
  195. </button>
  196. <ul class="dropdown-menu search-item" data-name="groupid">
  197. <li data-value="-1">
  198. <a class="save_mark" href="javascript:void(0);" >
  199. 全部
  200. </a>
  201. </li>
  202. {volist name="groupList" id="vo"}
  203. <li data-value="{$vo.id}">
  204. <a class="save_mark" href="javascript:void(0);" >
  205. {$vo.name}
  206. </a>
  207. </li>
  208. {/volist}
  209. </ul>
  210. </div>
  211. </th>
  212. <th class="text-center">用户标签</th>
  213. <!-- <th class="text-center">首次关注时间</th>-->
  214. <th class="text-center">操作</th>
  215. </tr>
  216. </thead>
  217. <tbody>
  218. <?php $count = count($list); ?>
  219. {if condition="$count"}
  220. {volist name="list" id="vo"}
  221. <tr>
  222. <td class="text-center">
  223. <label class="checkbox-inline i-checks">
  224. <input type="checkbox" name="coupon[]" value="{$vo.uid}">
  225. </label>
  226. </td>
  227. <td class="text-center">
  228. {$vo.uid}
  229. </td>
  230. <td class="text-center">
  231. {$vo.nickname}
  232. </td>
  233. <td class="text-center">
  234. <img src="{$vo.headimgurl}" alt="{$vo.nickname}" title="{$vo.nickname}" style="width:50px;height: 50px;cursor: pointer;" class="head_image" data-image="{$vo.headimgurl}">
  235. </td>
  236. <td class="text-center">
  237. {if condition="$vo['sex'] eq 1"}
  238. {elseif condition="$vo['sex'] eq 2"/}
  239. {else/}
  240. 保密
  241. {/if}
  242. </td>
  243. <td class="text-center">
  244. {$vo.country}{$vo.province}{$vo.city}
  245. </td>
  246. <td class="text-center">
  247. {if condition="$vo['subscribe']"}
  248. 关注
  249. {else/}
  250. 未关注
  251. {/if}
  252. </td>
  253. <td class="text-center">
  254. <?php if(!is_array($groupList)){ ?>
  255. <?php }else{ ?>
  256. <?php if(!$groupList || $vo['groupid'] == 0 || !isset($groupList[$vo['groupid']])){ ?>
  257. <?php }else{ ?>
  258. <span class="badge badge-primary">{$groupList[$vo['groupid']]['name']}</span>
  259. <?php } ?>
  260. <?php }?>
  261. </td>
  262. <td class="text-center">
  263. <?php if(!is_array($tagList)){ ?>
  264. <?php }else{ ?>
  265. <?php $tagId = explode(',',$vo['tagid_list']);
  266. if(!$tagList || $vo['tagid_list'] == ''|| !$tagId){ ?>
  267. <?php }else{ foreach($tagId as $tag){ if(isset($tagList[$tag])){?>
  268. <span class="badge badge-info">{$tagList[$tag]['name']}</span>
  269. <?php }?>
  270. <?php } } ?>
  271. <?php }?>
  272. </td>
  273. <!-- <td class="text-center">-->
  274. <!-- {$vo.add_time|date="Y-m-d H:i:s"}-->
  275. <!-- </td>-->
  276. <td class="text-center">
  277. <div class="btn-group">
  278. <button data-toggle="dropdown" class="btn btn-warning btn-xs dropdown-toggle"
  279. aria-expanded="false">操作
  280. <span class="caret"></span>
  281. </button>
  282. <ul class="dropdown-menu">
  283. {if $vo.openid && $vo.subscribe == 1}
  284. <li>
  285. <a class="save_mark" href="javascript:void(0);" onclick="$eb.createModalFrame('修改分组','{:Url('edit_user_group',['openid'=>$vo['openid']])}',{w:350,h:500})" >
  286. 修改分组
  287. </a>
  288. </li>
  289. <li>
  290. <a class="save_mark" href="javascript:void(0);" onclick="$eb.createModalFrame('修改标签','{:Url('edit_user_tag',['openid'=>$vo['openid']])}',{w:350,h:500})" >
  291. 修改标签
  292. </a>
  293. </li>
  294. <li>
  295. <a class="save_mark synchro" href="javascript:void(0);" data-url="{:Url('synchro_tag',['openid'=>$vo['openid']])}" >
  296. 同步标签
  297. </a>
  298. </li>
  299. {else/}
  300. <li>
  301. <a class="save_mark" href="javascript:void(0);">
  302. 无法操作
  303. </a>
  304. </li>
  305. {/if}
  306. </ul>
  307. </div>
  308. </td>
  309. </tr>
  310. {/volist}
  311. {else/}
  312. <tr id="content" style="display:none;height:400px;"></tr>
  313. {/if}
  314. </tbody>
  315. </table>
  316. </div>
  317. {include file="public/inner_page"}
  318. </div>
  319. </div>
  320. </div>
  321. </div>
  322. {/block}
  323. {block name="script"}
  324. <script>
  325. window.$list = <?php echo json_encode($list);?>;
  326. window.$uidAll = <?php echo json_encode($uidAll);?>;
  327. window.$where = <?php echo json_encode($where);?>;
  328. $('.this-page').on('click',function () {
  329. $('input[name="coupon[]"]').each(function(){
  330. $(this).checked = true;
  331. $(this).parent().addClass('checked');
  332. $('#batch').val(1);
  333. });
  334. })
  335. $('.this-all').on('click',function () {
  336. $('input[name="coupon[]"]').each(function(){
  337. $(this).checked = true;
  338. $(this).parent().addClass('checked');
  339. $('#batch').val(2);
  340. });
  341. })
  342. $('.this-up').on('click',function () {
  343. $('input[name="coupon[]"]').each(function(){
  344. $(this).checked = false;
  345. $(this).parent().removeClass('checked');
  346. $('#batch').val('');
  347. });
  348. })
  349. $(function init() {
  350. $('.search-item>.btn').on('click', function () {
  351. var that = $(this), value = that.data('value'), p = that.parent(), name = p.data('name'), form = p.parents();
  352. form.find('input[name="' + name + '"]').val(value);
  353. $('input[name=export]').val(0);
  354. form.submit();
  355. });
  356. $('.tag-item>.btn').on('click', function () {
  357. var that = $(this), value = that.data('value'), p = that.parent(), name = p.data('name'), form = p.parents(),list = $('input[name="' + name + '"]').val().split(',');
  358. var bool = 0;
  359. $.each(list,function (index,item) {
  360. if(item == value){
  361. bool = 1
  362. list.splice(index,1);
  363. }
  364. })
  365. if(!bool) list.push(''+value+'');
  366. form.find('input[name="' + name + '"]').val(list.join(','));
  367. $('input[name=export]').val(0);
  368. form.submit();
  369. });
  370. $('.search-item>li').on('click', function () {
  371. var that = $(this), value = that.data('value'), p = that.parent(), name = p.data('name'), form = $('#form');
  372. form.find('input[name="' + name + '"]').val(value);
  373. $('input[name=export]').val(0);
  374. form.submit();
  375. });
  376. $('.search-item>li').each(function () {
  377. var that = $(this), value = that.data('value'), p = that.parent(), name = p.data('name');
  378. if($where[name]) $('.'+name).css('color','#1ab394');
  379. });
  380. $('.search-item-value').each(function () {
  381. var that = $(this), name = that.attr('name'), value = that.val(), dom = $('.search-item[data-name="' + name + '"] .btn[data-value="' + value + '"]');
  382. dom.eq(0).removeClass('btn-outline btn-link').addClass('btn-primary btn-sm')
  383. .siblings().addClass('btn-outline btn-link').removeClass('btn-primary btn-sm')
  384. });
  385. $('.tag-item-value').each(function () {
  386. var that = $(this), name = that.attr('name'), value = that.val().split(',');
  387. dom = [];
  388. $.each(value,function (index,item) {
  389. dom.push($('.tag-item[data-name="' + name + '"] .btn[data-value="' + item + '"]'));
  390. })
  391. $.each(dom,function (index,item) {
  392. item.eq(0).removeClass('btn-outline btn-link tag').addClass('btn-primary btn-sm')
  393. })
  394. });
  395. })
  396. $('.i-checks').iCheck({
  397. checkboxClass: 'icheckbox_square-green',
  398. });
  399. $('.head_image').on('click',function (e) {
  400. var image = $(this).data('image');
  401. $eb.openImage(image);
  402. })
  403. var dateInput =$('.datepicker');
  404. dateInput.daterangepicker({
  405. autoUpdateInput: false,
  406. "opens": "center",
  407. "drops": "down",
  408. "ranges": {
  409. '今天': [moment(), moment().add(1, 'days')],
  410. '昨天': [moment().subtract(1, 'days'), moment()],
  411. '上周': [moment().subtract(6, 'days'), moment()],
  412. '前30天': [moment().subtract(29, 'days'), moment()],
  413. '本月': [moment().startOf('month'), moment().endOf('month')],
  414. '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
  415. },
  416. "locale" : {
  417. applyLabel : '确定',
  418. cancelLabel : '清空',
  419. fromLabel : '起始时间',
  420. toLabel : '结束时间',
  421. format : 'YYYY/MM/DD',
  422. customRangeLabel : '自定义',
  423. daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
  424. monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月',
  425. '七月', '八月', '九月', '十月', '十一月', '十二月' ],
  426. firstDay : 1
  427. }
  428. });
  429. dateInput.on('cancel.daterangepicker', function(ev, picker) {
  430. $("#data").val('');
  431. });
  432. dateInput.on('apply.daterangepicker', function(ev, picker) {
  433. $("input[name=data]").val(picker.startDate.format('YYYY/MM/DD') + ' - ' + picker.endDate.format('YYYY/MM/DD'));
  434. $('input[name=export]').val(0);
  435. $('#form').submit();
  436. });
  437. //发优惠券
  438. $('.grant').on('click',function (e) {
  439. var chk_value =[];
  440. var batch = $('#batch').val();
  441. if(batch == 1){
  442. $.each($list.data,function (index,item) {
  443. chk_value.push(item.uid);
  444. })
  445. }else if(batch == 2){
  446. chk_value = $uidAll;
  447. }else{
  448. $('input[name="coupon[]"]:checked').each(function(){
  449. chk_value.push($(this).val());
  450. str += $(this).val();
  451. });
  452. if(chk_value.length < 1){
  453. $eb.message('请选择要发放优惠券的用户');
  454. return false;
  455. }
  456. }
  457. var str = chk_value.join(',');
  458. // var url = "http://"+window.location.host+"/admin/ump.store_coupon/grant/id/"+str;
  459. var url = "{:Url('ump.store_coupon/grant')}?id="+str;
  460. $eb.createModalFrame(this.innerText,url,{'w':800});
  461. })
  462. $('.news').on('click',function (e) {
  463. var chk_value =[];
  464. var batch = $('#batch').val();
  465. if(batch == 1){
  466. $.each($list.data,function (index,item) {
  467. chk_value.push(item.uid);
  468. })
  469. }else if(batch == 2){
  470. chk_value = $uidAll;
  471. }else{
  472. $('input[name="coupon[]"]:checked').each(function(){
  473. chk_value.push($(this).val());
  474. str += $(this).val();
  475. });
  476. if(chk_value.length < 1){
  477. $eb.message('请选择要发消息的用户');
  478. return false;
  479. }
  480. }
  481. var str = chk_value.join(',');
  482. var url = "{:Url('wechat.wechat_news_category/send_news')}?id="+str;
  483. $eb.createModalFrame(this.innerText,url,{'w':800});
  484. })
  485. $('.synchro').on('click',function(){
  486. window.t = $(this);
  487. var _this = $(this),url =_this.data('url');
  488. $eb.$swal('delete',function(){
  489. $eb.axios.get(url).then(function(res){
  490. console.log(res);
  491. if(res.status == 200 && res.data.code == 200) {
  492. $eb.$swal('success',res.data.msg);
  493. }else
  494. return Promise.reject(res.data.msg || '同步失败')
  495. }).catch(function(err){
  496. $eb.$swal('error',err);
  497. });
  498. },{'title':'您确定要同步该用户的标签吗?','text':'请谨慎操作!','confirm':'是的,我要同步'})
  499. });
  500. </script>
  501. {/block}