ordersstatement.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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: 'ordersstatement/index',
  8. export_url: 'ordersexport',
  9. table: 'orders',
  10. }
  11. });
  12. var table = $("#table");
  13. table.bootstrapTable({
  14. url: $.fn.bootstrapTable.defaults.extend.index_url,
  15. pk: 'id',
  16. sortName: 'createtime',
  17. showColumns: false,
  18. showToggle: false,
  19. showExport: false,
  20. searchFormVisible: true,
  21. search: false,
  22. commonSearch: true,
  23. exportTypes: ['excel'],
  24. exportOptions: {
  25. type: 'excel',
  26. onMsoNumberFormat: function (cell, row, col) {
  27. return (row > 0 && col == 1) ? '\\@' : '';
  28. }
  29. },
  30. columns: [
  31. [
  32. {field: 'out_trade_no', title: __('商户单号')},
  33. {field: 'transaction_id', title: __('交易单号')},
  34. {field: 'type_text', title: __('Type'), operate: false},
  35. {field: 'user_id', title: __('用户 ID'), operate: false},
  36. {field: 'money', title: __('充值金额'), operate: false},
  37. {
  38. field: 'state',
  39. title: __('支付状态'),
  40. formatter: Controller.api.formatter.states,
  41. searchList: {"0": __('未支付'), "1": __('已支付')}
  42. },
  43. {
  44. field: 'createtime',
  45. title: __('下单时间'),
  46. formatter: Table.api.formatter.datetime,
  47. operate: 'RANGE',
  48. addclass: 'datetimerange'
  49. },
  50. {
  51. field: 'finishtime',
  52. title: __('完成时间'),
  53. formatter: Table.api.formatter.datetime,
  54. operate: false
  55. }
  56. ]
  57. ]
  58. });
  59. // 为表格绑定事件
  60. Table.api.bindevent(table);
  61. },
  62. api: {
  63. bindevent: function () {
  64. Form.api.bindevent($("form[role=form]"));
  65. },
  66. formatter: {
  67. states: function (value, row, index) {
  68. if (value == 0) {
  69. return '未支付';
  70. } else {
  71. return '已支付';
  72. }
  73. },
  74. },
  75. }
  76. };
  77. return Controller;
  78. });