Init Repo

This commit is contained in:
root
2019-09-06 23:53:10 +08:00
commit f0ef89dfbb
7905 changed files with 914138 additions and 0 deletions

View File

@ -0,0 +1,173 @@
var mmg;
function initGrid(){
var h = WST.pageHeight();
var cols = [
{title:'账号', name:'loginName', width: 30,sortable:true},
{title:'用户名', name:'userName' ,width:100,sortable:true},
{title:'手机号码', name:'userPhone' ,width:100,sortable:true},
{title:'电子邮箱', name:'userEmail' ,width:60,sortable:true},
{title:'最后登录时间', name:'lastTime' ,width:60,sortable:true},
{title:'状态', name:'userStatus' ,width:20, renderer:function(val,item,rowIndex){
return '<input type="checkbox" '+((val==1)?"checked":"")+' lay-skin="switch" lay-filter="userStatus" data="'+item['userId']+'" lay-text="启用|停用">';
}},
{title:'操作', name:'' ,width:170, align:'center', renderer: function(val,item,rowIndex){
var h = "";
if(WST.GRANT.ZHGL_02)h += "<a class='btn btn-blue' onclick='javascript:getForEdit("+item['userId']+")'><i class='fa fa-pencil'></i>修改</a> ";
if(WST.GRANT.ZHGL_02)h += "<a class='btn btn-blue' onclick='javascript:resetPayPwd(" + item['userId'] + ")'><i class='fa fa-key'></i>重置支付密码</a> ";
return h;
}}
];
mmg = $('.mmg').mmGrid({height: h-155,indexCol: true,indexColWidth:50, cols: cols,method:'POST',
url: WST.U('admin/Users/pageQuery'), fullWidthRows: true, autoLoad: true,remoteSort: true,sortName:'lastTime',sortStatus:'desc',
plugins: [
$('#pg').mmPaginator({})
]
});
mmg.on('loadSuccess',function(){
layui.form.render('','gridForm');
layui.form.on('switch(userStatus)', function(data){
var id = $(this).attr("data");
if(this.checked){
//信息框-例2
layer.msg('确定要启用此账户吗?', {
time: 0 //不自动关闭
,btn: ['确定', '取消']
,yes: function(index){
changeUserStatus(id, 1);
setTimeout(function(){ layer.close(index); }, 2000);
}
});
}else{
layer.open({
type: 1,
title: '禁用说明',
closeBtn: 1,
shadeClose: true,
area: '50%',
btn: ['确定'],
btnAlign: 'c', //按钮居中
// skin: '',
content: '<div style="margin:10px;">禁用时长:<input id="lockTime" class="ipt" style="marign:5px;width:200px;" class="ipt" placeholder="请输入禁用时长,单位(小时)"></div>' +
'<div style="margin:10px;">禁用原因:<textarea id="lockReason" class="ipt" style="width:300px;height:100px;" maxlength="100"></textarea></div>',
yes: function(index){
let lockTime = $('#lockTime').val();
if('' == lockTime){
WST.msg('请输入禁用时间', {icon: 2,time:3000});
$('#lockTime').focus();
return;
}
let lockReason = $('#lockReason').val();
if('' == lockReason){
WST.msg('请输入禁用原因', {icon: 2,time:3000});
$('#lockReason').focus();
return;
}
changeUserStatus(id, 0, lockTime, lockReason);
setTimeout(function(){ layer.close(index); }, 2000);
}
})
}
});
})
$('#headTip').WSTTips({width:90,height:35,callback:function(v){
if(v){
mmg.resize({height:h-155});
}else{
mmg.resize({height:h-128});
}
}});
}
function resetPayPwd(id){
var box = WST.confirm({content:"您确定重置支付密码为666666吗?",yes:function(){
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/users/resetPayPwd'),{userId:id},function(data,textStatus){
layer.close(loading);
var json = WST.toAdminJson(data);
if(json.status=='1'){
WST.msg("重置成功",{icon:1});
layer.close(box);
accountQuery();
}else{
WST.msg(json.msg,{icon:2});
}
});
}});
}
function getForEdit(id){
var loading = WST.msg('正在获取数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/users/get'),{id:id},function(data,textStatus){
layer.close(loading);
var json = WST.toAdminJson(data);
//清空密码
json.loginPwd = '';
if(json.userId){
WST.setValues(json);
layui.form.render();
$('#loginName').html(json.loginName);
$('#userId').val(json.userId);
toEdit(json.userId);
}else{
WST.msg(json.msg,{icon:2});
}
});
}
function toEdit(id){
var box = WST.open({title:'编辑',type:1,content:$('#accountBox'),area: ['450px', '260px'],btn:['确定','取消'],yes:function(){
$('#accountForm').isValid(function(v){
if(v){
var params = WST.getParams('.ipt');
if(id>0)
params.userId = id;
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/users/editAccount'),params,function(data,textStatus){
layer.close(loading);
var json = WST.toAdminJson(data);
if(json.status=='1'){
WST.msg("操作成功",{icon:1});
$('#accountForm')[0].reset();
layer.close(box);
accountQuery();
}else{
WST.msg(json.msg,{icon:2});
}
});
}else{
return false;
}
});
},cancel:function(){$('#accountForm')[0].reset();},end:function(){$('#accountBox').hide();$('#accountForm')[0].reset();}});
}
function changeUserStatus(id, status, lockTime ,lockReason){
if(!WST.GRANT.ZHGL_02)return;
$.post(WST.U('admin/Users/changeUserStatus'), {'id':id, 'status':status,'lockTime':lockTime, 'lockReason':lockReason}, function(data, textStatus){
var json = WST.toAdminJson(data);
if(json.status=='1'){
WST.msg("操作成功",{icon:1});
accountQuery();
}else{
WST.msg(json.msg,{icon:2});
}
})
}
function accountQuery(){
var query = WST.getParams('.query');
query.page = 1;
mmg.load(query);
}

View File

