order.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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:__('转让')}, formatter: Table.api.formatter.status},
  31. {field: 'price', title: __('Price'), operate:false},
  32. {field: 'status', title: __('Status'), searchList: {0:__('已下单'), 1:__('支付'), 2:__('转让'), 3:__('发货'), 4:__('取消'), 5:__('完成')}, formatter: Table.api.formatter.status},
  33. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  34. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  35. //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  36. ]
  37. ]
  38. });
  39. // 为表格绑定事件
  40. Table.api.bindevent(table);
  41. },
  42. api: {
  43. bindevent: function () {
  44. Form.api.bindevent($("form[role=form]"));
  45. }
  46. }
  47. };
  48. return Controller;
  49. });