withdraw.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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: 'withdraw/index' + location.search,
  8. add_url: 'withdraw/add',
  9. // edit_url: 'withdraw/edit',
  10. // del_url: 'withdraw/del',
  11. multi_url: 'withdraw/multi',
  12. import_url: 'withdraw/import',
  13. table: 'withdraw',
  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. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'id', title: __('Id')},
  26. {field: 'user_id', title: __('User_id')},
  27. {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
  28. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  29. {field: 'money', title: __('Money'), operate:'BETWEEN'},
  30. {field: 'agentjewel', title: __('Agentjewel'), operate:'BETWEEN'},
  31. {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
  32. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  33. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  34. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
  35. {field: 'audittime', title: __('Audittime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  36. {field: 'auditremark', title: __('Auditremark'), operate: 'LIKE'},
  37. {field: 'operate', title: __('Operate'), table: table,
  38. buttons:[
  39. {
  40. name:'audit',
  41. text:'审核',
  42. title:'审核',
  43. icon:'fa fa-exclamation-circle',
  44. classname:'btn btn-xs btn-info btn-dialog',
  45. url:'withdraw/audit/id/{ids}?dialog=1',
  46. target:'_self',
  47. refresh:true,
  48. hidden:function(row){
  49. return row.status==0 ? false : true;
  50. }
  51. }
  52. ],
  53. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  54. ]
  55. ]
  56. });
  57. // 为表格绑定事件
  58. Table.api.bindevent(table);
  59. },
  60. add: function () {
  61. Controller.api.bindevent();
  62. },
  63. edit: function () {
  64. Controller.api.bindevent();
  65. },
  66. audit: function () {
  67. Controller.api.bindevent();
  68. },
  69. api: {
  70. bindevent: function () {
  71. Form.api.bindevent($("form[role=form]"));
  72. }
  73. }
  74. };
  75. return Controller;
  76. });