payorder.js 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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: 'payorder/index' + location.search,
  8. // add_url: 'payorder/add',
  9. // edit_url: 'payorder/edit',
  10. // del_url: 'payorder/del',
  11. // multi_url: 'payorder/multi',
  12. // import_url: 'payorder/import',
  13. table: 'pay_order',
  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: __('用户ID')},
  27. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  28. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  29. {field: 'pay_no', title: __('Pay_no'), operate: 'LIKE'},
  30. {field: 'money', title: __('Money'), operate:'BETWEEN'},
  31. {field: 'status', title: __('Status'), searchList: {"1":__('支付成功')}, formatter: Table.api.formatter.normal, operate: false},
  32. {field: 'payment_class', title: __('Payment_class'), operate: 'LIKE'},
  33. // {field: 'username', title: __('Username'), operate: 'LIKE'},
  34. // {field: 'payment', title: __('Payment'), operate: 'LIKE'},
  35. {field: 'memo', title: __('Memo'), operate: 'LIKE'},
  36. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  37. // {field: 'type', title: __('Type'), operate: 'LIKE'},
  38. // {field: 'pay_type', title: __('Pay_type'), operate: 'LIKE'},
  39. // {field: 'ext_info', title: __('Ext_info')},
  40. // {field: 'queried', title: __('Queried')},
  41. // {field: 'query_info', title: __('Query_info')},
  42. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  43. ]
  44. ]
  45. });
  46. //这里我们手动设置底部的值
  47. table.on('load-success.bs.table', function (e, data) {
  48. $("#today_recharge").text(data.extend.today_recharge);
  49. $("#yesterday_recharge").text(data.extend.yesterday_recharge);
  50. $("#total_recharge").text(data.extend.total_recharge);
  51. });
  52. // 为表格绑定事件
  53. Table.api.bindevent(table);
  54. },
  55. add: function () {
  56. Controller.api.bindevent();
  57. },
  58. edit: function () {
  59. Controller.api.bindevent();
  60. },
  61. api: {
  62. bindevent: function () {
  63. Form.api.bindevent($("form[role=form]"));
  64. }
  65. }
  66. };
  67. return Controller;
  68. });