userwallet.js 4.0 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: '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: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  29. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  30. {field: 'gold', title: __('Gold')},
  31. {field: 'money', title: __('Money')},
  32. {field: 'jewel', title: __('Jewel')},
  33. {field: 'vip_endtime', title: __('Vip_endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  34. // {field: 'vip_level', title: __('Vip_level'),searchList: {"0":__('Vip_level 0'),"10":__('Vip_level 10'),"20":__('Vip_level 20'),"30":__('Vip_level 30'),"40":__('Vip_level 40')}, formatter: Table.api.formatter.status},
  35. {field: 'pay_money', title: __('累计消费金额')},
  36. {field: 'get_money', title: __('累计获得金额')},
  37. {field: 'operate', title: __('Operate'), table: table,
  38. buttons:[
  39. {
  40. name:'updategold',
  41. text:'充值金币',
  42. title:'充值金币',
  43. icon:'fa fa-exclamation-circle',
  44. classname:'btn btn-xs btn-info btn-dialog',
  45. url:'userwallet/updategold/id/{ids}?dialog=1',
  46. target:'_self',
  47. },
  48. {
  49. name:'updatemoney',
  50. text:'充值积分',
  51. title:'充值积分',
  52. icon:'fa fa-exclamation-circle',
  53. classname:'btn btn-xs btn-info btn-dialog',
  54. url:'userwallet/updatemoney/id/{ids}?dialog=1',
  55. target:'_self',
  56. },
  57. ],
  58. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  59. ]
  60. ]
  61. });
  62. // 为表格绑定事件
  63. Table.api.bindevent(table);
  64. },
  65. add: function () {
  66. Controller.api.bindevent();
  67. },
  68. edit: function () {
  69. Controller.api.bindevent();
  70. },
  71. updategold: function () {
  72. Controller.api.bindevent();
  73. },
  74. updatemoney: function () {
  75. Controller.api.bindevent();
  76. },
  77. api: {
  78. bindevent: function () {
  79. Form.api.bindevent($("form[role=form]"));
  80. }
  81. }
  82. };
  83. return Controller;
  84. });