list.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. <?php
  2. use common\services\xhCouponService;
  3. use common\services\xhUserService;
  4. use common\services\xhUserAssetService;
  5. use common\components\stringUtil;
  6. ?>
  7. <script src="/js/mobiscroll/mobiscroll.core-2.5.2.js" type="text/javascript"></script>
  8. <script src="/js/mobiscroll/mobiscroll.core-2.5.2-zh.js" type="text/javascript"></script>
  9. <link href="/css/mobiscroll/mobiscroll.core-2.5.2.css" rel="stylesheet" type="text/css"/>
  10. <link href="/css/mobiscroll/mobiscroll.animation-2.5.2.css" rel="stylesheet" type="text/css"/>
  11. <script src="/js/mobiscroll/mobiscroll.datetime-2.5.1.js" type="text/javascript"></script>
  12. <script src="/js/mobiscroll/mobiscroll.datetime-2.5.1-zh.js" type="text/javascript"></script>
  13. <!-- S 可根据自己喜好引入样式风格文件 -->
  14. <script src="/js/mobiscroll/mobiscroll.android-ics-2.5.2.js" type="text/javascript"></script>
  15. <script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp&libraries=geometry&key=OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH"></script>
  16. <link href="/css/mobiscroll/mobiscroll.android-ics-2.5.2.css" rel="stylesheet" type="text/css"/>
  17. <style>
  18. .main_index_bg_function .overview-item {
  19. width: 24%;
  20. display: inline-block;
  21. text-align: center;
  22. height: 50px;
  23. padding-top: 8px;
  24. background: #f8f8f8;
  25. }
  26. .main_index_bg_today .overview-item {
  27. width: 24%;
  28. display: inline-block;
  29. text-align: center;
  30. height: 50px;
  31. }
  32. .main_index_bg_wait .overview-item {
  33. width: 24%;
  34. display: inline-block;
  35. text-align: center;
  36. height: 50px;
  37. }
  38. </style>
  39. <div class="panel panel-default">
  40. <div class="panel-body">
  41. <div class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  42. <div class="row">
  43. <form action="" method="GET">
  44. <div class="col-xs-6" style="width:90%;">
  45. <div class="dataTables_length">
  46. <label>类型: <select name="class" class="form-control">
  47. <option <?php if (isset($_GET['class']) && $_GET['class'] == -1) {
  48. echo 'selected="selected"';
  49. } ?> value="-1">全部
  50. </option>
  51. <option <?php if (isset($_GET['class']) && $_GET['class'] == 1) {
  52. echo 'selected="selected"';
  53. } ?> value="1">会员
  54. </option>
  55. </select>
  56. </label>
  57. <label>昵称/手机号:<input type="search" value="<?php if (isset($_GET['content'])) {
  58. echo $_GET['content'];
  59. } ?>" class="form-control" name="content" placeholder=""></label>
  60. <input class="btn btn-secondary btn-single" type="submit" name="" value="搜索"/>
  61. </div>
  62. </div>
  63. </form>
  64. </div>
  65. <div class="table-responsive">
  66. <table class="table table-bordered table-striped table-hover table-condensed">
  67. <thead>
  68. <tr class="active">
  69. <th class="no-sorting hidden-xs"><input name="selectAll" type="checkbox"></th>
  70. <th class="hidden-xs">ID</th>
  71. <th class="hidden-xs">头像</th>
  72. <th>来源&nbsp;&nbsp;昵称</th>
  73. <th class="hidden-xs">手机号</th>
  74. <th class="hidden-xs">标签</th>
  75. <th class="hidden-xs">等级</th>
  76. <th class="hidden-xs">粉丝</th>
  77. <th class="hidden-xs">余额</th>
  78. <th class="hidden-xs">积分</th>
  79. <th>操作</th>
  80. </tr>
  81. </thead>
  82. <tbody class="middle-align">
  83. <?php foreach ($models as $key => $val) { ?>
  84. <tr>
  85. <td class="hidden-xs"><input name="uId" value="<?= $val['id'] ?>" type="checkbox"></td>
  86. <td class="hidden-xs"><?= $val['id'] ?></td>
  87. <td class="hidden-xs">
  88. <a href="/user/detail?id=<?= $val['id'] ?>" title="<?= $val['userName'] ?>">
  89. <img src="<?php if (!empty($val['avatar'])) {
  90. $avatar = xhUserService::getAvatarList($val['avatar']);
  91. echo Yii::$app->params['imgUrl'] . $avatar['small'];
  92. } else {
  93. echo Yii::$app->params['imgUrl'] .'/unknowavatar.png';
  94. } ?>"
  95. style="width:20px;border-radius:10px;"/>
  96. </a>
  97. </td>
  98. <td>
  99. <?php $rand = rand(0,2);if($rand == 0){ ?>
  100. <img src="/images/source_wx.jpg" width="15" />&nbsp;&nbsp;
  101. <?php } if($rand == 1){ ?>
  102. <img src="/images/source_xcx.jpg" width="15" />&nbsp;&nbsp;
  103. <?php } if($rand == 2){ ?>
  104. <img src="/images/source_zfb.jpg" width="15" />&nbsp;&nbsp;
  105. <?php } ?>
  106. <a class="add-under-line" href="/user/detail?id=<?= $val['id'] ?>"
  107. title="<?= $val['userName'] ?>"><?php echo stringUtil::subStringUtf8($val['userName'], 10, '..'); ?></a>
  108. </td>
  109. <td class="hidden-xs">
  110. <?= $val['mobile'] ?>
  111. </td>
  112. <td class="hidden-xs">
  113. <?php
  114. $cacheTag = isset($val['tag']) ? $val['tag'] : '';
  115. if (!empty($cacheTag)) {
  116. $cacheTagList = explode(',', $cacheTag);
  117. foreach ($cacheTagList as $cacheKey => $cacheVal) {
  118. if (isset($merchantTag[$cacheVal])) {
  119. echo '<a href="javascript:void(0)" title="' . $merchantTag[$cacheVal] . '">' . stringUtil::subStringUtf8($merchantTag[$cacheVal], 3, '…') . '</a><br />';
  120. }
  121. }
  122. }
  123. $userAsset = xhUserAssetService::getByUserId($val['id']);
  124. $coupon = xhCouponService::getUserCoupon($val['id']);
  125. $couponJson = json_encode($coupon);
  126. ?>
  127. </td>
  128. <td class="hidden-xs">
  129. <?php if (!empty($userAsset['memberLevel'])) { ?>
  130. <?php if (empty($val['subscribe'])) { ?>
  131. <a href="javascript:void(0)" data-toggle="tooltip" data-placement="bottom"
  132. title="" data-original-title="客户需关注公众号并申请会员卡,才能查看等级"
  133. style="color:#68b828;cursor:pointer;text-decoration:none;"
  134. <i="" class="fa-question-circle"></a>
  135. <?php } else { ?>
  136. <?php if (empty($val['mobile'])) { ?>
  137. <a href="javascript:void(0)" data-toggle="tooltip" data-placement="bottom"
  138. title="" data-original-title="客户需申请会员卡才能查看等级"
  139. style="color:#68b828;cursor:pointer;text-decoration:none;"
  140. <i="" class="fa-question-circle"></a>
  141. <?php } else { ?>
  142. <?php
  143. $level = $userAsset['memberLevel'];
  144. $discount = $memberIntegral[$level]['discount'];
  145. echo $userAsset['memberLevel'] . '/' . $discount . '折';
  146. ?>
  147. <?php } ?>
  148. <?php } ?>
  149. <?php } ?>
  150. </td>
  151. <td class="hidden-xs"><?php if ($val['subscribe'] == 1) echo '<a href="javascript:void(0)" style="color:#68b828;cursor:text" <i class="fa fa-check"></i></a>'; ?></td>
  152. <td class="hidden-xs"><?php if (!empty($userAsset['balance']) && $userAsset['balance'] != 0.00) { ?>
  153. <a
  154. style="background-color: #68b828;color:white;padding:2px;border-radius:5px;text-decoration:none;color:#ffffff;"
  155. href="/capital/user?id=<?= $val['id'] ?>"><?= $userAsset['balance'] ?></a><?php } ?>
  156. </td>
  157. <td class="hidden-xs">
  158. <?php if (!empty($userAsset['integral'])) { ?>
  159. <?php if (empty($val['subscribe'])) { ?>
  160. <a href="javascript:void(0)" data-toggle="tooltip" data-placement="bottom"
  161. title="" data-original-title="客户需关注公众号并申请会员卡,才能查看积分"
  162. style="color:#68b828;cursor:pointer;text-decoration:none;"
  163. <i="" class="fa-question-circle"></a>
  164. <?php } else { ?>
  165. <?php if (empty($val['mobile'])) { ?>
  166. <a href="javascript:void(0)" data-toggle="tooltip" data-placement="bottom"
  167. title="" data-original-title="客户需申请会员卡才能查看积分"
  168. style="color:#68b828;cursor:pointer;text-decoration:none;"
  169. <i="" class="fa-question-circle"></a>
  170. <?php } else { ?>
  171. <a style="background-color: #68b828;color:white;padding:2px;border-radius:5px;text-decoration:none;color:#ffffff;"
  172. href="/integral/user?id=<?= $val['id'] ?>"><?= $userAsset['integral'] ?></a>
  173. <?php } ?>
  174. <?php } ?>
  175. <?php } ?>
  176. </td>
  177. <td>
  178. <?php if ($val['subscribe'] == 1) { ?>
  179. <?php if (!empty($merchantExtend['recharge'])) { ?>
  180. <?php } ?>
  181. <?php if (!empty($merchantExtend['init'])) { ?>
  182. <?php } ?>
  183. <?php } ?>
  184. </td>
  185. </tr>
  186. <?php } ?>
  187. </tbody>
  188. </table>
  189. </div>
  190. <div class="row">
  191. <div>
  192. <div style="display:inline-block;margin-left:15px;">
  193. <label>
  194. <select name="doOption" aria-controls="example-1" class="form-control">
  195. <option value="0">添加标签</option>
  196. </select>
  197. </label>
  198. <button name="multipConfirm" class="btn btn-secondary btn-single">确认</button>
  199. </div>
  200. <div class="dataTables_paginate paging_simple_numbers"
  201. style="float:right;padding-top:0px;margin-right:15px;">
  202. <?= $pages ?>
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. </div>
  208. </div>
  209. <!-- footer -->
  210. <?php
  211. use backend\widgets\FooterWidget;
  212. ?>
  213. <?= FooterWidget::widget() ?>
  214. <!-- footer -->
  215. <!-- modal 升级会员确认提醒框 -->
  216. <div class="modal fade" id="memberModal">
  217. <div class="modal-dialog" style="height:300px;">
  218. <div class="modal-content">
  219. <div class="modal-header">
  220. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  221. <h4 class="modal-title">消息提示</h4>
  222. </div>
  223. <div class="modal-body">
  224. <div class="row">
  225. <div class="col-md-6">
  226. <div class="form-group">
  227. <label for="field-1" class="control-label">确认将 <span></span>会员等级设置为</label>
  228. <select class="form-control" name="memberLevel">
  229. <?php foreach ($memberIntegral as $key => $val) { ?>
  230. <?php echo '<option value="' . $val['level'] . '">' . $val['level'] . '级 ' . $val['discount'] . '折</option>'; ?>
  231. <?php } ?>
  232. </select>
  233. </div>
  234. </div>
  235. </div>
  236. <input type="hidden" name="requestUrl" value=""/>
  237. <div class="row">
  238. <div class="col-md-6">
  239. <div class="form-group">
  240. <label for="field-1" class="control-label">请输入确认密码:</label>
  241. <input type="password" class="form-control" name="confirmPassword" placeholder="" value="">
  242. </div>
  243. </div>
  244. </div>
  245. </div>
  246. <div class="modal-footer">
  247. <button type="button" class="btn btn-info" name="memberConfirmButton">确认</button>
  248. <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
  249. </div>
  250. </div>
  251. </div>
  252. </div>
  253. <script>
  254. $(function () {
  255. //升级为会员 取消会员操作
  256. jQuery("a[name=memberButton]").click(function () {
  257. var url = $(this).attr('data-url');
  258. var name = $(this).attr('data-name');
  259. $("#memberModal .modal-body span").text(name);
  260. $("#memberModal .modal-body input[name=requestUrl]").val(url);
  261. jQuery('#memberModal').modal('show', {backdrop: 'fade'});
  262. });
  263. //确认升级会员
  264. jQuery("button[name=memberConfirmButton]").click(function () {
  265. var url = $("#memberModal .modal-body input[name=requestUrl]").val();
  266. var confirmPassword = $("#memberModal .modal-body input[name=confirmPassword]").val();
  267. var memberLevel = $("select[name=memberLevel]").find("option:selected").val();
  268. $.ajax({
  269. type: "GET",
  270. url: url + "&confirmPassword=" + confirmPassword + "&memberLevel=" + memberLevel,
  271. async: false,
  272. dataType: 'json',
  273. success: function (data) {
  274. if (data.code == 'A0001') {
  275. setTimeout(function () {
  276. window.location.reload();
  277. }, 2000);
  278. }
  279. xhPopMsg(data.msg, 2000);
  280. }
  281. });
  282. });
  283. });
  284. </script>
  285. <!-- modal 充值 -->
  286. <div class="modal fade" id="rechargeModal">
  287. <div class="modal-dialog" style="height:450px;">
  288. <div class="modal-content">
  289. <div class="modal-header">
  290. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  291. <h4 class="modal-title">操作提示</h4>
  292. </div>
  293. <div class="modal-body">
  294. <div class="row">
  295. <div class="col-md-6">
  296. <div class="form-group">
  297. <label for="field-1" class="control-label"><span></span> 帐户充值:</label>
  298. <input type="tel" class="form-control" placeholder="" name="rechargeAmount" value=""
  299. style="width:70%;display:inline-block;"> 元
  300. <input type="hidden" name="requestUrl" value=""/>
  301. <input type="hidden" name="userName" value=""/>
  302. </div>
  303. </div>
  304. </div>
  305. <div class="row">
  306. <div class="col-md-6">
  307. <div class="form-group">
  308. <label for="field-1" class="control-label">请输入确认密码:</label>
  309. <input type="password" class="form-control" name="rechargePassword" placeholder="" value="">
  310. </div>
  311. </div>
  312. </div>
  313. <div class="row">
  314. <div class="col-md-6">
  315. <div class="checkbox">
  316. <label>
  317. <input name="confirmToRecharge" type="checkbox">确认为<span></span>充值 <em
  318. style="font-style: normal;">0</em> 元
  319. </label>
  320. </div>
  321. </div>
  322. </div>
  323. </div>
  324. <div class="modal-footer">
  325. <button type="button" class="btn btn-info" name="rechargeConfirmButton">确认</button>
  326. <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
  327. </div>
  328. </div>
  329. </div>
  330. </div>
  331. <script>
  332. $(function () {
  333. //充值操作
  334. jQuery("a[name=rechargeButton]").click(function () {
  335. var url = $(this).attr('data-url');
  336. var userName = $(this).attr('data-userName');
  337. $("#rechargeModal .modal-body span").text(userName);
  338. $("#rechargeModal .modal-body input[name=userName]").val(userName);
  339. $("#rechargeModal .modal-body input[name=requestUrl]").val(url);
  340. $("#rechargeModal .modal-body input[name=rechargeAmount]").val('');
  341. $("#rechargeModal .modal-body input[name=rechargePassword]").val('');
  342. $("#rechargeModal .modal-body em").html('0');
  343. $("input[name=confirmToRecharge]").prop("checked", false);
  344. jQuery('#rechargeModal').modal('show');
  345. });
  346. //确认充值
  347. jQuery("button[name=rechargeConfirmButton]").click(function () {
  348. var url = $("#rechargeModal .modal-body input[name=requestUrl]").val();
  349. var userName = $("#rechargeModal .modal-body input[name=userName]").val();
  350. var rechargeAmount = $("#rechargeModal .modal-body input[name=rechargeAmount]").val();
  351. var rechargePassword = $("#rechargeModal .modal-body input[name=rechargePassword]").val();
  352. if (isNaN(rechargeAmount)) {
  353. xhPopMsg('充值金额填写有误', 1300);
  354. return;
  355. }
  356. if (rechargeAmount <= 0) {
  357. xhPopMsg('金额不能小于0', 1300);
  358. return;
  359. }
  360. if (rechargePassword.length <= 0) {
  361. xhPopMsg('请输入确认密码', 1300);
  362. return;
  363. }
  364. if ($("input[name=confirmToRecharge]").prop("checked") == false) {
  365. xhPopMsg('请勾选确认充值项', 1300);
  366. return;
  367. }
  368. if ($("button[name=rechargeConfirmButton]").attr('submitStatus') == 'yes') {
  369. xhPopMsg('请稍候…', 1000);
  370. return;
  371. }
  372. $("button[name=rechargeConfirmButton]").attr('submitStatus', 'yes');
  373. setTimeout(function () {
  374. $("button[name=rechargeConfirmButton]").attr('submitStatus', 'no');
  375. }, 8000);
  376. $.ajax({
  377. type: "GET",
  378. url: url + '&rechargeAmount=' + rechargeAmount + '&rechargePassword=' + rechargePassword,
  379. async: false,
  380. dataType: 'json',
  381. success: function (data) {
  382. if (data.code == 'A0001') {
  383. setTimeout(function () {
  384. window.location.reload();
  385. }, 2000);
  386. }
  387. xhPopMsg(data.msg, 1300);
  388. }
  389. });
  390. });
  391. //充值时输入金额反应
  392. $("#rechargeModal .modal-body input[name=rechargeAmount]").keyup(function () {
  393. var val = $(this).val();
  394. if (isNaN(val) == false) {
  395. $("#rechargeModal .modal-body em").html(val);
  396. }
  397. });
  398. });
  399. </script>
  400. <script>
  401. //全选 全不选
  402. $(":checkbox[name=selectAll]").click(function () {
  403. var status = $(this).prop("checked");
  404. if (status == true) {
  405. $(":checkbox[name=uId]").prop("checked", true);
  406. } else {
  407. $(":checkbox[name=uId]").prop("checked", false);
  408. }
  409. });
  410. </script>
  411. <!-- 添加标签 -->
  412. <div class="modal fade" id="userTagModal">
  413. <div class="modal-dialog" style="height:450px;">
  414. <div class="modal-content">
  415. <div class="modal-header">
  416. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  417. <h4 class="modal-title">请选择你要添加的标签</h4>
  418. </div>
  419. <div class="modal-body">
  420. <input type="hidden" name="requestUrl" value="/user/batch-add-user-tag"/>
  421. <?php if (!empty($merchantTag)) { ?>
  422. <?php foreach ($merchantTag as $key => $val) { ?>
  423. <div class="row">
  424. <div class="col-md-6">
  425. <div class="checkbox">
  426. <label>
  427. <input name="theTag" value="<?= $key ?>" type="radio"> <?= $val ?>
  428. </label>
  429. </div>
  430. </div>
  431. </div>
  432. <?php }
  433. } ?>
  434. </div>
  435. <div class="modal-footer">
  436. <button type="button" class="btn btn-info" name="userTagConfirmButton">确认</button>
  437. <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
  438. </div>
  439. </div>
  440. </div>
  441. </div>
  442. <script>
  443. var shopProvince = "<?=$merchant['shopProvince'] ?>";
  444. var shopCity = "<?=$merchant['shopCity'] ?>";
  445. $("button[name=multipConfirm]").click(function () {
  446. var ids = new Array();
  447. $(":checkbox[name=uId]:checked").each(function () {
  448. var theId = $(this).val();
  449. ids.push(theId);
  450. });
  451. if (ids.length <= 0) {
  452. xhPopMsg('请选择你要操作的用户', 1300);
  453. return;
  454. }
  455. var option = $("select[name=doOption]").val();
  456. option = parseInt(option);
  457. switch (option) {
  458. case 0:
  459. //批量添加标签
  460. jQuery('#userTagModal').modal('show');
  461. break;
  462. case 1:
  463. xhPopMsg('此功能开发中…', 1300);
  464. break;
  465. }
  466. });
  467. //确认添加标签
  468. jQuery("button[name=userTagConfirmButton]").click(function () {
  469. var tagId = $("#userTagModal .modal-body :input[name=theTag]:checked").val();
  470. var url = $("#userTagModal .modal-body input[name=requestUrl]").val();
  471. var ids = new Array();
  472. $(":checkbox[name=uId]:checked").each(function () {
  473. var theId = $(this).val();
  474. ids.push(theId);
  475. });
  476. if (ids.length <= 0) {
  477. xhPopMsg('请选择用户', 1300);
  478. return;
  479. }
  480. var userIdStr = ids.join(',');
  481. $.ajax({
  482. type: "GET",
  483. url: url + '?tagId=' + tagId + '&userIdStr=' + userIdStr,
  484. async: false,
  485. dataType: 'json',
  486. success: function (data) {
  487. xhPopMsg(data.msg, 1300);
  488. if (data.code == 'A0001') {
  489. setTimeout(function () {
  490. window.location.reload();
  491. }, 1000);
  492. }
  493. }
  494. });
  495. });
  496. </script>