userwallet.js 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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: 'vip_endtime', title: __('Vip_endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  33. {field: 'vip_level', title: __('Vip_level'),searchList: {"0":__('Vip_level 0'),"10":__('Vip_level 10'),"20":__('Vip_level 20')}, formatter: Table.api.formatter.status},
  34. {field: 'pay_money', title: __('累计消费金额')},
  35. {field: 'get_money', title: __('累计获得金额')},
  36. {field: 'operate', title: __('Operate'), table: table,
  37. buttons:[
  38. {
  39. name:'updategold',
  40. text:'充值金币',
  41. title:'充值金币',
  42. icon:'fa fa-exclamation-circle',
  43. classname:'btn btn-xs btn-info btn-dialog',
  44. url:'userwallet/updategold/id/{ids}?dialog=1',
  45. target:'_self',
  46. },
  47. {
  48. name:'updatemoney',
  49. text:'充值余额',
  50. title:'充值余额',
  51. icon:'fa fa-exclamation-circle',
  52. classname:'btn btn-xs btn-info btn-dialog',
  53. url:'userwallet/updatemoney/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. updategold: function () {
  71. Controller.api.bindevent();
  72. },
  73. updatemoney: 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. });