截流自动化的商城平台
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

index.html 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. {layout name="layout1" /}
  2. <div class="layui-fluid">
  3. <div class="layui-card">
  4. <div class="layui-card-body">
  5. <div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4">
  6. <div class="layui-colla-item">
  7. <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2>
  8. <div class="layui-colla-content layui-show">
  9. <p>*分销会员列表,可查看分销员佣金详情,直推会员,分销订单,以及修改分销会员上级;</p>
  10. <p>*分销佣金需要订单完成并且超出售后期限后系统自动结算。</p>
  11. </div>
  12. </div>
  13. </div>
  14. </div>
  15. <div class="layui-tab layui-tab-card" lay-filter="tab-all">
  16. <ul class="layui-tab-title">
  17. <!-- <li data-type='member' class="layui-this">分销会员列表</li>-->
  18. <!-- <li data-type='audit'>申请分销会员列表</li>-->
  19. </ul>
  20. <div class="layui-tab-content">
  21. <!--分销会员列表-->
  22. <div class="layui-tab-item layui-show ">
  23. {include file="/distribution/member/member_lists"/}
  24. </div>
  25. <!--待审核分销会员列表-->
  26. <div class="layui-tab-item">
  27. {include file="/distribution/member/audit_lists"/}
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <script>
  34. layui.config({
  35. version:"{$front_version}",
  36. base: '/static/lib/'
  37. }).use(['element','table', 'form'], function () {
  38. var $ = layui.$
  39. , form = layui.form
  40. , table = layui.table
  41. , element = layui.element;
  42. //图片放大
  43. $(document).on('click', '.image-show', function () {
  44. var src = $(this).attr('src');
  45. like.showImg(src,600);
  46. });
  47. getLists('member');
  48. //切换列表
  49. element.on('tab(tab-all)', function (data) {
  50. form.render('select');
  51. var type = $(this).attr('data-type');
  52. getLists(type);
  53. });
  54. function getLists(type) {
  55. // 会员列表
  56. if (type == 'member') {
  57. table.render({
  58. elem: '#member-lists'
  59. , url: '{:url("distribution.member/index")}?type=member'
  60. , cols: [[
  61. {field: 'id', title: 'ID', align: 'center'}
  62. , {field: 'user', title: '会员信息', templet: '#user-info', width: 350}
  63. , {field: 'distribution_code', title: '邀请码', width: 100, align: 'center'}
  64. , {field: 'leader', title: '上级推荐人', width: 280, align: 'center', templet:'#leader-info'}
  65. , {field: 'fans', title: '推广会员数', width: 110, align: 'center'}
  66. , {field: 'distribution_num', title: '分销订单数', width: 110, align: 'center'}
  67. , {field: 'distribution_amount', title: '分销订单金额', width: 130, align: 'center'}
  68. , {field: 'distribution_money', title: '分销佣金', width: 110, align: 'center'}
  69. , {fixed: 'right', title: '操作', width: 280, align: 'center', toolbar: '#member-operation'}
  70. ]]
  71. , page: true
  72. , text: {none: '暂无数据!'}
  73. , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
  74. return {
  75. "code": res.code,
  76. "msg": res.msg,
  77. "count": res.data.count, //解析数据长度
  78. "data": res.data.lists, //解析数据列表
  79. };
  80. },
  81. response: {
  82. statusCode: 1
  83. }
  84. ,done: function(res, curr, count){
  85. // 解决操作栏因为内容过多换行问题
  86. $(".layui-table-main tr").each(function (index, val) {
  87. $($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
  88. $($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
  89. });
  90. }
  91. });
  92. }
  93. // 审核会员列表
  94. if (type == 'audit') {
  95. table.render({
  96. elem: '#audit-lists'
  97. , url: '{:url("distribution.member/index")}?type=audit'
  98. , cols: [[
  99. {type: 'numbers', title: '序号', align: 'center'}
  100. , {field: 'user', title: '会员信息', templet: '#user-info'}
  101. , {field: 'leader', title: '上级推荐人', align: 'center', templet:'#leader-info'}
  102. , {field: 'reason', title: '申请原因', align: 'center'}
  103. , {field: 'denial_reason', title: '拒绝原因', align: 'center'}
  104. , {field: 'status_text', title: '状态', width: 110, align: 'center'}
  105. , {field: 'create_time', width: 180, title: '申请时间', align: 'center'}
  106. , {fixed: 'right', title: '操作', width: 200, align: 'center', toolbar: '#audit-operation'}
  107. ]]
  108. , page: true
  109. , text: {none: '暂无数据!'}
  110. , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
  111. return {
  112. "code": res.code,
  113. "msg": res.msg,
  114. "count": res.data.count, //解析数据长度
  115. "data": res.data.lists, //解析数据列表
  116. };
  117. },
  118. response: {
  119. statusCode: 1
  120. }
  121. ,done: function(res, curr, count){
  122. // 解决操作栏因为内容过多换行问题
  123. $(".layui-table-main tr").each(function (index, val) {
  124. $($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
  125. $($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
  126. });
  127. }
  128. });
  129. }
  130. }
  131. //==============================================会员列表start===============================================
  132. var active = {
  133. add: function(){
  134. var index = layer.open({
  135. type: 2
  136. ,title: '添加分销会员'
  137. ,content: '{:url("distribution.member/addMember")}'
  138. ,area: ['500px', '400px']
  139. ,btn: ['保存', '取消']
  140. ,maxmin: true
  141. ,yes: function(index, layero){
  142. var iframeWindow = window['layui-layer-iframe'+ index]
  143. ,submitID = 'addSubmit'
  144. ,submit = layero.find('iframe').contents().find('#'+ submitID);
  145. //监听提交
  146. iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
  147. var field = data.field;
  148. like.ajax({
  149. url:'{:url("distribution.member/addMember")}',
  150. data:field,
  151. type:"post",
  152. success:function(res) {
  153. if(res.code === 1) {
  154. layui.layer.msg(res.msg, {offset:'15px',icon:1,time:1000});
  155. layer.close(index);
  156. table.reload('member-lists', {
  157. where: []
  158. });
  159. }
  160. }
  161. });
  162. });
  163. submit.trigger('click');
  164. }
  165. ,cancel: function(index, layero){
  166. var window_index = index;
  167. layer.confirm('尚未保存,确定关闭吗?', {
  168. time: 0, //不自动关闭
  169. btn: ['确定', '取消'],
  170. yes: function(index){
  171. layer.close(index);
  172. layer.close(window_index);
  173. }
  174. });
  175. return false;
  176. }
  177. });
  178. },
  179. };
  180. $('.layui-btn.layuiadmin-btn').on('click', function(){
  181. var type = $(this).data('type');
  182. active[type] ? active[type].call(this) : '';
  183. });
  184. form.on('submit(member-search)', function (data) {
  185. var field = data.field;
  186. //执行重载
  187. table.reload('member-lists', {
  188. where: field,
  189. page: {
  190. curr: 1
  191. }
  192. });
  193. });
  194. //清空查询
  195. form.on('submit(member-clear-search)', function () {
  196. $('#freeze_distribution').val('');
  197. $('#member_keyword').val('');
  198. form.render('select');
  199. //刷新列表
  200. table.reload('member-lists', {
  201. where: [],
  202. page: {
  203. curr: 1
  204. }
  205. });
  206. });
  207. table.on('tool(member-lists)', function (obj) {
  208. var id = obj.data.id;
  209. var nickname = obj.data.nickname;
  210. if (obj.event === 'freeze' || obj.event === 'unfreeze') {
  211. var type = 'freeze';
  212. var confirm_text = '确定冻结分销会员:';
  213. if (obj.event === 'unfreeze'){
  214. type = 'unfreeze';
  215. confirm_text = '确定解冻分销会员:';
  216. }
  217. layer.confirm(confirm_text + '<span style="color: red">'+nickname+'</span>', function (index) {
  218. like.ajax({
  219. url: '{:url("distribution.member/freeze")}',
  220. data: {'id':id, 'type': type},
  221. type: "post",
  222. success: function (res) {
  223. if (res.code == 1) {
  224. layui.layer.msg(res.msg, {
  225. offset: '15px'
  226. , icon: 1
  227. , time: 1000
  228. });
  229. table.reload('member-lists');
  230. layer.close(index);
  231. }
  232. }
  233. });
  234. layer.close(index);
  235. });
  236. }
  237. if(obj.event === 'del') { // 删除资格
  238. layer.confirm('确定删除分销资格<span style="color: red">'+nickname+'</span>', function (index) {
  239. like.ajax({
  240. url: '{:url("distribution.member/del")}',
  241. data: {'id':id},
  242. type: "post",
  243. success: function (res) {
  244. if (res.code == 1) {
  245. layui.layer.msg(res.msg, {
  246. offset: '15px'
  247. , icon: 1
  248. , time: 1000
  249. });
  250. table.reload('member-lists');
  251. layer.close(index);
  252. }
  253. }
  254. });
  255. layer.close(index);
  256. });
  257. }
  258. // 会员分销资料(分销资料)
  259. if (obj.event === 'info') {
  260. layer.open({
  261. type: 2
  262. ,title: '分销资料'
  263. ,content: '{:url("distribution.member/info")}?id='+id
  264. ,area: ['90%', '90%']
  265. ,btn:['返回']
  266. })
  267. }
  268. //推广会员
  269. if (obj.event === 'fans') {
  270. layer.open({
  271. type: 2
  272. ,title: '推广会员'
  273. ,content: '{:url("distribution.member/fans")}?id='+id
  274. ,area: ['90%', '90%']
  275. ,btn:['返回']
  276. })
  277. }
  278. //收入明细
  279. if (obj.event === 'earnings_detail') {
  280. layer.open({
  281. type: 2
  282. ,title: '收入明细'
  283. ,content: '{:url("distribution.member/earningsDetail")}?id='+id
  284. ,area: ['90%', '90%']
  285. ,btn:['返回']
  286. })
  287. }
  288. //修改上级
  289. if (obj.event === 'update_leader') {
  290. layer.open({
  291. type: 2
  292. ,title: '修改上级'
  293. ,content: '{:url("distribution.member/updateLeader")}?id='+id
  294. ,area: ['60%', '60%']
  295. ,btn:['确认', '返回']
  296. ,yes: function(index, layero){
  297. var iframeWindow = window['layui-layer-iframe'+ index]
  298. ,submitID = 'update-leader-submit'
  299. ,submit = layero.find('iframe').contents().find('#'+ submitID);
  300. //监听提交
  301. iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
  302. var field = data.field;
  303. like.ajax({
  304. url:'{:url("distribution.member/updateLeader")}',
  305. data:field,
  306. type:"post",
  307. success:function(res)
  308. {
  309. if(res.code == 1)
  310. {
  311. layui.layer.msg(res.msg, {
  312. offset: '15px'
  313. , icon: 1
  314. , time: 1000
  315. });
  316. table.reload('member-lists');
  317. layer.close(index);
  318. }
  319. }
  320. });
  321. });
  322. submit.trigger('click');
  323. }
  324. })
  325. }
  326. });
  327. //==============================================会员列表end===============================================
  328. //==============================================会员审核列表start==========================================
  329. form.on('submit(audit-clear-search)', function () {
  330. $('#audit_keyword').val('');
  331. $('#audit_status').val('');
  332. form.render('select');
  333. //刷新列表
  334. table.reload('audit-lists', {
  335. where: [],
  336. page: {
  337. curr: 1
  338. }
  339. });
  340. });
  341. form.on('submit(audit-search)', function (data) {
  342. var field = data.field;
  343. //执行重载
  344. table.reload('audit-lists', {
  345. where: field,
  346. page: {
  347. curr: 1
  348. }
  349. });
  350. });
  351. //会员审核操作
  352. table.on('tool(audit-lists)', function (obj) {
  353. var id = obj.data.id;
  354. var nickname = obj.data.nickname;
  355. var confirm_text = '';
  356. var data= {};
  357. if (obj.event === 'pass') {
  358. confirm_text = '确定审核通过分销申请:'+ nickname;
  359. data = {'id': id, 'type': 'pass'};
  360. auditAjax(confirm_text, data);
  361. }
  362. if (obj.event === 'refuse') {
  363. layer.prompt({
  364. formType: 2,
  365. value: '',
  366. title: '请输入拒绝原因',
  367. area: ['400px', '120px'] //自定义文本域宽高
  368. }, function(value, index, elem){
  369. confirm_text = '确定审核拒绝分销申请:'+ nickname;
  370. data = {'id': id, 'type': 'refuse', 'denial_reason': value};
  371. like.ajax({
  372. url: '{:url("distribution.member/audit")}',
  373. data: data,
  374. type: "post",
  375. success: function (res) {
  376. if (res.code == 1) {
  377. layui.layer.msg(res.msg, {
  378. offset: '15px'
  379. , icon: 1
  380. , time: 1000
  381. });
  382. table.reload('audit-lists');
  383. layer.close(index);
  384. }
  385. }
  386. });
  387. layer.close(index);
  388. });
  389. }
  390. });
  391. //审核操作
  392. function auditAjax(confirm_text, data) {
  393. layer.confirm(confirm_text, function (index) {
  394. like.ajax({
  395. url: '{:url("distribution.member/audit")}',
  396. data: data,
  397. type: "post",
  398. success: function (res) {
  399. if (res.code == 1) {
  400. layui.layer.msg(res.msg, {
  401. offset: '15px'
  402. , icon: 1
  403. , time: 1000
  404. });
  405. table.reload('audit-lists');
  406. layer.close(index);
  407. }
  408. }
  409. });
  410. layer.close(index);
  411. });
  412. }
  413. //==============================================会员审核列表end===========================================
  414. });
  415. </script>