
function validataOrderTypeInit(type , v )
{	
	if(type == 0 )
	{
		if($("#borardTypeCode").val() != v )
		{	
			$("#borardLayer").val("");
			$("#init_param_flag").val("");
		}
		$("#borardTypeCode").val(v);
	}	
	
	if(type == 1 )
	{
		$("#borardLayer").val(v);
	}
	
	if($.trim($("#borardLength").val()) == '' || isNaN($.trim($("#borardLength").val())) || $("#borardLength").val()==0)
	{
		$("#borardLength").val("") ;
	}
	
	if($.trim($("#borardWith").val()) == '' || isNaN($.trim($("#borardWith").val()))  || $("#borardWith").val()==0)
	{
		$("#borardWith").val("") ;
	}
	
	if($.trim($("#borardNumber").val()) == '' || isNaN($.trim($("#borardNumber").val()))  || $("#borardNumber").val()==0)
	{
		$("#borardNumber").val("") ;
	}
				
	if(type == 3 )
	{
		if($.trim($("#borardLength").val()) == '' || isNaN($.trim($("#borardLength").val())))
		{
			return;
		}
		
		if($.trim($("#borardWith").val()) == '' || isNaN($.trim($("#borardWith").val())))
		{
			return;
		}
		
		if($.trim($("#borardNumber").val()) == '' || isNaN($.trim($("#borardNumber").val())))
		{
			return;
		}
	}
	
	var loadOrderFaceWindow = layer.load(1); 	
	
    var url  = $("#pagePath").val() +"/website/orderPerfactLoadData.do?smp="+Math.random() ; 
	$.ajax({
		   type: "POST",
		   url: url,
		   data:$('#operation_form').serialize(), 
		   success: function(obj,status)
		   {
			   var status = obj.status ; 
			   var text = obj.text ;
			   
			   if(status == 'fail')
			   {
				   layer.alert(text,{icon: 6}); 
			   }
			   else if(status == 'success' )
			   {
				   var commonParamSettingVosList = obj.commonParamSettingVosList ; 
			
				   var div_html = '';
				   $("#pingbanNumber").val(obj.pingbanNumber);
				   $("#init_param_flag").val(obj.init_param_flag);
				   $("#order_param_id_string").val(obj.order_param_id_string);
				   $("#borardLayer").val(obj.borardLayer);
				   $("#borardTypeCode").val(obj.borardTypeCode);
				   $("#outProductTypeCode").val(obj.outProductTypeCode);
				   $("#borardHoudu").val(obj.borardHoudu);
				   $("#zuhanColorCode").val(obj.zuhanColorCode);
				   $("#fontColorCode").val(obj.fontColorCode);
				   $("#hanpangPdCode").val(obj.hanpangPdCode);
				   $("#zuhanFugaiCode").val(obj.zuhanFugaiCode);
				   $("#testProductCode").val(obj.testProductCode);
				   $("#tongboHdCode").val(obj.tongboHdCode);
				   $("#inviceStatusCode").val(obj.inviceStatusCode);
				   $("#paramRequestBacksigneOrder").val(obj.paramRequestBacksigneOrder);
				   $("#paramRequestBacksigneProduceId").val(obj.paramRequestBacksigneProduceId);
				   $("#paramRequestBacksigneOrderId").val(obj.paramRequestBacksigneOrderId);
				   $("#paymentTypeCode").val(obj.paymentTypeCode);
				   $("#orderTimeDicId").val(obj.orderTimeDicId);
				   $("#paramRequestBacksigneOrderInit").val(obj.paramRequestBacksigneOrderInit);
				   $("#minLineParam").val(obj.minLineParam);
				   $("#minGuokong").val(obj.minGuokong);
				   $("#haoManyPcs").html(obj.pbch_remark);
				   $("#customerOrderRemark").val(obj.customerOrderRemark);	
				   $("#pingbanTypeName").val(obj.pingbanTypeName);
				   
				   showPinbanRaton();
				   
				   for(var i = 0 ; i < commonParamSettingVosList.length ; i ++ )
				   {
					   var list  = commonParamSettingVosList[i].value ; 
					   
					   div_html = ""; 
					   
					   $("#"+commonParamSettingVosList[i].name ).html(""); 
					   
					   var c_input =  $("#"+commonParamSettingVosList[i].name ).siblings(".mlabel-input").val(); 
					   	
					   //alert(commonParamSettingVosList[i].name +"   " +c_input);
					   
					   
					   
					   for(var j = 0 ; j < list.length ; j++ )
					   {
						   if(list[j].flag == 'yes' )
						   {
							   var bgcol = "";
							   
							   if(commonParamSettingVosList[i].name == 'zuhan_color' || commonParamSettingVosList[i].name == 'font_color'  )
							   {
								   
								   bgcol = " <i class=\"form-color\" style=\""+ list[j].imgUrl +"\"></i> ";
							   }
							   
							   if($("#paramRequestBacksigneOrder").val() == 'default'  )
							   {
								   if(c_input == list[j].code)
								   {
									   var common_html = " <a class=\"mradio-item active\" href=\"javascript: void(0);\" \ data-val=\""+list[j].code+"\" data-mkey=\""+list[j].code+"\">" + bgcol + list[j].name+"</a> "; 
									   div_html = common_html ;  
									   break; 
								   }
							   }
							   else
							   {
								   var choose_cs = "mradio-item";
								  
								   if(c_input == list[j].code )
								   {	
									   choose_cs = "mradio-item active"; 
								   }
								   
								   var common_html = " <a class=\""+choose_cs+"\" href=\"javascript: void(0);\" \ data-val=\""+list[j].code+"\" data-mkey=\""+list[j].code+"\">" + bgcol + list[j].name+"</a> "; 
								   
								   div_html += common_html ; 
							   }
						   }
					   }	

					   if( commonParamSettingVosList[i].name == 'processList')
					   {
						   div_html+=" <p class=\"form-info\">注：其它特殊要求请备注，我司审核处理。</p> ";  
					   }
					   
					   if( commonParamSettingVosList[i].name == 'zuhan_fugai')
					   {
						   div_html+=" <p class=\"form-info\">注:如果是GERBER文件,一律按照文件加工,此选项无效!</p>    	 ";  
					   }
					   
					   
					   
					   $("#"+commonParamSettingVosList[i].name ).html(div_html); 
					   
				   }
				   
				   	
				   // .j-mlabel start
		    		//设置值
		            $(".j-mlabel").each(function(){
		                var _this = $(this),	
		                    $el = _this.find(_this.data("el")),
		                    $input = _this.find(".mlabel-input");

		                	$el.click(function(e){	
			                    e.preventDefault();
			                    
			                 //	alert("BOG :"+$(this).data("val"));
			                    	
			                    $(this).addClass("active").siblings(_this.data("el")).removeClass("active");
			                    
			                    
			                    if($input.attr("t") == 'bc')
		                    	{
			                    	//切换板材， 刷新参数 
			                    	if($input.val() != $(this).data("val"))
		                    		{
			                    		location.href = $("#pagePath").val() + "/pcbonline_"+$(this).data("val")+".html";
			                    		return ; 
		                    		}
		                    	}
			                    
			                    $input.val($(this).data("val"));
			                    
			                    showPinbanRaton();
			                    
			                    validataOrderTypeInit(3);
			                    
			                })
		            })
		            
		            // .j-mlabel end	
		            // target show 
		              $(".m-pcbform .next-show .mradio-item").click(function(e){
		                e.preventDefault();
		
		                var _this = $(this),
		                    $parent = _this.parents(".next-show"),
		                    $obj = eval("(" + $parent.data("obj") + ")"),
		                    $item = $parent.find(".mradio-item"),
		                    $key = _this.data("mkey");
		                	
		                    if($key)	
		                    {
		                        _this.addClass("active").siblings(".mradio-item").removeClass("active");
		
		                        for(var key in $obj){
		                            $($obj[key]).hide();
		                        }
		
		                        $($obj[$key]).show();
		                    }
		                    
		            })
		            
		            
		            
		            
		           
		            for(var i = 0 ; i < commonParamSettingVosList.length ; i ++ )
				    {
		               $("#orderAchieveList").html("");
		               
					   if(commonParamSettingVosList[i].name == 'aheive_time' )
					   {
						   var list  = commonParamSettingVosList[i].value ; 
						   
						   div_html = "";
						   
						   var not_defuat_achive_itme = 0;
						   
						   for(var j = 0 ; j <  list.length ;  j ++ )
						   {	
							   
							   if(list[j].flag == 'yes' )
							   {
								   div_html +=" <li class=\"select-item\" > "; 
								   div_html +="     <a href=\"javascript: void(0);\" data-val=\""+list[j].dicId+"\"  > ";
								   div_html +=" <span>"+list[j].name+"</span> ";
								   div_html +=" </a> ";
								   div_html +=" </li> ";
								   
								   if(not_defuat_achive_itme == 0)
								   {
									   if(obj.orderTimeDicId == list[j].dicId )
									   {	
											not_defuat_achive_itme = 1;
											
										    $("#orderAchieveText").text(list[j].name);
										    $("#orderTimeDicId").val(list[j].dicId);
											   
									   }
									   else if(list[j].isDefault == 'default' )
									   {
										   
										   $("#orderAchieveText").text(list[j].name);
										   $("#orderTimeDicId").val(list[j].dicId);
										    
									   }
									   
								   }
								   
							   }	
						   }
						   
						   
						   $("#orderAchieveList").html(div_html);
						   
						   
							// .j-select start
				            $(".j-select .select-item a").click(function(e){
				                e.preventDefault();
	
				                var _this = $(this),
				                    $text = _this.text(),
				                    $wp = _this.parents(".j-select"),
				                    $span = $wp.find(".select-btn span"),
				                    $list = _this.parents(".select-list"),
				                    $input = $wp.find("input");
				                
				                _this.addClass("active").parent().siblings().children("a").removeClass("active");
				                $span.text($text);
				                $wp.find(".select-btn").removeClass("active");
				                $list.slideUp();
				                
				                //alert("select: "+_this.data("val"));
				                
				                if(_this.data("val"))
				                {	
				                    $input.val(_this.data("val"));
				                    
				                    validataOrderTypeInit(3);
	
				                }else
				                {
				                	// location.href = _this.data("href");
				                }
	
				            })
				            // .j-select end
				
			            
						   
						   break; 
					   }
				    }

		            
		            
				   
				   
			   }
			   
			   var cost_url = $("#pagePath").val() + "/website/orderPerfact.do";
			   var is_cost = true;
			   
			   if($.trim($("#borardLength").val()) == '' || isNaN($.trim($("#borardLength").val())))
				{
				   is_cost = false;
				}
				
				if($.trim($("#borardWith").val()) == '' || isNaN($.trim($("#borardWith").val())))
				{
					is_cost = false;
				}
				
				if($.trim($("#borardNumber").val()) == '' || isNaN($.trim($("#borardNumber").val())))
				{
					is_cost = false;
				}
			   
			   if(is_cost)
			   {
				   $.ajax({
					   type: "POST",
					   url: cost_url,
					   data:$('#operation_form').serialize(), 
					   
					   success: function(obj,status)
					   {
						   layer.close(loadOrderFaceWindow);
						   
						   var status = obj.status ; 
						   var text = obj.text ;
						   
						   if(status == 'fail')
						   {
							   layer.alert(text,{icon: 6}); 
						   }
						   else if(status == 'success' )
						   {
							   var cd = "";
							   
							   if(obj.bang > 0)
							   {
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '板材费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.bang.toFixed(2)+'</div></div></li>' ;
							   }
							   
							   if(obj.feilin > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '菲林费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.feilin.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   if(obj.color > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '颜色费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.color.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   
							   
							   if(obj.jiaji > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '加急费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.jiaji.toFixed(2)+'</div></div></li>' ;
								   
							   }
							 
							   $("#payTotal").html("&yen;"+obj.total.toFixed(2));
							   $("#pay_total_2").html("&yen;"+obj.total.toFixed(2));
							   
							   if(obj.project > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '工程费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.project.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   if(obj.pendu > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '喷镀费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.pendu.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   if(obj.pingban > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '拼板费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.pingban.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   if(obj.test > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '测试费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.test.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   if(obj.tongbo > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '表层铜厚：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.tongbo.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   
							   
							   if(obj.payBgaMoney > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += 'BGA费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.payBgaMoney.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   if(obj.payBanKongMoney > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '半孔费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.payBanKongMoney.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   if(obj.payImpendanceMoney > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '阻抗费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.payImpendanceMoney.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   if(obj.payZuhanFugaiMoney > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '塞油费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.payZuhanFugaiMoney.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   if(obj.payInsideCopperMoney > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '内层铜厚：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.payInsideCopperMoney.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   if(obj.payMinLineSizeMoney > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '线宽距费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.payMinLineSizeMoney.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   if(obj.payViasMoney > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '过孔费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.payViasMoney.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   if(obj.payBlindMoney > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += 'HDI费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.payBlindMoney.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   
							   if(obj.tgval > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += 'TG板材费：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.tgval.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   	
							   if(obj.process > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '特殊工艺：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.process.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   
							   if(obj.ryjh > 0){
								   
								   cd += '<li style="float: left; "><div style=" font-size: 1.2rem ;  width: 170px; height: 26px; "><div style="width: 71px; height: 26px; border:.5px solid #e5e5e5; padding:4px 8px; line-height:24px; background-color: #f5f5f5;  float: left; " > ';
								   cd += '软硬结合：</div><div style="width: 63px; height: 26px; border:.5px solid #e5e5e5;padding:4px 8px; line-height:24px; float: right;  " > ';
								   cd += ''+obj.ryjh.toFixed(2)+'</div></div></li>' ;
								   
							   }
							   
							   		
							   $("#cost_detail").html(cd);
							   $("#area").html( "面积：" + obj.area + "㎡");
							   $("#weight").html("重量：" + obj.weight + "KG");
						   }
					   }
					   ,error:function(msg,status,e)
					   {
						   layer.close(loadOrderFaceWindow);
						   $("#save_tip_div2").hide();
						   layer.alert('系统正忙，无法处理您的请求' + status ,{icon: 6});
					   }
				   })
			   }
			   else
			   {
				   layer.close(loadOrderFaceWindow);
			   }
			   
			   $("#bigbox_load").hide();
			   $("#bigbox").show();		
		
		   },error:function(msg,status,e)
		   {
			   $("#save_tip_div2").hide();
			   layer.close(loadOrderFaceWindow);
			   layer.alert('系统正忙，无法处理您的请求' + status ,{icon: 6});
		   }
	});
	
}


function changeColorCode(val){
	if(val=='蓝色'){
		return 's-blue';
	}
	if(val=='绿色'){
		return 's-green';
	}
	if(val=='红色'){
		return 'u-red';
	}
	if(val=='黄色'){
		return 's-yell';
	}
	if(val=='白色'){
		return 's-white';
	}
	if(val=='黑色'){
		return 's-black';
	}
	if(val=='无'){
		return '';
	}
	if(val=='哑黑色'){
		return 's-black';
	}
}

function commonDivChooseValue(r , o , v ){
	if(r == 3 )
	{
		validataOrderTypeInit(3);  	
	}
	if(r == 4 )
	{
		$("#borardHoudu").val(v);
	}
	if(r == 5 )
	{	
		$("#zuhanColorCode").val(v);
	}
		
	if(r == 6 )
	{	
		if($("#zuhanColorCode").val() == 'hei' && v == 'heise')
		{
			alert('阻焊颜色选择了 ： 黑色 ， 字符只能选择 白色 ');
			return ; 	
		}
		
		if($("#zuhanColorCode").val() == 'bai' && v == 'baise')
		{
			alert('阻焊颜色选择了 ： 白色 ， 字符只能选择 黑色 ');
			return ;
		}
		
		if($("#zuhanColorCode").val() != 'bai' && v == 'heise')
		{
			alert('字符只能在阻焊是白色的时候 才可以选择黑色 ^ ^!');
			return ;
		}
	
		$("#fontColorCode").val(v);
	}
	
	if(r == 7 )
	{		
		$("#hanpangPdCode").val(v);
	}
	
	if(r == 8 )
	{		
		$("#zuhanFugaiCode").val(v);
	}
	
	if(r == 9 )
	{		
		$("#testProductCode").val(v);
	}
	
	if(r == 10 )
	{		
		$("#tongboHdCode").val(v);
	}
	
	if(r == 12 )
	{		
		$("#paymentTypeCode").val(v);
	}
	
	if(r == 15 )
	{
		$("dd[name='invoice_typeObjCss']").attr("class","change_remove");
		$("#"+o).attr("class","change");
		$("#inviceStatusCode").val(v); 	
		$("#inviceStatus").val($("#"+o).attr("na"));
		
		$("#invoiceStatusCodeDiv").hide();
		
		if(v == 'ptfp')	
		{
			$("#invoiceStatusCodeDiv").show();
			showPtfpTitle();
		}
		else if(v == 'avt')
		{
			//增值税发票， 检测是否填写了开票资料， 弹窗提示
			checkAvtInfo();
		}
			
	}
	
	if(r == 16 )
	{
		 $("#minLineParam").val(v);		
	}	
	if(r == 17)
	{
		 $("#minGuokong").val(v);	
	}
	if(r == 18)
	{
		 $("#markRequire").val(v);	
	}
	if(r == 19)
	{
		 $("#steelUseType").val(v);	
	}
	if(r == 20)
	{
		 $("#polishingProcess").val(v);	
	}
	if(r == 21)
	{
		 $("#borardHanpanType").val(v);	
	}
	if(r == 22)
	{
		 $("#doubleSmtProcessType").val(v);	
	}
	if(r == 23)
	{
		 $("#wuqianType_div dd").attr("class","change_remove");
		 $("#wuqianType_div dd[v='"+v+"']").attr("class","change");
		 $("#wuqianType").val(v);	
	}
	
	
	if(r == 115 )
	{
		$("#img_cs_1").hide();
		$("#img_cs_2").hide();		
		$("#dd_cs_1").removeClass('change')
		$("#dd_cs_2").removeClass('change');
		
		$("#dd_"+o).addClass('change');
		$("#img_"+o).show();
		
		$("#wuqianType").val(v);
	}
	
	
	if(r == 116 )
	{
		$("#img_cs_4").hide();
		$("#img_cs_5").hide();		
		$("#dd_cs_4").removeClass('change')
		$("#dd_cs_5").removeClass('change');
		
		$("#dd_"+o).addClass('change');
		$("#img_"+o).show();
		
		$("#doubleSmtProcessType").val(v);
	}
	
}


function orderPerfectUploadInit(editType)
{

	var borardWith = $("#borardWith").val() ;
	var borardLength = $("#borardLength").val() ;
	var borardNumber = $("#borardNumber").val() ;
	var borardHoudu = $("#borardHoudu").val() ;
	var fontColorCode = $("#fontColorCode").val() ;
	var zuhanColorCode = $("#zuhanColorCode").val() ;
	var hanpangPdCode = $("#hanpangPdCode").val() ;
	var zuhanFugaiCode = $("#zuhanFugaiCode").val() ;
	var tongboHdCode = $("#tongboHdCode").val() ;
	var inviceStatusCode = $("#inviceStatusCode").val() ;
	var ot = $("#outProductTypeCode").val() ;
	var logincode =  $("#loginCode").val();		
	
	var minLineParam = $("#minLineParam").val();  
	var minGuokong = $("#minGuokong").val();    

	var zuhan_colorObjjCss = $("#zuhanColorCode").val();
	var testProductCode = $("#testProductCode").val();
	
	
	if($.trim($("#borardLength").val()) ==''||$("#borardLength").val() ==0)
	{
		layer.alert("请输入板子长度",{icon: 6});
		return ;
	}
	if($.trim($("#borardWith").val()) ==''||$("#borardWith").val() ==0)
	{
		layer.alert("请输入板子宽度",{icon: 6});
		return ;
	}
	if($.trim($("#borardNumber").val()) ==''||$("#borardNumber").val() ==0)
	{
		layer.alert("请输入单片数量",{icon: 6});
		return ;
	}
	
	if($.trim($("#bcount").val()) !='' && isNaN($.trim($("#bcount").val())))
	{
		layer.alert("请输入正确的拼款数量",{icon: 6});
		return ;
	}
	if(!borardHoudu)
	{
		layer.alert("请选择板子厚度",{icon: 6});
		return ;
	}
	
	if(!zuhan_colorObjjCss || zuhan_colorObjjCss == '' )
	{
		layer.alert("请选择组焊颜色",{icon: 6});
		return ;
	}
	
	if(!fontColorCode)
	{
		layer.alert("请选择字符颜色",{icon: 6});
		return ;
	}
	if(!zuhanColorCode)
	{
		layer.alert("请选择阻焊颜色",{icon: 6});
		return ;
	}
	if(!hanpangPdCode)
	{
		layer.alert("请选择焊盘喷镀工艺",{icon: 6});
		return ;
	}
	if(!zuhanFugaiCode)
	{
		layer.alert("请选择阻焊覆盖工艺",{icon: 6});
		return ;
	}
	
	if(!tongboHdCode)
	{
		layer.alert("请选择铜箔厚度",{icon: 6});
		return ;
	}
	
	var outProductTypeCode = $("#outProductTypeCode").val();
	
	if(!outProductTypeCode)
	{
		layer.alert("请选择出货方式",{icon: 6});
		return ;
	}
	
	if(outProductTypeCode == 'daipin' )
	{
		if($.trim($("#pingbanTypeNameX").val()) == '' || isNaN($.trim($("#pingbanTypeNameX").val())))
		{
			layer.alert("请输入X方向拼版个数",{icon: 6});
			return ;
		}
		if($.trim($("#pingbanTypeNameY").val()) == '' || isNaN($.trim($("#pingbanTypeNameY").val())))
		{
			layer.alert("请输入Y方向拼版个数",{icon: 6});
			return ;
		}
	}
	
	if(testProductCode == '' )
	{
		layer.alert("请选择测试方式",{icon: 6});
		return ;
	}	
		
	if($("#orderTimeDicId").val() == '')
	{
		layer.alert("请选择订单交货时间",{icon: 6});
		return ;
	}
	
	var ii_lod = layer.load();
	
	var url = $("#pagePath").val() + "/forwardUploadPcbFile.html?rand="+ Math.random() ;
	$("#operation_form").attr("action",url);
	$("#operation_form").submit();
}


function setorderAcheiveTimeSpan()
{	
	
}

function chooseCity(proviceName , cityName ,chooseCityName)
{
	var proviceName = $("#"+proviceName).val();
	
	if(proviceName == '' )
	{
		return ;
	}
	
	var url = $("#pagePath").val() + "/receiving/loadCityList.do";
	$.ajax({
		type : "POST",
		url : url,
		data : "proviceName=" + proviceName + "&&smp=" 	+ Math.random(),
		dataType : 'json',
		success : function(obj, status)
		{
			var status = obj.status;
			var array = obj.array;

			if (status == 'fail') 
			{
				alert('系统正忙，无法处理您的请求' );
			
			} else if (status == 'success') 
			{
				$("#"+cityName).empty();
				var op = "<option value='' >选择城市</option>";
				
				
				for (var i = 0; i < array.length; i++) 
				{
					op += "<option value='"+array[i].cityName+"'" ;
						
					if(chooseCityName && chooseCityName == array[i].cityName )
					{
						
						op += "selected='selected' " ;
					}	

					op+= " >"+array[i].cityName+"</option>";
				}
				
				$("#"+cityName).append(op);
			} 

		},
		error : function(msg, status, e) {
			alert('系统正忙，无法处理您的请求' + status );
		}
	});
}



function closeOrderEditReceviwindow()
{
	window.parent.$("#order_edit_recevi_win_div").hide();
}


function addOrderChooseRecevingContact()
{
	
	$('#add_order_show_recevie_div').css(
			{
				position : 'absolute',
				left : ($(window).width() - $('#add_order_show_recevie_div')
						.outerWidth()) / 2,
				top : ($(window).height() - $('#add_order_show_recevie_div')
						.outerHeight())
						/ 2 + $(document).scrollTop()
			});
	
	
	$("#order_edit_recevi_win_div").show();
	var url = $("#pagePath").val() +"/receiving/addOrderQuery.do?rand="+Math.random();
	$("#order_edit_recevi_url").attr("src",url);
}

function deleteCustomerRecevingContact(id)
{
	location.href= $("#pagePath").val() + "/receiving/delete.do?orderReceivingContactRecordId=" + id; 
}


function setAddOrderRecevingInfo(a, b , c,d,e,f) 
{
	
	window.parent.$("#prov").html(a);
	window.parent.$("#ct").html(b);
	window.parent.$("#who").html(d);
	window.parent.$("#dt").html(c);
	window.parent.$("#ph").html(e);
	window.parent.$("#address").val(f);
	
	closeOrderEditReceviwindow();
	
	if(window.parent.$("#login_type").val() == 'addOrder' )
	{
		window.parent.cost_yunfei();
	}

}	


function closeorder_customer_avt_modify_win_div()
{
	window.parent.$("#order_customer_avt_modify_win_div").hide();
}

function submitOrderDirectAvtmodify()
{
	
	if($.trim($("#invoiceCompany").val()) == '')
	{
		layer.alert("请输入开票公司名称！",{icon: 6});
		return;
	}
	
	if($.trim($("#invoiceHeading").val()) == '')
	{
		layer.alert("请输入开票税号！",{icon: 6});
		return;
	}
	
	if($.trim($("#invoiceAddress").val()) == '')
	{
		layer.alert("请输入联系地址！",{icon: 6});
		return;
	}
	
	if($.trim($("#invoiceCall").val()) == '')
	{
		layer.alert("请输入联系电话！",{icon: 6});
		return;
	}
	
	if($.trim($("#invoiceBankName").val()) == '')
	{
		layer.alert("请输入开户行名称！",{icon: 6});
		return;
	}
	
	if($.trim($("#invoiceBankAccount").val()) == '')
	{
		layer.alert("请输入开户银行账户！",{icon: 6});
		return;
	}
	
	var url  = $("#pagePath").val() +"/customer/submitOrderDirectAvtmodify.do";
	$.ajax({
		   type: "POST",
		   url: url,
		   data: "invoiceCompany="+$("#invoiceCompany").val()+"&&invoiceHeading="+$("#invoiceHeading").val()+"&&invoiceAddress="+$("#invoiceAddress").val()+"&&invoiceCall="+$("#invoiceCall").val()+"&&invoiceBankName="+$("#invoiceBankName").val()+"&&invoiceBankAccount="+$("#invoiceBankAccount").val()+"&&smp="+Math.random() ,
		   dataType:'json' ,
		   success: function(obj,status)
		   {
			   var status = obj.status;
			   
			   if( status == 'success' )
			   {
				   closeorder_customer_avt_modify_win_div();
			   }
			   
		   },error:function(msg,status,e)
		   {	
			   layer.alert("系统正忙，无法处理您的请求！",{icon: 6});
		   }
	});
}








function saveCustomerRecevingContact()
{
	if($.trim($("#linkMan").val()) == '' )
	{
		jAlert('请输入联系人姓名', '操作提示');
		return false;
	}
	
	if($.trim($("#linkPhone").val()) == '' )
	{
		jAlert('请输入联系人手机号码', '操作提示');
		return false;
	}
	
	if($.trim($("#proviceName").val()) == '' )
	{
		jAlert('请选择所在省份', '操作提示');
		return false;
	}
	if($.trim($("#cityName").val()) == '' )
	{
		jAlert('请选择所在城市', '操作提示');
		return false;
	}
	if($.trim($("#detailsLinkAddress").val()) == '' || $.trim($("#detailsLinkAddress").val()).length < 3  )
	{
		jAlert('请输入详细收货地址', '操作提示');
		return false;
	}
	
	var url = $("#pagePath").val() +"/receiving/save.do";
	$("#operation_form").attr("action",url);
	$("#operation_form").submit();
}
function queryOrderEditRecevingList()
{
	var url = $("#pagePath").val() +"/receiving/addOrderQuery.do";
	$("#operation_form").attr("action",url);
	$("#operation_form").submit();
}

function editCustomerRecevingContactInit(id)
{
	location.href=  $("#pagePath").val() + "/receiving/editInit.do?orderReceivingContactRecordId=" + id; 
}

function deleteCustomerRecevingContact(id)
{
	location.href= $("#pagePath").val() + "/receiving/delete.do?orderReceivingContactRecordId=" + id; 
}


function submitOrderEvaluateRecord()
{
	if($.trim($("#evaluateContext").val()) == '' )
	{
		jAlert('请输入评价内容' , '操作提示');
		return ;
	}

	if($.trim($("#evaluateContext").val()).length < 3  )
	{
		jAlert('请输入评价内容，不少于3个字' , '操作提示');
		return ;
	}

	$('#order_details_setting_div').css(
	{
		position : 'absolute',
		top : ($(window).height() - $('#order_details_setting_div')
				.outerHeight())
				/ 2 + $(document).scrollTop()
	});
		
	$("#save_tip_div").show();	
	
	var url = $("#path").val() +"/evaluate/submitOrderEvaluate.do";
	$("#operation_form").attr("action",url);
	$("#operation_form").submit();	
}

function checkFontColorIsTrue(v){
	var flag = true;
	if($("#zuhanColorCode").val() == 'hei' && v == 'heise')
	{
		layer.alert("阻焊颜色选择了：黑色 ， 字符不能选择：黑色",{icon: 6});
		flag = false; 	
	}
	
	if($("#zuhanColorCode").val() == 'bai' && v == 'baise')
	{
		layer.alert("阻焊颜色选择了：白色 ， 字符不能选择：白色",{icon: 6});
		flag = false; 	
	}
	
	if($("#zuhanColorCode").val() != 'bai' && v == 'heise')
	{
		layer.alert("字符只能在阻焊是白色的时候 才可以选择黑色 ^ ^!",{icon: 6});
		flag = false; 	
	}
	
	return flag;
}

function checkAvtInfo()
{
	
	if($("#loginCode").val() == '')
	{
		return ;
	}
	
	var url  = pagePath +"/customer/checkAvtInfo.do";
	$.ajax({
		type: "POST",
		url: url,
		data: "smp="+Math.random() ,
		dataType:'json' ,
		success: function(obj,status)
		{
			var status = obj.status;
			
			if( status == 'fail' )
			{		
				$('#order_customer_avt_show_div').css(
						{
							position : 'absolute',
							left : ($(window).width() - $('#order_customer_avt_show_div')
									.outerWidth()) / 2,
									top : ($(window).height() - $('#order_customer_avt_show_div')
											.outerHeight())
											/ 2 + $(document).scrollTop()
						});	
				
				$("#order_customer_avt_url").attr("src",pagePath+"/customer/orderDirectAvtmodifyInit.do?rand="+Math.random());
				$("#order_customer_avt_modify_win_div").show();
			}
			else if(status == 'success')
			{
				showAvtTitle();
			}
			
		},error:function(msg,status,e)
		{
			jAlert('系统正忙，无法处理您的请求' + status , '操作提示');
		}
	});
}


function CostSmtOrder(){
	
	if($("#doubleSmtProcessType").val()==""){
		layer.alert("请选择板子层数！",{icon: 6});
		return;
	}

	if($("#pcbBorardLength").val()==""){
		layer.alert("请输入板子长度！",{icon: 6});
		return;
	}
	
	if($("#pcbBorardWidth").val()==""){
		layer.alert("请输入板子宽度！",{icon: 6});
		return;
	}
	
	if($("#pcbBorardNumber").val()==""){
		layer.alert("请输入板子数量！",{icon: 6});
		return;
	}
	
	var logincode =  $("#loginCode").val();
	
	if(logincode && logincode != '')
	{
		if($("#customerReceivingContactRecordId").val() == '')
		{
			layer.alert("请选择收货联系地址！",{icon: 6});
			return ;
		}
		if($("#expressCompanyCode").val()==""){
			layer.alert("请选择快递公司！",{icon: 6});
			return;
		}
	}
	
	var url = $("#pagePath").val() +"/forwardCastSmtOrder.html";
	$("#operation_form").attr("action",url);
	$("#operation_form").submit();
}


function smtOrderEditBack()
{
	var ii_lod = layer.load(); 
	
	layer.closeAll('iframe'); 	 	
	var url = $("#pagePath").val() +"/ForwardSingleSmtInit.html" ; 
	
	if($("#add_order_pcb").val() && $("#add_order_pcb").val() == 'yes' )
	{
		url = $("#pagePath").val() +"/ForwardOrderPerfact.html" ; 
	}		
	
	$("#operation_form").attr("action",url);
	$("#operation_form").submit();	
}

function modifyBorardNumerRefreshTotal()
{
	var ii_lod = layer.load(); 
	
	layer.closeAll('iframe'); 	 	
	
	$("#modify_number_flag").val("yes");
			
	var url = pagePath +"/uploadCostSmtOrder.html" ; 
	
	if($("#add_order_pcb").val() && $("#add_order_pcb").val() == 'yes' )
	{
		url = pagePath +"/castSmtOrder.html" ; 
	}		
	
	var ii_lod  = layer.msg('您修改了板子数量，系统正在重新计算bom报价，请耐心等候....', {  icon: 16 ,shade: 0.15 , time:1000*2000 });
	
	$("#operation_form").attr("action",url);
	$("#operation_form").submit();	
}
 

function saveDaikeAddSmtOrder()
{
	
	if($("#address").val()==""){	
		layer.alert('请选择收货联系地址！' ,{icon: 6});
		return;
	}	
	
	if($("#expressCompanyCode").val()==""){	
		layer.alert('请选择快递公司！' ,{icon: 6});
		return;
	}
	
	if($("#fapiao").val()==""){	
		layer.alert('请选择开票方式！' ,{icon: 6});
		return;
	}
	
	if($("#pcbFile").val()==""){	
		layer.alert('请选择并上传PCB文件' ,{icon: 6});
		return;
	}
	
	if($("#bomFile").val()==""){	
		layer.alert('请选择并上传BOM清单文件' ,{icon: 6});
		return;
	}
		
	$('#order_details_setting_div').css(
			{
				position : 'absolute',
				top : ($(window).height() - $('#order_details_setting_div')
						.outerHeight())
						/ 2 + $(document).scrollTop()
			});
		var ii_lod  = layer.msg('正在上传文件完成下单.....<br/>如果您的文件比较大上传会花费些时间，<br/>请耐心等候。', {  icon: 16 ,shade: 0.15 , time:1000 * 60 * 60  });
		var url = pagePath +"/smtprice/submitConfirmOrder.do";
		$("#operation_form").attr("action",url);
		$("#operation_form").submit();	
}



function isIE(){
	if(!!window.ActiveXObject || "ActiveXObject" in window){
		return true;
	}else{
		return false;
	}
}

function IEVersion(){
  var rv = -1;
  if (navigator.appName == 'Microsoft Internet Explorer'){
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }else if (navigator.appName == 'Netscape'){
    var ua = navigator.userAgent;
    var re  = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}



function CostSmtOrder()
{
	
	if($("#pcbBorardLength").val()==""){	
		layer.alert('请输入板子长度' ,{icon: 6});
		return;
	}
		
	if($("#pcbBorardWidth").val()==""){
		layer.alert('请输入板子宽度',{icon: 6});
		return;
	}
	
	if($("#pcbBorardNumber").val()==""){
		layer.alert('请输入板子数量',{icon: 6});
		return;
	}
	
	var url = $("#pagePath").val() +"/forwardCastSmtOrder.html";
	
	
	$("#operation_form").attr("action",url);
	$("#operation_form").submit();
}


function querySmtOrderRecordList()
{
	var url = pagePath +"/smtprice/querySmtOrderRecordList.do";
	$("#operation_form").attr("action",url);
	$("#operation_form").submit();
}

function SmtOrderPayInit()
{
	var idList  = document.getElementsByName("idList");
	var orderId = ""; 
	
	for(var i=0 ; i< idList.length ; i ++ )
	{
		if(idList[i].checked)	
		{
			orderId += idList[i].value + ","  ;
		}
	}
	
	if(orderId == '' )
	{
		jAlert('请选择您要进行支付的SMT订单！', '操作提示');
		return ;
	}
	
	var url = pagePath +"/pay/singleSmtOrder.do?id="+orderId +"&&payment_source_type=smt&&smp="+Math.random();
	var win = window.open (url, '_blank' ,'height=768px,width=1440px,top=10,left=10,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no') ;
	win.focus();
}

function cancelOrderForSmt(orderId,orderSourceCode)
{
	var text = "您确定要取消此贴片订单吗？";
	
	if(orderSourceCode == 'followPcb')
	{
		text = "您确定要取消此贴片订单吗？ PCB订单选择贴片的折扣优惠将会同步被取消！！";
	}
		
	jConfirm(text , '确定对话框', function(r) {
		if(r)
		{
			$("#smtOrderRecordId").val(orderId);
			var url = pagePath +"/staple/cancelSmtOrderById.do";
			$("#operation_form").attr("action",url);
			$("#operation_form").submit();
		}
	});
}

function paySingleInitForSmt(orderId)
{
	var url = pagePath +"/pay/singleSmtOrder.do?id="+orderId +"&&smp="+Math.random();
	var win = window.open (url, '_blank' ,'height=768px,width=1440px,top=10,left=10,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no') ;
	win.focus();		
}




function showPinbanRaton()
{
	var vl = $("#outProductTypeCode").val(); 
	
	$("#outProductTypeCodeDiv").find("a").attr("class","mradio-item");
	$("#outProductTypeCodeDiv").find("a[data-val='"+ vl +"']").attr("class","mradio-item  active");
	
	if(vl =='set' || vl == 'daipin' )
	{
		   $("#pinbanchicun").find(".label-title").html("拼版尺寸：");
		   $("#pinbanchicun").find(".form-info").html("* 注： 此处填拼版后的大片尺寸");
		   $("#borardNumberDiv").find(".label-title").html("连片数量：");
		   $("#borardNumberDiv").find(".form-sizedw").html("set");
		
	}else
	{
			$("#pinbanchicun").find(".label-title").html("单片尺寸：");
			$("#pinbanchicun").find(".form-info").html("注：此处填板子单片尺寸，若不清楚，填10×10cm");
			$("#borardNumberDiv").find(".label-title").html("单片数量：");
			$("#borardNumberDiv").find(".form-sizedw").html("pcs");
	}

}