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

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

        // 渲染表格
        let listUrl = $('#table-container').data('url');
        let insTb = table.render({
            elem: '#table-container',
            toolbar: '#toolbar-tpl',
            defaultToolbar: null,
            url: listUrl,
            method: 'post',
            even: true,
            limits: [10,20,50,100,200,500,1000],
            request: {
                pageName: 'page',
                limitName: 'size',
            },
            parseData: function (res) {
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.list //解析数据列表
                };
            },
            page: true,
            cols: [[
                // {type: 'checkbox'},
                {field: 'id' , width: 80, title: 'ID'},
                {field: 'name',  title: '名称'},
                {field: 'type_name',  title: '优惠券类型'},
                {templet: '#row-received_map',  title: '领取位置'},
                {field: 'received_time',  title: '领取时间'},
                {field: 'money',  title: '金额'},
                {field: 'business_name',  title: '商家名称'},
                {templet: '#row-sign_map',  title: '签到位置'},
                {field: 'verificate_time',  title: '签到时间'},
                {templet: '#row-state',  title: '状态'},
            ]],
            done: function () {
                Tools.setInsTb(insTb);
            }
        });


    }
    /*** index end ***/

});