money_out.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'trade/money_out/index' + location.search,
  8. table: 'money_out',
  9. }
  10. });
  11. var table = $("#table");
  12. // 初始化表格
  13. table.bootstrapTable({
  14. url: $.fn.bootstrapTable.defaults.extend.index_url,
  15. pk: 'id',
  16. sortName: 'id',
  17. fixedColumns: true,
  18. fixedRightNumber: 1,
  19. columns: [
  20. [
  21. {checkbox: true},
  22. {field: 'id', title: __('Id')},
  23. {field: 'order_type', title: __("Order_type"),
  24. searchList: {1:__('Usdt'), 2:__('Bank')},
  25. formatter: Table.api.formatter.status
  26. },
  27. {field: 'users.mobile', title: __('User_id')},
  28. {field: 'users.balance', title: __('当前余额')},
  29. {field: 'usdt_address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  30. {field: 'bank_name', title: __('Bank_name'), operate: 'LIKE'},
  31. {field: 'bank_card', title: __('Bank_card'), operate: 'LIKE'},
  32. {field: 'account_name', title: __('Account_name'), operate: 'LIKE'},
  33. {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
  34. {field: 'fee', title: __('Fee'), operate:'BETWEEN'},
  35. {field: 'real_amount', title: __('Real_amount'), operate:'BETWEEN'},
  36. {field: 'status', title: __("Status"),
  37. searchList: {100:__('Pending'), 200:__('Success'), 400:__('Fail'), 401:__('驳回'), 500:__('Cancel')},
  38. formatter: Table.api.formatter.status
  39. },
  40. {field: 'user_type', title: __("用户类型"),
  41. searchList: {0:__('假人'), 1:__('真人')},
  42. formatter: Table.api.formatter.status
  43. },
  44. {field: 'admins.nickname', title: __('Admin_id')},
  45. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  46. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  47. {field: 'operate', title: __('Operate'),
  48. table: table,
  49. buttons: [{
  50. name: "operate",
  51. text: __('成功'),
  52. classname: 'btn btn-xs btn-success btn-magic btn-ajax',
  53. confirm: __('Confirm review'),
  54. url: 'trade/money_out/review/status/200',
  55. visible: function (row) {
  56. if(row.status == 100) return true;
  57. return false;
  58. },
  59. refresh: true
  60. },
  61. {
  62. name: "operate",
  63. text: __('驳回'),
  64. classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
  65. confirm: __('Confirm review'),
  66. url: 'trade/money_out/review/status/401',
  67. visible: function (row) {
  68. if(row.status == 100) return true;
  69. return false;
  70. },
  71. refresh: true
  72. }],
  73. events: Table.api.events.operate, formatter: Table.api.formatter.operate
  74. }
  75. ]
  76. ]
  77. });
  78. // 为表格绑定事件
  79. Table.api.bindevent(table);
  80. //绑定TAB事件
  81. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  82. var typeStr = $(this).attr("href").replace('#', '');
  83. var options = table.bootstrapTable('getOptions');
  84. options.pageNumber = 1;
  85. options.queryParams = function (params) {
  86. params.order_type = typeStr;
  87. return params;
  88. };
  89. table.bootstrapTable('refresh', {});
  90. return false;
  91. });
  92. },
  93. add: function () {
  94. Controller.api.bindevent();
  95. },
  96. edit: function () {
  97. Controller.api.bindevent();
  98. },
  99. api: {
  100. bindevent: function () {
  101. Form.api.bindevent($("form[role=form]"));
  102. }
  103. }
  104. };
  105. return Controller;
  106. });