Info.js 3.24 KB



var $ = require('jquery'),
    common=require('../../common/common');

require('../../common/umeditor.config');
require('../../common/umeditor');
require('../../common/zh-cn');

var ENUM={
    shopNature:{1:'旗舰店',2:'专卖店',3:'分销店',4:'专营店',5:'有货国际',6:'一件代发'},
    shopsType:{1:'单品店',2:'多品店'},
    checkStatus:{100:'暂存',200:'审核中',300:'通过',900:'驳回'},
    opt:{"add":"添加","delete":"删除"},
    href:{"info":"/supplier/store/index","info2":"/supplier/check/index","info3":"/supplier/store/examine"},
    appType:{1:'是',0:'否'}
};
var shopNature = $('#shopNature1').html();
if(shopNature == 3){
    $('#shopNature1').html("分销店");
    $("#showUnionType").show();
    $("#showBLK").hide();
    $("#showUrl").hide();
    $("#showOther").hide();
    $("#showAdd").hide();
}else{
    if(shopNature == 1){
        $('#shopNature1').html("旗舰店");
    }else if(shopNature == 2){
        $('#shopNature1').html("专卖店");
    }else if(shopNature == 4){
        $('#shopNature1').html("专营店");
    }else if(shopNature == 5){
        $('#shopNature1').html("有货国际");
    }else if(shopNature == 6){
        $('#shopNature1').html("一件代发");
    }
    $("#showUnionType").hide();
    $("#showBLK").show();
    $("#showUrl").show();
    $("#showOther").show();
    $("#showAdd").show();
}
var Bll={
        toast:function(content,url){
            common.dialog.confirm("温馨提示",content,function(){
                common.util.__ajax({
                    url:url,
                    data:{shopsId:$("#shopsId").val()}
                },function(){
                    var href=location.pathname.match(/\/supplier\/store\/(\w*)\//);
                    location.href=ENUM.href[href[1]];
                });
            });
        }
    }


$('#basicTable').on('click', '#tongguo', function() {
    Bll.toast("您确定要通过审核吗?","/Shops/ShopsRest/checkShopPass");
});

$('#basicTable').on('click', '#bohui', function() {
    Bll.toast("您确定要驳回审核吗?","/Shops/ShopsRest/checkReject");
});




for(var key in ENUM){
    var me=$("#"+key);
    me.parent("div").html(ENUM[key][me.val()]);
}
$("#otherUrl").add("#websiteUrl").add("#shopAddress").each(function(){
    var data=JSON.parse($(this).val());
    var me=$(this).parent();
    $.each(data,function(i,item){
        me.append("<p>"+item+"</p>");
    });
});

var g2=new common.grid({
    el:"#baseTable",
    columns:[
        {display:"品牌","name":"brandName"},
        {display:"供应商","name":"supplierName"},
        {display:"操作",render:function(item){
            return ENUM.opt[item.method]||"无变化";
        }}
    ]
});
if($("#shopRelationList").val()){
    var a=JSON.parse($("#shopRelationList").val());
    g2.init(a);
}

window.UMshopintro = UM.getEditor('edit-shop-intro');
window.UMshopintro.setDisabled('fullscreen');
var shopIntroContent = $('#shopIntro').val();
if(shopIntroContent) {
    UMshopintro.setContent(shopIntroContent);
}

window.UMBusinessLicense = UM.getEditor('edit-business-license');
window.UMBusinessLicense.setDisabled('fullscreen');
var businessLicenseContent = $('#businessLicense').val();
if(businessLicenseContent) {
    UMBusinessLicense.setContent(businessLicenseContent);
}