money_out.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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: '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. {field: 'status', title: __("Status"),
  37. searchList: {0:__('Pending'), 1:__('Success'), 2:__('Fail')},
  38. formatter: Table.api.formatter.status
  39. },
  40. {field: 'admins.nickname', title: __('Admin_id')},
  41. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  42. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  43. {field: 'operate', title: __('Operate'),
  44. table: table,
  45. buttons: [{
  46. name: "operate",
  47. text: __('Success'),
  48. classname: 'btn btn-xs btn-success btn-magic btn-ajax',
  49. confirm: __('Confirm review'),
  50. url: 'trade/money_out/review/status/1',
  51. visible: function (row) {
  52. if(row.status == 0) return true;
  53. return false;
  54. },
  55. refresh: true
  56. },
  57. {
  58. name: "operate",
  59. text: __('Fail'),
  60. classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
  61. confirm: __('Confirm review'),
  62. url: 'trade/money_out/review/status/2',
  63. visible: function (row) {
  64. if(row.status == 0) return true;
  65. return false;
  66. },
  67. refresh: true
  68. }],
  69. events: Table.api.events.operate, formatter: Table.api.formatter.operate
  70. }
  71. ]
  72. ]
  73. });
  74. // 为表格绑定事件
  75. Table.api.bindevent(table);
  76. //绑定TAB事件
  77. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  78. var typeStr = $(this).attr("href").replace('#', '');
  79. var options = table.bootstrapTable('getOptions');
  80. options.pageNumber = 1;
  81. options.queryParams = function (params) {
  82. params.order_type = typeStr;
  83. return params;
  84. };
  85. table.bootstrapTable('refresh', {});
  86. return false;
  87. });
  88. },
  89. add: function () {
  90. Controller.api.bindevent();
  91. },
  92. edit: function () {
  93. Controller.api.bindevent();
  94. },
  95. api: {
  96. bindevent: function () {
  97. Form.api.bindevent($("form[role=form]"));
  98. }
  99. }
  100. };
  101. return Controller;
  102. });