money_out.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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: 'usdt_address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  29. {field: 'bank_name', title: __('Bank_name'), operate: 'LIKE'},
  30. {field: 'bank_card', title: __('Bank_card'), operate: 'LIKE'},
  31. {field: 'account_name', title: __('Account_name'), operate: 'LIKE'},
  32. {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
  33. {field: 'fee', title: __('Fee'), operate:'BETWEEN'},
  34. {field: 'real_amount', title: __('Real_amount'), operate:'BETWEEN'},
  35. {field: 'status', title: __("Status"),
  36. searchList: {100:__('Pending'), 200:__('Success'), 400:__('Fail'), 500:__('Cancel')},
  37. formatter: Table.api.formatter.status
  38. },
  39. {field: 'user_type', title: __("用户类型"),
  40. searchList: {0:__('假人'), 1:__('真人')},
  41. formatter: Table.api.formatter.status
  42. },
  43. {field: 'admins.nickname', title: __('Admin_id')},
  44. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  45. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  46. {field: 'operate', title: __('Operate'),
  47. table: table,
  48. buttons: [{
  49. name: "operate",
  50. text: __('成功'),
  51. classname: 'btn btn-xs btn-success btn-magic btn-ajax',
  52. confirm: __('Confirm review'),
  53. url: 'trade/money_out/review/status/200',
  54. visible: function (row) {
  55. if(row.status == 100) return true;
  56. return false;
  57. },
  58. refresh: true
  59. },
  60. {
  61. name: "operate",
  62. text: __('驳回'),
  63. classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
  64. confirm: __('Confirm review'),
  65. url: 'trade/money_out/review/status/400',
  66. visible: function (row) {
  67. if(row.status == 100) return true;
  68. return false;
  69. },
  70. refresh: true
  71. }],
  72. events: Table.api.events.operate, formatter: Table.api.formatter.operate
  73. }
  74. ]
  75. ]
  76. });
  77. // 为表格绑定事件
  78. Table.api.bindevent(table);
  79. //绑定TAB事件
  80. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  81. var typeStr = $(this).attr("href").replace('#', '');
  82. var options = table.bootstrapTable('getOptions');
  83. options.pageNumber = 1;
  84. options.queryParams = function (params) {
  85. params.order_type = typeStr;
  86. return params;
  87. };
  88. table.bootstrapTable('refresh', {});
  89. return false;
  90. });
  91. },
  92. add: function () {
  93. Controller.api.bindevent();
  94. },
  95. edit: function () {
  96. Controller.api.bindevent();
  97. },
  98. api: {
  99. bindevent: function () {
  100. Form.api.bindevent($("form[role=form]"));
  101. }
  102. }
  103. };
  104. return Controller;
  105. });