index.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. <style>
  4. .option {
  5. width: 200px;
  6. padding: 10px;
  7. background-color: #eeeeee;
  8. border-radius: 10px;
  9. text-align: center;
  10. display: none;
  11. }
  12. .option .layui-box p {
  13. margin: 5px 0;
  14. background-color: #ffffff;
  15. color: #0092DC;
  16. padding: 8px;
  17. cursor: pointer
  18. }
  19. .option .layui-box p.on {
  20. color: #eeeeee
  21. }
  22. </style>
  23. {/block}
  24. {block name="content"}
  25. <div class="layui-fluid">
  26. <div class="layui-row layui-col-space15" id="app">
  27. <!--搜索条件-->
  28. <div class="layui-col-md12">
  29. <div class="layui-card">
  30. <div class="layui-card-header">搜索条件</div>
  31. <div class="layui-card-body">
  32. <div class="layui-carousel layadmin-carousel layadmin-shortcut" lay-anim="" lay-indicator="inside"
  33. lay-arrow="none" style="background:none">
  34. <div class="layui-card-body">
  35. <div class="layui-row layui-col-space10 layui-form-item">
  36. <div class="layui-col-lg12">
  37. <label class="layui-form-label">时间选择:</label>
  38. <div class="layui-input-block" data-type="data" v-cloak="">
  39. <button class="layui-btn layui-btn-sm" type="button" v-for="item in dataList"
  40. @click="setData(item)"
  41. :class="{'layui-btn-primary':where.data!=item.value}">{{item.name}}
  42. </button>
  43. <button class="layui-btn layui-btn-sm" type="button" ref="time"
  44. @click="setData({value:'zd',is_zd:true})"
  45. :class="{'layui-btn-primary':where.data!='zd'}">自定义
  46. </button>
  47. <button type="button" class="layui-btn layui-btn-sm layui-btn-primary"
  48. v-show="showtime==true" ref="date_time">{$year.0} - {$year.1}
  49. </button>
  50. </div>
  51. </div>
  52. <div class="layui-col-lg12">
  53. <label class="layui-form-label">用户昵称:</label>
  54. <div class="layui-input-block">
  55. <input type="text" name="nickname" style="width: 50%" v-model="where.nickname"
  56. placeholder="请输入姓名、电话、UID" class="layui-input">
  57. </div>
  58. </div>
  59. <div class="layui-col-lg12">
  60. <div class="layui-input-block">
  61. <button @click="search" type="button"
  62. class="layui-btn layui-btn-sm layui-btn-normal">
  63. <i class="layui-icon layui-icon-search"></i>搜索
  64. </button>
  65. <button @click="excel" type="button"
  66. class="layui-btn layui-btn-warm layui-btn-sm export" type="button">
  67. <i class="fa fa-floppy-o" style="margin-right: 3px;"></i>导出
  68. </button>
  69. <button @click="refresh" type="reset"
  70. class="layui-btn layui-btn-primary layui-btn-sm">
  71. <i class="layui-icon layui-icon-refresh"></i>刷新
  72. </button>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <!--end-->
  82. <!-- 中间详细信息-->
  83. <div :class="item.col!=undefined ? 'layui-col-sm'+item.col+' '+'layui-col-md'+item.col:'layui-col-sm6 layui-col-md3'"
  84. v-for="item in badge" v-cloak="" v-if="item.count > 0">
  85. <div class="layui-card">
  86. <div class="layui-card-header">
  87. {{item.name}}
  88. <span class="layui-badge layuiadmin-badge" :class="item.background_color">{{item.field}}</span>
  89. </div>
  90. <div class="layui-card-body">
  91. <p class="layuiadmin-big-font">{{item.count}}</p>
  92. <p v-show="item.content!=undefined">
  93. {{item.content}}
  94. <span class="layuiadmin-span-color">{{item.sum}}<i :class="item.class"></i></span>
  95. </p>
  96. </div>
  97. </div>
  98. </div>
  99. <!--enb-->
  100. </div>
  101. <div class="layui-row layui-col-space15">
  102. <div class="layui-col-md12">
  103. <div class="layui-card">
  104. <div class="layui-card-header">分销员列表</div>
  105. <div class="layui-card-body">
  106. <!-- <div class="layui-btn-container">-->
  107. <!-- <div class="layui-btn-group conrelTable">-->
  108. <!-- <button class="layui-btn layui-btn-sm layui-btn-normal" type="button" data-type="refresh"><i class="layui-icon layui-icon-refresh" ></i>刷新</button>-->
  109. <!-- </div>-->
  110. <!-- </div>-->
  111. <table class="layui-hide" id="userList" lay-filter="userList"></table>
  112. <script type="text/html" id="headimgurl">
  113. <img style="cursor: pointer" lay-event='open_image' src="{{d.headimgurl}}">
  114. </script>
  115. <script type="text/html" id="act">
  116. <button type="button" class="layui-btn layui-btn-xs" onclick="dropdown(this)">操作 <span
  117. class="caret"></span></button>
  118. <ul class="layui-nav-child layui-anim layui-anim-upbit">
  119. <li>
  120. <a href="javascript:void(0);" class=""
  121. onclick="$eb.createModalFrame(this.innerText,'{:Url('stair')}?uid={{d.uid}}')">
  122. <i class="fa fa-list-alt"></i> 统计推广人列表
  123. </a>
  124. </li>
  125. <li>
  126. <a href="javascript:void(0);" class=""
  127. onclick="$eb.createModalFrame(this.innerText,'{:Url('stair_order')}?uid={{d.uid}}')">
  128. <i class="fa fa-reorder"></i> 统计推广订单
  129. </a>
  130. </li>
  131. <li>
  132. <a href="javascript:void(0);" lay-event='look_code'>
  133. <i class="fa fa-file-image-o"></i> 推广方式</a>
  134. </li>
  135. {{# if(d.spread_uid){ }}
  136. <li>
  137. <a href="javascript:void(0);" lay-event='delete_spread'>
  138. <i class="fa fa-unlock"></i> 清除上级
  139. </a>
  140. </li>
  141. {{# } }}
  142. </ul>
  143. </script>
  144. </div>
  145. <!--用户信息-->
  146. <script type="text/html" id="userinfo">
  147. 昵称:{{d.nickname==null ? '暂无信息':d.nickname}}
  148. <br>姓名:{{d.real_name==null ? '暂无信息':d.real_name}}
  149. <br>电话:{{d.phone==null ? '暂无信息':d.phone}}
  150. </script>
  151. <div class="option">
  152. <div class="layui-box">
  153. <input type="hidden" name="uid" id="uid">
  154. <p data-action="routine_code" data-type="wx">小程序推广二维码</p>
  155. <p data-action="wechant_code" data-type="wx">公众号推广二维码</p>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  163. {/block}
  164. {block name="script"}
  165. <script>
  166. var action = {
  167. refresh: function () {
  168. layList.reload();
  169. },
  170. delete_spread: function () {
  171. var ids = layList.getCheckData().getIds('uid');
  172. if (ids.length) {
  173. $eb.$swal('delete', function () {
  174. $eb.axios.post(layList.U({a: 'delete_promoter'}), {uids: ids}).then(function (res) {
  175. if (res.status == 200 && res.data.code == 200) {
  176. $eb.$swal('success', res.data.msg);
  177. layList.reload();
  178. } else
  179. return Promise.reject(res.data.msg || '清除失败')
  180. }).catch(function (err) {
  181. $eb.$swal('error', err);
  182. });
  183. }, {
  184. title: '您将解除选中用户的推广关系,请谨慎操作!',
  185. text: '解除后不可恢复',
  186. confirm: '是的我要解除'
  187. })
  188. } else {
  189. layList.msg('请选择要解除权限的用户');
  190. }
  191. },
  192. };
  193. layList.form.render();
  194. layList.tableList('userList', "{:Url('get_spread_list')}", function () {
  195. return [
  196. {type: 'checkbox'},
  197. {field: 'uid', title: 'UID', sort: true, width: '5%'},
  198. {field: 'headimgurl', title: '头像', templet: '#headimgurl'},
  199. {field: 'nickname', title: '用户信息', templet: '#userinfo', width: '12%'},
  200. {field: 'broken_commission', title: '冻结金额'},
  201. {field: 'spread_count', title: '推广用户数量', sort: true},
  202. {field: 'order_count', title: '订单数量'},
  203. {field: 'order_price', title: '订单金额', sort: true},
  204. {field: 'brokerage_money', title: '佣金金额', sort: true},
  205. {field: 'extract_count_price', title: '已提现金额', sort: true},
  206. {field: 'extract_count_num', title: '提现次数'},
  207. {field: 'new_money', title: '未提现金额', sort: true},
  208. {field: 'spread_name', title: '上级推广人', sort: true},
  209. {field: 'right', title: '操作', toolbar: '#act', width: '5%'},
  210. ];
  211. });
  212. layList.date({elem: '#start_time', theme: '#393D49', type: 'datetime'});
  213. layList.date({elem: '#end_time', theme: '#393D49', type: 'datetime'});
  214. layList.search('search', function (where) {
  215. if (where.start_time != '' && where.end_time == '') return layList.msg('请选择结束时间')
  216. if (where.end_time != '' && where.start_time == '') return layList.msg('请选择开始时间')
  217. console.log(where);
  218. layList.reload(where, true);
  219. });
  220. layList.search('export', function (where) {
  221. where.excel = 1;
  222. location.href = layList.U({a: 'get_spread_list', q: where});
  223. })
  224. $('.conrelTable').find('button').each(function () {
  225. var type = $(this).data('type');
  226. $(this).on('click', function () {
  227. action[type] && action[type]();
  228. })
  229. })
  230. $('.option .layui-box').find('p').each(function () {
  231. $(this).on('click', function () {
  232. var type = $(this).data('action'), uid = $('#uid').val();
  233. layList.baseGet(layList.U({a: 'look_code', q: {action: type, uid: uid}}), function (res) {
  234. if ($eb) {
  235. $eb.openImage(res.data.code_src);
  236. } else {
  237. layList.layer.open({
  238. type: 1,
  239. title: false,
  240. closeBtn: 0,
  241. shadeClose: true,
  242. content: '<img src="' + res.data.code_src + '" style="display: block;width: 100%;" />'
  243. });
  244. }
  245. }, function (res) {
  246. layList.msg(res.msg);
  247. });
  248. });
  249. });
  250. //下拉框
  251. $(document).click(function (e) {
  252. $('.layui-nav-child').hide();
  253. })
  254. function dropdown(that) {
  255. var oEvent = arguments.callee.caller.arguments[0] || event;
  256. oEvent.stopPropagation();
  257. var offset = $(that).offset();
  258. var top = offset.top - $(window).scrollTop();
  259. var index = $(that).parents('tr').data('index');
  260. $('.layui-nav-child').each(function (key) {
  261. if (key != index) {
  262. $(this).hide();
  263. }
  264. })
  265. if ($(document).height() < top + $(that).next('ul').height()) {
  266. $(that).next('ul').css({
  267. 'padding': 10,
  268. 'top': -($(that).parent('td').height() / 2 + $(that).height() + $(that).next('ul').height() / 2),
  269. 'min-width': 'inherit',
  270. 'left': -64,
  271. 'position': 'absolute'
  272. }).toggle();
  273. } else {
  274. $(that).next('ul').css({
  275. 'padding': 10,
  276. 'left': -64,
  277. 'top': $(that).parent('td').height() / 2 + $(that).height(),
  278. 'min-width': 'inherit',
  279. 'position': 'absolute'
  280. }).toggle();
  281. }
  282. }
  283. layList.tool(function (event, data, obj) {
  284. switch (event) {
  285. case 'delete_spread':
  286. var url = layList.U({a: 'empty_spread', q: {uid: data.uid}});
  287. $eb.$swal('delete', function () {
  288. $eb.axios.get(url).then(function (res) {
  289. if (res.status == 200 && res.data.code == 200) {
  290. $eb.$swal('success', res.data.msg)
  291. } else
  292. return Promise.reject(res.data.msg || '清除失败')
  293. }).catch(function (err) {
  294. $eb.$swal('error', err);
  295. });
  296. }, {
  297. title: '您将解除【' + data.nickname + '】的上级推广人,请谨慎操作!',
  298. text: '解除后无法恢复',
  299. confirm: '是的我要解除'
  300. })
  301. break;
  302. case 'look_code':
  303. $('#uid').val(data.uid);
  304. var index = layList.layer.open({
  305. type: 1,
  306. area: ['200px', 'auto'], //宽高
  307. content: $('.option'),
  308. title: false,
  309. cancel: function () {
  310. $('.option').hide();
  311. $('#uid').val('');
  312. }
  313. });
  314. break;
  315. case 'open_image':
  316. if ($eb)
  317. $eb.openImage(data.headimgurl);
  318. else
  319. layList.layer.open({
  320. type: 1,
  321. title: false,
  322. closeBtn: 0,
  323. shadeClose: true,
  324. content: '<img src="' + data.headimgurl + '" style="display: block;width: 100%;" />'
  325. });
  326. break;
  327. }
  328. });
  329. require(['vue'], function (Vue) {
  330. new Vue({
  331. el: "#app",
  332. data: {
  333. badge: [],
  334. dataList: [
  335. {name: '全部', value: ''},
  336. {name: '今天', value: 'today'},
  337. {name: '昨天', value: 'yesterday'},
  338. {name: '最近7天', value: 'lately7'},
  339. {name: '最近30天', value: 'lately30'},
  340. {name: '本月', value: 'month'},
  341. {name: '本年', value: 'year'},
  342. ],
  343. where: {
  344. data: '',
  345. nickname: '',
  346. excel: 0,
  347. },
  348. showtime: false,
  349. },
  350. watch: {},
  351. methods: {
  352. getBadge: function () {
  353. var that = this;
  354. layList.basePost(layList.Url({a: 'get_badge'}), this.where, function (rem) {
  355. that.badge = rem.data;
  356. });
  357. },
  358. setData: function (item) {
  359. var that = this;
  360. if (item.is_zd == true) {
  361. that.showtime = true;
  362. this.where.data = this.$refs.date_time.innerText;
  363. } else {
  364. this.showtime = false;
  365. this.where.data = item.value;
  366. }
  367. },
  368. search: function () {
  369. this.where.excel = 0;
  370. this.getBadge();
  371. console.log(this.where);
  372. layList.reload(this.where, true);
  373. },
  374. excel: function () {
  375. this.where.excel = 1;
  376. location.href = layList.U({a: 'get_spread_list', q: this.where});
  377. },
  378. refresh: function () {
  379. layList.reload();
  380. this.getBadge();
  381. }
  382. },
  383. mounted: function () {
  384. this.getBadge();
  385. var that = this;
  386. layList.laydate.render({
  387. elem: this.$refs.date_time,
  388. trigger: 'click',
  389. eventElem: this.$refs.time,
  390. range: true,
  391. change: function (value) {
  392. that.where.data = value;
  393. }
  394. });
  395. }
  396. })
  397. });
  398. </script>
  399. {/block}