all.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <?php
  2. use common\services\xhCouponService;
  3. use common\services\xhUserService;
  4. use common\services\xhUserAssetService;
  5. use common\components\stringUtil;
  6. ?>
  7. <?php
  8. use backend\widgets\TabWidget;
  9. echo TabWidget::widget(['list' => $this->context->menuList, 'currentMenu' => $this->context->id]);
  10. ?>
  11. <div class="panel panel-default">
  12. <?php
  13. use backend\widgets\SubTabWidget;
  14. echo SubTabWidget::widget(['list' => $this->context->subMenuList, 'currentMenu' => $this->context->action->id]);
  15. ?>
  16. <div class="panel-body">
  17. <div class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  18. <div class="row">
  19. <form action="" method="GET">
  20. <div class="col-xs-6" style="width:90%;">
  21. <div class="dataTables_length" style="padding-bottom:10px">
  22. <label>昵称/手机号:<input type="search" value="<?php if (isset($_GET['content'])) {
  23. echo $_GET['content'];
  24. } ?>" class="form-control" name="content" placeholder=""></label>
  25. <input class="btn btn-secondary btn-single" type="submit" name="" value="搜索"/>
  26. <span style="margin-left:30px;font-size:14px;">
  27. <span>客户数:<b><?= $merchantAsset['totalUser'] ?></b></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  28. <span>粉丝数:<b><?= $merchantAsset['totalFans'] ?></b></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  29. <span>会员数:<b><?= $merchantAsset['totalMember'] ?></b></span>
  30. </span>
  31. </div>
  32. </div>
  33. </form>
  34. </div>
  35. <div class="table-responsive">
  36. <table class="table table-bordered table-striped table-hover table-condensed">
  37. <thead>
  38. <tr class="active">
  39. <th class="no-sorting hidden-xs"><input name="selectAll" type="checkbox"></th>
  40. <th class="hidden-xs">ID</th>
  41. <th class="hidden-xs">头像</th>
  42. <th>来源&nbsp;昵称</th>
  43. <th class="hidden-xs">手机号</th>
  44. <th class="hidden-xs">标签</th>
  45. <th class="hidden-xs">会员级别</th>
  46. <th class="hidden-xs">余额</th>
  47. <th class="hidden-xs">积分</th>
  48. <th class="hidden-xs">关注公众号</th>
  49. <th class="hidden-xs">最近访问</th>
  50. <th>操作</th>
  51. </tr>
  52. </thead>
  53. <tbody class="middle-align">
  54. <?php foreach ($models as $key => $val) {
  55. if ($val['id'] == 12541128) {
  56. continue;
  57. } ?>
  58. <tr>
  59. <td class="hidden-xs"><input name="uId" value="<?= $val['id'] ?>" type="checkbox"></td>
  60. <td class="hidden-xs">
  61. <a href="/user/detail?id=<?= $val['id'] ?>" title="<?= $val['userName'] ?>"><?= $val['id'] ?>
  62. </td>
  63. <td class="hidden-xs">
  64. <a href="/user/detail?id=<?= $val['id'] ?>" title="<?= $val['userName'] ?>">
  65. <img src="<?php if (!empty($val['avatar'])) {
  66. $avatar = xhUserService::getAvatarList($val['avatar']);
  67. echo Yii::$app->params['imgUrl'] . $avatar['small'];
  68. } else {
  69. echo Yii::$app->params['imgUrl'] . '/unknowavatar.png';
  70. } ?>"
  71. style="width:20px;border-radius:10px;"/> </a>
  72. </td>
  73. <td>
  74. &nbsp;<img src="/images/<?= $this->context->sourceImg[$val['source']] ?>" width="15"/>
  75. &nbsp;
  76. <a class="add-under-line" href="/user/detail?id=<?= $val['id'] ?>" title="<?= $val['userName'] ?>"><?php echo stringUtil::subStringUtf8($val['userName'], 10, '..'); ?></a>
  77. </td>
  78. <td class="hidden-xs">
  79. <?= $val['mobile'] ?>
  80. </td>
  81. <td class="hidden-xs">
  82. <?php
  83. $cacheTag = isset($val['tag']) ? $val['tag'] : '';
  84. if (!empty($cacheTag)) {
  85. $cacheTagList = explode(',', $cacheTag);
  86. foreach ($cacheTagList as $cacheKey => $cacheVal) {
  87. if (isset($merchantTag[$cacheVal])) {
  88. echo '<a href="javascript:void(0)" title="' . $merchantTag[$cacheVal] . '">' . stringUtil::subStringUtf8($merchantTag[$cacheVal], 3, '…') . '</a><br />';
  89. }
  90. }
  91. }
  92. $userAsset = xhUserAssetService::getByUserId($val['id']);
  93. $coupon = xhCouponService::getUserCoupon($val['id']);
  94. $couponJson = json_encode($coupon);
  95. ?>
  96. </td>
  97. <td class="hidden-xs">
  98. <?php
  99. if ($userAsset['memberLevel'] > 0) {
  100. echo $userAsset['memberLevel'];
  101. } else {
  102. if ($userAsset['integral']) {
  103. echo '积分卡';
  104. }
  105. } ?>
  106. </td>
  107. <td class="hidden-xs">
  108. <?php if ($userAsset['balance'] > 0) { ?>
  109. <a style="background-color: #68b828;color:white;padding:2px;border-radius:5px;text-decoration:none;color:#ffffff;" href="/capital/user?id=<?= $val['id'] ?>">
  110. <?= $userAsset['balance'] ?>
  111. </a>
  112. <?php } ?>
  113. </td>
  114. <td class="hidden-xs">
  115. <?php if ($userAsset['integral'] > 0) { ?>
  116. <a style="background-color: #68b828;color:white;padding:2px;border-radius:5px;text-decoration:none;color:#ffffff;"
  117. href="/integral/user?id=<?= $val['id'] ?>"><?= $userAsset['integral'] ?></a>
  118. <?php } ?>
  119. </td>
  120. <td class="hidden-xs">
  121. <?php if ($val['subscribe'] == 1) { ?>
  122. <a href="javascript:void(0)" style="color:#68b828;"><i class="fa fa-check"></i></a>
  123. <?php } ?>
  124. </td>
  125. <td><?php if (!empty($val['visitTime'])) {
  126. if (date("m-d") == date("m-d", $val['visitTime'])) {
  127. echo '今天 ' . date("H:i", $val['visitTime']);
  128. } else {
  129. echo date("m-d H:i", $val['visitTime']);
  130. }
  131. } ?></td>
  132. <td style="text-align:center;">
  133. <a href="javascript:void(0);" title="充值" style="color:#68b828;" onclick="globalRecharge(<?= $val['id'] ?>,'<?= $val['userName'] ?>')">
  134. <i class="fa-rmb"></i> </a>
  135. &nbsp;&nbsp;&nbsp;
  136. <a href="javascript:void(0);" title="绑定手机" style="color:#68b828;font-size:15px;" onclick="globalBindMobile(<?= $val['id'] ?>,'<?= $val['userName'] ?>')">
  137. <i class="fa-mobile"></i> </a>
  138. <style>
  139. .all_user_more {
  140. position: relative;
  141. margin-left: 14px;
  142. }
  143. .all_user_more .all_user_show_more_list {
  144. display: none;
  145. width: 100px;
  146. z-index: 9999;
  147. position: absolute;
  148. right: -40px;
  149. top: 15px;
  150. text-align: center;
  151. background: white;
  152. border: 1px solid #ccc;
  153. border-top: none;
  154. height: 95px;
  155. }
  156. .all_user_more .all_user_show_more_list dd {
  157. padding: 6px 0 6px 0;
  158. border-top: 1px solid #ccc;
  159. cursor: pointer;
  160. }
  161. </style>
  162. <span class="all_user_more" id="all_user_more_<?= $val['id'] ?>">
  163. <a href="javascript:;" class="all_user_text" id="all_user_text_<?= $val['id'] ?>">更多</a>
  164. <div class="all_user_show_more_list" id="all_user_show_more_list_<?= $val['id'] ?>">
  165. <dl>
  166. <dd onclick="upgradeUser('<?= $val['userName'] ?>',<?= $val['id'] ?>)">升级</dd>
  167. <dd onclick="resetPassword('<?= $val['userName'] ?>',<?= $val['id'] ?>)">重置支付密码</dd>
  168. <dd onclick="remarkInfo('<?= $val['userName'] ?>',<?= $val['id'] ?>)">备注信息</dd>
  169. </dl>
  170. </div>
  171. </span>
  172. <script>
  173. var all_user_t_<?= $val['id'] ?>;
  174. $("#all_user_text_<?= $val['id'] ?>").mouseover(function () {
  175. console.log('abc');
  176. clearTimeout(all_user_t_<?= $val['id'] ?>);
  177. $('#all_user_show_more_list_<?= $val['id'] ?>').css('display', 'block');
  178. }).mouseout(function () {
  179. all_user_t_<?= $val['id'] ?> = setTimeout(function () {
  180. $('#all_user_show_more_list_<?= $val['id'] ?>').css('display', 'none');
  181. }, 100);
  182. })
  183. $("#all_user_show_more_list_<?= $val['id'] ?>").mouseover(function () {
  184. clearTimeout(all_user_t_<?= $val['id'] ?>);
  185. }).mouseout(function () {
  186. all_user_t_<?= $val['id'] ?> = setTimeout(function () {
  187. $('#all_user_show_more_list_<?= $val['id'] ?>').css('display', 'none');
  188. }, 100);
  189. });
  190. $("#all_user_show_more_list_<?= $val['id'] ?> > dl > dd").each(function () {
  191. $(this).mousemove(function () {
  192. clearTimeout(all_user_t_<?= $val['id'] ?>);
  193. $(this).css('background', '#f5f5f5');
  194. }).mouseout(function () {
  195. $(this).css('background', '#FFFFFF');
  196. });
  197. });
  198. </script>
  199. </td>
  200. </tr>
  201. <?php } ?>
  202. </tbody>
  203. </table>
  204. </div>
  205. <div class="row">
  206. <div>
  207. <div class="dataTables_paginate paging_simple_numbers"
  208. style="float:right;padding-top:0px;margin-right:15px;">
  209. <?= $pages ?>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. <!-- footer -->
  217. <?php
  218. use backend\widgets\FooterWidget;
  219. ?>
  220. <?= FooterWidget::widget() ?>
  221. <!-- footer -->
  222. <!-- modal 升级会员确认提醒框 -->
  223. <div class="modal fade" id="memberModal">
  224. <div class="modal-dialog" style="height:300px;">
  225. <div class="modal-content">
  226. <div class="modal-header">
  227. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  228. <h4 class="modal-title">消息提示</h4>
  229. </div>
  230. <div class="modal-body">
  231. <div class="row">
  232. <div class="col-md-6">
  233. <div class="form-group">
  234. <label for="field-1" class="control-label">确认将 <span></span>会员等级设置为</label>
  235. <select class="form-control" name="memberLevel">
  236. <?php foreach ($memberIntegral as $key => $val) { ?>
  237. <?php echo '<option value="' . $val['level'] . '">' . $val['level'] . '级 ' . $val['discount'] . '折</option>'; ?>
  238. <?php } ?>
  239. </select>
  240. </div>
  241. </div>
  242. </div>
  243. <input type="hidden" name="upgradeUserId" value=""/>
  244. <div class="row">
  245. <div class="col-md-6">
  246. <div class="form-group">
  247. <label for="field-1" class="control-label">请输入确认密码:</label>
  248. <input type="password" class="form-control" name="confirmPassword" placeholder="" value="">
  249. </div>
  250. </div>
  251. </div>
  252. </div>
  253. <div class="modal-footer">
  254. <button type="button" class="btn btn-info" name="memberConfirmButton">确认</button>
  255. <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
  256. </div>
  257. </div>
  258. </div>
  259. </div>
  260. <script>
  261. //升级为会员 取消会员操作
  262. function upgradeUser(name, id) {
  263. $("#memberModal .modal-body span").text(name);
  264. $("#memberModal .modal-body input[name=upgradeUserId]").val(id);
  265. jQuery('#memberModal').modal('show', {backdrop: 'fade'});
  266. }
  267. $(function () {
  268. //确认升级会员
  269. jQuery("button[name=memberConfirmButton]").click(function () {
  270. var confirmPassword = $("#memberModal .modal-body input[name=confirmPassword]").val();
  271. var upgradeUserId = $("#memberModal .modal-body input[name=upgradeUserId]").val();
  272. var memberLevel = $("select[name=memberLevel]").find("option:selected").val();
  273. $.ajax({
  274. type: "GET",
  275. url: "/user/upgrade?confirmPassword=" + confirmPassword + "&memberLevel=" + memberLevel + '&userId=' + upgradeUserId,
  276. async: false,
  277. dataType: 'json',
  278. success: function (data) {
  279. if (data.code == 'A0001') {
  280. setTimeout(function () {
  281. window.location.reload();
  282. }, 2000);
  283. }
  284. xhPopMsg(data.msg, 2000);
  285. }
  286. });
  287. });
  288. });
  289. </script>
  290. <script>
  291. //全选 全不选
  292. $(":checkbox[name=selectAll]").click(function () {
  293. var status = $(this).prop("checked");
  294. if (status == true) {
  295. $(":checkbox[name=uId]").prop("checked", true);
  296. } else {
  297. $(":checkbox[name=uId]").prop("checked", false);
  298. }
  299. });
  300. </script>
  301. <!-- 添加标签 -->
  302. <div class="modal fade" id="userTagModal">
  303. <div class="modal-dialog" style="height:450px;">
  304. <div class="modal-content">
  305. <div class="modal-header">
  306. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  307. <h4 class="modal-title">请选择你要添加的标签</h4>
  308. </div>
  309. <div class="modal-body">
  310. <input type="hidden" name="requestUrl" value="/user/batch-add-user-tag"/>
  311. <?php if (!empty($merchantTag)) { ?>
  312. <?php foreach ($merchantTag as $key => $val) { ?>
  313. <div class="row">
  314. <div class="col-md-6">
  315. <div class="checkbox">
  316. <label> <input name="theTag" value="<?= $key ?>" type="radio"> <?= $val ?>
  317. </label>
  318. </div>
  319. </div>
  320. </div>
  321. <?php }
  322. } ?>
  323. </div>
  324. <div class="modal-footer">
  325. <button type="button" class="btn btn-info" name="userTagConfirmButton">确认</button>
  326. <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
  327. </div>
  328. </div>
  329. </div>
  330. </div>
  331. <script>
  332. var shopProvince = "<?=$merchant['shopProvince'] ?>";
  333. var shopCity = "<?=$merchant['shopCity'] ?>";
  334. $("button[name=multipConfirm]").click(function () {
  335. var ids = new Array();
  336. $(":checkbox[name=uId]:checked").each(function () {
  337. var theId = $(this).val();
  338. ids.push(theId);
  339. });
  340. if (ids.length <= 0) {
  341. xhPopMsg('请选择你要操作的用户', 1300);
  342. return;
  343. }
  344. var option = $("select[name=doOption]").val();
  345. option = parseInt(option);
  346. switch (option) {
  347. case 0:
  348. //批量添加标签
  349. jQuery('#userTagModal').modal('show');
  350. break;
  351. case 1:
  352. xhPopMsg('此功能开发中…', 1300);
  353. break;
  354. }
  355. });
  356. //确认添加标签
  357. jQuery("button[name=userTagConfirmButton]").click(function () {
  358. var tagId = $("#userTagModal .modal-body :input[name=theTag]:checked").val();
  359. var url = $("#userTagModal .modal-body input[name=requestUrl]").val();
  360. var ids = new Array();
  361. $(":checkbox[name=uId]:checked").each(function () {
  362. var theId = $(this).val();
  363. ids.push(theId);
  364. });
  365. if (ids.length <= 0) {
  366. xhPopMsg('请选择用户', 1300);
  367. return;
  368. }
  369. var userIdStr = ids.join(',');
  370. $.ajax({
  371. type: "GET",
  372. url: url + '?tagId=' + tagId + '&userIdStr=' + userIdStr,
  373. async: false,
  374. dataType: 'json',
  375. success: function (data) {
  376. xhPopMsg(data.msg, 1300);
  377. if (data.code == 'A0001') {
  378. setTimeout(function () {
  379. window.location.reload();
  380. }, 1000);
  381. }
  382. }
  383. });
  384. });
  385. </script>
  386. <!-- 重置支付密码 -->
  387. <div class="modal fade" id="resetPasswordConfirmMention">
  388. <div class="modal-dialog" style="height:300px;">
  389. <div class="modal-content">
  390. <div class="modal-header">
  391. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  392. <h4 class="modal-title">提示</h4>
  393. </div>
  394. <div class="modal-body">
  395. 确认对 <span></span> 的支付密码进行重置? <input type="hidden" name="resetUserId" value=""/>
  396. </div>
  397. <div class="modal-footer">
  398. <button type="button" class="btn btn-info" name="resetPasswordConfirmOk">确认</button>
  399. <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
  400. </div>
  401. </div>
  402. </div>
  403. </div>
  404. <script>
  405. function remarkInfo(userName, id) {
  406. xhPopMsg('开发中...');
  407. }
  408. function resetPassword(userName, id) {
  409. $("#resetPasswordConfirmMention .modal-body span").text(userName);
  410. $("#resetPasswordConfirmMention .modal-body input[name=resetUserId]").val(id);
  411. jQuery('#resetPasswordConfirmMention').modal('show', {backdrop: 'fade'}).css({
  412. 'margin-top': function () {
  413. var modalHeight = jQuery("#resetPasswordConfirmMention").find('.modal-dialog').height();
  414. return ($(window).height() / 2 - (modalHeight / 2));
  415. }
  416. });
  417. }
  418. $(function () {
  419. //点击确认操作
  420. jQuery("button[name=resetPasswordConfirmOk]").click(function () {
  421. var resetUserId = jQuery("#resetPasswordConfirmMention .modal-body input[name=resetUserId]").val();
  422. var url = '/user/reset-pay-password?id=' + resetUserId;
  423. $.ajax({
  424. type: "GET", url: url, async: false, dataType: 'json', success: function (data) {
  425. if (data.code == 'A0001') {
  426. xhPopMsg('操作成功');
  427. $('#resetPasswordConfirmMention').modal('hide');
  428. return;
  429. }
  430. xhPopMsg(data.msg);
  431. }
  432. });
  433. });
  434. });
  435. </script>