layui.define([ 'form', 'laydate', 'table' ], function(exports) {
var form = layui.form;
var laydate = layui.laydate;
var table = layui.table;
var auditTable = null;
var data = {};
var view ={
init:function(e){
data = e;
this.initTable();
},
initTable:function(){
moneyTable = table.render({
elem : '#moneyTable',
method : 'post',
url : Common.ctxPath+ '/admin/cuser/query/queryCuserList.json' //数据接口
,page : true //开启分页
,limit : 10,
where: data,
parseData :function(res){ //res 即为原始返回的数据
if(res.data.length == 0){
Common.info("无数据");
}
return res;
},
cols : [ [ //表头
{
field: 'userType',
title : '角色',
width : 120,
},{
title : '昵称',
width : 150,
templet: function (d) {
if(d.nickName == null){
return '--';
}else{
return $.base64.atob(d.nickName, true);
}
}
},{
field : 'mobilePhone',
title : '手机号',
width : 120
}, {
field : 'userId',
title : '用户ID',
width : 120
}, {
field : 'orderStatus3',
title : '待完成订单',
width : 150,
templet : function (data) {
if(data.userType == '入库员' || data.userType == '运营员' || data.userType == '推广员') {
return '--';
}else{
return data.orderStatus3
}
},
sort : true
},
{
field : 'orderStatus5',
title : '累计完成订单',
width : 120,
templet : function (data) {
if(data.userType == '入库员' || data.userType == '运营员' || data.userType == '推广员') {
return '--';
}else{
return data.orderStatus5
}
},
sort : true
},{
field: 'registTime',
title: '注册时时间',
width: 180,
templet:function (d) {
if(d.registTime != null){
return d.registTime
}else{
return "--";
}
},
sort : true
},
{
field: 'loginTime',
title: '登录时间',
width: 180,
templet:function (d) {
if(d.loginTime != null){
return d.loginTime
}else{
return "--";
}
},
sort : true
},
{
field: '',
title: '操作',
templet: function (data) {
if(data.userTypex == 6){
return '更多';
}else{
return '详情';
}
}
}
] ]
});
},
}
$.post(Common.ctxPath+ '/admin/cuser/editrole/queryAllRole.json',{},function (data) {
var html = '';
for(var i = 0; i < data.length; i++){
if(data[i].configValueName != '普通用户'){
continue;
}
html += '';
}
$("#all").after(html);
});
// 搜索
$("#search").click(function () {
var x = $("button[name='today']");
var ut = '';
for(var i = 0; i < x.length; i++){
if($(x[i]).attr('class').indexOf("layui-btn-primary") == -1){
ut = $(x[i]).attr('dt');
break;
}
}
data = {'name':$("#name").val(), 'phone':$("#phone").val(),'userType':ut};
view.init(data);
});
exports('cuserQuery',view);
});