userwallet.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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',sortable:true},
  28. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  29. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  30. {field: 'money', title: __('Money'), operate:'BETWEEN',sortable:true},
  31. {field: 'gold', title: __('Gold'),sortable:true},
  32. {field: 'vip_endtime', title: __('Vip_endtime'), operate:'RANGE',sortable:true, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  33. {field: 'operate', title: __('Operate'), table: table,
  34. buttons:[
  35. {
  36. name:'updatemoney',
  37. text:'充值金币',
  38. title:'充值金币',
  39. icon:'fa fa-exclamation-circle',
  40. classname:'btn btn-xs btn-info btn-dialog',
  41. url:'userwallet/updatemoney/id/{ids}?dialog=1',
  42. target:'_self',
  43. /*hidden:function(row){
  44. return row.status==100 ? false : false;
  45. }*/
  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. /*hidden:function(row){
  56. return row.status==100 ? false : false;
  57. }*/
  58. }
  59. ],
  60. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  61. ]
  62. ]
  63. });
  64. // 为表格绑定事件
  65. Table.api.bindevent(table);
  66. },
  67. add: function () {
  68. Controller.api.bindevent();
  69. },
  70. edit: function () {
  71. Controller.api.bindevent();
  72. },
  73. updatemoney: function () {
  74. Controller.api.bindevent();
  75. },
  76. updatevip: 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. });