layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect', 'laydate'], function () {
    let $ = layui.jquery,
        table = layui.table,
        xmSelect = layui.xmSelect,
        miniTab = layui.miniTab,
        laydate = layui.laydate,
        form = layui.form;

    /** index page **/
    if ($('.location-index-page').length > 0) {
        miniTab.listen();

        let listUrl = $('#table-container').data('url');
        let insTb = table.render({
            elem: '#table-container',
            title: '快递公司列表',
            defaultToolbar: ['filter', 'exports', {
                title: '搜索'
                , layEvent: 'search'
                , icon: 'layui-icon-search'
            }],
            toolbar: '#toolbar-tpl',
            method: 'POST',
            url: listUrl,
            page: false,
            request: {
                pageName: 'page',
                limitName: 'size',
            },
            parseData: function (res) {
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.list //解析数据列表
                };
            },
            cols: [[
                {type: 'checkbox'},
                {field: 'name', title: '快递公司名称', minWidth: 200},
                {field: 'default_price', title: '默认运费'},
                {field: 'code', title: '快递公司代号'},
                {title: '默认快递', width: 90, align: 'center', templet: function (d) {
                        return d.is_default > 0 ? '<span class="layui-font-blue">是</span>' : '否';
                    }
                },
                {width: 180, fixed:'right', align: 'center', title: '操作', templet: '#row-operate'}
            ]],
            done: function () {
                Tools.setInsTb(insTb);
            }
        });

    }


});