var mmg; function initGrid(){ var h = WST.pageHeight(); var cols = [ {title:'店铺编号', name:'shopSn', width: 30,sortable: true}, {title:'店铺账号', name:'loginName',width: 60,sortable: true}, {title:'店铺名称', name:'shopName',width: 60,sortable: true}, {title:'店主姓名', name:'shopkeeper',width: 40,hidden: true,sortable: true}, {title:'店主联系电话', name:'telephone',width: 30,hidden: true,sortable: true}, {title:'商品数量', name:'goodsNum',width: 30,sortable: true,align:'center'}, {title:'店铺地址', name:'shopAddress',width:120 }, {title:'主营类目', name:'catName',width:60,sortable: true,}, {title:'所属公司', name:'shopCompany',width: 60,hidden: true}, {title:'申请时间', name:'applyTime',width: 60}, {title:'通过时间', name:'createTime',width: 60}, {title:'营业状态', name:'shopAtive' ,width: 20,sortable: true,renderer: function (val,item,rowIndex){ return (item['shopAtive']==1)?" 营业中":" 休息中"; }}, // {title:'ECT支付', name:'shopAtive' ,width: 20,sortable: true,renderer: function (val,item,rowIndex){ // return (item['status']==1)?"关闭":"开启"; // }}, {title:'操作', name:'' ,width:250, renderer: function(val,item,rowIndex){ var h = ""; if(WST.GRANT.DPGL_02)h += "修改 "; if(WST.GRANT.DPGL_03 && item['shopId']!=1)h += "删除 "; h += "商家资金"; h += "设置佣金扣点 "; return h; }} ]; mmg = $('.mmg').mmGrid({height: (h-85),indexCol: true, cols: cols,method:'POST',nowrap:true, url: WST.U('admin/shops/pageQuery'), fullWidthRows: true, autoLoad: true, remoteSort:true , sortName: 'shopSn', sortStatus: 'desc', plugins: [ $('#pg').mmPaginator({}) ] }); } function toCommission(shopId){ $('#topCommission')[0].reset(); $.post(WST.U('admin/shops/commission'),{shopId:shopId},function(data,textStatus){ // dump($data);die; var json = WST.toAdminJson(data); if(json){ WST.setValues(json); layui.form.render(); editsBox(shopId); } }); } function editsBox(shopId){ var title =(shopId>0)?"修改":"新增"; var box = WST.open({title:title,type:1,content:$('#accredBox'),area: ['750px', '320px'],btn:['确定','取消'], end:function(){$('#accredBox').hide();},yes:function(){ $('#topCommission').submit(); }}); $('#topCommission').validator({ fields: { 'commission': {rule:"required",msg:{required:'请输入佣金扣点'}}, }, // fields: { // 'comDeduct': {rule:"required",msg:{required:'请输入提成比例'}}, // }, fields: { 'userName': {rule:"required",msg:{required:'请输入业务员名称'}}, }, fields: { 'usersPhone': {rule:"required",msg:{required:'请输入业务员电话'}}, }, fields: { 'userId': {rule:"required",msg:{required:'请输入业务员编号'}}, }, valid: function(form){ var params = WST.getParams('.ipt'); var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000}); $.post(WST.U('admin/shops/upCommission/'+(shopId)),params,function(data,textStatus){ layer.close(loading); var json = WST.toAdminJson(data); if(json.status=='1'){ WST.msg("操作成功",{icon:1}); layer.close(box); $('#accredBox').hide(); grid.reload(secTyepId); }else{ WST.msg(json.msg,{icon:2}); } }); } }); } function loadGrid(){ var params = WST.getParams('.j-ipt'); params.areaIdPath = WST.ITGetAllAreaVals('areaId1','j-areas').join('_'); params.page = 1; mmg.load(params); } function initApplyGrid(){ var h = WST.pageHeight(); var cols = [ {title:'申请人账号', name:'loginName', width: 30}, {title:'申请人姓名', name:'trueName', width: 30}, {title:'店铺名称', name:'shopName',width:100 }, {title:'直营人', name:'userName',width:100 }, {title:'申请联系人电话', name:'phone',width:30 }, {title:'店铺地址', name:'shopAddress',width:30 }, {title:'申请日期', name:'applyTime' }, {title:'申请状态', name:'status' ,width:30,renderer: function (val,item,rowIndex){ if(item['status']==0){ return " 待处理"; }else if(item['status']==1){ return " 申请成功"; }else{ return " 申请失败"; } }}, {title:'操作', name:'' ,width:80, align:'center', renderer: function(val,item,rowIndex){ var h = ""; if(WST.GRANT.DPSQ_04)h += "操作 "; if(item['status']==-1){ if(WST.GRANT.DPSQ_03)h += "删除 "; } return h; }} ]; mmg = $('.mmg').mmGrid({height: (h-85),indexCol: true, cols: cols,method:'POST',nowrap:true, url: WST.U('admin/shops/shopApplyList'), fullWidthRows: true, autoLoad: true, plugins: [ $('#pg').mmPaginator({}) ] }); } function loadApplyGrid(){ var params = WST.getParams('.j-ipt'); params.areaIdPath = WST.ITGetAllAreaVals('areaId1','j-areas').join('_'); params.page = 1; mmg.load(params); } function toPay(id,status){ var box = WST.confirm({content:"您确定修改ECT支付状态吗?",yes:function(){ var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000}); $.post(WST.U('admin/payments/pay'),{id:id,status:status},function(data,textStatus){ layer.close(loading); var json = WST.toAdminJson(data); if(json.status=='1'){ WST.msg("操作成功",{icon:1}); layer.close(box); loadGrid(); }else{ WST.msg(json.msg,{icon:2}); } }); }}); } function toHandle(id){ location.href = WST.U('admin/shops/applyEdit','id='+id); } function toDelApply(id){ var box = WST.confirm({content:"您确定要彻底删除该店铺申请信息吗?",yes:function(){ var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000}); $.post(WST.U('admin/shops/delApply'),{id:id},function(data,textStatus){ layer.close(loading); var json = WST.toAdminJson(data); if(json.status=='1'){ WST.msg("操作成功",{icon:1}); layer.close(box); grid.reload(); }else{ WST.msg(json.msg,{icon:2}); } }); }}); } function initStopGrid(){ var h = WST.pageHeight(); var cols = [ {title:'店铺编号', name:'shopSn', width: 30}, {title:'店铺账号', name:'loginName', width: 60}, {title:'店铺名称', name:'shopName',width: 120}, {title:'店主姓名', name:'shopkeeper',width: 40,hidden: true}, {title:'店主联系电话', name:'telephone',hidden: true}, {title:'店铺地址', name:'shopAddress',width:350 }, {title:'所属公司', name:'shopCompany',hidden: true }, {title:'操作', name:'' ,width:80, align:'center', renderer: function(val,item,rowIndex){ var h = ""; h += "修改 "; h += "删除 "; return h; }} ]; mmg = $('.mmg').mmGrid({height: (h-85),indexCol: true, cols: cols,method:'POST',nowrap:true, url: WST.U('admin/shops/pageStopQuery'), fullWidthRows: true, autoLoad: true, plugins: [ $('#pg').mmPaginator({}) ] }); } function loadStopGrid(){ var params = WST.getParams('.j-ipt'); params.areaIdPath = WST.ITGetAllAreaVals('areaId1','j-areas').join('_'); params.page = 1; mmg.load(params); } var initTab2 = false,initTab3 = false; function initUpload(isEdit){ if(!isEdit){ legalCertificateImgUpload(); businessLicenceImgUpload(); bankAccountPermitImgUpload(); shopLicenseUpload(); organizationCodeUpload(); taxRegistrationCertificateUpload(); taxpayerQualificationUpload(); }else{ var element = layui.element; element.on('tab(msgTab)', function(data){ if(data.index==1){ if(initTab2)return; initTab2 = true; legalCertificateImgUpload(); businessLicenceImgUpload(); bankAccountPermitImgUpload(); organizationCodeUpload(); shopLicenseUpload(); }else if(data.index==2){ if(initTab3)return; initTab3 = true; taxRegistrationCertificateUpload(); taxpayerQualificationUpload(); } }); } } function legalCertificateImgUpload (){ WST.upload({ pick:'#legalCertificateImgPicker', formData: {dir:'shops'}, 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){ $('#legalCertificateImgMsg').empty().hide(); $('#legalCertificateImgPreview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb).show(); $('#legalCertificateImgPreview_a').attr('href',WST.conf.IMGURL+"/"+json.savePath+json.name); $('#legalCertificateImg').val(json.savePath+json.name); $('#msg_legalCertificateImg').hide(); } }, progress:function(rate){ $('#legalCertificateImgMsg').show().html('已上传'+rate+"%"); } }); } function businessLicenceImgUpload(){ WST.upload({ pick:'#businessLicenceImgPicker', formData: {dir:'shops'}, 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){ $('#businessLicenceImgMsg').empty().hide(); $('#businessLicenceImgPreview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb).show(); $('#businessLicenceImgPreview_a').attr('href',WST.conf.IMGURL+"/"+json.savePath+json.name); $('#businessLicenceImg').val(json.savePath+json.name); $('#msg_businessLicenceImg').hide(); } }, progress:function(rate){ $('#businessLicenceImgMsg').show().html('已上传'+rate+"%"); } }); } function bankAccountPermitImgUpload(){ WST.upload({ pick:'#bankAccountPermitImgPicker', formData: {dir:'shops'}, 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){ $('#bankAccountPermitImgMsg').empty().hide(); $('#bankAccountPermitImgPreview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb).show(); $('#bankAccountPermitImgPreview_a').attr('href',WST.conf.IMGURL+"/"+json.savePath+json.name); $('#bankAccountPermitImg').val(json.savePath+json.name); $('#msg_bankAccountPermitImg').hide(); } }, progress:function(rate){ $('#bankAccountPermitImgMsg').show().html('已上传'+rate+"%"); } }); } function organizationCodeUpload(){ WST.upload({ pick:'#organizationCodeImgPicker', formData: {dir:'shops'}, 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){ $('#organizationCodeImgMsg').empty().hide(); $('#organizationCodeImgPreview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb).show(); $('#organizationCodeImgPreview_a').attr('href',WST.conf.IMGURL+"/"+json.savePath+json.name); $('#organizationCodeImg').val(json.savePath+json.name); $('#msg_organizationCodeImg').hide(); } }, progress:function(rate){ $('#organizationCodeImgMsg').show().html('已上传'+rate+"%"); } }); } function shopLicenseUpload (){ WST.upload({ pick:'#shopLicenseImgPicker', formData: {dir:'shops'}, 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){ $('#shopLicenseImgMsg').empty().hide(); $('#shopLicenseImgPreview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb).show(); $('#shopLicenseImgPreview_a').attr('href',WST.conf.IMGURL+"/"+json.savePath+json.name); $('#shopLicense').val(json.savePath+json.name); $('#msg_shopLicenseImg').hide(); } }, progress:function(rate){ $('#shopLicenseImgMsg').show().html('已上传'+rate+"%"); } }); } function taxRegistrationCertificateUpload(){ var uploader = WST.upload({ pick:'#taxRegistrationCertificateImgPicker', formData: {dir:'shops'}, accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'}, fileNumLimit:3, callback:function(f,file){ var json = WST.toAdminJson(f); if(json.status==1){ $('#taxRegistrationCertificateImgMsg').empty().hide(); var tdiv = $("
"); var btn = $('