Users_Admin.js 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071
  1. var ExcelData, ExcelKind;
  2. function ConfirmImport() {
  3. $.ajax({
  4. type: "POST",
  5. url: "/Admin/Users/Import?r=" + Math.random(1),
  6. data: "Kind=" + ExcelKind + "&ExcelData=" + encodeURIComponent(JSON.stringify(ExcelData)),
  7. dataType: "text",
  8. success: function (data) {
  9. if (data == "success") {
  10. layer.msg("导入成功", { time: 2000 }, function () {
  11. window.location.reload();
  12. });
  13. } else if (data.indexOf("warning") == 0) {
  14. var datalist = data.split('|');
  15. layer.alert(datalist[0], { time: 20000 }, function () {
  16. window.location.reload();
  17. });
  18. } else {
  19. layer.msg(data);
  20. }
  21. }
  22. });
  23. }
  24. layui.config({
  25. base: '/layuiadmin/' //静态资源所在路径
  26. }).extend({
  27. myexcel: 'layui/lay/modules/excel',
  28. index: 'lib/index' //主入口模块
  29. }).use(['index', 'table', 'excel', 'laydate'], function () {
  30. var $ = layui.$
  31. , form = layui.form
  32. , table = layui.table;
  33. //- 筛选条件-日期
  34. var laydate = layui.laydate;
  35. var layCreateDate = laydate.render({
  36. elem: '#CreateDate',
  37. type: 'date',
  38. range: true,
  39. trigger: 'click',
  40. change: function (value, date, endDate) {
  41. var op = true;
  42. if (date.year == endDate.year && endDate.month - date.month <= 1) {
  43. if (endDate.month - date.month == 1 && endDate.date > date.date) {
  44. op = false;
  45. layCreateDate.hint('日期范围请不要超过1个月');
  46. setTimeout(function () {
  47. $(".laydate-btns-confirm").addClass("laydate-disabled");
  48. }, 1);
  49. }
  50. } else {
  51. op = false;
  52. layCreateDate.hint('日期范围请不要超过1个月');
  53. setTimeout(function () {
  54. $(".laydate-btns-confirm").addClass("laydate-disabled");
  55. }, 1);
  56. }
  57. if (op) {
  58. $('#CreateDate').val(value);
  59. }
  60. }
  61. });
  62. //excel导入
  63. var excel = layui.excel;
  64. $('#ExcelFile').change(function (e) {
  65. var files = e.target.files;
  66. excel.importExcel(files, {}, function (data) {
  67. ExcelData = data[0].Sheet1;
  68. });
  69. });
  70. //监听单元格编辑
  71. table.on('edit(LAY-list-manage)', function (obj) {
  72. var value = obj.value //得到修改后的值
  73. , data = obj.data //得到所在行所有键值
  74. , field = obj.field; //得到字段
  75. if (field == "Sort") {
  76. $.ajax({
  77. type: "POST",
  78. url: "/Admin/Users/Sort?r=" + Math.random(1),
  79. data: "Id=" + data.Id + "&Sort=" + value,
  80. dataType: "text",
  81. success: function (data) {
  82. }
  83. });
  84. }
  85. });
  86. //列表数据
  87. table.render({
  88. elem: '#LAY-list-manage'
  89. , url: '/Admin/Users/IndexData' //模拟接口
  90. , cols: [[
  91. { type: 'checkbox', fixed: 'left' }
  92. , { field: 'Id', width: 100, title: 'ID', sort: true }
  93. , { field: 'MakerCode', width: 200, title: '创客编号', sort: true, templet: '#MakerCodeTpl' }
  94. , { field: 'RealName', width: 200, title: '创客姓名', sort: true }
  95. , { field: 'UserLevel', width: 200, title: '创客等级', sort: true }
  96. , { field: 'AgentAreas', width: 200, title: '展业地区', sort: true }
  97. , { field: 'SettleAmount', width: 200, title: '提现金额(元)', sort: true }
  98. , { field: 'FreezeAmount', width: 200, title: '冻结金额(元)', sort: true }
  99. , { field: 'CertId', width: 200, title: '身份证号', sort: true }
  100. , { field: 'Mobile', width: 200, title: '联系手机', sort: true }
  101. , { field: 'MerchantType', width: 200, title: '商户创客类型', sort: true }
  102. , { field: 'MerchantDate', width: 200, title: '成为商户创客时间', sort: true }
  103. , { field: 'ParentMakerCode', width: 200, title: '直属创客编号', sort: true }
  104. , { field: 'ParentRealName', width: 200, title: '直属创客名称', sort: true }
  105. , { field: 'TopMakerCode', width: 200, title: '顶级创客编号', sort: true }
  106. , { field: 'TopRealName', width: 200, title: '顶级创客名称', sort: true }
  107. , { field: 'AuthFlagName', width: 200, title: '实名状态', sort: true }
  108. , { field: 'RiskFlagName', width: 200, title: '风控状态', sort: true }
  109. , { field: 'CreateDate', width: 200, title: '注册时间', sort: true }
  110. , { title: '操作', width: 2000, align: 'left', toolbar: '#table-list-tools' }
  111. ]]
  112. , where: {
  113. SelfId: SelfId,
  114. ParentId: ParentId,
  115. MakerCode: MakerCode
  116. }
  117. , page: true
  118. , limit: 30
  119. , height: 'full-' + String($('.layui-card-header').height() + 130)
  120. , text: '对不起,加载出现异常!'
  121. , done: function (res, curr, count) {
  122. $(".layui-none").text("无数据");
  123. }
  124. });
  125. //监听工具条
  126. table.on('tool(LAY-list-manage)', function (obj) {
  127. var data = obj.data;
  128. if (obj.event === 'del') {
  129. var index = layer.confirm('是否确定注销' + data.MakerCode + ',' + data.RealName + '?', function (index) {
  130. $.ajax({
  131. type: "POST",
  132. url: "/Admin/Users/Delete?r=" + Math.random(1),
  133. data: "Id=" + data.Id,
  134. dataType: "text",
  135. success: function (data) {
  136. if (data == "success") {
  137. obj.del();
  138. layer.close(index);
  139. parent.layer.msg('已注销');
  140. } else {
  141. parent.layer.msg(data);
  142. }
  143. }
  144. });
  145. });
  146. } else if (obj.event === 'cancle') {
  147. var index = layer.confirm('是否确定注销' + data.MakerCode + ',' + data.RealName + '?', function (index) {
  148. $.ajax({
  149. type: "POST",
  150. url: "/Admin/Users/Cancel?r=" + Math.random(1),
  151. data: "UserId=" + data.Id,
  152. dataType: "text",
  153. success: function (data) {
  154. if (data == "success") {
  155. obj.del();
  156. layer.close(index);
  157. parent.layer.msg('已注销');
  158. } else {
  159. parent.layer.msg(data);
  160. }
  161. }
  162. });
  163. });
  164. } else if (obj.event === 'sycn') {
  165. var index = layer.confirm('确定要同步该创客的机具数吗?', function (index) {
  166. layer.close(index);
  167. var loadindex = layer.load(1, {
  168. shade: [0.5, '#000']
  169. });
  170. $.ajax({
  171. type: "POST",
  172. url: "/Admin/Users/SycnData?r=" + Math.random(1),
  173. data: "Id=" + data.Id,
  174. dataType: "text",
  175. success: function (data) {
  176. layer.close(loadindex);
  177. if (data == "success") {
  178. layer.msg('同步成功');
  179. } else {
  180. layer.msg(data);
  181. }
  182. }
  183. });
  184. });
  185. } else if (obj.event === 'edit') {
  186. var tr = $(obj.tr);
  187. var perContent = layer.open({
  188. type: 2
  189. , title: '服务商信息管理'
  190. , content: 'Edit?Id=' + data.Id
  191. , maxmin: true
  192. , area: ['500px', '550px']
  193. , btn: ['修改', '三要素验证', '四要素验证', '取消']
  194. , yes: function (index, layero) {
  195. var iframeWindow = window['layui-layer-iframe' + index]
  196. , submitID = 'LAY-list-front-submit'
  197. , submit = layero.find('iframe').contents().find('#' + submitID);
  198. setTimeout(function () {
  199. layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
  200. var errObj = $(this).find('.layui-form-danger');
  201. if (errObj.length > 0) {
  202. iframeWindow.element.tabChange('mytabbar', String(i + 1));
  203. submit.click();
  204. }
  205. });
  206. }, 300);
  207. //监听提交
  208. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  209. var field = data.field; //获取提交的字段
  210. var userdata = "";
  211. for (var prop in field) {
  212. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  213. }
  214. //提交 Ajax 成功后,静态更新表格中的数据
  215. //$.ajax({});
  216. $.ajax({
  217. type: "POST",
  218. url: "/Admin/Users/Edit?r=" + Math.random(1),
  219. data: userdata,
  220. dataType: "text",
  221. success: function (data) {
  222. layer.close(index); //关闭弹层
  223. if (data == "success") {
  224. layer.msg("保存成功", { time: 1500 }, function () {
  225. table.reload('LAY-list-manage'); //数据刷新
  226. });
  227. } else {
  228. layer.msg(data);
  229. }
  230. }
  231. });
  232. });
  233. submit.trigger('click');
  234. }
  235. , btn2: function () {
  236. layer.msg('验证通过');
  237. return false;
  238. }
  239. , btn3: function () {
  240. layer.msg('验证通过');
  241. return false;
  242. }
  243. , success: function (layero, index) {
  244. }
  245. });
  246. } else if (obj.event === 'EditSettleAmount') {
  247. var tr = $(obj.tr);
  248. var perContent = layer.open({
  249. type: 2
  250. , title: '修改结算金额'
  251. , content: 'EditSettleAmount?Id=' + data.Id
  252. , maxmin: false
  253. , area: ['450px', '550px']
  254. , btn: ['确定', '取消']
  255. , yes: function (index, layero) {
  256. var iframeWindow = window['layui-layer-iframe' + index]
  257. , submitID = 'LAY-list-front-submit'
  258. , submit = layero.find('iframe').contents().find('#' + submitID);
  259. //监听提交
  260. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  261. var field = data.field; //获取提交的字段
  262. var userdata = "";
  263. for (var prop in field) {
  264. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  265. }
  266. //提交 Ajax 成功后,静态更新表格中的数据
  267. //$.ajax({});
  268. $.ajax({
  269. type: "POST",
  270. url: "/Admin/Users/EditSettleAmount?r=" + Math.random(1),
  271. data: userdata,
  272. dataType: "text",
  273. success: function (data) {
  274. layer.close(index); //关闭弹层
  275. if (data == "success") {
  276. layer.msg("保存成功", { time: 1500 }, function () {
  277. table.reload('LAY-list-manage'); //数据刷新
  278. });
  279. } else {
  280. layer.msg(data);
  281. }
  282. }
  283. });
  284. });
  285. submit.trigger('click');
  286. }
  287. , success: function (layero, index) {
  288. }
  289. });
  290. } else if (obj.event === 'EditCashFreezeAmt') {
  291. var tr = $(obj.tr);
  292. var perContent = layer.open({
  293. type: 2
  294. , title: '修改账户金额'
  295. , content: 'EditCashFreezeAmt?Id=' + data.Id
  296. , maxmin: false
  297. , area: ['450px', '550px']
  298. , btn: ['确定', '取消']
  299. , yes: function (index, layero) {
  300. var iframeWindow = window['layui-layer-iframe' + index]
  301. , submitID = 'LAY-list-front-submit'
  302. , submit = layero.find('iframe').contents().find('#' + submitID);
  303. //监听提交
  304. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  305. var field = data.field; //获取提交的字段
  306. var userdata = "";
  307. for (var prop in field) {
  308. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  309. }
  310. //提交 Ajax 成功后,静态更新表格中的数据
  311. //$.ajax({});
  312. $.ajax({
  313. type: "POST",
  314. url: "/Admin/Users/EditCashFreezeAmt?r=" + Math.random(1),
  315. data: userdata,
  316. dataType: "text",
  317. success: function (data) {
  318. layer.close(index); //关闭弹层
  319. if (data == "success") {
  320. layer.msg("保存成功", { time: 1500 }, function () {
  321. table.reload('LAY-list-manage'); //数据刷新
  322. });
  323. } else {
  324. layer.msg(data);
  325. }
  326. }
  327. });
  328. });
  329. submit.trigger('click');
  330. }
  331. , success: function (layero, index) {
  332. }
  333. });
  334. } else if (obj.event === 'EditBalance') {
  335. var tr = $(obj.tr);
  336. var perContent = layer.open({
  337. type: 2
  338. , title: '账户操作'
  339. , content: 'EditBalance?Id=' + data.Id
  340. , maxmin: false
  341. , area: ['450px', '600px']
  342. , btn: ['确定', '取消']
  343. , yes: function (index, layero) {
  344. var iframeWindow = window['layui-layer-iframe' + index]
  345. , submitID = 'LAY-list-front-submit'
  346. , submit = layero.find('iframe').contents().find('#' + submitID);
  347. //监听提交
  348. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  349. var field = data.field; //获取提交的字段
  350. var userdata = "";
  351. for (var prop in field) {
  352. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  353. }
  354. //提交 Ajax 成功后,静态更新表格中的数据
  355. //$.ajax({});
  356. $.ajax({
  357. type: "POST",
  358. url: "/Admin/Users/EditBalance?r=" + Math.random(1),
  359. data: userdata,
  360. dataType: "text",
  361. success: function (data) {
  362. layer.close(index); //关闭弹层
  363. if (data == "success") {
  364. layer.msg("保存成功", { time: 1500 }, function () {
  365. table.reload('LAY-list-manage'); //数据刷新
  366. });
  367. } else {
  368. layer.msg(data);
  369. }
  370. }
  371. });
  372. });
  373. submit.trigger('click');
  374. }
  375. , success: function (layero, index) {
  376. }
  377. });
  378. } else if (obj.event === 'LockEnterpriseMaker') {
  379. var index = layer.confirm('是否确定取消' + data.MakerCode + ',' + data.RealName + '的企业账户权限?', function (index) {
  380. $.ajax({
  381. type: "POST",
  382. url: "/Admin/Users/CloseEnterpriseMaker?r=" + Math.random(1),
  383. data: "Id=" + data.Id,
  384. dataType: "text",
  385. success: function (data) {
  386. layer.close(index); //关闭弹层
  387. if (data == "success") {
  388. layer.msg("已取消", { time: 1500 }, function () {
  389. table.reload('LAY-list-manage'); //数据刷新
  390. });
  391. } else {
  392. parent.layer.msg(data);
  393. }
  394. }
  395. });
  396. });
  397. } else if (obj.event === 'EnterpriseMaker') {
  398. var index = layer.confirm('是否确定设置' + data.MakerCode + ',' + data.RealName + '的账号为企业账户权限?', function (index) {
  399. $.ajax({
  400. type: "POST",
  401. url: "/Admin/Users/OpenEnterpriseMaker?r=" + Math.random(1),
  402. data: "Id=" + data.Id,
  403. dataType: "text",
  404. success: function (data) {
  405. layer.close(index); //关闭弹层
  406. if (data == "success") {
  407. layer.msg("设置成功", { time: 1500 }, function () {
  408. table.reload('LAY-list-manage'); //数据刷新
  409. });
  410. } else {
  411. parent.layer.msg(data);
  412. }
  413. }
  414. });
  415. });
  416. } else if (obj.event === 'SetBigLeader') {
  417. var index = layer.confirm('是否确定设置' + data.MakerCode + ',' + data.RealName + '的账户为大盟主?', function (index) {
  418. $.ajax({
  419. type: "POST",
  420. url: "/Admin/Users/SetBigLeader?r=" + Math.random(1),
  421. data: "Id=" + data.Id,
  422. dataType: "text",
  423. success: function (data) {
  424. layer.close(index); //关闭弹层
  425. if (data == "success") {
  426. layer.msg("设置成功", { time: 1500 }, function () {
  427. table.reload('LAY-list-manage'); //数据刷新
  428. });
  429. } else {
  430. parent.layer.msg(data);
  431. }
  432. }
  433. });
  434. });
  435. } else if (obj.event === 'SetSmallLeader') {
  436. var index = layer.confirm('是否确定设置' + data.MakerCode + ',' + data.RealName + '的账号为小盟主?', function (index) {
  437. $.ajax({
  438. type: "POST",
  439. url: "/Admin/Users/SetSmallLeader?r=" + Math.random(1),
  440. data: "Id=" + data.Id,
  441. dataType: "text",
  442. success: function (data) {
  443. layer.close(index); //关闭弹层
  444. if (data == "success") {
  445. layer.msg("设置成功", { time: 1500 }, function () {
  446. table.reload('LAY-list-manage'); //数据刷新
  447. });
  448. } else {
  449. parent.layer.msg(data);
  450. }
  451. }
  452. });
  453. });
  454. } else if (obj.event === 'ChangeLeaderAmount') {
  455. var tr = $(obj.tr);
  456. var perContent = layer.open({
  457. type: 2
  458. , title: '修改盟主金额'
  459. , content: 'ChangeLeaderAmount?Id=' + data.Id
  460. , maxmin: false
  461. , area: ['450px', '550px']
  462. , btn: ['确定', '取消']
  463. , yes: function (index, layero) {
  464. var iframeWindow = window['layui-layer-iframe' + index]
  465. , submitID = 'LAY-list-front-submit'
  466. , submit = layero.find('iframe').contents().find('#' + submitID);
  467. //监听提交
  468. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  469. var field = data.field; //获取提交的字段
  470. var userdata = "";
  471. for (var prop in field) {
  472. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  473. }
  474. //提交 Ajax 成功后,静态更新表格中的数据
  475. //$.ajax({});
  476. $.ajax({
  477. type: "POST",
  478. url: "/Admin/Users/ChangeLeaderAmount?r=" + Math.random(1),
  479. data: userdata,
  480. dataType: "text",
  481. success: function (data) {
  482. layer.close(index); //关闭弹层
  483. if (data == "success") {
  484. layer.msg("修改成功", { time: 1500 }, function () {
  485. table.reload('LAY-list-manage'); //数据刷新
  486. });
  487. } else {
  488. layer.msg(data);
  489. }
  490. }
  491. });
  492. });
  493. submit.trigger('click');
  494. }
  495. , success: function (layero, index) {
  496. }
  497. });
  498. } else if (obj.event === 'detail') {
  499. var tr = $(obj.tr);
  500. var perContent = layer.open({
  501. type: 2
  502. , title: '创客详情'
  503. , content: 'Detail?Id=' + data.Id
  504. , maxmin: false
  505. , area: ['450px', '500px']
  506. , btn: ['关闭']
  507. , yes: function (index, layero) {
  508. layer.close(index); //关闭弹层
  509. }
  510. , success: function (layero, index) {
  511. }
  512. });
  513. } else if (obj.event === 'Lock') {
  514. var index = layer.confirm('是否确定锁定' + data.MakerCode + ',' + data.RealName + '的账号,禁止他登录与提现?', function (index) {
  515. $.ajax({
  516. type: "POST",
  517. url: "/Admin/Users/Open?r=" + Math.random(1),
  518. data: "Id=" + data.Id,
  519. dataType: "text",
  520. success: function (data) {
  521. layer.close(index); //关闭弹层
  522. if (data == "success") {
  523. layer.msg("已锁定", { time: 1500 }, function () {
  524. table.reload('LAY-list-manage'); //数据刷新
  525. });
  526. } else {
  527. parent.layer.msg(data);
  528. }
  529. }
  530. });
  531. });
  532. } else if (obj.event === 'UnLock') {
  533. var index = layer.confirm('是否确定恢复' + data.MakerCode + ',' + data.RealName + '的账号,恢复他登录?', function (index) {
  534. $.ajax({
  535. type: "POST",
  536. url: "/Admin/Users/Close?r=" + Math.random(1),
  537. data: "Id=" + data.Id,
  538. dataType: "text",
  539. success: function (data) {
  540. layer.close(index); //关闭弹层
  541. if (data == "success") {
  542. layer.msg("已解锁", { time: 1500 }, function () {
  543. table.reload('LAY-list-manage'); //数据刷新
  544. });
  545. } else {
  546. parent.layer.msg(data);
  547. }
  548. }
  549. });
  550. });
  551. } else if (obj.event === 'Risk') {
  552. var tr = $(obj.tr);
  553. var perContent = layer.open({
  554. type: 2
  555. , title: '风控'
  556. , content: 'Risk?Id=' + data.Id
  557. , maxmin: false
  558. , area: ['450px', '600px']
  559. , btn: ['保存', '取消']
  560. , yes: function (index, layero) {
  561. var iframeWindow = window['layui-layer-iframe' + index]
  562. , submitID = 'LAY-list-front-submit'
  563. , submit = layero.find('iframe').contents().find('#' + submitID);
  564. //监听提交
  565. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  566. var field = data.field; //获取提交的字段
  567. var userdata = "";
  568. for (var prop in field) {
  569. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  570. }
  571. //提交 Ajax 成功后,静态更新表格中的数据
  572. //$.ajax({});
  573. $.ajax({
  574. type: "POST",
  575. url: "/Admin/Users/Risk?r=" + Math.random(1),
  576. data: userdata,
  577. dataType: "text",
  578. success: function (data) {
  579. layer.close(index); //关闭弹层
  580. if (data == "success") {
  581. layer.msg("保存成功", { time: 1500 }, function () {
  582. table.reload('LAY-list-manage'); //数据刷新
  583. });
  584. } else {
  585. layer.msg(data);
  586. }
  587. }
  588. });
  589. });
  590. submit.trigger('click');
  591. }
  592. , success: function (layero, index) {
  593. }
  594. });
  595. } else if (obj.event === 'UnRisk') {
  596. var index = layer.confirm('确定要解除风控吗?', function (index) {
  597. $.ajax({
  598. type: "POST",
  599. url: "/Admin/Users/UnRisk?r=" + Math.random(1),
  600. data: "Id=" + data.Id,
  601. dataType: "text",
  602. success: function (data) {
  603. layer.close(index); //关闭弹层
  604. if (data == "success") {
  605. layer.msg("已解除风控", { time: 1500 }, function () {
  606. table.reload('LAY-list-manage'); //数据刷新
  607. });
  608. } else {
  609. parent.layer.msg(data);
  610. }
  611. }
  612. });
  613. });
  614. } else if (obj.event === 'ResetPwd') {
  615. var index = layer.confirm('是否确定重置' + data.MakerCode + ',' + data.RealName + '的登录密码?', function (index) {
  616. $.ajax({
  617. type: "POST",
  618. url: "/Admin/Users/ResetPwd?r=" + Math.random(1),
  619. data: "Id=" + data.Id,
  620. dataType: "text",
  621. success: function (data) {
  622. layer.close(index); //关闭弹层
  623. if (data.indexOf("success|") > -1) {
  624. var datalist = data.split('|');
  625. layer.alert('密码重置为:' + datalist[1]);
  626. } else {
  627. parent.layer.msg(data);
  628. }
  629. }
  630. });
  631. });
  632. } else if (obj.event === 'sycnamount') {
  633. var index = layer.confirm('确定要重置该创客的小分仓额度吗?', function (index) {
  634. layer.close(index);
  635. var loadindex = layer.load(1, {
  636. shade: [0.5, '#000']
  637. });
  638. $.ajax({
  639. type: "POST",
  640. url: "/Admin/Users/SycnAmountData?r=" + Math.random(1),
  641. data: "Id=" + data.Id,
  642. dataType: "text",
  643. success: function (data) {
  644. layer.close(loadindex);
  645. if (data == "success") {
  646. layer.msg('重置成功');
  647. table.reload('LAY-list-manage');
  648. } else {
  649. layer.msg(data);
  650. }
  651. }
  652. });
  653. });
  654. } else if (obj.event === 'sycntrade') {
  655. var tr = $(obj.tr);
  656. var perContent = layer.open({
  657. type: 2
  658. , title: '同步交易额'
  659. , content: 'SycnTradeAmount?Id=' + data.Id
  660. , maxmin: false
  661. , area: ['550px', '700px']
  662. , btn: ['确定', '取消']
  663. , yes: function (index, layero) {
  664. var iframeWindow = window['layui-layer-iframe' + index]
  665. , submitID = 'LAY-list-front-submit'
  666. , submit = layero.find('iframe').contents().find('#' + submitID);
  667. //监听提交
  668. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  669. var field = data.field; //获取提交的字段
  670. var userdata = "";
  671. for (var prop in field) {
  672. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  673. }
  674. //提交 Ajax 成功后,静态更新表格中的数据
  675. //$.ajax({});
  676. var loadindex = layer.load(1, {
  677. shade: [0.5, '#000']
  678. });
  679. $.ajax({
  680. type: "POST",
  681. url: "/Admin/Users/SycnTradeAmountDo?r=" + Math.random(1),
  682. data: userdata,
  683. dataType: "text",
  684. success: function (data) {
  685. layer.close(loadindex); //关闭弹层
  686. layer.close(index); //关闭弹层
  687. if (data == "success") {
  688. layer.alert('重置程序已启动,请稍后核对创客交易额');
  689. } else {
  690. layer.msg(data);
  691. }
  692. }
  693. });
  694. });
  695. submit.trigger('click');
  696. }
  697. , success: function (layero, index) {
  698. }
  699. });
  700. }
  701. });
  702. //监听搜索
  703. form.on('submit(LAY-list-front-search)', function (data) {
  704. var field = data.field;
  705. field.ShowFlag = 1;
  706. if (field.MakerCode == "" && field.RealName == "" && field.ParentMakerCode == "" && field.ParentRealName == "" && field.Mobile == "" && field.CertId == "" && field.CreateDateData == "" && field.UserLevel == "" && field.AuthFlagSelect == "" && field.RiskFlagSelect == "" && field.MerchantTypeSelect == "") {
  707. layer.alert('请输入查询条件');
  708. }
  709. else {
  710. //执行重载
  711. table.reload('LAY-list-manage', {
  712. where: field
  713. });
  714. }
  715. });
  716. form.on('submit(LAY-list-front-searchall)', function (data) {
  717. table.reload('LAY-list-manage', {
  718. where: {
  719. SelfId: SelfId,
  720. ParentId: ParentId,
  721. MakerCode: MakerCode
  722. }
  723. });
  724. });
  725. //事件
  726. var active = {
  727. batchdel: function () {
  728. var checkStatus = table.checkStatus('LAY-list-manage')
  729. , data = checkStatus.data; //得到选中的数据
  730. if (data.length < 1) {
  731. parent.layer.msg("请选择要注销的项");
  732. } else {
  733. var ids = "";
  734. $.each(data, function (index, value) {
  735. ids += data[index].Id + ",";
  736. });
  737. ids = ids.substring(0, ids.length - 1);
  738. var index = layer.confirm('确定要注销吗?注销后不能恢复!', function (index) {
  739. $.ajax({
  740. type: "POST",
  741. url: "/Admin/Users/Delete?r=" + Math.random(1),
  742. data: "Id=" + ids,
  743. dataType: "text",
  744. success: function (data) {
  745. layer.close(index);
  746. if (data == "success") {
  747. table.reload('LAY-list-manage');
  748. } else {
  749. layer.msg(data);
  750. }
  751. }
  752. });
  753. });
  754. }
  755. }
  756. , add: function () {
  757. var perContent = layer.open({
  758. type: 2
  759. , title: '创客-添加'
  760. , content: 'Add'
  761. , maxmin: true
  762. , area: ['500px', '550px']
  763. , btn: ['确定', '取消']
  764. , yes: function (index, layero) {
  765. var iframeWindow = window['layui-layer-iframe' + index]
  766. , submitID = 'LAY-list-front-submit'
  767. , submit = layero.find('iframe').contents().find('#' + submitID);
  768. setTimeout(function () {
  769. layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
  770. var errObj = $(this).find('.layui-form-danger');
  771. if (errObj.length > 0) {
  772. iframeWindow.element.tabChange('mytabbar', String(i + 1));
  773. submit.click();
  774. }
  775. });
  776. }, 300);
  777. //监听提交
  778. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  779. var field = data.field; //获取提交的字段
  780. var userdata = "";
  781. for (var prop in field) {
  782. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  783. }
  784. //提交 Ajax 成功后,静态更新表格中的数据
  785. //$.ajax({});
  786. $.ajax({
  787. type: "POST",
  788. url: "/Admin/Users/Add?r=" + Math.random(1),
  789. data: userdata,
  790. dataType: "text",
  791. success: function (data) {
  792. if (data == "success") {
  793. layer.close(index); //关闭弹层
  794. layer.msg('新增成功', { time: 1500 }, function () {
  795. table.reload('LAY-list-manage'); //数据刷新
  796. });
  797. } else {
  798. layer.msg(data);
  799. }
  800. }
  801. });
  802. });
  803. submit.trigger('click');
  804. }
  805. });
  806. }
  807. , ImportSettleAmount: function () {
  808. ExcelKind = 1;
  809. layer.open({
  810. type: 1,
  811. title: '导入',
  812. maxmin: false,
  813. area: ['460px', '280px'],
  814. content: $('#excelForm'),
  815. cancel: function () {
  816. }
  817. });
  818. $("#excelTemp").html('<a href="/users/批量修改提现结算金额模版.xlsx">点击下载批量修改提现结算金额模版</a>');
  819. }
  820. , ImportFreezeAmt: function () {
  821. ExcelKind = 2;
  822. layer.open({
  823. type: 1,
  824. title: '导入',
  825. maxmin: false,
  826. area: ['460px', '280px'],
  827. content: $('#excelForm'),
  828. cancel: function () {
  829. }
  830. });
  831. $("#excelTemp").html('<a href="/users/批量修改提现冻结金额模版.xlsx">点击下载批量修改提现冻结金额模版</a>');
  832. }
  833. , ImportRisk: function () {
  834. ExcelKind = 3;
  835. layer.open({
  836. type: 1,
  837. title: '导入',
  838. maxmin: false,
  839. area: ['460px', '280px'],
  840. content: $('#excelForm'),
  841. cancel: function () {
  842. }
  843. });
  844. $("#excelTemp").html('<a href="/users/提现风控模版.xlsx">点击下载提现风控模版</a>');
  845. }
  846. //new function 2022-05-24
  847. , ImportEditAmt: function () {
  848. ExcelKind = 4;
  849. layer.open({
  850. type: 1,
  851. title: '导入',
  852. maxmin: false,
  853. area: ['460px', '280px'],
  854. content: $('#excelForm'),
  855. cancel: function () {
  856. }
  857. });
  858. $("#excelTemp").html('<a href="/users/批量修改金额模版.xlsx">点击下载批量修改金额模版</a>');
  859. }
  860. , ExportExcel: function () {
  861. var userdata = '';
  862. $(".layuiadmin-card-header-auto input").each(function (i) {
  863. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  864. });
  865. $(".layuiadmin-card-header-auto select").each(function (i) {
  866. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  867. });
  868. $.ajax({
  869. type: "GET",
  870. url: "/Admin/Users/ExportExcel?r=" + Math.random(1),
  871. data: userdata,
  872. dataType: "json",
  873. success: function (data) {
  874. data.Obj.unshift(data.Fields);
  875. excel.exportExcel(data.Obj, data.Info, 'xlsx');
  876. }
  877. });
  878. }
  879. , ExportZSExcel: function () {
  880. var userdata = '';
  881. $(".layuiadmin-card-header-auto input").each(function (i) {
  882. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  883. });
  884. $(".layuiadmin-card-header-auto select").each(function (i) {
  885. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  886. });
  887. $.ajax({
  888. type: "GET",
  889. url: "/Admin/Users/ExportZSExcel?r=" + Math.random(1),
  890. data: userdata,
  891. dataType: "json",
  892. success: function (data) {
  893. data.Obj.unshift(data.Fields);
  894. excel.exportExcel(data.Obj, data.Info, 'xlsx');
  895. }
  896. });
  897. }
  898. , ExportSJExcel: function () {
  899. var userdata = '';
  900. $(".layuiadmin-card-header-auto input").each(function (i) {
  901. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  902. });
  903. $(".layuiadmin-card-header-auto select").each(function (i) {
  904. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  905. });
  906. $.ajax({
  907. type: "GET",
  908. url: "/Admin/Users/ExportSJExcel?r=" + Math.random(1),
  909. data: userdata,
  910. dataType: "json",
  911. success: function (data) {
  912. data.Obj.unshift(data.Fields);
  913. excel.exportExcel(data.Obj, data.Info, 'xlsx');
  914. }
  915. });
  916. }
  917. , ThreeElement: function () {
  918. var perContent = layer.open({
  919. type: 2
  920. , title: '三/四要素验证'
  921. , content: 'ThreeElement'
  922. , maxmin: false
  923. , area: ['450px', '450px']
  924. , btn: ['验证', '取消']
  925. , yes: function (index, layero) {
  926. var iframeWindow = window['layui-layer-iframe' + index]
  927. , submitID = 'LAY-list-front-submit'
  928. , submit = layero.find('iframe').contents().find('#' + submitID);
  929. //监听提交
  930. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  931. var field = data.field; //获取提交的字段
  932. var userdata = "";
  933. for (var prop in field) {
  934. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  935. }
  936. //提交 Ajax 成功后,静态更新表格中的数据
  937. //$.ajax({});
  938. $.ajax({
  939. type: "POST",
  940. url: "/Admin/Users/ThreeElement?r=" + Math.random(1),
  941. data: userdata,
  942. dataType: "text",
  943. success: function (data) {
  944. if (data == "success") {
  945. layer.msg("验证通过");
  946. } else {
  947. layer.msg(data);
  948. }
  949. }
  950. });
  951. });
  952. submit.trigger('click');
  953. }
  954. , success: function (layero, index) {
  955. }
  956. });
  957. }
  958. , Open: function () {
  959. var checkStatus = table.checkStatus('LAY-list-manage')
  960. , data = checkStatus.data; //得到选中的数据
  961. if (data.length < 1) {
  962. parent.layer.msg("请选择要开启的项");
  963. } else {
  964. var ids = "";
  965. $.each(data, function (index, value) {
  966. ids += data[index].Id + ",";
  967. });
  968. ids = ids.substring(0, ids.length - 1);
  969. var index = layer.confirm('确定要开启吗?', function (index) {
  970. $.ajax({
  971. type: "POST",
  972. url: "/Admin/Users/Open?r=" + Math.random(1),
  973. data: "Id=" + ids,
  974. dataType: "text",
  975. success: function (data) {
  976. layer.close(index);
  977. if (data == "success") {
  978. table.reload('LAY-list-manage');
  979. } else {
  980. layer.msg(data);
  981. }
  982. }
  983. });
  984. });
  985. }
  986. }
  987. , Close: function () {
  988. var checkStatus = table.checkStatus('LAY-list-manage')
  989. , data = checkStatus.data; //得到选中的数据
  990. if (data.length < 1) {
  991. parent.layer.msg("请选择要关闭的项");
  992. } else {
  993. var ids = "";
  994. $.each(data, function (index, value) {
  995. ids += data[index].Id + ",";
  996. });
  997. ids = ids.substring(0, ids.length - 1);
  998. var index = layer.confirm('确定要关闭吗?', function (index) {
  999. $.ajax({
  1000. type: "POST",
  1001. url: "/Admin/Users/Close?r=" + Math.random(1),
  1002. data: "Id=" + ids,
  1003. dataType: "text",
  1004. success: function (data) {
  1005. layer.close(index);
  1006. if (data == "success") {
  1007. table.reload('LAY-list-manage');
  1008. } else {
  1009. layer.msg(data);
  1010. }
  1011. }
  1012. });
  1013. });
  1014. }
  1015. }
  1016. };
  1017. $('.layui-btn').on('click', function () {
  1018. var type = $(this).data('type');
  1019. active[type] ? active[type].call(this) : '';
  1020. });
  1021. });