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+='
'; }) 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 = '
' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' '; let tdStr=''; $.each(json.data,function(){ tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; }); auth_html+=tdStr+'' + '
本人ID亲人ID亲人姓名亲人身份证关系关系证明照身份证正面身份证反面
'+this.userId+''+this.familyId+''+this.familyName+''+this.familyIdCard+''+this.familyRelations+''+"'+"'+"
'; 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 = '
' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' '; let tdStr=''; $.each(json.data,function(){ tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; }); auth_html+=tdStr+'' + '
本人ID报备姓名报备身份证关系关系证明照
'+this.userId+''+this.familyName+''+this.familyIdCard+''+this.familyRelations+''+"
'; 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 = '
' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' '; let tdStr=''; $.each(json.data,function(){ tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; }); auth_html+=tdStr+'/tbody>' + '
本人ID合伙人ID合伙人姓名身份证职位持股比例手持营业执照照片身份证正面身份证反面
'+this.userId+''+this.partnerId+''+this.uName+''+this.idCard+''+this.positionName+''+this.stake+''+"'+"'+"
'; 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 = '
' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' '; let tdStr=''; $.each(json.data,function(){ tdStr+=''; tdStr+=''; tdStr+=''; tdStr+=''; }); auth_html+=tdStr+'' + '
本人ID银行名开户名卡号
'+this.userId+''+this.bankName+''+this.accountName+''+this.bankNo+'
'; 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: '
审核处理: ' + '' + '
', 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: '
' }); }); 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""; }}, {title:'认证信息', name:'' ,width:150, align:'center', renderer: function(val,item,rowIndex) { let h = ""; h += "亲人认证 "; h += " 亲人报备 "; 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 += " 已通过 "; if (WST.GRANT.GTRZSH_01) { h += " 修改 "; } }else if(val==2){ h += " 已拒绝 "; if (WST.GRANT.GTRZSH_01) { h += " 修改 "; } }else { h += " 待审核 "; if (WST.GRANT.GTRZSH_01) { h += " 审核 "; } } 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""; // }}, {title:'认证信息', name:'' ,width:150, align:'center', renderer: function(val,item,rowIndex) { let h = ""; h += "合作人员 "; h += " 银行卡列表 "; 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 += " 已通过 "; if (WST.GRANT.HZRZSH_01) { h += " 修改 "; } }else if(val==2){ h += " 已拒绝 "; if (WST.GRANT.HZRZSH_01) { h += " 修改 "; } }else { h += " 待审核 "; if (WST.GRANT.HZRZSH_01) { h += " 审核 "; } } 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""; }}, {title:'店铺图片组', name:'shopImg' ,width:100,sortable:true ,renderer:function(val,item,rowIndex) { return"查看"; }}, {title:'申请区域', name:'province' ,width:100,sortable:true ,renderer:function(val,item,rowIndex) { var html=''+item.province.areaName+'-'+item.city.areaName+'-'; switch(item.applyLevel){ case '4': html +=''+item.county.areaName+''; // html +=item.town.areaName+'-'+item.village.areaName; break; case '3': html +=item.county.areaName+'-'; html +=''+item.town.areaName+''; // html +=item.village.areaName; break; case '2': html +=item.county.areaName+'-'+item.town.areaName+'-'; html +=''+item.village.areaName+''; break; } html+=''; 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 += " 已通过 "; if (WST.GRANT.SQSJ_01) { h += " 修改 "; } }else if(val==2){ h += " 已拒绝 "; if (WST.GRANT.SQSJ_01) { h += " 修改 "; } }else { h += " 待审核 "; if (WST.GRANT.SQSJ_01) { h += " 审核 "; } } 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(''); }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); }