69 lines
2.3 KiB
JavaScript
69 lines
2.3 KiB
JavaScript
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'},
|
|
{templet: '#row-cover', title: '头像'},
|
|
{templet:function(d){
|
|
if(d.account!=undefined&&d.account){
|
|
return d.account.nick_name;
|
|
}
|
|
return d.consumer_name;
|
|
}, title: '昵称'},
|
|
{templet:function(d){
|
|
if(d.account!=undefined&&d.account){
|
|
return d.account.mobile;
|
|
}
|
|
return '';
|
|
}, title: '授权手机号'},
|
|
{field: 'received_time', title: '领取时间'},
|
|
{templet: '#row-received_map', title: '领取位置'},
|
|
|
|
|
|
{templet: '#row-state', title: '状态'},
|
|
{field: 'verificate_time', title: '验证时间'},
|
|
]],
|
|
done: function () {
|
|
Tools.setInsTb(insTb);
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
/*** index end ***/
|
|
|
|
}); |