@ -0,0 +1,70 @@
{extend name="base" /}
{block name="css"}
<link rel="stylesheet" type="text/css" href="__ADMIN__/js/mmgrid/mmGrid.css?v={$v}" />
{/block}
{block name="js"}
<script src="__ADMIN__/js/mmgrid/mmGrid.js?v={$v}" type="text/javascript"></script>
<script src="__ADMIN__/users/account.js?v={$v}" type="text/javascript"></script>
{/block}
{block name="main"}
<div id='alertTips' class='alert alert-success alert-tips fade in'>
<div id='headTip' class='head'><i class='fa fa-lightbulb-o'></i>操作说明</div>
<ul class='body'>
<li>本功能主要用于管理会员(商家)的账号信息,您可以通过各种条件查询会员账号。</li>
</ul>
</div>
<div class="wst-toolbar">
<form>
<div id="query">
<input type="text" name="loginName1" placeholder='账号/店铺名称' id="loginName1" class="query" />
<select name="userType" id="userType" class="query">
<option value="">会员类型</option>
<option value="0">普通会员</option>
<option value="1">商家</option>
</select>
<select name="userStatus1" id="userStatus1" class="query">
<option value="">账号状态</option>
<option value="1">启用</option>
<option value="0">停用</option>
</select>
<button type="button" class='btn btn-primary btn-mright' onclick="javascript:accountQuery()" ><i class="fa fa-search"></i>查询</button>
</div>
</form>
<div style="clear:both"></div>
</div>
<form autocomplete="off" class='layui-form wst-grid' lay-filter='gridForm'>
<div id="mmg" class="mmg"></div>
</form>
<div id="pg" style="text-align: right;"></div>
<div id='accountBox' style='display:none'>
<form id='accountForm' autocomplete="off" class='layui-form'>
<table class='wst-form wst-box-top'>
<tr>
<th width='100'>账号<font color='red'>*</font></th>
<td height='30'>
<input type="hidden" name="userId" id="userId">
<div id="loginName"></div>
</td>
</tr>
<tr>
<th>密码<font color='red'>*</font></th>
<td><input type='password' id='loginPwd' data-rule="length[6~20];" placeholder="为空则说明不修改密码" class='ipt' maxLength='20'/></td>
</tr>
<tr>
<th>会员状态<font color='red'>*</font></th>
<td height='30'>
<input type="checkbox" class='ipt' value='1' name="userStatus" id="userStatus" lay-skin="switch" lay-text="启用|停用">
</td>
</tr>
</table>
</form>
</div>
<script>
$(function(){
initGrid()
});
</script>
{/block}

View File

