rechargetop.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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: 'operation/rechargetop/index' + location.search,
  8. table: 'operation_rechargetop',
  9. }
  10. });
  11. var table = $("#table");
  12. //当表格数据加载完成时
  13. table.on('load-success.bs.table', function (e, data) {
  14. //这里可以获取从服务端获取的JSON数据
  15. //这里我们手动设置底部的值
  16. $("#total-money").text(data.extend.total_money);
  17. });
  18. // 初始化表格
  19. table.bootstrapTable({
  20. url: $.fn.bootstrapTable.defaults.extend.index_url,
  21. pk: 'id',
  22. sortName: 'id',
  23. searchFormTemplate: 'customformtpl',
  24. columns: [
  25. [
  26. {field: 'user_id', title: __('用户ID')},
  27. {field: 'user.u_id', title: __('前端用户ID')},
  28. {field: 'user.nickname', title: __('用户昵称')},
  29. {field: 'user.mobile', title: __('手机号')},
  30. {field: 'amount', title: __('总充值金额(元)')},
  31. ]
  32. ]
  33. });
  34. // 为表格绑定事件
  35. Table.api.bindevent(table);
  36. },
  37. add: function () {
  38. Controller.api.bindevent();
  39. },
  40. edit: function () {
  41. Controller.api.bindevent();
  42. },
  43. api: {
  44. bindevent: function () {
  45. Form.api.bindevent($("form[role=form]"));
  46. }
  47. }
  48. };
  49. return Controller;
  50. });