buying.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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: 'user/buying/index' + location.search+'&ids='+Config.ids,
  8. table: 'user_buying',
  9. }
  10. });
  11. var table = $("#table");
  12. // 初始化表格
  13. table.bootstrapTable({
  14. url: $.fn.bootstrapTable.defaults.extend.index_url,
  15. pk: 'id',
  16. sortName: 'id',
  17. fixedColumns: true,
  18. fixedRightNumber: 1,
  19. columns: [
  20. [
  21. {checkbox: true},
  22. {field: 'id', title: __('Id')},
  23. //users,formuser,productlists,orders
  24. {field: 'users.address', title: __('User_id')},
  25. {field: 'order_id', title: __('Order_id')},
  26. {field: 'fromuser.address', title: __('From_id')},
  27. {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
  28. {field: 'fee', title: __('Fee'), operate:'BETWEEN'},
  29. {field: 'income', title: __('Income'), operate:'BETWEEN'},
  30. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  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. });