money_in.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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: 'img_urls', title: __('Url'), formatter: Table.api.formatter.url, visible: false},
  35. {field: 'status', title: __("Status"),
  36. searchList: {0:__('待支付'), 100:__('待处理'), 200:__('成功'), 400:__('失败'), 500:__('取消')},
  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'), operate: false},
  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: false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  46. {field: 'operate', title: __('Operate'),
  47. table: table,
  48. buttons: [{
  49. name: "success",
  50. text: __('通过'),
  51. classname: 'btn btn-xs btn-success btn-magic btn-ajax',
  52. confirm: __('Confirm review'),
  53. url: 'trade/money_in/review/status/200',
  54. visible: function (row) {
  55. if(row.status == 100) return true;
  56. return false;
  57. },
  58. refresh: true
  59. },{
  60. name: "cancel",
  61. text: __('取消'),
  62. classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
  63. confirm: __('Confirm review'),
  64. url: 'trade/money_in/review/status/500',
  65. visible: function (row) {
  66. if(row.status == 100) return true;
  67. return false;
  68. },
  69. refresh: true
  70. },
  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. formatter: {
  103. thumb: function (value, row, index) {
  104. var html = '';
  105. html = '<a href="' + row.img_url + '" target="_blank"><img src="' + row.img_url + '" alt="" style="max-height:60px;max-width:120px"></a>';
  106. return '<div style="width:120px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + html + '</div>';
  107. },
  108. // url: function (value, row, index) {
  109. // return '<a href="' + row.img_url + '" target="_blank" class="label bg-green">' + row.url + '</a>';
  110. // },
  111. // filename: function (value, row, index) {
  112. // return '<div style="width:150px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + Table.api.formatter.search.call(this, value, row, index) + '</div>';
  113. // },
  114. // mimetype: function (value, row, index) {
  115. // return '<div style="width:80px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + Table.api.formatter.search.call(this, value, row, index) + '</div>';
  116. // },
  117. }
  118. }
  119. };
  120. return Controller;
  121. });