index.php 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <div class="layui-fluid" style="background: #fff;margin-top: -10px;">
  4. <div class="layui-row layui-col-space15" id="app">
  5. <div class="layui-col-md12">
  6. <div class="layui-card">
  7. <div class="layui-card-body">
  8. <form class="layui-form layui-form-pane" action="">
  9. <div class="layui-form-item">
  10. <div class="layui-inline">
  11. <label class="layui-form-label">模板名称</label>
  12. <div class="layui-input-block">
  13. <input type="text" name="name" class="layui-input" placeholder="请输入模板名称">
  14. </div>
  15. </div>
  16. <div class="layui-inline">
  17. <div class="layui-input-inline">
  18. <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">
  19. <i class="layui-icon layui-icon-search"></i>搜索</button>
  20. </div>
  21. </div>
  22. </div>
  23. </form>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="layui-col-md12">
  28. <div class="layui-card">
  29. <div class="layui-card-body">
  30. <div class="layui-btn-container">
  31. <button class="layui-btn layui-btn-sm"
  32. onclick="$eb.createModalFrame(this.innerText,'{:Url('add')}',{h:800,w:1100})">添加运费模板
  33. </button>
  34. </div>
  35. <table class="layui-hide" id="List" lay-filter="List"></table>
  36. <script type="text/html" id="act">
  37. <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='edit'>
  38. 编辑
  39. </button>
  40. {{# if(d.id!=1){ }}
  41. <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='del'>
  42. 删除
  43. </button>
  44. {{# } }}
  45. </script>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  52. <script>
  53. //实例化form
  54. layList.form.render();
  55. //加载列表
  56. layList.tableList('List', "{:Url('temp_list')}", function () {
  57. return [
  58. {field: 'id', title: 'ID'},
  59. {field: 'name', title: '模板名称'},
  60. {field: 'type', title: '计费方式'},
  61. {field: 'appoint', title: '指定包邮'},
  62. {field: 'sort', title: '排序'},
  63. {field: 'add_time', title: '添加时间'},
  64. {field: 'operate', title: '操作', toolbar: '#act', align: 'center'}
  65. ];
  66. })
  67. //点击事件绑定
  68. layList.tool(function (event, data, obj) {
  69. switch (event) {
  70. case 'del':
  71. var url = layList.U({c: 'setting.shipping_templates', a: 'delete', q: {id: data.id}});
  72. var code = {title: "操作提示", text: "确定删除此模板吗?", type: 'info', confirm: '是的,删除'};
  73. $eb.$swal('delete', function () {
  74. $eb.axios.get(url).then(function (res) {
  75. if (res.status == 200 && res.data.code == 200) {
  76. $eb.$swal('success', res.data.msg);
  77. obj.del();
  78. location.reload();
  79. } else
  80. return Promise.reject(res.data.msg || '删除失败')
  81. }).catch(function (err) {
  82. $eb.$swal('error', err);
  83. });
  84. }, code)
  85. break;
  86. case 'edit':
  87. $eb.createModalFrame(data.name + '-编辑', layList.U({a: 'add', q: {id: data.id}}), {
  88. h: 700,
  89. w: 1000
  90. });
  91. break;
  92. }
  93. })
  94. layList.search('search',function(where){
  95. layList.reload(where);
  96. });
  97. </script>
  98. {/block}