Users_Admin.js 36 KB

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