userwallet.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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: 'userwallet/index' + location.search,
  8. add_url: 'userwallet/add',
  9. // edit_url: 'userwallet/edit',
  10. // del_url: 'userwallet/del',
  11. multi_url: 'userwallet/multi',
  12. import_url: 'userwallet/import',
  13. table: 'user_wallet',
  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: 'gold', title: __('Gold'), operate:'BETWEEN'},
  29. {field: 'jewel', title: __('Jewel'), operate:'BETWEEN'},
  30. {field: 'agentjewel', title: __('Agentjewel'), operate:'BETWEEN'},
  31. {field: 'vip_endtime', title: __('Vip_endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  32. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
  33. {field: 'audio_sec', title: __('Audio_sec')},
  34. {field: 'video_sec', title: __('Video_sec')},
  35. {field: 'typing_times', title: __('Typing_times')},
  36. {field: 'operate', title: __('Operate'), table: table,
  37. buttons:[
  38. {
  39. name:'updatemoney',
  40. text:'充值金币',
  41. title:'充值金币',
  42. icon:'fa fa-exclamation-circle',
  43. classname:'btn btn-xs btn-info btn-dialog',
  44. url:'userwallet/updatemoney/id/{ids}?dialog=1',
  45. target:'_self',
  46. },
  47. /* {
  48. name:'updatevip',
  49. text:'充值vip会员',
  50. title:'充值vip会员',
  51. icon:'fa fa-exclamation-circle',
  52. classname:'btn btn-xs btn-info btn-dialog',
  53. url:'userwallet/updatevip/id/{ids}?dialog=1',
  54. target:'_self',
  55. }*/
  56. ],
  57. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  58. ]
  59. ]
  60. });
  61. // 为表格绑定事件
  62. Table.api.bindevent(table);
  63. },
  64. add: function () {
  65. Controller.api.bindevent();
  66. },
  67. edit: function () {
  68. Controller.api.bindevent();
  69. },
  70. updatemoney: function () {
  71. Controller.api.bindevent();
  72. },
  73. updatevip: function () {
  74. Controller.api.bindevent();
  75. },
  76. api: {
  77. bindevent: function () {
  78. Form.api.bindevent($("form[role=form]"));
  79. }
  80. }
  81. };
  82. return Controller;
  83. });