UsersChildren_Admin.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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: 'TotalPosAmount', width: 200, title: 'POS交易总额', sort: true }
  96. , { field: 'TotalAmtfc', width: 200, title: '刷卡交易总额(扶)', sort: true }
  97. , { field: 'DAmtfc', width: 200, title: '贷记卡交易额(扶)', sort: true }
  98. , { field: 'JAmtfc', width: 200, title: '借记卡非封顶交易额(扶)', sort: true }
  99. , { field: 'JfAmtfc', width: 200, title: '借记卡封顶交易额(扶)', sort: true }
  100. , { field: 'JCountfc', width: 200, title: '借记卡交易笔数(扶)', sort: true }
  101. , { field: 'YAmtfc', width: 200, title: '云闪付小额交易额(扶)', sort: true }
  102. , { field: 'TotalAmtwd', width: 200, title: '刷卡交易总额(稳)', sort: true }
  103. , { field: 'DAmtwd', width: 200, title: '贷记卡交易额(稳)', sort: true }
  104. , { field: 'JAmtwd', width: 200, title: '借记卡非封顶交易额(稳)', sort: true }
  105. , { field: 'JfAmtwd', width: 200, title: '借记卡封顶交易额(稳)', sort: true }
  106. , { field: 'JCountwd', width: 200, title: '借记卡交易笔数(稳)', sort: true }
  107. , { field: 'YAmtwd', width: 200, title: '云闪付小额交易额(稳)', sort: true }
  108. , { field: 'TotalAmtyl', width: 200, title: '刷卡交易总额(稳A)', sort: true }
  109. , { field: 'DAmtyl', width: 200, title: '贷记卡交易额(稳A)', sort: true }
  110. , { field: 'JAmtyl', width: 200, title: '借记卡非封顶交易额(稳A)', sort: true }
  111. , { field: 'JfAmtyl', width: 200, title: '借记卡封顶交易额(稳A)', sort: true }
  112. , { field: 'JCountyl', width: 200, title: '借记卡交易笔数(稳A)', sort: true }
  113. , { field: 'YAmtyl', width: 200, title: '云闪付小额交易额(稳A)', sort: true }
  114. , { field: 'TotalAmtyl2', width: 200, title: '刷卡交易总额(稳B)', sort: true }
  115. , { field: 'DAmtyl2', width: 200, title: '贷记卡交易额(稳B)', sort: true }
  116. , { field: 'JAmtyl2', width: 200, title: '借记卡非封顶交易额(稳B)', sort: true }
  117. , { field: 'JfAmtyl2', width: 200, title: '借记卡封顶交易额(稳B)', sort: true }
  118. , { field: 'JCountyl2', width: 200, title: '借记卡交易笔数(稳B)', sort: true }
  119. , { field: 'YAmtyl2', width: 200, title: '云闪付小额交易额(稳B)', sort: true }
  120. , { field: 'TBCount', width: 200, title: '团队机具绑定总数', sort: true }
  121. , { field: 'TACount', width: 200, title: '团队机具激活总数', sort: true }
  122. // , { field: 'HelpInfo', width: 400, title: '扶持期商户交易信息', sort: true }
  123. // , { field: 'NotHelpInfo', width: 400, title: '稳定期商户交易信息', sort: true }
  124. ]]
  125. , where: {
  126. ParentId: ParentId,
  127. MakerCode: MakerCode
  128. }
  129. , page: true
  130. , limit: 30
  131. , height: 'full-' + String($('.layui-card-header').height() + 130)
  132. , text: '对不起,加载出现异常!'
  133. , done: function (res, curr, count) {
  134. $("#TotalAmtfc").text(res.other.TotalAmtfc);
  135. $("#DAmtfc").text(res.other.DAmtfc);
  136. $("#JAmtfc").text(res.other.JAmtfc);
  137. $("#JfAmtfc").text(res.other.JfAmtfc);
  138. $("#JCountfc").text(res.other.JCountfc);
  139. $("#YAmtfc").text(res.other.YAmtfc);
  140. $("#TotalAmtwd").text(res.other.TotalAmtwd);
  141. $("#DAmtwd").text(res.other.DAmtwd);
  142. $("#JAmtwd").text(res.other.JAmtwd);
  143. $("#JfAmtwd").text(res.other.JfAmtwd);
  144. $("#JCountwd").text(res.other.JCountwd);
  145. $("#YAmtwd").text(res.other.YAmtwd);
  146. $("#TotalAmtyl").text(res.other.TotalAmtyl);
  147. $("#DAmtyl").text(res.other.DAmtyl);
  148. $("#JAmtyl").text(res.other.JAmtyl);
  149. $("#JfAmtyl").text(res.other.JfAmtyl);
  150. $("#JCountyl").text(res.other.JCountyl);
  151. $("#YAmtyl").text(res.other.YAmtyl);
  152. $("#TotalAmtyls").text(res.other.TotalAmtyls);
  153. $("#DAmtyls").text(res.other.DAmtyls);
  154. $("#JAmtyls").text(res.other.JAmtyls);
  155. $("#JfAmtyls").text(res.other.JfAmtyls);
  156. $("#JCountyls").text(res.other.JCountyls);
  157. $("#YAmtyls").text(res.other.YAmtyls);
  158. $("#TotalAmtfc1").text(res.other.TotalAmtfc1);
  159. $("#DAmtfc1").text(res.other.DAmtfc1);
  160. $("#JAmtfc1").text(res.other.JAmtfc1);
  161. $("#JfAmtfc1").text(res.other.JfAmtfc1);
  162. $("#JCountfc1").text(res.other.JCountfc1);
  163. $("#YAmtfc1").text(res.other.YAmtfc1);
  164. $("#TotalAmtwd1").text(res.other.TotalAmtwd1);
  165. $("#DAmtwd1").text(res.other.DAmtwd1);
  166. $("#JAmtwd1").text(res.other.JAmtwd1);
  167. $("#JfAmtwd1").text(res.other.JfAmtwd1);
  168. $("#JCountwd1").text(res.other.JCountwd1);
  169. $("#YAmtwd1").text(res.other.YAmtwd1);
  170. $("#TotalAmtyl1").text(res.other.TotalAmtyl1);
  171. $("#DAmtyl1").text(res.other.DAmtyl1);
  172. $("#JAmtyl1").text(res.other.JAmtyl1);
  173. $("#JfAmtyl1").text(res.other.JfAmtyl1);
  174. $("#JCountyl1").text(res.other.JCountyl1);
  175. $("#YAmtyl1").text(res.other.YAmtyl1);
  176. $("#TotalAmtyl1s").text(res.other.TotalAmtyl1s);
  177. $("#DAmtyl1s").text(res.other.DAmtyl1s);
  178. $("#JAmtyl1s").text(res.other.JAmtyl1s);
  179. $("#JfAmtyl1s").text(res.other.JfAmtyl1s);
  180. $("#JCountyl1s").text(res.other.JCountyl1s);
  181. $("#YAmtyl1s").text(res.other.YAmtyl1s);
  182. $("#TotalPosAmount").text(res.other.TotalPosAmount);
  183. $("#TotalPosAmount1").text(res.other.TotalPosAmount1);
  184. $("#BCount").text(res.other.BCount);
  185. $("#ACount").text(res.other.ACount);
  186. $("#PBCount").text(res.other.PBCount);
  187. $("#PACount").text(res.other.PACount);
  188. $("#TBCount").text(res.other.TBCount);
  189. $("#TACount").text(res.other.TACount);
  190. $(".layui-none").text("无数据");
  191. }
  192. });
  193. //监听工具条
  194. table.on('tool(LAY-list-manage)', function (obj) {
  195. var data = obj.data;
  196. });
  197. //监听搜索
  198. form.on('submit(LAY-list-front-search)', function (data) {
  199. var field = data.field;
  200. //执行重载
  201. table.reload('LAY-list-manage', {
  202. where: field
  203. });
  204. });
  205. form.on('submit(LAY-list-front-searchall)', function (data) {
  206. table.reload('LAY-list-manage', {
  207. where: {
  208. SelfId: SelfId,
  209. ParentId: ParentId,
  210. MakerCode: MakerCode
  211. }
  212. });
  213. });
  214. $('.layui-btn').on('click', function () {
  215. var type = $(this).data('type');
  216. active[type] ? active[type].call(this) : '';
  217. });
  218. });