recharorder.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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: 'recharorder/index' + location.search,
  8. // add_url: 'recharorder/add',
  9. // edit_url: 'recharorder/edit',
  10. // del_url: 'recharorder/del',
  11. multi_url: 'recharorder/multi',
  12. import_url: 'recharorder/import',
  13. table: 'rechar_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. // fixedColumns: true,
  23. // fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'user_id', title: __('User_id')},
  29. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  30. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  31. {field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
  32. {field: 'money', title: __('Money'), operate:'BETWEEN'},
  33. {field: 'purpose', title: __('Purpose'), searchList: {"1":__('Purpose 1'),"2":__('Purpose 2'),"3":__('Purpose 3')}, formatter: Table.api.formatter.normal, operate: false},
  34. {field: 'pay_type', title: __('Pay_type'), operate: false},
  35. {field: 'relation_id', title: __('订单ID')},
  36. // {field: 'refund_no', title: __('Refund_no'), operate: 'LIKE'},
  37. {field: 'transaction_id', title: __('Transaction_id'), operate: 'LIKE'},
  38. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
  39. {field: 'pay_status', title: __('Pay_status'), searchList: {"0":__('正常'),"1":__('Pay_status 1'),"2":__('Pay_status 2'),"3":__('Pay_status 3')}, formatter: Table.api.formatter.status,
  40. custom: {0: 'success', 1: 'danger', 2: 'danger', 3: 'danger'}
  41. },
  42. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  43. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  44. // {field: 'diversionfst', title: __('Diversionfst'), operate: 'LIKE'},
  45. // {field: 'diversioncsk', title: __('Diversioncsk'), operate: 'LIKE'},
  46. // {field: 'trace_id', title: __('Trace_id'), operate: 'LIKE'},
  47. {field: 'video_id', title: __('Video_id')},
  48. {field: 'video.title', title: __('Video.title'), operate: 'LIKE'},
  49. {field: 'video.image', title: __('Video.image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  50. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  51. ]
  52. ]
  53. });
  54. // 为表格绑定事件
  55. Table.api.bindevent(table);
  56. },
  57. add: function () {
  58. Controller.api.bindevent();
  59. },
  60. edit: function () {
  61. Controller.api.bindevent();
  62. },
  63. api: {
  64. bindevent: function () {
  65. Form.api.bindevent($("form[role=form]"));
  66. }
  67. }
  68. };
  69. return Controller;
  70. });