function get_name(obj){
    var name=$(obj).val();
    if(name==3){
        $("#con_name").show();
        $("#con_shuihao").show();
        $("#name").hide();
        $("#email").hide();
    }else{
        $("#name").show();
        $("#email").show();
        $("#con_name").hide();
        $("#con_shuihao").hide();
    }
}
function change_title(k){
    if(k==0){
        $("#no_invoice").addClass("on-a");
        $("#pr_invoice").removeClass("on-a");
        $("#vat_invoice").removeClass("on-a");
        $("#invoice_info").hide();
        $("#invoice_remark").hide();
        $("#title_info").hide();
        $("#invoice_title").hide();
        $("#vat_title").hide();
        $("#vat_title_info").hide();
    }else if(k==1){
        $("#pr_invoice").addClass("on-a");
        $("#no_invoice").removeClass("on-a");
        $("#vat_invoice").removeClass("on-a");
        $("#invoice_info").show();
        $("#invoice_remark").show();
        $("#title_info").show();
        $("#invoice_title").show();
        $("#vat_title").hide();
        $("#vat_title_info").hide();
    }else if(k==3){
        $("#vat_invoice").addClass("on-a");
        $("#no_invoice").removeClass("on-a");
        $("#pr_invoice").removeClass("on-a");
        $("#invoice_info").show();
        $("#invoice_remark").show();
        $("#title_info").show();
        $("#invoice_title").show();
        $("#vat_title").show();
        $("#vat_title_info").show();
    }
}
function save_invoice(){
    var invoice_type=0;
    var ids=$("#ids").val();
    invoice_type= $(".on-a").attr('data');
    var invotce_title=$("input[name='invoice_title']:checked").val();
    var con_name=$("input[name='con_name']").val();
    var con_shuihao=$("input[name='con_shuihao']").val();
    var name=$("input[name='name']").val();
    var email=$("input[name='email']").val();
    var type=$("#type").val();
    var query = new Object();
    query.invoice_type=invoice_type;
    query.invotce_title=invotce_title;
    query.con_name=con_name;
    query.con_shuihao=con_shuihao;
    query.name=name;
    query.email=email;
    $.ajax({
        url: APP + "Mobile/Order/sub_vat",
        type: "post",
        data: query,
        dataType: "json",
        success:function(obj){
            if(obj.status==1){
                // $.showSuccess(obj.msg,0,'hc');
                showtoast(obj.msg);body_css();
                var body = $('body').css("position");
                if(body=='relative'){
                    $('body').css("position","");
                }
                if(ids){
                    window.location.href=APP + "Mobile/Order/index/ids/"+ids+"/invoice_type/"+invoice_type+"/type/"+type;
                }else if(order_param.type==1 || order_param.type==14){//++外卖商品
                    window.location.href=APP+"Mobile/Order/index/goods_id/"+order_param.goods_id+"/number/"+order_param.number+"/goods_attr/"+order_param.goods_attr+"/act/"+order_param.act+"/type/"+order_param.type+"/invoice_type/"+invoice_type;
                }else if(order_param.type==3){
                    window.location.href=APP+"Mobile/Order/index/goods_id/"+order_param.goods_id+"/number/"+order_param.number+"/goods_attr/"+order_param.goods_attr+"/integra/"+order_param.integra+"/type/"+order_param.type+"/invoice_type/"+invoice_type;

                }else if(order_param.type==6){
                    window.location.href=APP+"Mobile/Order/index/goods_id/"+order_param.goods_id+"/number/"+order_param.number+"/goods_attr/"+order_param.goods_attr+"/integra/"+order_param.integra+"/type/"+order_param.type+"/invoice_type/"+invoice_type;
                }
            }else{
                // $.showErr(obj.msg,0,'hc');
                showtoast(obj.msg);body_css();
            }
        }
    });
}
function body_css(){
    var body = $('body').css("position");
    if(body=='relative'){
        $('body').css("position","");
    }
}