@ -0,0 +1,611 @@
let mmg;
var QLG = QLG || {};
let authActionUrl='';
QLG.init=function (typeNum){
if(1 == typeNum){
authActionUrl = 'personalAction';
}else if(2 == typeNum){
authActionUrl = 'companyAction';
}else if(3 == typeNum){
authActionUrl = 'setUserUpdate';
}
}
function showMsg(title,html){
layer.open({
type: 1,
title: title,
closeBtn: 1,
shadeClose: true,
area: '50%',
btn: ['确定'],
btnAlign: 'c', //按钮居中
// skin: '',
content: html
});
}
$("body").on("click",'.showShopImg',function(){
let imgs = $(this).attr('data-imgs');
let imgsArr = imgs.split(',');
let html='';
$.each(imgsArr,function(i,v){
html+='<img src="'+WST.conf.IMGURL+'/'+v+'"><br>';
})
showMsg('商铺图片组',html)
});
//亲人认证
$("body").on("click",'.family_personal',function(){
let userId = $(this).attr('data-userId');
$.post(WST.U('admin/Users/authFamilyList'),{'isPersonal':1,'userId':userId},function(data) {
let json = WST.toAdminJson(data);
if(1 == json.status){
if('undefined' == typeof(json.data)){
WST.msg('没有相关数据', {icon: 2,time:3000});
return;
}
let auth_html = '<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;"></fieldset> ' +
'<table class="layui-table" lay-even="" lay-skin="row">' +
' <thead>' +
' <tr>' +
' <th>本人ID</th>' +
' <th>亲人ID</th>' +
' <th>亲人姓名</th>' +
' <th>亲人身份证</th>' +
' <th>关系</th>' +
' <th>关系证明照</th>' +
' <th>身份证正面</th>' +
' <th>身份证反面</th>' +
' </tr> ' +
' </thead>' +
' <tbody>';
let tdStr='';
$.each(json.data,function(){
tdStr+='<tr><td>'+this.userId+'</td>';
tdStr+='<td>'+this.familyId+'</td>';
tdStr+='<td>'+this.familyName+'</td>';
tdStr+='<td>'+this.familyIdCard+'</td>';
tdStr+='<td>'+this.familyRelations+'</td>';
tdStr+='<td>'+"<img class='uploadImg' style='width:80px;height:80px;' src='"+WST.conf.IMGURL+'/'+this.familyRelationsImg+'\' /></td>';
tdStr+='<td>'+"<img class='uploadImg' style='width:80px;height:80px;' src='"+WST.conf.IMGURL+'/'+this.idCardFrontImg+'\' /></td>';
tdStr+='<td>'+"<img class='uploadImg' style='width:80px;height:80px;' src='"+WST.conf.IMGURL+'/'+this.idCardBackImg+'\' /></td></tr>';
});
auth_html+=tdStr+'</tbody>' +
'</table> ';
showMsg('亲人认证列表',auth_html)
return;
}
WST.msg('数据读取出错,请重试', {icon: 2,time:3000});
return;
});
});
//亲人报备
$("body").on("click",'.family_report',function(){
let userId = $(this).attr('data-userId');
$.post(WST.U('admin/Users/authFamilyList'),{'isPersonal':0,'userId':userId},function(data) {
let json = WST.toAdminJson(data);
if(1 == json.status){
if('undefined' == typeof(json.data)){
WST.msg('没有相关数据', {icon: 2,time:3000});
return;
}
let auth_html = '<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;"></fieldset> ' +
'<table class="layui-table" lay-even="" lay-skin="row">' +
' <thead>' +
' <tr>' +
' <th>本人ID</th>' +
' <th>报备姓名</th>' +
' <th>报备身份证</th>' +
' <th>关系</th>' +
' <th>关系证明照</th>' +
' </tr> ' +
' </thead>' +
' <tbody>';
let tdStr='';
$.each(json.data,function(){
tdStr+='<tr><td>'+this.userId+'</td>';
tdStr+='<td>'+this.familyName+'</td>';
tdStr+='<td>'+this.familyIdCard+'</td>';
tdStr+='<td>'+this.familyRelations+'</td>';
tdStr+='<td>'+"<img class='uploadImg' style='width:80px;height:80px;' src='"+WST.conf.IMGURL+'/'+this.familyRelationsImg+'\' /></td></tr>';
});
auth_html+=tdStr+'</tbody>' +
'</table> ';
showMsg('亲人报备列表',auth_html)
return;
}
WST.msg('数据读取出错,请重试', {icon: 2,time:3000});
return;
});
});
//合作认证
$("body").on("click",'.company_partner',function(){
let userId = $(this).attr('data-userId');
$.post(WST.U('admin/Users/authCompanyList'),{'userId':userId},function(data) {
let json = WST.toAdminJson(data);
if(1 == json.status){
if('undefined' == typeof(json.data)){
WST.msg('没有相关数据', {icon: 2,time:3000});
return;
}
let auth_html = '<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;"></fieldset> ' +
'<table class="layui-table" lay-even="" lay-skin="row">' +
' <thead>' +
' <tr>' +
' <th>本人ID</th>' +
' <th>合伙人ID</th>' +
' <th>合伙人姓名</th>' +
' <th>身份证</th>' +
' <th>职位</th>' +
' <th>持股比例</th>' +
' <th>手持营业执照照片</th>' +
' <th>身份证正面</th>' +
' <th>身份证反面</th>' +
' </tr> ' +
' </thead>' +
' <tbody>';
let tdStr='';
$.each(json.data,function(){
tdStr+='<tr><td>'+this.userId+'</td>';
tdStr+='<td>'+this.partnerId+'</td>';
tdStr+='<td>'+this.uName+'</td>';
tdStr+='<td>'+this.idCard+'</td>';
tdStr+='<td>'+this.positionName+'</td>';
tdStr+='<td>'+this.stake+'</td>';
tdStr+='<td>'+"<img class='uploadImg' style='width:80px;height:80px;' src='"+WST.conf.IMGURL+'/'+this.businessImg+'\' /></td>';
tdStr+='<td>'+"<img class='uploadImg' style='width:80px;height:80px;' src='"+WST.conf.IMGURL+'/'+this.idCardFrontImg+'\' /></td>';
tdStr+='<td>'+"<img class='uploadImg' style='width:80px;height:80px;' src='"+WST.conf.IMGURL+'/'+this.idCardBackImg+'\' /></td> </tr>';
});
auth_html+=tdStr+'/tbody>' +
'</table> ';
showMsg('合作人认证列表',auth_html)
return;
}
WST.msg('数据读取出错,请重试', {icon: 2,time:3000});
return;
});
});
//银行卡列表
$("body").on("click",'.company_bank',function(){
let userId = $(this).attr('data-userId');
$.post(WST.U('admin/Users/authCompanyBank'),{'userId':userId},function(data) {
let json = WST.toAdminJson(data);
if(1 == json.status){
if('undefined' == typeof(json.data)){
WST.msg('没有相关数据', {icon: 2,time:3000});
return;
}
let auth_html = '<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;"></fieldset> ' +
'<table class="layui-table" lay-even="" lay-skin="row">' +
' <thead>' +
' <tr>' +
' <th>本人ID</th>' +
' <th>银行名</th>' +
' <th>开户名</th>' +
' <th>卡号</th>' +
' </tr> ' +
' </thead>' +
' <tbody>';
let tdStr='';
$.each(json.data,function(){
tdStr+='<tr><td>'+this.userId+'</td>';
tdStr+='<td>'+this.bankName+'</td>';
tdStr+='<td>'+this.accountName+'</td>';
tdStr+='<td>'+this.bankNo+'</td></tr>';
});
auth_html+=tdStr+'</tbody>' +
'</table> ';
showMsg('合作人银行卡列表',auth_html)
return;
}
WST.msg('数据读取出错,请重试', {icon: 2,time:3000});
return;
});
});
$("body").on("click",'.authAction',function(){
let id = $(this).attr('data-id');
layer.open({
type: 1,
title: '审核操作',
closeBtn: 1,
shadeClose: true,
area: '50%',
btn: ['确定'],
btnAlign: 'c', //按钮居中
// skin: '',
content: '<div style="text-align:center;margin-top:1rem;padding-top:1rem;">审核处理:<label><input type="radio" class="status" value="1" name="status" onclick="javascript:WST.showHide(0,&quot;#trApplyDesc&quot;);" title="通过">通过' +
' </label> ' +
'<label><input type="radio" class="status" value="2" name="status" onclick="javascript:WST.showHide(1,&quot;#trApplyDesc&quot;);" title="不通过">拒绝' +
'</label>' +
'<div id="trApplyDesc" style="display:none">' +
'<th>不通过原因<font color="red">*</font></th>' +
'<td><textarea id="applyDesc" class="ipt" style="width:300px;height:100px;" maxlength="100" data-rule="不通过原因:required(#status-1:checked);"></textarea></td>' +
'</div></div>',
yes: function(index){
let obj = $("input[name='status']:checked");
let status =obj.val();
if(!status){
WST.msg('请选择通过或不通过', {icon: 2,time:3000});
return;
}
let applyDesc = $('#applyDesc').val();
if(2 == status && '' == applyDesc ){
WST.msg('请输入拒绝理由', {icon: 2,time:3000});
$('#applyDesc').focus();
return;
}
let msgArr = ['通过','拒绝'];
let msg = "您确定要"+msgArr[status-1]+"此用户的申请信息?";
let box = WST.confirm({content:msg,yes:function(){
let loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/Users/'+authActionUrl),{id:id,status:status,'reasonsForRefusal':applyDesc},function(data,textStatus){
layer.close(loading);
let json = WST.toAdminJson(data);
if(json.status=='1'){
WST.msg("操作成功",{icon:1});
layer.close(box);
layer.close(index);
userQuery();
}else{
WST.msg(json.msg,{icon:2});
}
});
}});
}
});
});
$("body").on("click",'.uploadImg',function(){
layer.open({
type: 1,
title: false,
closeBtn: 0,
area: '90%',
skin: 'layui-layer-nobg', //没有背景色
shadeClose: true,
content: '<div ><img src="'+$(this).attr('src')+'"></div>'
});
});
function initPersonalGrid(){
let h = WST.pageHeight();
let cols = [
{title:'账号', name:'loginName', width: 130,sortable:true},
{title:'手机号码', name:'userPhone' ,width:100,sortable:true},
{title:'户主姓名', name:'householdName' ,width:100,sortable:true},
{title:'身份证', name:'householdIdCard' ,width:100,sortable:true},
{title:'居住地址', name:'houseAddress' ,width:100,sortable:true},
{title:'手持户口本照片', name:'accountBookImg' ,width:100,sortable:true ,renderer:function(val,item,rowIndex) {
return"<span><img class='uploadImg' style='width:80px;height:80px;' src='"+WST.conf.IMGURL+'/'+val+"'</span>";
}},
{title:'认证信息', name:'' ,width:150, align:'center', renderer: function(val,item,rowIndex) {
let h = "";
h += "<a data-userId='"+item.userId+"'class='family_personal'>亲人认证</a> ";
h += "<a data-userId='"+item.userId+"'class='family_report'> 亲人报备</a> ";
return h;
}},
{title:'申请时间', name:'createTime' ,width:120,sortable:true,renderer:function(val,item,rowIndex) {
return getLocalTime(val);
}},
{title:'状态/操作', name:'status' ,width:60,sortable:true, renderer:function(val,item,rowIndex) {
let h = "";
if(val==1){
h += "<span class='statu-yes'><i class='fa fa-check-circle'></i> 已通过&nbsp;</span>";
if (WST.GRANT.GTRZSH_01) {
h += "<a data-id='" + item.id + "'class='btn btn-blue authAction'> <i class='fa fa-pencil'></i>修改</a> ";
}
}else if(val==2){
h += "<span class='statu-no'><i class='fa fa-ban'></i> 已拒绝&nbsp;</span>";
if (WST.GRANT.GTRZSH_01) {
h += "<a data-id='"+item.id+"'class='btn btn-blue authAction'> <i class='fa fa-pencil'></i>修改</a> ";
}
}else {
h += "<span class='statu-wait'><i class='fa fa-clock-o'></i> 待审核&nbsp;</span>";
if (WST.GRANT.GTRZSH_01) {
h += "<a data-id='"+item.id+"'class='btn btn-blue authAction'> <i class='fa fa-pencil'></i>审核</a> ";
}
}
return h;
}
}];
mmg = $('.mmg').mmGrid({height: h-173,indexCol: true,indexColWidth:50, cols: cols,method:'POST',
url: WST.U('admin/Users/getPersonalReview'), fullWidthRows: true, autoLoad: true,remoteSort: true,sortName:'createTime',sortStatus:'desc',
plugins: [
$('#pg').mmPaginator({})
]
});
$('#headTip').WSTTips({width:90,height:35,callback:function(v){
if(v){
mmg.resize({height:h-173});
}else{
mmg.resize({height:h-128});
}
}});
}
function initCompanyGrid(){
let h = WST.pageHeight();
let cols = [
{title:'账号', name:'loginName', width: 130,sortable:true},
{title:'手机号码', name:'userPhone' ,width:100,sortable:true},
{title:'合作名', name:'companyName' ,width:100,sortable:true},
{title:'直营人姓名', name:'trueName' ,width:100,sortable:true},
{title:'身份证', name:'idCard' ,width:100,sortable:true},
{title:'公司地址', name:'companyAddress' ,width:100,sortable:true},
// {title:'手持户口本照片', name:'accountBookImg' ,width:100,sortable:true ,renderer:function(val,item,rowIndex) {
// return"<span><img class='uploadImg' style='width:80px;height:80px;' src='"+WST.conf.IMGURL+'/'+val+"'</span>";
// }},
{title:'认证信息', name:'' ,width:150, align:'center', renderer: function(val,item,rowIndex) {
let h = "";
h += "<a data-userId='"+item.userId+"'class='company_partner'>合作人员</a> ";
h += "<a data-userId='"+item.userId+"'class='company_bank'> 银行卡列表</a> ";
return h;
}},
{title:'申请时间', name:'createTime' ,width:120,sortable:true,renderer:function(val,item,rowIndex) {
return getLocalTime(val);
}},
{title:'状态/操作', name:'status' ,width:60,sortable:true, renderer:function(val,item,rowIndex) {
let h = "";
if(val==1){
h += "<span class='statu-yes'><i class='fa fa-check-circle'></i> 已通过&nbsp;</span>";
if (WST.GRANT.HZRZSH_01) {
h += "<a data-id='"+item.id+"'class='btn btn-blue authAction'> <i class='fa fa-pencil'></i>修改</a> ";
}
}else if(val==2){
h += "<span class='statu-no'><i class='fa fa-ban'></i> 已拒绝&nbsp;</span>";
if (WST.GRANT.HZRZSH_01) {
h += "<a data-id='"+item.id+"'class='btn btn-blue authAction'> <i class='fa fa-pencil'></i>修改</a> ";
}
}else {
h += "<span class='statu-wait'><i class='fa fa-clock-o'></i> 待审核&nbsp;</span>";
if (WST.GRANT.HZRZSH_01) {
h += "<a data-id='"+item.id+"'class='btn btn-blue authAction'> <i class='fa fa-pencil'></i>审核</a> ";
}
}
return h;
}}
];
mmg = $('.mmg').mmGrid({height: h-173,indexCol: true,indexColWidth:50, cols: cols,method:'POST',
url: WST.U('admin/Users/getCompanyReview'), fullWidthRows: true, autoLoad: true,remoteSort: true,sortName:'createTime',sortStatus:'desc',
plugins: [
$('#pg').mmPaginator({})
]
});
$('#headTip').WSTTips({width:90,height:35,callback:function(v){
if(v){
mmg.resize({height:h-173});
}else{
mmg.resize({height:h-128});
}
}});
}
function toEdit(id){
location.href=WST.U('admin/users/toEdit','id='+id);
}
function toRecharge(id){
location.href=WST.U('admin/users/toRecharge','id='+id);
}
function toExport(){
let params = {};
params = WST.getParams('.query');
let box = WST.confirm({content:"您确定要导出订单吗?",yes:function(){
layer.close(box);
location.href=WST.U('admin/users/toExport',params);
}});
}
function toDel(id,userType){
let msg = (userType==1)?"您要删除的用户是商家用户,您确定要删除吗?":"您确定要删除该用户吗?";
let box = WST.confirm({content:msg,yes:function(){
let loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/Users/del'),{id:id},function(data,textStatus){
layer.close(loading);
let json = WST.toAdminJson(data);
if(json.status=='1'){
WST.msg("操作成功",{icon:1});
layer.close(box);
userQuery();
}else{
WST.msg(json.msg,{icon:2});
}
});
}});
}
function userQuery(){
let query = WST.getParams('.query');
query.page = 1;
mmg.load(query);
}
function initApplyGrid(){
var h = WST.pageHeight();
var cols = [
{title:'账号', name:'loginName', width: 130,sortable:true},
{title:'用户名', name:'trueName' ,width:100,sortable:true},
{title:'手机号码', name:'userPhone' ,width:100,sortable:true},
{title:'店铺名', name:'shopName' ,width:100,sortable:true},
{title:'直营人', name:'userName' ,width:100,sortable:true},
{title:'店铺电话', name:'phone' ,width:100,sortable:true},
{title:'申请级别', name:'applyLevel' ,width:60,sortable:true, renderer:function(val,item,rowIndex){
var str = '';
switch(val){
case '2':
str = '商超';
break;
case '3':
str = '商厦';
break;
case '4':
str = '商都';
break;
}
return str;
}},
{title:'确认书', name:'confirmImg' ,width:100,sortable:true ,renderer:function(val,item,rowIndex) {
return"<span><img class='uploadImg' style='width:80px;height:80px;' src='"+WST.conf.IMGURL+'/'+val+"'</span>";
}},
{title:'店铺图片组', name:'shopImg' ,width:100,sortable:true ,renderer:function(val,item,rowIndex) {
return"<span data-imgs='"+val+"' class='showShopImg'>查看</span>";
}},
{title:'申请区域', name:'province' ,width:100,sortable:true ,renderer:function(val,item,rowIndex) {
var html='<span>'+item.province.areaName+'-'+item.city.areaName+'-';
switch(item.applyLevel){
case '4':
html +='<a style="color:red;">'+item.county.areaName+'</a>';
// html +=item.town.areaName+'-'+item.village.areaName;
break;
case '3':
html +=item.county.areaName+'-';
html +='<a style="color:red;">'+item.town.areaName+'</a>';
// html +=item.village.areaName;
break;
case '2':
html +=item.county.areaName+'-'+item.town.areaName+'-';
html +='<a style="color:red;">'+item.village.areaName+'</a>';
break;
}
html+='</span>';
return html;
}},
{title:'申请时间', name:'createTime' ,width:120,sortable:true,renderer:function(val,item,rowIndex) {
return getLocalTime(val);
}},
{title:'状态/操作', name:'status' ,width:60,sortable:true, renderer:function(val,item,rowIndex) {
let h = "";
if(val==1){
h += "<span class='statu-yes'><i class='fa fa-check-circle'></i> 已通过&nbsp;</span>";
if (WST.GRANT.SQSJ_01) {
h += "<a data-id='"+item.id+"'class='btn btn-blue authAction'> <i class='fa fa-pencil'></i>修改</a> ";
}
}else if(val==2){
h += "<span class='statu-no'><i class='fa fa-ban'></i> 已拒绝&nbsp;</span>";
if (WST.GRANT.SQSJ_01) {
h += "<a data-id='"+item.id+"'class='btn btn-blue authAction'> <i class='fa fa-pencil'></i>修改</a> ";
}
}else {
h += "<span class='statu-wait'><i class='fa fa-clock-o'></i> 待审核&nbsp;</span>";
if (WST.GRANT.SQSJ_01) {
h += "<a data-id='"+item.id+"'class='btn btn-blue authAction'> <i class='fa fa-pencil'></i>审核</a> ";
}
}
return h;
}
}];
mmg = $('.mmg').mmGrid({height: h-173,indexCol: true,indexColWidth:50, cols: cols,method:'POST',
url: WST.U('admin/Users/getUserUpdateList'), fullWidthRows: true, autoLoad: true,remoteSort: true,sortName:'createTime',sortStatus:'desc',
plugins: [
$('#pg').mmPaginator({})
]
});
$('#headTip').WSTTips({width:90,height:35,callback:function(v){
if(v){
mmg.resize({height:h-173});
}else{
mmg.resize({height:h-128});
}
}});
}
function editInit(){
/* 表单验证 */
$('#userForm').validator({
dataFilter: function(data) {
if (data.ok === '该登录账号可用' ) return "";
else return "已被注册";
},
rules: {
loginName: function(element) {
return /\w{5,}/.test(element.value) || '账号应为5-16字母、数字或下划线';
},
myRemote: function(element){
return $.post(WST.U('admin/users/checkLoginKey'),{'loginName':element.value,'userId':$('#userId').val()},function(data,textStatus){});
}
},
fields: {
loginName: {
rule:"required;loginName;myRemote",
msg:{required:"请输入会员账号"},
tip:"请输入会员账号",
ok:"",
},
userPhone: {
rule:"mobile;myRemote",
ok:"",
},
userEmail: {
rule:"email;myRemote",
ok:"",
},
userScore: {
rule:"integer[+0]",
msg:{integer:"当前积分只能是正整数"},
tip:"当前积分只能是正整数",
ok:"",
},
userTotalScore: {
rule:"match[gte, userScore];integer[+0];",
msg:{integer:"当前积分只能是正整数",match:'会员历史积分必须不小于会员积分'},
tip:"当前积分只能是正整数",
ok:"",
},
userQQ: {
rule:"integer[+]",
msg:{integer:"QQ只能是数字"},
tip:"QQ只能是数字",
ok:"",
},
},
valid: function(form){
let params = WST.getParams('.ipt');
let loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/Users/'+((params.userId==0)?"add":"edit")),params,function(data,textStatus){
layer.close(loading);
let json = WST.toAdminJson(data);
if(json.status=='1'){
WST.msg("操作成功",{icon:1});
location.href=WST.U('Admin/Users/index');
}else{
WST.msg(json.msg,{icon:2});
}
});
}
});
//上传头像
WST.upload({
pick:'#adFilePicker',
formData: {dir:'users'},
accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'},
callback:function(f){
let json = WST.toAdminJson(f);
if(json.status==1){
$('#uploadMsg').empty().hide();
//将上传的图片路径赋给全局变量
$('#userPhoto').val(json.savePath+json.name);
$('#preview').html('<img src="'+WST.conf.IMGURL+'/'+json.savePath+json.thumb+'" height="152" />');
}else{
WST.msg(json.msg,{icon:2});
}
},
progress:function(rate){
$('#uploadMsg').show().html('已上传'+rate+"%");
}
});
}
/**
* 时间戳格式化函数
*/
function getLocalTime(nS) {
return new Date(parseInt(nS) * 1000).toLocaleString().substr(0,19);
}

