userwallet.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. name:'updatejewel',
  59. text:'充值钻石',
  60. title:'充值钻石',
  61. icon:'fa fa-exclamation-circle',
  62. classname:'btn btn-xs btn-info btn-dialog',
  63. url:'userwallet/updatejewel/id/{ids}?dialog=1',
  64. target:'_self',
  65. },
  66. ],
  67. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  68. ]
  69. ]
  70. });
  71. // 为表格绑定事件
  72. Table.api.bindevent(table);
  73. },
  74. add: function () {
  75. Controller.api.bindevent();
  76. },
  77. edit: function () {
  78. Controller.api.bindevent();
  79. },
  80. updategold: function () {
  81. Controller.api.bindevent();
  82. },
  83. updatemoney: function () {
  84. Controller.api.bindevent();
  85. },
  86. updatejewel: function () {
  87. Controller.api.bindevent();
  88. },
  89. api: {
  90. bindevent: function () {
  91. Form.api.bindevent($("form[role=form]"));
  92. }
  93. }
  94. };
  95. return Controller;
  96. });