order.js 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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: 'offline/order/index' + location.search,
  8. multi_url: 'offline/order/multi',
  9. import_url: 'offline/order/import',
  10. dragsort_url: "",
  11. table: 'product_order',
  12. }
  13. });
  14. var table = $("#table");
  15. // 初始化表格
  16. table.bootstrapTable({
  17. url: $.fn.bootstrapTable.defaults.extend.index_url,
  18. pk: 'id',
  19. sortName: 'weigh',
  20. fixedColumns: true,
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'id', title: __('Id'), operate: false},
  25. {field: 'users.address', title: __('User_id'),operate:'LIKE'},
  26. {field: 'users.nickname', title: __('UID'),operate:'LIKE', visible: false},
  27. {field: 'order_no', title: __('订单号')},
  28. {field: 'order_id', title: __('Order_id'), operate: false},
  29. {field: 'products.zh_name', title: __('Product_id'),operate:'LIKE'},
  30. {field: 'areas.address', title: __('Area_id'), operate: false},
  31. {field: 'type_id', title: __('Type_id'),
  32. searchList: {
  33. 0:__('热销'), 1:__('转让'), 2:__('赠送'),
  34. 3:__('新人茶权空投'), 4:__('新人福利空投'), 5:__('空投'), 6:__('合成'), 7:__('求购'),8:__('Rwa茶兑换'), 9:__('Teac兑换')
  35. }, formatter: Table.api.formatter.label
  36. },
  37. {field: 'from_user', title: __('来源用户Id'), operate:false},
  38. {field: 'price', title: __('Price'), operate:false},
  39. {field: 'fees', title: __('手续费'), operate:false},
  40. {field: 'status', title: __('Status'), searchList:
  41. {0:__('已下单'), 1:__('支付'), 2:__('转让'), 3:__('提货'), 4:__('取消'), 5:__('关闭'), 6:__('质押存储')
  42. },formatter: Table.api.formatter.status, operate: false},
  43. {field: 'address.address', title: __('提货地址'), operate:false},
  44. {field: 'address.status', title: __('发货状态'), searchList: {0:__('待发货'), 1:__('已发货'), 2:__('已完成')}, formatter: Table.api.formatter.flag},
  45. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  46. {
  47. field: 'operate', title: __('Operate'), table: table,
  48. events: Table.api.events.operate,
  49. buttons: [{
  50. name: 'shipping',
  51. text: '发货',
  52. title: '发货',
  53. classname: 'btn btn-xs btn-primary btn-dialog btn-receivable',
  54. icon: 'fa fa-keyboard-o',
  55. url: 'offline/order/shipping',
  56. //extend: 'data-area=\'["50%", "50%"]\'',
  57. visible: function (row) {
  58. if(row.status == 3) return true;
  59. return false;
  60. }
  61. },],
  62. formatter: Table.api.formatter.operate
  63. }
  64. ]
  65. ]
  66. });
  67. // 为表格绑定事件
  68. Table.api.bindevent(table);
  69. },
  70. shipping: function () {
  71. Controller.api.bindevent();
  72. },
  73. api: {
  74. bindevent: function () {
  75. Form.api.bindevent($("form[role=form]"));
  76. }
  77. }
  78. };
  79. return Controller;
  80. });