View File

@ -0,0 +1,32 @@
<script src="users.js"></script>{extend name="base" /}
{block name="css"}
<link rel="stylesheet" type="text/css" href="__ADMIN__/js/mmgrid/mmGrid.css?v={$v}" />
{/block}
{block name="js"}
<script src="__ADMIN__/js/mmgrid/mmGrid.js?v={$v}" type="text/javascript"></script>
<script src="__ADMIN__/users/auth.js?v={$v}" type="text/javascript"></script>
{/block}
{block name="main"}
<div id='alertTips' class='alert alert-success alert-tips fade in'>
<div id='headTip' class='head'><i class='fa fa-lightbulb-o'></i>操作说明</div>
<ul class='body'>
<li>合作认证审核列表。</li>
</ul>
</div>
<div class="wst-toolbar">
<form autocomplete="off" >
<div id="query" style="float:left;">
<input type="text" name="loginName" placeholder='账号/手机' id="loginName" class="query" />
<button type="button" class="btn btn-primary" onclick="javascript:userQuery()" ><i class="fa fa-search"></i>查询</button>
</div><br />
</form>
</div>
<div class='wst-grid'>
<div id="mmg" class="mmg"></div>
<div id="pg" style="text-align: right;"></div>
</div>
<script>
$(function(){QLG.init(2);initCompanyGrid()});
</script>
{/block}

