You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

75 lines
2.9 KiB

  1. require.config({
  2. paths : {
  3. "delivery" : "../addons/unishop/js/delivery"
  4. }
  5. });
  6. define(['jquery', 'bootstrap', 'backend', 'table', 'form','delivery'], function ($, undefined, Backend, Table, Form,undefined) {
  7. var Controller = {
  8. index: function () {
  9. // 初始化表格参数配置
  10. Table.api.init({
  11. extend: {
  12. index_url: 'unishop/delivery/index' + location.search,
  13. add_url: 'unishop/delivery/add',
  14. edit_url: 'unishop/delivery/edit',
  15. del_url: 'unishop/delivery/del',
  16. multi_url: 'unishop/delivery/multi',
  17. table: 'unishop_delivery',
  18. }
  19. });
  20. var table = $("#table");
  21. // 初始化表格
  22. table.bootstrapTable({
  23. url: $.fn.bootstrapTable.defaults.extend.index_url,
  24. pk: 'id',
  25. sortName: 'id',
  26. columns: [
  27. [
  28. {checkbox: true},
  29. {field: 'id', title: __('Id')},
  30. {field: 'name', title: __('Name')},
  31. {field: 'min', title: __('Min buy')},
  32. {field: 'type', title: __('Type'), searchList: {"quantity":__('Quantity'),"weight":__('Weight')}, formatter: Table.api.formatter.normal},
  33. {field: 'switch', title: __('Switch'), searchList: {"1":__('Yes'),"0":__('No')}, formatter: Table.api.formatter.toggle},
  34. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  35. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  36. {field: 'weigh', title: __('Weigh')},
  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. add: function () {
  45. // 配送区域表格
  46. new Delivery({
  47. table: '.regional-table',
  48. regional: '.regional-choice',
  49. datas: datas
  50. });
  51. Controller.api.bindevent();
  52. },
  53. edit: function () {
  54. // 配送区域表格
  55. new Delivery({
  56. table: '.regional-table',
  57. regional: '.regional-choice',
  58. datas: datas
  59. });
  60. Controller.api.bindevent();
  61. },
  62. api: {
  63. bindevent: function () {
  64. Form.api.bindevent($("form[role=form]"));
  65. }
  66. }
  67. };
  68. return Controller;
  69. });