money_in.js 5.3 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_in/index' + location.search,
  8. table: 'money_in',
  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'), operate: false},
  23. {field: 'order_type', title: __("Order_type"),
  24. searchList: {1:__('Usdt'), 2:__('Bank')},
  25. formatter: Table.api.formatter.status, operate: false
  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: false},
  32. {field: 'amount', title: __('Amount'), operate: false},
  33. {field: 'img_url', title: __('充值截图'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
  34. {field: 'status', title: __("Status"),
  35. searchList: {0:__('待支付'), 100:__('待处理'), 200:__('成功'), 400:__('失败'), 500:__('取消')},
  36. formatter: Table.api.formatter.status
  37. },
  38. {field: 'user_type', title: __("用户类型"),
  39. searchList: {0:__('假人'), 1:__('真人')},
  40. formatter: Table.api.formatter.status
  41. },
  42. {field: 'admins.nickname', title: __('Admin_id'), operate: false},
  43. {field: 'create_time', title: __('Create_time'), operate: 'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  44. {field: 'update_time', title: __('Update_time'), operate: false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  45. {field: 'operate', title: __('Operate'),
  46. table: table,
  47. buttons: [{
  48. name: "success",
  49. text: __('通过'),
  50. classname: 'btn btn-xs btn-success btn-magic btn-ajax',
  51. confirm: __('Confirm review'),
  52. url: 'trade/money_in/review/status/200',
  53. visible: function (row) {
  54. if(row.status == 100) return true;
  55. return false;
  56. },
  57. refresh: true
  58. },{
  59. name: "cancel",
  60. text: __('取消'),
  61. classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
  62. confirm: __('Confirm review'),
  63. url: 'trade/money_in/review/status/500',
  64. visible: function (row) {
  65. if(row.status == 100) return true;
  66. return false;
  67. },
  68. refresh: true
  69. },
  70. ],
  71. events: Table.api.events.operate, formatter: Table.api.formatter.operate
  72. }
  73. ]
  74. ]
  75. });
  76. // 为表格绑定事件
  77. Table.api.bindevent(table);
  78. //绑定TAB事件
  79. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  80. var typeStr = $(this).attr("href").replace('#', '');
  81. var options = table.bootstrapTable('getOptions');
  82. options.pageNumber = 1;
  83. options.queryParams = function (params) {
  84. params.order_type = typeStr;
  85. return params;
  86. };
  87. table.bootstrapTable('refresh', {});
  88. return false;
  89. });
  90. },
  91. add: function () {
  92. Controller.api.bindevent();
  93. },
  94. edit: function () {
  95. Controller.api.bindevent();
  96. },
  97. api: {
  98. bindevent: function () {
  99. Form.api.bindevent($("form[role=form]"));
  100. }
  101. }
  102. };
  103. return Controller;
  104. });