View File

@ -0,0 +1,103 @@
{extend name="base" /}
{block name="css"}
<link rel="stylesheet" type="text/css" href="__STATIC__/plugins/webuploader/webuploader.css?v={$v}" />
{/block}
{block name="js"}
<script type='text/javascript' src='__STATIC__/plugins/webuploader/webuploader.js?v={$v}'></script>
<script src="__ADMIN__/users/users.js?v={$v}" type="text/javascript"></script>
{/block}
{block name="main"}
<div class="l-loading" style="display: block" id="wst-loading"></div>
<form id="userForm" autocomplete="off" class='layui-form'>
<table class='wst-form wst-box-top'>
<tr>
<th width='150'>账号<font color='red'>*</font></th>
<td width='370'>
{if ($data['userId']>0)}
{$data['loginName']}
{else /}
<input type="text" class="ipt" id="loginName" name="loginName" />
{/if}
</td>
<td rowspan="5">
<div id="preview" >
<img src="__IMGURL__/{if $data['userPhoto']==''}{:WSTConf('CONF.userLogo')}{else}{$data['userPhoto']}{/if}" height="150" />
</div>
<div id='adFilePicker' style="margin-left:40px;">上传头像</div>
<input type="hidden" id="userPhoto" class="ipt" />
<span id='uploadMsg'></span>
</td>
</tr>
{if ((int)$data['userId']==0)}
<tr>
<th>密码<font color='red'>*</font></th>
<td><input type="password" id='loginPwd' class='ipt' maxLength='20' value='66666666' data-rule="登录密码: required;length[6~20]" data-target="#msg_loginPwd"/>
<span id='msg_loginPwd'>(默认为66666666)</span>
</td>
</tr>
{/if}
<tr>
<th>用户名:</th>
<td>
<input type="text" class="ipt" id="userName" name="userName" value="{$data['userName']}" />
</td>
</tr>
<tr>
<th>性别<font color='red'>*</font></th>
<td>
<label><input type="radio" class="ipt" id="userSex" name="userSex" <?=($data['userSex']==1)?'checked':'';?> value="1" title='男'/></label>
<label><input type="radio" class="ipt" id="userSex" name="userSex" <?=($data['userSex']==2)?'checked':'';?> value="2" title='女'/></label>
<label><input type="radio" class="ipt" id="userSex" name="userSex" <?=($data['userSex']==0)?'checked':'';?> value="0" title='保密'/></label>
</td>
</tr>
<tr>
<th>手机号码:</th>
<td>
<input type="text" class="ipt" id="userPhone" name="userPhone" value="{$data['userPhone']}" />
</td>
</tr>
<tr>
<th>电子邮箱:</th>
<td>
<input type="text" class="ipt" id="userEmail" name="userEmail" value="{$data['userEmail']}" />
</td>
</tr>
<tr>
<th>QQ</th>
<td>
<input type="text" class="ipt" id="userQQ" name="userQQ" value="{$data['userQQ']}" />
</td>
</tr>
<tr>
<th>是否允许举报<font color='red'>*</font></th>
<td>
<label><input type="radio" class="ipt" id="isInform" name="isInform" <?=($data['isInform']==1)?'checked':'';?> value="1" title='允许举报商品'/></label>
<label><input type="radio" class="ipt" id="isInform" name="isInform" <?=($data['isInform']==0)?'checked':'';?> value="0" title='禁止举报商品'/></label>
</td>
</tr>
{if ((int)$data['userId']==0)}
<tr>
<th>会员状态<font color='red'>*</font></th>
<td>
<input type="checkbox" style='width:80px;' class="ipt" checked name="userStatus" id='userStatus' lay-skin="switch" title="开关" value='1' lay-text="启用|停用">
</td>
</tr>
{/if}
<tr>
<td colspan='2' align='center'>
<input type="hidden" name="id" id="userId" class="ipt" value="<?=(int)$data['userId']?>" />
<button type="submit" class="btn btn-primary btn-mright" ><i class="fa fa-check"></i>提交</button>
<button type="button" class="btn" onclick="javascript:history.go(-1)"><i class="fa fa-angle-double-left"></i>返回</button>
</td>
</tr>
</table>
</form>
<script>
$(function(){editInit()});
</script>
{/block}

