1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- {extend name="public/container"}
- {block name="content"}
- <div class="layui-fluid" style="background: #fff;margin-top: -10px;">
- <div class="layui-row layui-col-space15" id="app">
- <div class="layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-body">
- <form class="layui-form layui-form-pane" action="">
- <div class="layui-form-item">
- <div class="layui-inline">
- <label class="layui-form-label">模板名称</label>
- <div class="layui-input-block">
- <input type="text" name="name" class="layui-input" placeholder="请输入模板名称">
- </div>
- </div>
- <div class="layui-inline">
- <div class="layui-input-inline">
- <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">
- <i class="layui-icon layui-icon-search"></i>搜索</button>
- </div>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- <div class="layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-body">
- <div class="layui-btn-container">
- <button class="layui-btn layui-btn-sm"
- onclick="$eb.createModalFrame(this.innerText,'{:Url('add')}',{h:800,w:1100})">添加运费模板
- </button>
- </div>
- <table class="layui-hide" id="List" lay-filter="List"></table>
- <script type="text/html" id="act">
- <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='edit'>
- 编辑
- </button>
- {{# if(d.id!=1){ }}
- <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='del'>
- 删除
- </button>
- {{# } }}
- </script>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script src="{__ADMIN_PATH}js/layuiList.js"></script>
- <script>
- //实例化form
- layList.form.render();
- //加载列表
- layList.tableList('List', "{:Url('temp_list')}", function () {
- return [
- {field: 'id', title: 'ID'},
- {field: 'name', title: '模板名称'},
- {field: 'type', title: '计费方式'},
- {field: 'appoint', title: '指定包邮'},
- {field: 'sort', title: '排序'},
- {field: 'add_time', title: '添加时间'},
- {field: 'operate', title: '操作', toolbar: '#act', align: 'center'}
- ];
- })
- //点击事件绑定
- layList.tool(function (event, data, obj) {
- switch (event) {
- case 'del':
- var url = layList.U({c: 'setting.shipping_templates', a: 'delete', q: {id: data.id}});
- var code = {title: "操作提示", text: "确定删除此模板吗?", type: 'info', confirm: '是的,删除'};
- $eb.$swal('delete', function () {
- $eb.axios.get(url).then(function (res) {
- if (res.status == 200 && res.data.code == 200) {
- $eb.$swal('success', res.data.msg);
- obj.del();
- location.reload();
- } else
- return Promise.reject(res.data.msg || '删除失败')
- }).catch(function (err) {
- $eb.$swal('error', err);
- });
- }, code)
- break;
- case 'edit':
- $eb.createModalFrame(data.name + '-编辑', layList.U({a: 'add', q: {id: data.id}}), {
- h: 700,
- w: 1000
- });
- break;
- }
- })
- layList.search('search',function(where){
- layList.reload(where);
- });
- </script>
- {/block}
|