withdraws.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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: 'account/withdraws/index' + location.search,
  8. add_url: 'account/withdraws/add',
  9. edit_url: 'account/withdraws/edit',
  10. del_url: 'account/withdraws/del',
  11. multi_url: 'account/withdraws/multi',
  12. import_url: 'account/withdraws/import',
  13. table: 'account_withdraws',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'apply_sn', title: __('Apply_sn'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  29. {field: 'user_id', title: __('User_id')},
  30. {field: 'account_log_id', title: __('Account_log_id')},
  31. {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
  32. {field: 'remark', title: __('Remark'), operate: 'LIKE'},
  33. {field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3')}, formatter: Table.api.formatter.normal},
  34. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
  35. {field: 'result_status', title: __('Result_status'), operate: 'LIKE', formatter: Table.api.formatter.status},
  36. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  37. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  39. buttons: [
  40. {
  41. name: 'audit',
  42. title: __('提现审核'),
  43. classname: 'btn btn-xs btn-success btn-dialog',
  44. icon: 'fa fa-check-circle-o',
  45. url: 'account/withdraws/audit',
  46. hidden: function(row){ //判断按钮是否隐藏
  47. return row.status === 0;
  48. } //判断按钮是否隐藏,支持function
  49. }
  50. ],
  51. formatter: Table.api.formatter.operate}
  52. ]
  53. ]
  54. });
  55. // 为表格绑定事件
  56. Table.api.bindevent(table);
  57. },
  58. add: function () {
  59. Controller.api.bindevent();
  60. },
  61. edit: function () {
  62. Controller.api.bindevent();
  63. },
  64. audit: function () {
  65. Controller.api.bindevent();
  66. },
  67. api: {
  68. bindevent: function () {
  69. Form.api.bindevent($("form[role=form]"));
  70. }
  71. }
  72. };
  73. return Controller;
  74. });