order.js 4.0 KB

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