couponarea.js 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. define(["jquery", "easy-admin"], function ($, ea) {
  2. var init = {
  3. table_elem: '#currentTable',
  4. table_render_id: 'currentTableRenderId',
  5. index_url: 'coupon.couponarea/index',
  6. add_url: 'coupon.couponarea/add',
  7. edit_url: 'coupon.couponarea/edit',
  8. delete_url: 'coupon.couponarea/delete',
  9. opentime_url:'coupon.couponarea/addtime',
  10. export_url: 'mall.cate/export',
  11. modify_url: 'coupon.couponarea/modify',
  12. };
  13. var Controller = {
  14. index: function () {
  15. ea.table.render({
  16. init: init,
  17. toolbar:['refresh',
  18. [{
  19. text: '添加',
  20. url: init.add_url,
  21. method: 'open',
  22. auth: 'add',
  23. class: 'layui-btn layui-btn-normal layui-btn-sm',
  24. icon: 'fa fa-plus '
  25. },
  26. // {
  27. // text: '导入',
  28. // url: init.putin_url,
  29. // method: 'import',
  30. // auth: 'putin',
  31. // class: 'layui-btn layui-btn-success layui-btn-sm',
  32. // icon: 'fa fa-plus ',
  33. // }
  34. ]
  35. ],
  36. cols: [[
  37. {type: "checkbox"},
  38. {field: 'id', width: 80, title: 'ID'},
  39. {field: 'name', minWidth: 80, title: '大区名字'},
  40. {field: 'short_name', minWidth: 80, title: '简写名'},
  41. {field: 'add_scale', minWidth: 80, title: '增长比例',templet: function (d) {
  42. return '<span class="layui-badge layui-bg-blue">' + d.add_scale+'%</span>';
  43. }},
  44. {field: 'buy_time', minWidth: 280, title: '可购买时间'},
  45. {field: 'coupon_pic', width: 120, title: '图片封面', templet: function (d) {
  46. return '<span><img src="' + d.coupon_pic + '" style="width: 60px;height: 60px;border-radius: 60px;"></span>';
  47. }},
  48. {field: 'status', title: '状态', width: 85, search: 'select', selectList: {'disable': '删除', 'normal': '正常'}, templet: ea.table.switch},
  49. {field: 'can_buy', title: '购买状态', width: 120, search: 'select', selectList: {0: '不可购买', 1: '可购买'}, templet: ea.table.switch},
  50. {field: 'create_time', minWidth: 150, title: '创建时间'},
  51. {width: 250, title: '操作', templet: ea.table.tool,
  52. operat: ['edit',
  53. [{
  54. text: '配置时间',
  55. url: init.opentime_url,
  56. method: 'open',
  57. auth: 'addtime',
  58. refresh:false,
  59. class: 'layui-btn layui-btn-normal layui-btn-xs',
  60. }]
  61. ]},
  62. ]],
  63. });
  64. ea.listen();
  65. },
  66. add: function () {
  67. ea.listen();
  68. },
  69. edit: function () {
  70. ea.listen();
  71. },
  72. addtime: function () {
  73. ea.listen();
  74. }
  75. };
  76. return Controller;
  77. });