UsersChildren_Admin.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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 <= 2) {
  43. if (endDate.month - date.month == 2 && endDate.date > date.date) {
  44. op = false;
  45. layCreateDate.hint('日期范围请不要超过2个月');
  46. setTimeout(function () {
  47. $(".laydate-btns-confirm").addClass("laydate-disabled");
  48. }, 1);
  49. }
  50. } else {
  51. op = false;
  52. layCreateDate.hint('日期范围请不要超过2个月');
  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: 'TotalAmtyl', width: 200, title: '刷卡交易总额(盈)', sort: true }
  108. , { field: 'DAmtyl', width: 200, title: '贷记卡交易额(盈)', sort: true }
  109. , { field: 'JAmtyl', width: 200, title: '借记卡非封顶交易额(盈)', sort: true }
  110. , { field: 'JfAmtyl', width: 200, title: '借记卡封顶交易额(盈)', sort: true }
  111. , { field: 'JCountyl', width: 200, title: '借记卡交易笔数(盈)', sort: true }
  112. , { field: 'YAmtyl', width: 200, title: '云闪付小额交易额(盈)', sort: true }
  113. , { field: 'TBCount', width: 200, title: '团队机具绑定总数', sort: true }
  114. , { field: 'TACount', width: 200, title: '团队机具激活总数', sort: true }
  115. // , { field: 'HelpInfo', width: 400, title: '扶持期商户交易信息', sort: true }
  116. // , { field: 'NotHelpInfo', width: 400, title: '稳定期商户交易信息', sort: true }
  117. ]]
  118. , where: {
  119. ParentId: ParentId,
  120. MakerCode: MakerCode
  121. }
  122. , page: true
  123. , limit: 30
  124. , height: 'full-' + String($('.layui-card-header').height() + 130)
  125. , text: '对不起,加载出现异常!'
  126. , done: function (res, curr, count) {
  127. $("#TotalAmtfc").text(res.other.TotalAmtfc);
  128. $("#DAmtfc").text(res.other.DAmtfc);
  129. $("#JAmtfc").text(res.other.JAmtfc);
  130. $("#JfAmtfc").text(res.other.JfAmtfc);
  131. $("#JCountfc").text(res.other.JCountfc);
  132. $("#YAmtfc").text(res.other.YAmtfc);
  133. $("#TotalAmtwd").text(res.other.TotalAmtwd);
  134. $("#DAmtwd").text(res.other.DAmtwd);
  135. $("#JAmtwd").text(res.other.JAmtwd);
  136. $("#JfAmtwd").text(res.other.JfAmtwd);
  137. $("#JCountwd").text(res.other.JCountwd);
  138. $("#YAmtwd").text(res.other.YAmtwd);
  139. $("#TotalAmtyl").text(res.other.TotalAmtyl);
  140. $("#DAmtyl").text(res.other.DAmtyl);
  141. $("#JAmtyl").text(res.other.JAmtyl);
  142. $("#JfAmtyl").text(res.other.JfAmtyl);
  143. $("#JCountyl").text(res.other.JCountyl);
  144. $("#YAmtyl").text(res.other.YAmtyl);
  145. $("#TotalAmtfc1").text(res.other.TotalAmtfc1);
  146. $("#DAmtfc1").text(res.other.DAmtfc1);
  147. $("#JAmtfc1").text(res.other.JAmtfc1);
  148. $("#JfAmtfc1").text(res.other.JfAmtfc1);
  149. $("#JCountfc1").text(res.other.JCountfc1);
  150. $("#YAmtfc1").text(res.other.YAmtfc1);
  151. $("#TotalAmtwd1").text(res.other.TotalAmtwd1);
  152. $("#DAmtwd1").text(res.other.DAmtwd1);
  153. $("#JAmtwd1").text(res.other.JAmtwd1);
  154. $("#JfAmtwd1").text(res.other.JfAmtwd1);
  155. $("#JCountwd1").text(res.other.JCountwd1);
  156. $("#YAmtwd1").text(res.other.YAmtwd1);
  157. $("#TotalAmtyl1").text(res.other.TotalAmtyl1);
  158. $("#DAmtyl1").text(res.other.DAmtyl1);
  159. $("#JAmtyl1").text(res.other.JAmtyl1);
  160. $("#JfAmtyl1").text(res.other.JfAmtyl1);
  161. $("#JCountyl1").text(res.other.JCountyl1);
  162. $("#YAmtyl1").text(res.other.YAmtyl1);
  163. $("#BCount").text(res.other.BCount);
  164. $("#ACount").text(res.other.ACount);
  165. $("#PBCount").text(res.other.PBCount);
  166. $("#PACount").text(res.other.PACount);
  167. $("#TBCount").text(res.other.TBCount);
  168. $("#TACount").text(res.other.TACount);
  169. $(".layui-none").text("无数据");
  170. }
  171. });
  172. //监听工具条
  173. table.on('tool(LAY-list-manage)', function (obj) {
  174. var data = obj.data;
  175. });
  176. //监听搜索
  177. form.on('submit(LAY-list-front-search)', function (data) {
  178. var field = data.field;
  179. //执行重载
  180. table.reload('LAY-list-manage', {
  181. where: field
  182. });
  183. });
  184. form.on('submit(LAY-list-front-searchall)', function (data) {
  185. table.reload('LAY-list-manage', {
  186. where: {
  187. SelfId: SelfId,
  188. ParentId: ParentId,
  189. MakerCode: MakerCode
  190. }
  191. });
  192. });
  193. $('.layui-btn').on('click', function () {
  194. var type = $(this).data('type');
  195. active[type] ? active[type].call(this) : '';
  196. });
  197. });