takecash.js 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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: 'takecash/index' + location.search,
  8. // add_url: 'takecash/add',
  9. // edit_url: 'takecash/edit',
  10. // del_url: 'takecash/del',
  11. multi_url: 'takecash/multi',
  12. import_url: 'takecash/import',
  13. table: 'take_cash',
  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: 'user_id', title: __('User_id')},
  29. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  30. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  31. // {field: 'wallet_id', title: __('Wallet_id')},
  32. {field: 'number', title: __('Number'), operate:'BETWEEN'},
  33. {field: 'money', title: __('Money'), operate:'BETWEEN'},
  34. {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
  35. {field: 'alipay_account', title: __('Alipay_account'), operate: 'LIKE'},
  36. {field: 'realname', title: __('Realname'), operate: 'LIKE'},
  37. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
  38. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  39. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. {field: 'audittime', title: __('Audittime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  41. {field: 'auditremark', title: __('Auditremark'), operate: 'LIKE'},
  42. // {field: 'intro_uid', title: __('Intro_uid')},
  43. // {field: 'userto.nickname', title: __('Userto.nickname'), operate: 'LIKE'},
  44. // {field: 'userto.mobile', title: __('Userto.mobile'), operate: 'LIKE'},
  45. // {field: 'intro_money', title: __('Intro_money'), operate:'BETWEEN'},
  46. // {field: 'withdrawalconfig.money', title: __('Withdrawalconfig.money'), operate:'BETWEEN'},
  47. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  48. {field: 'operate', title: __('Operate'), table: table,
  49. buttons:[
  50. {
  51. name:'audit',
  52. text:'审核',
  53. title:'审核',
  54. icon:'fa fa-exclamation-circle',
  55. classname:'btn btn-xs btn-info btn-dialog',
  56. url:'takecash/audit/id/{ids}?dialog=1',
  57. target:'_self',
  58. /*hidden:function(row){
  59. return row.status==100 ? false : false;
  60. }*/
  61. }
  62. ],
  63. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  64. ]
  65. ]
  66. });
  67. // 为表格绑定事件
  68. Table.api.bindevent(table);
  69. },
  70. add: function () {
  71. Controller.api.bindevent();
  72. },
  73. edit: function () {
  74. Controller.api.bindevent();
  75. },
  76. audit: function () {
  77. Controller.api.bindevent();
  78. },
  79. api: {
  80. bindevent: function () {
  81. Form.api.bindevent($("form[role=form]"));
  82. }
  83. }
  84. };
  85. return Controller;
  86. });