View File

@ -0,0 +1,49 @@
{extend name="base" /}
{block name="css"}
<link rel="stylesheet" type="text/css" href="__ADMIN__/js/mmgrid/mmGrid.css?v={$v}" />
{/block}
{block name="js"}
<script src="__ADMIN__/js/mmgrid/mmGrid.js?v={$v}" type="text/javascript"></script>
<script src="__ADMIN__/users/users.js?v={$v}" type="text/javascript"></script>
{/block}
{block name="main"}
<div id='alertTips' class='alert alert-success alert-tips fade in'>
<div id='headTip' class='head'><i class='fa fa-lightbulb-o'></i>操作说明</div>
<ul class='body'>
<li>本功能主要用于管理会员(商家的会员身份)资料,您可以通过各种条件查询会员资料。</li>
<li>本功能主要以买家身份涉及的资料为主,例如买家的积分,资金和消费记录。商家资金在财务模块的资金管理中查看。</li>
</ul>
</div>
<div class="wst-toolbar">
<form autocomplete="off" >
<div id="query" style="float:left;">
<select name="userType" id="userType" class="query">
<option value="">会员类型</option>
<option value="0">普通会员</option>
<option value="1">商家</option>
</select>
<input type="text" name="loginName1" placeholder='账号/店铺名称' id="loginName1" class="query" />
<input type="text" name="loginPhone" placeholder='手机号码' id="loginPhone" class="query" />
<input type="text" name="loginEmail" placeholder='电子邮箱' id="loginEmail" class="query" />
<button type="button" class="btn btn-primary" onclick="javascript:userQuery()" ><i class="fa fa-search"></i>查询</button>
</div>
{if WSTGrant('HYGL_01')} <button type="button" class="btn btn-primary f-right btn-fixtop" style='margin-left:10px;' onclick='javascript:toExport(0)'><i class="fa fa-sign-in"></i>导出</button>
<button type="button" class="btn btn-success f-right" style='margin-top:3px;' onclick="javascript:toEdit()"><i class="fa fa-plus"></i>新增</button>
{/if}
<div style="clear:both"></div>
</form>
</div>
<div class='wst-grid'>
<div id="mmg" class="mmg"></div>
<div id="pg" style="text-align: right;"></div>
</div>
<script>
$(function(){initGrid()});
</script>
{/block}

View File

