order.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.status},
  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: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  36. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  37. //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  38. ]
  39. ]
  40. });
  41. // 为表格绑定事件
  42. Table.api.bindevent(table);
  43. },
  44. api: {
  45. bindevent: function () {
  46. Form.api.bindevent($("form[role=form]"));
  47. }
  48. }
  49. };
  50. return Controller;
  51. });