viporders.js 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. Table.api.init({
  5. extend: {
  6. index_url: Config.orderpath,
  7. export_url: Config.exportpath,
  8. table: 'orders',
  9. },
  10. showToggle: false,
  11. showColumns: false,
  12. visible: false,
  13. searchFormVisible: true,
  14. search:false,
  15. showExport:false,
  16. commonSearch: true,
  17. });
  18. var table = $("#table");
  19. table.bootstrapTable({
  20. url: $.fn.bootstrapTable.defaults.extend.index_url,
  21. pk: 'id',
  22. sortName: 'orders.id',
  23. columns: [
  24. [
  25. {field: 'out_trade_no', title: __('商户单号')},
  26. {field: 'transaction_id', title: __('交易单号')},
  27. {field: 'user.nickname', title: __('用户'),operate:false,formatter: Controller.api.formatter.user},
  28. {field: 'user.createtime', title: __('用户注册时间'),operate:false,formatter: Table.api.formatter.datetime},
  29. {field: 'type', title: __('Type'), visible:false, searchList: {"type 1":__('Type 1'),"type 2":__('Type 2')},operate:false},
  30. {field: 'type_text', title: __('Type'), operate:false},
  31. {field: 'money', title: __('充值金额')},
  32. {field: 'state', title: __('支付状态'), formatter: Controller.api.formatter.states, searchList: {"0":__('未支付'),"1":__('已支付')}},
  33. {field: 'createtime', title: __('下单时间'), formatter: Table.api.formatter.datetime,operate: 'RANGE', addclass:'datetimerange', options: {dateLimit:{days : 30}}},
  34. {field: 'finishtime', title: __('完成时间'), formatter: Table.api.formatter.datetime,operate: false},
  35. {field: 'referral_id', title: __('推广链接id'),operate:false},
  36. {field: 'pdpd', title: __('推广链接渠道'),operate:false},
  37. {field: 'bookname', title: __('书名'),operate:false},
  38. {field: 'agent_nickname', title: __('代理商'), operate:false},
  39. {field: 'channel_nickname', title: __('渠道商昵称')},
  40. {field: 'channel_id', title: __('渠道商Id')},
  41. {field: 'channel_username', title: __('渠道商账号')},
  42. {
  43. field: 'channel_qrimage',
  44. title: __('渠道商二维码(点击查看大图)'),
  45. operate: false,
  46. formatter: Controller.api.formatter.qrimage
  47. }
  48. ]
  49. ],
  50. exportOptions: {
  51. type: 'excel',
  52. onMsoNumberFormat: function (cell, row, col) {
  53. return (row > 0 && col == 1) ? '\\@' : '';
  54. }
  55. }
  56. });
  57. // 为表格绑定事件
  58. Table.api.bindevent(table);
  59. },
  60. add: function () {
  61. Controller.api.bindevent();
  62. },
  63. edit: function () {
  64. Controller.api.bindevent();
  65. },
  66. api: {
  67. bindevent: function () {
  68. Form.api.bindevent($("form[role=form]"));
  69. }, formatter: {
  70. user: function (value, row, index) {
  71. return '<img style="width:20px;" src="' + row.user.avatar + '" /> ' + row.user.nickname + ' (id:' + row.user.id + ')';
  72. },
  73. states: function (value, row, index) {
  74. if (value == 0) {
  75. return '<span class="ord_red">未支付</span>';
  76. } else {
  77. return '<span class="ord_green">已支付</span>';
  78. }
  79. },
  80. qrimage: function (value, row, index) {
  81. if (value) {
  82. return '<a href="' + value + '" target="_blank"><img style="width:20px;" src="' + value + '"></a>';
  83. } else {
  84. return '无';
  85. }
  86. }
  87. }
  88. }
  89. };
  90. return Controller;
  91. });