@ -0,0 +1,32 @@
<script src="users.js"></script>{extend name="base" /}
{block name="css"}
<link rel="stylesheet" type="text/css" href="__ADMIN__/js/mmgrid/mmGrid.css?v={$v}" />
{/block}
{block name="js"}
<script src="__ADMIN__/js/mmgrid/mmGrid.js?v={$v}" type="text/javascript"></script>
<script src="__ADMIN__/users/auth.js?v={$v}" type="text/javascript"></script>
{/block}
{block name="main"}
<div id='alertTips' class='alert alert-success alert-tips fade in'>
<div id='headTip' class='head'><i class='fa fa-lightbulb-o'></i>操作说明</div>
<ul class='body'>
<li>个体认证审核列表。</li>
</ul>
</div>
<div class="wst-toolbar">
<form autocomplete="off" >
<div id="query" style="float:left;">
<input type="text" name="loginName" placeholder='账号/手机' id="loginName" class="query" />
<button type="button" class="btn btn-primary" onclick="javascript:userQuery()" ><i class="fa fa-search"></i>查询</button>
</div><br />
</form>
</div>
<div class='wst-grid'>
<div id="mmg" class="mmg"></div>
<div id="pg" style="text-align: right;"></div>
</div>
<script>
$(function(){QLG.init(1);initPersonalGrid()});
</script>
{/block}

View File

@ -0,0 +1,170 @@
{extend name="base" /}
{block name="css"}
{/block}
{block name="js"}
{/block}
{block name="main"}
<div class="l-loading" style="display: block" id="wst-loading"></div>
<table class='wst-form wst-box-top'>
<tr>
<th width='150'>账号<font color='red'>*</font></th>
<td width='370'>
{if ($data['userId']>0)}
{$data['loginName']}
{else /}
<input type="text" class="ipt" id="loginName" name="loginName" />
{/if}
</td>
</tr>
<tr>
<th>选择币种<font color='red'>*</font></th>
<td>
<select class="ipt" id="rechargeCurrency" name="rechargeCurrency" >
<option value="0">请选择</option>
<option value="1">预获产品券</option>
<option value="2">预获优惠券</option>
<option value="3">产品券</option>
<option value="4">优惠券</option>
<option value="5">旺旺券</option>
</select>
</td>
</tr>
<tr>
<th>充值/扣除<font color='red'>*</font></th>
<td>
<input type="radio" name="rechargeType" id="recharge" value="1" checked>
<label for="recharge">充值</label>
<input type="radio" name="rechargeType" id="deduct" value="0">
<label for="deduct">扣除</label>
</td>
</tr>
<tr>
<th>充值/扣除数量<font color='red'>*</font></th>
<td>
<input type="text" class="ipt" id="rechargeNum" name="rechargeNum" value="" />
</td>
</tr>
<tr>
<td colspan='2' align='center'>
<input type="hidden" name="id" id="userId" class="ipt" value="<?=(int)$data['userId']?>" />
<button type="submit" class="btn btn-primary btn-mright submit" ><i class="fa fa-check"></i>提交</button>
<button type="button" class="btn" onclick="javascript:history.go(-1)"><i class="fa fa-angle-double-left"></i>返回</button>
</td>
</tr>
</table>
<script>
$(".submit").click(function(){
var userId = $('#userId').val();
var loginName = $('#loginName').val();
var rechargeCurrency = $('#rechargeCurrency').val();
var rechargeType = $("input[name='rechargeType']:checked").val();
var rechargeNum = $('#rechargeNum').val();
if(!rechargeNum || rechargeNum <= 0){
WST.msg('请正确输入充值或扣除数量');
return;
}
$(".submit").attr('disabled','disabled');
$.ajax({
type: "POST",
url:WST.U('admin/users/recharge'),
data:{"loginName":loginName,"userId":userId,"rechargeNum":rechargeNum,"rechargeType":rechargeType,"rechargeCurrency":rechargeCurrency},
dataType:"json",
success:function(response){
alert(response.msg);
$(".submit").removeAttr('disabled');
},error:function(data){
WST.msg(data);
$(".submit").removeAttr('disabled');
}
});
});
</script>
{/block}

View File

@ -0,0 +1,32 @@
<script src="users.js"></script>{extend name="base" /}
{block name="css"}
<link rel="stylesheet" type="text/css" href="__ADMIN__/js/mmgrid/mmGrid.css?v={$v}" />
{/block}
{block name="js"}
<script src="__ADMIN__/js/mmgrid/mmGrid.js?v={$v}" type="text/javascript"></script>
<script src="__ADMIN__/users/auth.js?v={$v}" type="text/javascript"></script>
{/block}
{block name="main"}
<div id='alertTips' class='alert alert-success alert-tips fade in'>
<div id='headTip' class='head'><i class='fa fa-lightbulb-o'></i>操作说明</div>
<ul class='body'>
<li>申请升级审核列表。</li>
</ul>
</div>
<div class="wst-toolbar">
<form autocomplete="off" >
<div id="query" style="float:left;">
<input type="text" name="loginName" placeholder='账号/手机' id="loginName" class="query" />
<button type="button" class="btn btn-primary" onclick="javascript:userQuery()" ><i class="fa fa-search"></i>查询</button>
</div><br />
</form>
</div>
<div class='wst-grid'>
<div id="mmg" class="mmg"></div>
<div id="pg" style="text-align: right;"></div>
</div>
<script>
$(function(){QLG.init(3);initApplyGrid();});
</script>
{/block}

View File

