withdrawal.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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: 'greenroom/withdrawal/index' + location.search,
  8. edit_url: 'greenroom/withdrawal/edit',
  9. multi_url: 'greenroom/withdrawal/multi',
  10. import_url: 'greenroom/withdrawal/import',
  11. table: 'withdrawal',
  12. }
  13. });
  14. var table = $("#table");
  15. // 初始化表格
  16. table.bootstrapTable({
  17. url: $.fn.bootstrapTable.defaults.extend.index_url,
  18. pk: 'id',
  19. sortName: 'id',
  20. columns: [
  21. [
  22. {checkbox: true},
  23. {field: 'id', title: __('Id')},
  24. {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
  25. {field: 'addtime', title: __('Addtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  26. {field: 'uid', title: __('Uid')},
  27. {field: 'account', title: __('Account'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  28. {field: 'status', title: __('状态'), searchList: {"-1":__('已驳回'),"0":__('未知'),"1":__('申请中'),"2":__('审核通过'),"3":__('已完成')}, formatter: Table.api.formatter.status},
  29. {field: 'admin.username', title: __('Admin.username'), operate: 'LIKE'},
  30. {field: 'admin.nickname', title: __('Admin.nickname'), operate: 'LIKE'},
  31. {field: 'admin.appname', title: __('Admin.appname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  32. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  33. buttons: [
  34. {
  35. name: 'ajax',
  36. text: __('同意'),
  37. title: __('同意'),
  38. classname: 'btn btn-xs btn-success btn-magic btn-ajax',
  39. icon: 'fa fa-magic',
  40. url: 'customer/customer/freecustomer',
  41. confirm: '确定同意这次提现申请?',
  42. success: function (data, ret) {
  43. Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
  44. //如果需要阻止成功提示,则必须使用return false;
  45. //return false;
  46. },
  47. error: function (data, ret) {
  48. console.log(data, ret);
  49. Layer.alert(ret.msg);
  50. return false;
  51. }
  52. },
  53. {
  54. name: 'ajax',
  55. text: __('拒绝'),
  56. title: __('拒绝'),
  57. classname: 'btn btn-xs btn-success btn-magic btn-ajax',
  58. icon: 'fa fa-magic',
  59. url: 'greenroom/withdrawal/reject',
  60. confirm: '确定拒绝这次提现申请?',
  61. success: function (data, ret) {
  62. Layer.alert(ret.msg);
  63. //如果需要阻止成功提示,则必须使用return false;
  64. //return false;
  65. },
  66. error: function (data, ret) {
  67. console.log(data, ret);
  68. Layer.alert(ret.msg);
  69. return false;
  70. }
  71. }
  72. ],
  73. formatter: Table.api.formatter.operate}
  74. ]
  75. ]
  76. });
  77. // 为表格绑定事件
  78. Table.api.bindevent(table);
  79. },
  80. add: function () {
  81. Controller.api.bindevent();
  82. },
  83. edit: function () {
  84. Controller.api.bindevent();
  85. },
  86. api: {
  87. bindevent: function () {
  88. Form.api.bindevent($("form[role=form]"));
  89. }
  90. }
  91. };
  92. return Controller;
  93. });