order.js 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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: 'order_no', title: __('订单号')},
  27. {field: 'order_id', title: __('Order_id'), operate: false},
  28. {field: 'products.zh_name', title: __('Product_id'),operate:'LIKE'},
  29. {field: 'areas.address', title: __('Area_id')},
  30. {field: 'type_id', title: __('Type_id'), searchList: {0:__('热销'), 1:__('转让'), 2:__('赠送')}, formatter: Table.api.formatter.label},
  31. {field: 'from_user', title: __('来源用户Id'), operate:false},
  32. {field: 'price', title: __('Price'), operate:false},
  33. {field: 'fees', title: __('手续费'), operate:false},
  34. {field: 'status', title: __('Status'), searchList: {0:__('已下单'), 1:__('支付'), 2:__('转让'), 3:__('提货'), 4:__('取消'), 5:__('关闭')},formatter: Table.api.formatter.status},
  35. {field: 'address.address', title: __('提货地址'), operate:false},
  36. {field: 'address.status', title: __('发货状态'), searchList: {0:__('待发货'), 1:__('已发货'), 2:__('已完成')}, formatter: Table.api.formatter.flag},
  37. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {
  39. field: 'operate', title: __('Operate'), table: table,
  40. events: Table.api.events.operate,
  41. buttons: [{
  42. name: 'shipping',
  43. text: '发货',
  44. title: '发货',
  45. classname: 'btn btn-xs btn-primary btn-dialog btn-receivable',
  46. icon: 'fa fa-keyboard-o',
  47. url: 'offline/order/shipping',
  48. //extend: 'data-area=\'["50%", "50%"]\'',
  49. visible: function (row) {
  50. if(row.status == 3) return true;
  51. return false;
  52. }
  53. },],
  54. formatter: Table.api.formatter.operate
  55. }
  56. ]
  57. ]
  58. });
  59. // 为表格绑定事件
  60. Table.api.bindevent(table);
  61. },
  62. shipping: function () {
  63. Controller.api.bindevent();
  64. },
  65. api: {
  66. bindevent: function () {
  67. Form.api.bindevent($("form[role=form]"));
  68. }
  69. }
  70. };
  71. return Controller;
  72. });