@ -0,0 +1,205 @@
var mmg;
function initGrid(){
$("body").on("click",'.uploadImg',function(){
layer.open({
type: 1,
title: false,
closeBtn: 0,
area: '90%',
skin: 'layui-layer-nobg', //没有背景色
shadeClose: true,
content: '<div ><img src="'+$(this).attr('src')+'"></div>'
});
});
var h = WST.pageHeight();
var cols = [
{title:'账号', name:'loginName', width: 130,sortable:true},
{title:'用户名', name:'userName' ,width:100,sortable:true},
{title:'手机号码', name:'userPhone' ,width:100,sortable:true},
{title:'推荐人', name:'pName' ,width:60,sortable:true},
{title:'预获产品券', name:'expectedProductNum' ,width:50,sortable:true, renderer:function(val,item,rowIndex){
return '¥'+val;
}},
{title:'预获优惠券', name:'expectedCouponsNum' ,width:50,sortable:true, renderer:function(val,item,rowIndex){
return '¥'+val;
}},
{title:'产品券', name:'productNum' ,width:50,sortable:true, renderer:function(val,item,rowIndex){
return '¥'+val;
}},
{title:'优惠券', name:'couponsNum' ,width:50,sortable:true, renderer:function(val,item,rowIndex){
return '¥'+val;
}},
{title:'旺旺券', name:'wangNum' ,width:50,sortable:true, renderer:function(val,item,rowIndex){
return '¥'+val;
}},
{title:'注册确认书', name:'regConfirmImg' ,width:50,sortable:true, renderer:function(val,item,rowIndex){
return '<img class="uploadImg" style="width:80px;height:80px;" src = "'+WST.conf.IMGURL+'/'+val+'"/>';
}},
// {title:'可用金额', name:'userMoney' ,width:50,sortable:true, renderer:function(val,item,rowIndex){
// return '¥'+val;
// }},
// {title:'冻结金额', name:'lockMoney' ,width:40,sortable:true, renderer:function(val,item,rowIndex){
// return '¥'+val;
// }},
// {title:'积分', name:'userScore' ,width:50,sortable:true},
// {title:'ECT', name:'userECT' ,width:50,sortable:true},
// {title:'等级', name:'rank' ,width:60,sortable:true},
{title:'注册时间', name:'createTime' ,width:120,sortable:true},
{title:'状态', name:'userStatus' ,width:60,sortable:true, renderer:function(val,item,rowIndex){
return (val==1)?"<span class='statu-yes'><i class='fa fa-check-circle'></i> 启用&nbsp;</span>":"<span class='statu-no'><i class='fa fa-ban'></i> 停用&nbsp;</span>";
}},
{title:'操作', name:'' ,width:150, align:'center', renderer: function(val,rowdata,rowIndex){
var h = "";
if(WST.GRANT.HYGL_02)h += "<a class='btn btn-blue' href='"+WST.U('admin/Users/toEdit','id='+rowdata['userId'])+"'><i class='fa fa-pencil'></i>修改</a> ";
if(WST.GRANT.HYGL_03)h += "<a class='btn btn-red' href='javascript:toDel(" + rowdata['userId'] + ","+rowdata['userType']+")'><i class='fa fa-trash-o'></i>删除</a> ";
if(WST.GRANT.HYGL_04)h += "<a class='btn btn-blue' href='javascript:toRecharge(" + rowdata['userId'] + ")'><i class='fa fa-pencil'></i>充值</a> "
h += "<br/><a href='"+WST.U('admin/userscores/touserscores','id='+rowdata['userId'])+"'>积分</a> ";
h += "<a href='"+WST.U('admin/logmoneys/tologmoneys','id='+rowdata['userId'])+"&type=0'>用户资金</a> ";
h += "<a href='"+WST.U('admin/orders/index','userId='+rowdata['userId'])+"&type=0'>消费信息</a> ";
return h;
}}
];
mmg = $('.mmg').mmGrid({height: h-173,indexCol: true,indexColWidth:50, cols: cols,method:'POST',
url: WST.U('admin/Users/pageQuery'), fullWidthRows: true, autoLoad: true,remoteSort: true,sortName:'createTime',sortStatus:'desc',
plugins: [
$('#pg').mmPaginator({})
]
});
$('#headTip').WSTTips({width:90,height:35,callback:function(v){
if(v){
mmg.resize({height:h-173});
}else{
mmg.resize({height:h-128});
}
}});
}
function toEdit(id){
location.href=WST.U('admin/users/toEdit','id='+id);
}
function toRecharge(id){
location.href=WST.U('admin/users/toRecharge','id='+id);
}
function toExport(){
var params = {};
params = WST.getParams('.query');
var box = WST.confirm({content:"您确定要导出订单吗?",yes:function(){
layer.close(box);
location.href=WST.U('admin/users/toExport',params);
}});
}
function toDel(id,userType){
var msg = (userType==1)?"您要删除的用户是商家用户,您确定要删除吗?":"您确定要删除该用户吗?";
var box = WST.confirm({content:msg,yes:function(){
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/Users/del'),{id:id},function(data,textStatus){
layer.close(loading);
var json = WST.toAdminJson(data);
if(json.status=='1'){
WST.msg("操作成功",{icon:1});
layer.close(box);
userQuery();
}else{
WST.msg(json.msg,{icon:2});
}
});
}});
}
function userQuery(){
var query = WST.getParams('.query');
query.page = 1;
mmg.load(query);
}
function editInit(){
/* 表单验证 */
$('#userForm').validator({
dataFilter: function(data) {
if (data.ok === '该登录账号可用' ) return "";
else return "已被注册";
},
rules: {
loginName: function(element) {
return /\w{5,}/.test(element.value) || '账号应为5-16字母、数字或下划线';
},
myRemote: function(element){
return $.post(WST.U('admin/users/checkLoginKey'),{'loginName':element.value,'userId':$('#userId').val()},function(data,textStatus){});
}
},
fields: {
loginName: {
rule:"required;loginName;myRemote",
msg:{required:"请输入会员账号"},
tip:"请输入会员账号",
ok:"",
},
userPhone: {
rule:"mobile;myRemote",
ok:"",
},
userEmail: {
rule:"email;myRemote",
ok:"",
},
userScore: {
rule:"integer[+0]",
msg:{integer:"当前积分只能是正整数"},
tip:"当前积分只能是正整数",
ok:"",
},
userTotalScore: {
rule:"match[gte, userScore];integer[+0];",
msg:{integer:"当前积分只能是正整数",match:'会员历史积分必须不小于会员积分'},
tip:"当前积分只能是正整数",
ok:"",
},
userQQ: {
rule:"integer[+]",
msg:{integer:"QQ只能是数字"},
tip:"QQ只能是数字",
ok:"",
},
},
valid: function(form){
var params = WST.getParams('.ipt');
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/Users/'+((params.userId==0)?"add":"edit")),params,function(data,textStatus){
layer.close(loading);
var json = WST.toAdminJson(data);
if(json.status=='1'){
WST.msg("操作成功",{icon:1});
location.href=WST.U('Admin/Users/index');
}else{
WST.msg(json.msg,{icon:2});
}
});
}
});
//上传头像
WST.upload({
pick:'#adFilePicker',
formData: {dir:'users'},
accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'},
callback:function(f){
var json = WST.toAdminJson(f);
if(json.status==1){
$('#uploadMsg').empty().hide();
//将上传的图片路径赋给全局变量
$('#userPhoto').val(json.savePath+json.name);
$('#preview').html('<img src="'+WST.conf.IMGURL+'/'+json.savePath+json.thumb+'" height="152" />');
}else{
WST.msg(json.msg,{icon:2});
}
},
progress:function(rate){
$('#uploadMsg').show().html('已上传'+rate+"%");
}
});
}