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

    miniTab.listen();

    // 渲染表格
    let listUrl = $('#table-container').data('url');
    let insTb = table.render({
        elem: '#table-container',
        defaultToolbar: [],
        url: listUrl,
        method: 'post',
        request: {
            pageName: 'page',
            limitName: 'size',
        },
        skin: 'line',
        parseData: function (res) {
            return {
                "code": res.code, //解析接口状态
                "msg": res.msg, //解析提示文本
                "count": res.data.total, //解析数据长度
                "data": res.data.list //解析数据列表
            };
        },
        page: false,
        cols: [[
            {field: 'nickname', title: '微信昵称'},
            {templet: '#row-name', title: '真实姓名'},
            {field: 'position', title: '职位'},
            {field: 'phone', minWidth: 150, title: '手机号'},
            {field: 'shares', title: '分享次数'},
            {field: 'views', title: '客户浏览'},
            {field: 'customer', title: '带来客户'},
            {field: 'asks', title: '咨询数量'},
        ]],
        done: function () {
            Tools.setInsTb(insTb);
        }
    });
});