AuditBankInfoCtrl.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. define(['app/app'], function (app) {
  2. 'use strict';
  3. app.register.controller('AuditBankInfoCtrl', ['$scope', 'ngTableParams', 'bankInfoService', 'toaster', 'BaseService', function ($scope, ngTableParams, bankInfoService, toaster, BaseService) {
  4. $scope.active = 'tobeAudit';
  5. $scope.status = 101;
  6. $scope.$$auditBankInfo = {};
  7. $scope.$$auditBankInfo.bankInfoFail = null;
  8. //设置状态
  9. $scope.setActive = function (active) {
  10. if($scope.active != active) {
  11. $scope.active = active;
  12. switch ($scope.active) {
  13. case 'tobeAudit':
  14. $scope.status = 101;
  15. break;
  16. case 'pass':
  17. $scope.status = 104;
  18. break;
  19. case 'fail':
  20. $scope.status = 103;
  21. break;
  22. }
  23. $scope.bankInfoTableParams.page(1);
  24. $scope.bankInfoTableParams.reload();
  25. }
  26. };
  27. //table的设置
  28. $scope.bankInfoTableParams = new ngTableParams({
  29. page : 1,
  30. count : 5,
  31. sorting : {
  32. createTime : 'DESC'
  33. }
  34. }, {
  35. total : 0,
  36. getData : function ($defer, params) {
  37. const param = BaseService.parseParams(params.url());
  38. param.status = $scope.status;
  39. param.keyword = $scope.keyword;
  40. bankInfoService.getPageStatusBankInfo(param, function (data) {
  41. params.total(data.totalElements);
  42. $defer.resolve(data.content);
  43. }, function (response) {
  44. toaster.pop('error', '获取账户信息失败 ', response.data);
  45. });
  46. }
  47. });
  48. //搜索
  49. $scope.onSearch = function () {
  50. $scope.bankInfoTableParams.reload();
  51. }
  52. //审核不通过
  53. $scope.auditFail = function (info) {
  54. $scope.$$auditBankInfo.openDiv = true;
  55. $scope.$$auditBankInfo.bankInfoFail = info;
  56. };
  57. //审核通过
  58. $scope.auditPass = function (info) {
  59. bankInfoService.auditBankInfoPass({id: info.id},null, function (data) {
  60. if(data.code == 1) {
  61. toaster.pop('success', '已审核通过');
  62. $scope.bankInfoTableParams.reload();
  63. }else {
  64. toaster.pop('info', '审核通过失败:' + data.message);
  65. }
  66. },function () {
  67. toaster.pop('error', '审核通过失败,请重新操作');
  68. });
  69. };
  70. //确认审核不通过
  71. $scope.confirm = function () {
  72. if(!$scope.$$auditBankInfo.reason) {
  73. toaster.pop('info', '提示', "请输入审核不通过原因");
  74. return ;
  75. }
  76. bankInfoService.auditBankInfoFail({id : $scope.$$auditBankInfo.bankInfoFail.id}, {reason : $scope.$$auditBankInfo.reason}, function (data) {
  77. if(data.code == 1) {
  78. $scope.bankInfoTableParams.reload();
  79. toaster.pop('success', '操作成功');
  80. $scope.$$auditBankInfo.openDiv = false;
  81. $scope.$$auditBankInfo.reason = null;
  82. $scope.$$auditBankInfo.bankInfoFail = null;
  83. }else {
  84. toaster.pop('info', '操作失败:' + data.message);
  85. }
  86. }, function (response) {
  87. console.log(response);
  88. toaster.pop('error', '审核报错,请重新试试');
  89. });
  90. }
  91. //操作取消
  92. $scope.cancle = function () {
  93. $scope.$$auditBankInfo.openDiv = false;
  94. $scope.$$auditBankInfo.reason = null;
  95. $scope.$$auditBankInfo.bankInfoFail = null;
  96. }
  97. }]);
  98. app.register.filter('bankStatusFilter', function () {
  99. return function (status) {
  100. var result = '未知状态';
  101. switch (status) {
  102. case 101:
  103. result = '已提交';
  104. break;
  105. case 103:
  106. result = '未通过';
  107. break;
  108. case 104:
  109. result = '已通过';
  110. break;
  111. }
  112. return result;
  113. }
  114. })
  115. });