UsersChildren_Admin.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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/ChildrenData' //模拟接口
  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: 'TotalAmtfc', width: 200, title: '刷卡交易总额(扶)', sort: true }
  96. , { field: 'DAmtfc', width: 200, title: '贷记卡交易额(扶)', sort: true }
  97. , { field: 'JAmtfc', width: 200, title: '借记卡非封顶交易额(扶)', sort: true }
  98. , { field: 'JfAmtfc', width: 200, title: '借记卡封顶交易额(扶)', sort: true }
  99. , { field: 'JCountfc', width: 200, title: '借记卡交易笔数(扶)', sort: true }
  100. , { field: 'YAmtfc', width: 200, title: '云闪付小额交易额(扶)', sort: true }
  101. , { field: 'TotalAmtwd', width: 200, title: '刷卡交易总额(稳)', sort: true }
  102. , { field: 'DAmtwd', width: 200, title: '贷记卡交易额(稳)', sort: true }
  103. , { field: 'JAmtwd', width: 200, title: '借记卡非封顶交易额(稳)', sort: true }
  104. , { field: 'JfAmtwd', width: 200, title: '借记卡封顶交易额(稳)', sort: true }
  105. , { field: 'JCountwd', width: 200, title: '借记卡交易笔数(稳)', sort: true }
  106. , { field: 'YAmtwd', width: 200, title: '云闪付小额交易额(稳)', sort: true }
  107. , { field: 'BCount', width: 200, title: '绑定数', sort: true }
  108. , { field: 'ACount', width: 200, title: '激活数', sort: true }
  109. // , { field: 'HelpInfo', width: 400, title: '扶持期商户交易信息', sort: true }
  110. // , { field: 'NotHelpInfo', width: 400, title: '稳定期商户交易信息', sort: true }
  111. ]]
  112. , where: {
  113. ParentId: ParentId,
  114. MakerCode: MakerCode
  115. }
  116. , page: true
  117. , limit: 30
  118. , height: 'full-' + String($('.layui-card-header').height() + 130)
  119. , text: '对不起,加载出现异常!'
  120. , done: function (res, curr, count) {
  121. $("#TotalAmtfc").text(res.other.TotalAmtfc);
  122. $("#DAmtfc").text(res.other.DAmtfc);
  123. $("#JAmtfc").text(res.other.JAmtfc);
  124. $("#JfAmtfc").text(res.other.JfAmtfc);
  125. $("#JCountfc").text(res.other.JCountfc);
  126. $("#YAmtfc").text(res.other.YAmtfc);
  127. $("#TotalAmtwd").text(res.other.TotalAmtwd);
  128. $("#DAmtwd").text(res.other.DAmtwd);
  129. $("#JAmtwd").text(res.other.JAmtwd);
  130. $("#JfAmtwd").text(res.other.JfAmtwd);
  131. $("#JCountwd").text(res.other.JCountwd);
  132. $("#YAmtwd").text(res.other.YAmtwd);
  133. $("#BCount").text(res.other.BCount);
  134. $("#ACount").text(res.other.ACount);
  135. $(".layui-none").text("无数据");
  136. }
  137. });
  138. //监听工具条
  139. table.on('tool(LAY-list-manage)', function (obj) {
  140. var data = obj.data;
  141. });
  142. //监听搜索
  143. form.on('submit(LAY-list-front-search)', function (data) {
  144. var field = data.field;
  145. //执行重载
  146. table.reload('LAY-list-manage', {
  147. where: field
  148. });
  149. });
  150. form.on('submit(LAY-list-front-searchall)', function (data) {
  151. table.reload('LAY-list-manage', {
  152. where: {
  153. SelfId: SelfId,
  154. ParentId: ParentId,
  155. MakerCode: MakerCode
  156. }
  157. });
  158. });
  159. $('.layui-btn').on('click', function () {
  160. var type = $(this).data('type');
  161. active[type] ? active[type].call(this) : '';
  162. });
  163. });