// 可分配产品界面
$('.assigned-content .assigned-right i').click(function () {
    $('.proportion-wind').show();
    $('.block-mask-more').show();
});
$('.proporion-sel .no-qu').click(function () {
    $('.proportion-wind').hide();
    $('.block-mask-more').hide();
});




// 删除已分配产品
$('.select .select-wed').click(function () {
    if($(this).hasClass('on')){
        $(this).removeClass('on')
    }else{
        $(this).addClass('on')
    }
});
function changClass(obj) {
    if($(obj).hasClass('on')){
        $(obj).removeClass('on')
    }else{
        $(obj).addClass('on')
    }
    $('.select .select-wed').each(function () {
        if ($(this).hasClass('on')) {
            $('.remove-product button').removeAttr("disabled").css({"background": "#93c1ff","box-shadow":"0px 2px 12px #BDD7FA","-moz-box-shadow":"0px 2px 12px #BDD7FA;","-webkit-box-shadow":"0px 2px 12px #BDD7FA;"});
            return false;
        } else {
            $('.remove-product button').attr('disabled', "true").css({"background": "rgb(205,213,225);","box-shadow":"none"});
        }
    })
}

$('.select .select-wed').click(function () {
    $('.select .select-wed').each(function () {
        if ($(this).hasClass('on')) {
            $('.remove-product button').removeAttr("disabled").css({"background": "#93c1ff","box-shadow":"0px 2px 12px #BDD7FA","-moz-box-shadow":"0px 2px 12px #BDD7FA;","-webkit-box-shadow":"0px 2px 12px #BDD7FA;"});
            return false;
        } else {
            $('.remove-product button').attr('disabled', "true").css({"background": "rgb(205,213,225);","box-shadow":"none"});
        }
    })
});




// 设置销售区域界面
$('ul#sales-area li a').click(function () {
    $(this).parents('li').remove();
});
function removeSales(obj) {
    $(obj).parents('li').remove();
}

// 新增下级弹窗
// 企业/个人选择
var per_height = parseInt($('.person-model').height()/2);
$('.person-model').css({"margin-top":-per_height+"px"});
$('#enterprise').click(function () {
    $('.person-model').show();
    $('.block-mask').show();
});
$('.person-model li p').click(function () {
    var s_index = $(this).parent('li').index();
    $('select#ssss_enterprise option').eq(s_index).attr("selected",true);
    $('.person-model li p').removeClass('on');
    $(this).addClass('on');
    var s_name = $(this).text();
    $('.person-model').hide();
    $('.block-mask').hide();
    $('#enterprise').text(s_name);
    $('#papers').text('');

    var ert = $(this).text();
    if(ert == '企业'){
        $('#ertff').html('<ul>'
            +'<li>'
            +'<p onclick="tyu(this)">营业执照</p>'
            +'</li>'
            +'<li>'
            +'<p onclick="tyu(this)">统一社会信用代码</p>'
            +'</li>'
            +'<li>'
            +'<p onclick="tyu(this)">组织机构代码证</p>'
            +'</li>'
            +'</ul>');
        var papers_height = parseInt($('.papers-model').height()/2);
        $('.papers-model').css({"margin-top":-papers_height+"px"});

        $('#qqqqqq').html(
            '<select name="terminalType" id="ssss_idcard">'
            +'<option value="1" >营业执照</option>'
            +'<option value="2" >统一社会信用代码</option>'
            +'<option value="3" >组织机构代码证</option>'
            +'</select>'
        );


    }else{
        $('#ertff').html('<ul>'
            +'<li>'
            +'<p onclick="tyu(this)">身份证</p>'
            +'</li>'
            +'<li>'
            +'<p onclick="tyu(this)">台胞证</p>'
            +'</li>'
            +'<li>'
            +'<p onclick="tyu(this)">护照</p>'
            +'</li>'
            +'<li>'
            +'<p onclick="tyu(this)">其他</p>'
            +'</li>'
            +'<li>'
            +'<p onclick="tyu(this)">回乡证</p>'
            +'</li>'
            +'</ul>');
        var papers_height = parseInt($('.papers-model').height()/2);
        $('.papers-model').css({"margin-top":-papers_height+"px"});

        $('#qqqqqq').html(
            '<select name="terminalType" id="ssss_idcard">'
            +'<option value="0" >身份证</option>'
            +'<option value="1" >台胞证</option>'
            +'<option value="2" >护照</option>'
            +'<option value="5" >其他</option>'
            +'<option value="3" >回乡证</option>'
            +'</select>'
        );
    }

});
// 证件类型
var papers_height = parseInt($('#ertff').height()/2);
$('#ertff').css({"margin-top":-papers_height+"px"});
$('#papers').click(function () {
    $('#ertff').show();
    $('.block-mask').show();
});
$('.papers-model ul li p').click(function () {
    $('#ertff li p').removeClass('on');
    $(this).addClass('on');
    var s_name = $(this).text();
    $('#ertff').hide();
    $('.block-mask').hide();
    $('#papers').text(s_name);
})
function tyu(obj) {
    $('#ertff li p').removeClass('on');
    $(obj).addClass('on');
    var s_name = $(obj).text();
    $('#ertff').hide();
    $('.block-mask').hide();
    $('#papers').text(s_name);
    var s_index = $(obj).parent('li').index();
    $('select#ssss_idcard option').attr("selected",false);
    $('select#ssss_idcard option').eq(s_index).attr("selected",true);

}
// 具体地址填写
var specific_height = parseInt($('.specific-address').height()/2);
$('.specific-address').css({"margin-top":-specific_height+"px"});
$('#specific').click(function () {
    $('.specific-address').show();
    $('.specific-address textarea').focus();
    $('.block-mask').show();
});
$('.specific-address button.cancel').click(function () {
    $('.specific-address').hide();
    $('.block-mask').hide();
});
$('.specific-address button.bao').click(function () {
    $('.specific-address').hide();
    $('.block-mask').hide();
    var text_sd = $('.specific-address textarea').val();
    $('#specific').text(text_sd);
    $('#adwer').val(text_sd);
    // $('.specific-address textarea').val(" ");

});

// 账号设置-性别选择
var sex_height = parseInt($('.sex-model').height()/2);
$('.sex-model').css({"margin-top":-sex_height+"px"});
$('#select-sex').click(function () {
    $('.sex-model').show();
    $('.block-mask').show();
});
$('.sex-model li p').click(function () {
    var s_index = $(this).parent('li').index();
    $('select#ssss option').eq(s_index).attr("selected",true);
    $('.sex-model li p').removeClass('on');
    $(this).addClass('on');
    var s_name = $(this).text();
    $('.sex-model').hide();
    $('.block-mask').hide();
    $('#select-sex').text(s_name);
});
// 账号设置-状态选择
var state_height = parseInt($('.state-model').height()/2);
$('.state-model').css({"margin-top":-state_height+"px"});
$('#state').click(function () {
    $('.state-model').show();
    $('.block-mask').show();
});
$('.state-model li p').click(function () {
    var s_index = $(this).parent('li').index();
    $('select#ssss_status option').eq(s_index).attr("selected",true);
    $('.state-model li p').removeClass('on');
    $(this).addClass('on');
    var s_name = $(this).text();
    $('.state-model').hide();
    $('.block-mask').hide();
    $('#state').text(s_name);
});
















