661 lines
25 KiB
JavaScript
Executable File
661 lines
25 KiB
JavaScript
Executable File
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)?"<span class='statu-yes'><i class='fa fa-check-circle'></i> 营业中</span>":"<span class='statu-wait'><i class='fa fa-coffee'></i> 休息中</span>";
|
|
}},
|
|
// {title:'ECT支付', name:'shopAtive' ,width: 20,sortable: true,renderer: function (val,item,rowIndex){
|
|
// return (item['status']==1)?"<a class='btn btn-red statu-yes' href='javascript:toPay(" + item['shopId']+ ","+item['status']+ ")'><i class='fa'></i>关闭</a>":"<a class='btn btn-red statu-no' href='javascript:toPay(" + item['shopId'] + ")'><i class='fa'></i>开启</a>";
|
|
|
|
// }},
|
|
{title:'操作', name:'' ,width:250, renderer: function(val,item,rowIndex){
|
|
var h = "";
|
|
if(WST.GRANT.DPGL_02)h += "<a class='btn btn-blue' href='javascript:toEdit(" + item['shopId'] + ")'><i class='fa fa-pencil'></i>修改</a> ";
|
|
if(WST.GRANT.DPGL_03 && item['shopId']!=1)h += "<a class='btn btn-red' href='javascript:toDel(" + item['shopId'] + ")'><i class='fa fa-trash-o'></i>删除</a> ";
|
|
h += "<a class='btn btn-blue' href='"+WST.U('admin/logmoneys/tologmoneys','id='+item['shopId'])+"&type=1'><i class='fa fa-search'></i>商家资金</a>";
|
|
h += "<a class='btn btn-blue' href='javascript:toCommission(" + item['shopId'] + ")'><i class='fa fa-pencil'></i>设置佣金扣点</a> ";
|
|
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 "<span class='statu-wait'><i class='fa fa-clock-o'></i> 待处理</span>";
|
|
}else if(item['status']==1){
|
|
return "<span class='statu-yes'><i class='fa fa-check-circle'></i> 申请成功</span>";
|
|
}else{
|
|
return "<span class='statu-no'><i class='fa fa-ban'></i> 申请失败</span>";
|
|
}
|
|
}},
|
|
{title:'操作', name:'' ,width:80, align:'center', renderer: function(val,item,rowIndex){
|
|
var h = "";
|
|
if(WST.GRANT.DPSQ_04)h += "<a class='btn btn-blue' href='javascript:toHandle(" + item['shopId'] + ")'><i class='fa fa-pencil'></i>操作</a> ";
|
|
if(item['status']==-1){
|
|
if(WST.GRANT.DPSQ_03)h += "<a class='btn btn-red' href='javascript:toDelApply(" + item['shopId'] + ")'><i class='fa fa-trash-o'></i>删除</a> ";
|
|
}
|
|
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 += "<a class='btn btn-blue' href='javascript:toEdit(" + item['shopId'] + ")'><i class='fa fa-pencil'></i>修改</a> ";
|
|
h += "<a class='btn btn-red' href='javascript:toDel(" + item['shopId'] + ")'><i class='fa fa-trash-o'></i>删除</a> ";
|
|
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 = $("<div style='width:75px;float:left;margin-right:5px;'><a target='_blank' href='"+WST.conf.IMGURL+"/"+json.savePath+json.name+"'>"+
|
|
"<img class='step_pic"+"' width='75' height='75' src='"+WST.conf.IMGURL+"/"+json.savePath+json.thumb+"' v='"+json.savePath+json.name+"'></a></div>");
|
|
var btn = $('<div style="position:relative;top:-80px;left:60px;cursor:pointer;" ><img src="'+WST.conf.ROOT+'/hyhproject/home/View/default/img/seller_icon_error.png"></div>');
|
|
tdiv.append(btn);
|
|
$('#taxRegistrationCertificateImgBox').append(tdiv);
|
|
$('#msg_taxRegistrationCertificateImg').hide();
|
|
var imgPath = [];
|
|
$('.step_pic').each(function(){
|
|
imgPath.push($(this).attr('v'));
|
|
});
|
|
$('#taxRegistrationCertificateImg').val(imgPath.join(','));
|
|
btn.on('click','img',function(){
|
|
uploader.removeFile(file);
|
|
$(this).parent().parent().remove();
|
|
uploader.refresh();
|
|
if($('#taxRegistrationCertificateImgBox').children().size()<=0){
|
|
$('#msg_taxRegistrationCertificateImg').show();
|
|
}
|
|
});
|
|
}else{
|
|
WST.msg(json.msg,{icon:2});
|
|
}
|
|
},
|
|
progress:function(rate){
|
|
$('#taxRegistrationCertificateImgMsg').show().html('已上传'+rate+"%");
|
|
}
|
|
});
|
|
}
|
|
function taxpayerQualificationUpload(){
|
|
WST.upload({
|
|
pick:'#taxpayerQualificationImgPicker',
|
|
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){
|
|
$('#taxpayerQualificationImgMsg').empty().hide();
|
|
$('#taxpayerQualificationImgPreview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb).show();
|
|
$('#taxpayerQualificationImgPreview_a').attr('href',WST.conf.IMGURL+"/"+json.savePath+json.name);
|
|
$('#taxpayerQualificationImg').val(json.savePath+json.name);
|
|
$('#msg_taxpayerQualificationImg').hide();
|
|
}
|
|
},
|
|
progress:function(rate){
|
|
$('#taxpayerQualificationImgMsg').show().html('已上传'+rate+"%");
|
|
}
|
|
});
|
|
}
|
|
function initEdit(opts){
|
|
var laydate = layui.laydate;
|
|
laydate.render({elem: '#establishmentDate'});
|
|
laydate.render({elem: '#businessStartDate'});
|
|
laydate.render({elem: '#businessEndDate'});
|
|
laydate.render({elem: '#legalCertificateStartDate'});
|
|
laydate.render({elem: '#legalCertificateEndDate'});
|
|
laydate.render({elem: '#organizationCodeStartDate'});
|
|
laydate.render({elem: '#organizationCodeEndDate'});
|
|
WST.upload({
|
|
pick:'#shopImgPicker',
|
|
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){
|
|
$('#uploadMsg').empty().hide();
|
|
$('#preview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb);
|
|
$('#shopImg').val(json.savePath+json.name);
|
|
$('#editFrom').validator('hideMsg', '#shopImg');
|
|
}
|
|
},
|
|
progress:function(rate){
|
|
$('#uploadMsg').show().html('已上传'+rate+"%");
|
|
}
|
|
});
|
|
initTime('#serviceStartTime',opts.serviceStartTime);
|
|
initTime('#serviceEndTime',opts.serviceEndTime);
|
|
if($('#shopId').val()>0){
|
|
var areaIdPath = opts.areaIdPath.split("_");
|
|
$('#area_0').val(areaIdPath[0]);
|
|
var aopts = {id:'area_0',val:areaIdPath[0],childIds:areaIdPath,className:'j-areas',isRequire:true}
|
|
WST.ITSetAreas(aopts);
|
|
if(opts.bankAreaIdPath!=''){
|
|
var areaIdPath = opts.bankAreaIdPath.split("_");
|
|
$('#barea_0').val(areaIdPath[0]);
|
|
var aopts = {id:'barea_0',val:areaIdPath[0],childIds:areaIdPath,className:'j-bareas',isRequire:true}
|
|
WST.ITSetAreas(aopts);
|
|
}
|
|
if(opts.businessAreaPath!=''){
|
|
var areaIdPath = opts.businessAreaPath.split("_");
|
|
$('#carea_0').val(areaIdPath[0]);
|
|
var aopts = {id:'carea_0',val:areaIdPath[0],childIds:areaIdPath,className:'j-careas',isRequire:false}
|
|
WST.ITSetAreas(aopts);
|
|
}
|
|
}
|
|
initUpload(opts.isEdit);
|
|
}
|
|
function delVO(obj){
|
|
$(obj).parent().remove();
|
|
var imgPath = [];
|
|
$('.step_pic').each(function(){
|
|
imgPath.push($(this).attr('v'));
|
|
});
|
|
$('#taxRegistrationCertificateImg').val(imgPath.join(','));
|
|
}
|
|
function toEdit(id){
|
|
location.href=WST.U('admin/shops/toEdit','id='+id);
|
|
}
|
|
function toDel(id){
|
|
var box = WST.confirm({content:"您确定要删除该店铺吗?",yes:function(){
|
|
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
|
$.post(WST.U('admin/shops/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);
|
|
grid.reload();
|
|
}else{
|
|
WST.msg(json.msg,{icon:2});
|
|
}
|
|
});
|
|
}});
|
|
}
|
|
function checkLoginKey(obj){
|
|
if($.trim(obj.value)=='')return;
|
|
var params = {key:obj.value,userId:0};
|
|
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
|
$.post(WST.U('admin/users/checkLoginKey'),params,function(data,textStatus){
|
|
layer.close(loading);
|
|
var json = WST.toAdminJson(data);
|
|
if(json.status!='1'){
|
|
WST.msg(json.msg,{icon:2});
|
|
obj.value = '';
|
|
}
|
|
});
|
|
}
|
|
function save(){
|
|
$('#editFrom').isValid(function(v){
|
|
if(v){
|
|
var params = WST.getParams('.ipt');
|
|
params.areaId = WST.ITGetAreaVal('j-areas');
|
|
params.bankAreaId = WST.ITGetAreaVal('j-bareas');
|
|
params.businessAreaPath0 = WST.ITGetAreaVal('j-careas');
|
|
var p= $('.file-panel').text();
|
|
if(p!=""){
|
|
WST.msg('请先上传补充材料',{icon:6});
|
|
return;
|
|
}
|
|
var shopAds = [];
|
|
$('.j-gallery-img').each(function(){
|
|
shopAds.push($(this).attr('v'));
|
|
});
|
|
|
|
params.shopAds = shopAds.join(',');
|
|
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
|
$.post(WST.U('admin/shops/edit'),params,function(data,textStatus){
|
|
layer.close(loading);
|
|
var json = WST.toAdminJson(data);
|
|
if(json.status=='1'){
|
|
WST.msg("操作成功",{icon:1,time:1000},function(){
|
|
if(params.shopStatus==1){
|
|
location.href=WST.U('admin/shops/index');
|
|
}else{
|
|
location.href=WST.U('admin/shops/stopIndex');
|
|
}
|
|
});
|
|
|
|
}else{
|
|
WST.msg(json.msg,{icon:2});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
function getUserByKey(){
|
|
if($.trim($('#keyName').val())=='')return;
|
|
$('#keyNameBox').html('');
|
|
$('#shopUserId').val(0);
|
|
var loading = WST.msg('正在查询用户信息...', {icon: 16,time:60000});
|
|
$.post(WST.U('admin/users/getUserByKey'),{key:$('#keyName').val()},function(data,textStatus){
|
|
layer.close(loading);
|
|
var json = WST.toAdminJson(data);
|
|
if(json.status=='1'){
|
|
$('#keyNameBox').html('用户:'+json.data.loginName);
|
|
$('#shopUserId').val(json.data.userId);
|
|
}else{
|
|
WST.msg(json.msg,{icon:2});
|
|
}
|
|
});
|
|
}
|
|
function add(){
|
|
$('#editFrom').isValid(function(v){
|
|
if(v){
|
|
var params = WST.getParams('.ipt');
|
|
params.areaId = WST.ITGetAreaVal('j-areas');
|
|
params.bankAreaId = WST.ITGetAreaVal('j-bareas');
|
|
params.businessAreaPath0 = WST.ITGetAreaVal('j-careas');
|
|
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
|
$.post(WST.U('admin/shops/add'),params,function(data,textStatus){
|
|
layer.close(loading);
|
|
var json = WST.toAdminJson(data);
|
|
if(json.status=='1'){
|
|
WST.msg("操作成功",{icon:1,time:1000},function(){
|
|
location.href=WST.U('admin/shops/index');
|
|
});
|
|
|
|
}else{
|
|
WST.msg(json.msg,{icon:2});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
function apply(){
|
|
$('#editFrom').isValid(function(v){
|
|
if(v){
|
|
var params = WST.getParams('.ipt');
|
|
if(params.applyStatus==-1 && params.applyDesc==''){
|
|
WST.msg('请输入审核不通过原因!',{icon:2});
|
|
return;
|
|
}
|
|
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
|
$.post(WST.U('admin/shops/handleApply'),params,function(data,textStatus){
|
|
//layer.close(loading);
|
|
var json = WST.toAdminJson(data);
|
|
if(json.status=='1'){
|
|
WST.msg("操作成功",{icon:1,time:1000},function(){
|
|
location.href=WST.U('admin/shops/apply');
|
|
});
|
|
|
|
}else{
|
|
WST.msg(json.msg,{icon:2});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
function initTime($id,val){
|
|
var html = [],t0,t1;
|
|
var str = val.split(':');
|
|
for(var i=0;i<24;i++){
|
|
t0 = (val.indexOf(':00')>-1 && (parseInt(str[0],10)==i))?'selected':'';
|
|
t1 = (val.indexOf(':30')>-1 && (parseInt(str[0],10)==i))?'selected':'';
|
|
html.push('<option value="'+i+':00" '+t0+'>'+i+':00</option>');
|
|
html.push('<option value="'+i+':30" '+t1+'>'+i+':30</option>');
|
|
}
|
|
$($id).append(html.join(''));
|
|
}
|
|
//质保金管理
|
|
function toDeposit(){
|
|
location.href=WST.U('admin/shops/toDeposit');
|
|
}
|
|
|
|
function editInit(){
|
|
/* 表单验证 */
|
|
$('#topDeposit').validator({
|
|
valid: function(form) {
|
|
var params = WST.getParams('.ipt');
|
|
if(params.shopId=='') {
|
|
WST.msg('请填写店铺编号', {
|
|
icon: 2
|
|
});
|
|
return;
|
|
}
|
|
if(params.applyStatus==1 && params.addDeposit=='') {
|
|
WST.msg('请填写充值质保金金额', {
|
|
icon: 2
|
|
});
|
|
return;
|
|
}
|
|
if(params.applyStatus==2 && params.offDeposit=='') {
|
|
WST.msg('请填写扣除质保金金额', {
|
|
icon: 2
|
|
});
|
|
return;
|
|
}
|
|
if(params.applyStatus==2 && params.offCause=='') {
|
|
WST.msg('请填写扣除质保原因', {
|
|
icon: 2
|
|
});
|
|
return;
|
|
}
|
|
$.post(WST.U('admin/shops/topDeposit'), params, function(data, textStatus) {
|
|
var json = WST.toAdminJson(data);
|
|
if(json.status == 1) {
|
|
WST.msg(json.msg, {
|
|
icon: 1
|
|
}, function() {
|
|
// $('#goodsOrder').val(+$('#goodsOrder').val()+1);
|
|
$('#cashDeposit').val('');
|
|
//location.href = WST.AU('hyhlimitactive://Hyhlimitactive/getGoodsAdd');
|
|
});
|
|
} else {
|
|
WST.msg(json.msg, {
|
|
icon: 2
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|