//产险短信展示
function showCXSmsContent(claimNo){
	var sms_clmPerson;
	if($('#clmPerson1').attr('class')=="check_yes"){
		sms_clmPerson = 1;

	} else {
		sms_clmPerson = 0;
	}
	   
	$.ajax({
        cache: true,
        type: "POST",
        url:"showsmscontent.do",
        data:{"claimNo":claimNo,"sms_clmPerson":sms_clmPerson,"sms_salesman":"","operator":""},
        async: false,
        error: function(request) {
            alert("展示短信失败！");
            $("#endcasebutton").disabled=false;
        },
        success: function(data) {
        	$("#end3").html('');
        	$("#end02").html('');
        	$("#end03").html('');
        	$("#end04").html('');
        	$("#end05").html('');
        	var a02 = data[2];
    		var a03 = data[3];
    		var a04 = data[4];
    		var a05 = data[5];
    		var a06 = data[6];
    		var endCaseType = data[7];
    		if(endCaseType=="04"){
    			$("#finishCaseMassage1").hide();$("#finishCaseLine1").hide();
    			$("#finishCaseMassage4").hide();$("#finishCaseLine3").hide();
    			$("#finishCaseMassage5").hide();$("#finishCaseLine4").hide();
    		}else if(endCaseType=="03"){
    			$("#finishCaseMassage1").hide();$("#finishCaseLine1").hide();
    			$("#finishCaseMassage2").hide();$("#finishCaseLine2").hide();
    			$("#finishCaseMassage3").hide();$("#finishCaseLine3").hide();
    		}else{
    			$("#finishCaseLine1").hide();
    			$("#finishCaseMassage2").hide();$("#finishCaseLine2").hide();
    			$("#finishCaseMassage3").hide();$("#finishCaseLine3").hide();
    			$("#finishCaseMassage4").hide();$("#finishCaseLine4").hide();
    			$("#finishCaseMassage5").hide();
    		}
    		
        	for(var i = 0;i<data[0].length;i++){
        		var a = data[0][i];
        		var b = data[1][i];
        		$("#end3").append(a+"<br>"+"领款人手机号码："+b);
        	}
        	$("#end02").append(a02);
        	$("#end03").append(a03);
        	$("#end04").append(a04);
        	$("#end05").append(a05);
        	
        	var end02_html = $("#end02").html();
        	if (end02_html != '') {
        		if(a06=="endCaseReasonIsNull")
        			end02_html = end02_html.replace(a06,"<input type=\"text\" id=\"auditOption02\" name=\"auditOption02\" class=\"input input_bot_line i_s_100\" style=\"width:auto;\" value='' />");
        		else
        			end02_html = end02_html.replace(a06,"<input type=\"text\" id=\"auditOption02\" name=\"auditOption02\" class=\"input input_bot_line i_s_100\" style=\"width:auto;\" value='"+ a06 +"' />");
        		$("#end02").html(end02_html);
        	}
        	
        	var end03_html = $("#end03").html();
        	if (end03_html != '') {
        		end03_html = end03_html.replace('businessManName',"<input id=\"businessManName03\" type=\"text\" class=\"input input_bot_line i_s_100\" value='' />");
        		if(a06=="endCaseReasonIsNull")
        			end03_html = end03_html.replace(a06,"<input type=\"text\" id=\"auditOption03\" name=\"auditOption03\" class=\"input input_bot_line i_s_100\"  style=\"width:auto;\" value='' /> ");
        		else
        			end03_html = end03_html.replace(a06,"<input type=\"text\" id=\"auditOption03\" name=\"auditOption03\" class=\"input input_bot_line i_s_100\"  style=\"width:auto;\" value='"+ a06 +"' /> ");
        		$("#end03").html(end03_html + "<br><br> 业务员手机号码： <input type=\"text\" id=\"businesManPhone1\" name=\"businesManPhone1\" class=\"input input_bot_line i_s_100\" /> <br>");
        	}
        	
        	var end04_html = $("#end04").html();
        	if (end04_html != '') {
        		if(a06=="endCaseReasonIsNull")
        			end04_html = end04_html.replace(a06,"<input type=\"text\" id=\"auditOption04\" name=\"auditOption04\" class=\"input input_bot_line i_s_100\" style=\"width:auto;\" value='' />");
        		else
        			end04_html = end04_html.replace(a06,"<input type=\"text\" id=\"auditOption04\" name=\"auditOption04\" class=\"input input_bot_line i_s_100\" style=\"width:auto;\" value='"+ a06 +"' />");
        		$("#end04").html(end04_html);
        	}
        	
        	var end05_html = $("#end05").html();
        	if (end05_html != '') {
        		end05_html = end05_html.replace('businessManName',"<input type=\"text\" id=\"businessManName05\" class=\"input input_bot_line i_s_100\" value='' />");
        		if(a06=="endCaseReasonIsNull")
        			end05_html = end05_html.replace(a06,"<input type=\"text\" id=\"auditOption05\" name=\"auditOption05\" class=\"input input_bot_line i_s_100\" style=\"width:auto;\" value='' />");
        		else
        			end05_html = end05_html.replace(a06,"<input type=\"text\" id=\"auditOption05\" name=\"auditOption05\" class=\"input input_bot_line i_s_100\" style=\"width:auto;\" value='"+ a06 +"' />");
        		$("#end05").html(end05_html +"<br><br> 业务员手机号码： <input type=\"text\" id=\"businesManPhone2\" name=\"businesManPhone2\" class=\"input input_bot_line i_s_100\" /> <br>");
        	}
        	
        	showDiv('cxOpenMse'); 
	        }
        });
}



function selectPayType(flag){
	$(flag).val()=='1'?$(flag).val('0'):$(flag).val('1');
}


function CXSendSmsContent(claimNo){
	
	   var sms_clmPerson;
	   var sms_clmPerson02;
	   var sms_clmPerson03;
	   var sms_clmPerson04;
	   var sms_clmPerson05;
	   var auditOption02=$("#auditOption02").val();
	   var auditOption03=$("#auditOption03").val();
	   var auditOption04=$("#auditOption04").val();
	   var auditOption05=$("#auditOption05").val();
	   var businessManName03=$("#businessManName03").val();
	   var businessManName05=$("#businessManName05").val();
	   var businesManPhone1 = $("#businesManPhone1").val();
	   var businesManPhone2 = $("#businesManPhone2").val();
	   if($('#clmPerson1').attr('class')=="check_yes"){
		   sms_clmPerson = 1;

	   }else{
			sms_clmPerson = 0;
	   }
	   if($('#clmPerson02').attr('class')=="check_yes"){
		   sms_clmPerson02 = 1;
//		   if($("#auditOption02").val()==null || $("#auditOption02").val()==""){
//				alert("请填写撤案原因");
//				return;
//		   }

	   }else{
			sms_clmPerson02 = 0;
	   }
	   if($('#clmPerson03').attr('class')=="check_yes"){
		   sms_clmPerson03 = 1;
//		   if($("#auditOption03").val()==null || $("#auditOption03").val()==""){
//				alert("请填写撤案原因");
//				return;
//		   }
	   }else{
			sms_clmPerson03 = 0;
	   }
	   if($('#clmPerson04').attr('class')=="check_yes"){
		   sms_clmPerson04 = 1;
//		   if($("#auditOption04").val()==null || $("#auditOption04").val()==""){
//				alert("请填写拒赔原因");
//				return;
//		   }
	   }else{
			sms_clmPerson04 = 0;
	   }
	   if($('#clmPerson05').attr('class')=="check_yes"){
		   sms_clmPerson05 = 1;
//		   if($("#auditOption05").val()==null || $("#auditOption05").val()==""){
//				alert("请填写拒赔原因");
//				return;
//		   }

	   }else{
			sms_clmPerson05 = 0;
	   }
	   
	   $.ajax({
	        cache: true,
	        type: "POST",
	        url:"showsmscontent.do",
		    data : {
				"claimNo" : claimNo,
				"sms_clmPerson" : sms_clmPerson,
				"sms_salesman" : "",
				"operator" : "",
				"yname" : "",
				"phone" : "",
				"phone1" : "",
				"sms_clmPerson02" : sms_clmPerson02,
				"sms_clmPerson03" : sms_clmPerson03,
				"sms_clmPerson04" : sms_clmPerson04,
				"sms_clmPerson05" : sms_clmPerson05 ,
				"businesManPhone1" : businesManPhone1,
				"businesManPhone2" : businesManPhone2,
				"auditOption02" : auditOption02,
				"auditOption03" : auditOption03 ,
				"auditOption04" : auditOption04,
				"auditOption05" : auditOption05,
				"businessManName03" : businessManName03,
				"businessManName05" : businessManName05
				
		    },
	        async: false,
	        error: function(request) {
	            alert("短信发送失败！");
	          
	        },
	        success: function(data) {
	        	
	        	if(sms_clmPerson=='1'||sms_clmPerson02=='1'||sms_clmPerson03=='1'||sms_clmPerson04=='1'||sms_clmPerson05=='1'){
		        	closeDiv('cxOpenMse'); 
	        		 alert("发送成功！");
	        		 $('#clmPerson').attr('class',"check_no");
	        		 $('#clmPerson02').attr('class',"check_no");
	        		 $('#clmPerson03').attr('class',"check_no");
	        		 $('#clmPerson04').attr('class',"check_no");
	        		 $('#clmPerson05').attr('class',"check_no");
	        	}
	        		  	
	        }
	    });
	   $("#smsbuttom").removeAttr("onclick");
	   
}

function showSmsContent(claimNo){
	   var sms_clmPerson;
	   var sms_salesman;
	   if($('#clmPerson').attr('class')=="check_yes"){
		   sms_clmPerson = 1;

	   }else{
			sms_clmPerson = 0;
	   }
	   
	   if($('#salesman').attr('class')=="check_yes"){
		   sms_salesman = 1;
		  
	   }else{
			sms_salesman = 0;
	   }
	   var operator = $("#operator").val();
	   
		$.ajax({
	        cache: true,
	        type: "POST",
	        url:"showsmscontent.do",
	        data:{"claimNo":claimNo,"sms_clmPerson":sms_clmPerson,"sms_salesman":sms_salesman,"operator":operator},
	        async: false,
	        error: function(request) {
	            alert("展示短信失败！");
	            $("#endcasebutton").disabled=false;
	        },
	        success: function(data) {
	        	 /* alert(data[0]); */
	        	$("#end1").html('');
	        	for(var i = 0;i<data[0].length;i++){
	        		var a = data[0][i];
	        		var b = data[2][i];
	     
	        		$("#end1").append(a+"<br><br>"+"领款人手机号码："+b+"<br><br>"); 
	        	}
	        	
	        	var end1_html = $("#end1").html();
	        	if (end1_html != '') {
	        		end1_html = end1_html.replace("12312312312","<input type=\"text\" id=\"phone1\" name=\"phone1\" class=\"input input_bot_line i_s_100\" />");

	        	}
	        	$("#end1").html(end1_html);
	        	
	        	 /* $("#end1").html(data[0]);  */
	        	$("#end2").html(data[1]);
	        	/* $("#phoneno").html(data[2]); */
	        	
	        	var end2_html = $("#end2").html();
	        	if (end2_html != '') {
	        		end2_html = end2_html.replace("尊敬的","尊敬的<input type=\"text\" id=\"yname\" name=\"yname\" class=\"input input_bot_line i_s_100\" />");
	        		end2_html = end2_html.replace("12312312312","<input type=\"text\" id=\"phone\" name=\"phone\" class=\"input input_bot_line i_s_100\" />");

	        	}
	        	$("#end2").html(end2_html);
	        	
	        	$("#end_02").html('');
	        	$("#end_03").html('');
	        	$("#end_04").html('');
	        	$("#end_05").html('');
	        	var a02 = data[3];
	    		var a03 = data[4];
	    		var a04 = data[5];
	    		var a05 = data[6];
	    		var a06 = data[7];
	    		var endCaseType = data[8];
	    		if(endCaseType=="04"){
	    			$("#finishCaseMassage_1").hide();$("#finishCaseLine_1").hide();
	    			$("#finishCaseMassage_4").hide();$("#finishCaseLine_3").hide();
	    			$("#finishCaseMassage_5").hide();$("#finishCaseLine_4").hide();
	    		}else if(endCaseType=="03"){
	    			$("#finishCaseMassage_1").hide();$("#finishCaseLine_1").hide();
	    			$("#finishCaseMassage_2").hide();$("#finishCaseLine_2").hide();
	    			$("#finishCaseMassage_3").hide();$("#finishCaseLine_3").hide();
	    		}else{
	    			$("#finishCaseLine_1").hide();
	    			$("#finishCaseMassage_2").hide();$("#finishCaseLine_2").hide();
	    			$("#finishCaseMassage_3").hide();$("#finishCaseLine_3").hide();
	    			$("#finishCaseMassage_4").hide();$("#finishCaseLine_4").hide();
	    			$("#finishCaseMassage_5").hide();
	    		}
	        	$("#end_02").append(a02);
	        	$("#end_03").append(a03);
	        	$("#end_04").append(a04);
	        	$("#end_05").append(a05);
	        	
	        	var end02_html = $("#end_02").html();
	        	if (end02_html != '') {
	        		if(a06=="endCaseReasonIsNull")
	        			end02_html = end02_html.replace(a06,"<input type=\"text\" id=\"auditOption02\" name=\"auditOption02\" class=\"input input_bot_line i_s_100\" style=\"width:auto;\" value='' />");
	        		else
	        			end02_html = end02_html.replace(a06,"<input type=\"text\" id=\"auditOption02\" name=\"auditOption02\" class=\"input input_bot_line i_s_100\" style=\"width:auto;\" value='"+ a06 +"' />");
	        		$("#end_02").html(end02_html);
	        	}
	        	
	        	var end03_html = $("#end_03").html();
	        	if (end03_html != '') {
	        		end03_html = end03_html.replace('businessManName',"<input id=\"businessManName03\" type=\"text\" class=\"input input_bot_line i_s_100\" value=' ' />");
	        		if(a06=="endCaseReasonIsNull")
	        			end03_html = end03_html.replace(a06,"<input type=\"text\" id=\"auditOption03\" name=\"auditOption03\" class=\"input input_bot_line i_s_100\"  style=\"width:auto;\" value='' /> ");
	        		else
	        			end03_html = end03_html.replace(a06,"<input type=\"text\" id=\"auditOption03\" name=\"auditOption03\" class=\"input input_bot_line i_s_100\"  style=\"width:auto;\" value='"+ a06 +"' /> ");
	        		$("#end_03").html(end03_html + "<br><br> 业务员手机号码： <input type=\"text\" id=\"businesManPhone1\" name=\"businesManPhone1\" class=\"input input_bot_line i_s_100\" /> <br>");
	        	}
	        	
	        	var end04_html = $("#end_04").html();
	        	if (end04_html != '') {
	        		if(a06=="endCaseReasonIsNull")
	        			end04_html = end04_html.replace(a06,"<input type=\"text\" id=\"auditOption04\" name=\"auditOption04\" class=\"input input_bot_line i_s_100\" style=\"width:auto;\" value='' />");
	        		else
	        			end04_html = end04_html.replace(a06,"<input type=\"text\" id=\"auditOption04\" name=\"auditOption04\" class=\"input input_bot_line i_s_100\" style=\"width:auto;\" value='"+ a06 +"' />");
	        		$("#end_04").html(end04_html);
	        	}
	        	
	        	var end05_html = $("#end_05").html();
	        	if (end05_html != '') {
	        		end05_html = end05_html.replace('businessManName',"<input type=\"text\" id=\"businessManName05\" class=\"input input_bot_line i_s_100\" value=' ' />");
	        		if(a06=="endCaseReasonIsNull")
	        			end05_html = end05_html.replace(a06,"<input type=\"text\" id=\"auditOption05\" name=\"auditOption05\" class=\"input input_bot_line i_s_100\" style=\"width:auto;\" value='' />");
	        		else
	        			end05_html = end05_html.replace(a06,"<input type=\"text\" id=\"auditOption05\" name=\"auditOption05\" class=\"input input_bot_line i_s_100\" style=\"width:auto;\" value='"+ a06 +"' />");
	        		$("#end_05").html(end05_html +"<br><br> 业务员手机号码： <input type=\"text\" id=\"businesManPhone2\" name=\"businesManPhone2\" class=\"input input_bot_line i_s_100\" /> <br>");
	        	}
	        	
	        	showDiv('openMse'); 
	         }
	    });
}
	        	 
	        		

function sendSmsContent(claimNo){
	   var sms_clmPerson;
	   var sms_salesman;
	   var sms_clmPerson02;
	   var sms_clmPerson03;
	   var sms_clmPerson04;
	   var sms_clmPerson05;
	   var auditOption02=$("#auditOption02").val();
	   var auditOption03=$("#auditOption03").val();
	   var auditOption04=$("#auditOption04").val();
	   var auditOption05=$("#auditOption05").val();
	   var businessManName03=$("#businessManName03").val();
	   var businessManName05=$("#businessManName05").val();
	   var businesManPhone1 = $("#businesManPhone1").val();
	   var businesManPhone2 = $("#businesManPhone2").val();
	   if($('#clmPerson').attr('class')=="check_yes"){
		   sms_clmPerson = 1;

	   }else{
			sms_clmPerson = 0;
	   }
	   
	   if($('#salesman').attr('class')=="check_yes"){
		   sms_salesman = 1;
		  
	   }else{
			sms_salesman = 0;
	   }
	   if($('#clmPerson_02').attr('class')=="check_yes"){
		   sms_clmPerson02 = 1;
//		   if($("#auditOption02").val()==null || $("#auditOption02").val()==""){
//				alert("请填写撤案原因");
//				return;
//		   }

	   }else{
			sms_clmPerson02 = 0;
	   }
	   if($('#clmPerson_03').attr('class')=="check_yes"){
		   sms_clmPerson03 = 1;
//		   if($("#auditOption03").val()==null || $("#auditOption03").val()==""){
//				alert("请填写撤案原因");
//				return;
//		   }
	   }else{
			sms_clmPerson03 = 0;
	   }
	   if($('#clmPerson_04').attr('class')=="check_yes"){
		   sms_clmPerson04 = 1;
//		   if($("#auditOption04").val()==null || $("#auditOption04").val()==""){
//				alert("请填写拒赔原因");
//				return;
//		   }
	   }else{
			sms_clmPerson04 = 0;
	   }
	   if($('#clmPerson_05').attr('class')=="check_yes"){
		   sms_clmPerson05 = 1;
//		   if($("#auditOption05").val()==null || $("#auditOption05").val()==""){
//				alert("请填写拒赔原因");
//				return;
//		   }

	   }else{
			sms_clmPerson05 = 0;
	   }
	   var operator = $("#operator").val();
	   var yname = $("#yname").val();
	   var phone = $("#phone").val();
	   var phone1 = $("#phone1").val();
	   if(sms_salesman=='1'){
			 if(operator.length!=11){
   			   alert("请输入11位手机号码");
   			   return ;
   		   }
		     }
	   
	   $.ajax({
	        cache: true,
	        type: "POST",
	        url:"showsmscontent.do",
	        data:{"claimNo":claimNo,
	        	"sms_clmPerson":sms_clmPerson,
	        	"sms_salesman":sms_salesman,
	        	"operator":operator,
	        	"yname":yname,
	        	"phone":phone,
	        	"phone1":phone1,
	        	"sms_clmPerson02" : sms_clmPerson02,
				"sms_clmPerson03" : sms_clmPerson03,
				"sms_clmPerson04" : sms_clmPerson04,
				"sms_clmPerson05" : sms_clmPerson05 ,
				"businesManPhone1" : businesManPhone1,
				"businesManPhone2" : businesManPhone2,
				"auditOption02" : auditOption02,
				"auditOption03" : auditOption03 ,
				"auditOption04" : auditOption04,
				"auditOption05" : auditOption05,
				"businessManName03" : businessManName03,
				"businessManName05" : businessManName05
	        	},
	        async: false,
	        error: function(request) {
	            alert("短信发送失败！");
	          
	        },
	        success: function(data) {
	        	
	        	if(sms_clmPerson=='1' || sms_salesman=='1'||sms_clmPerson02=='1'||sms_clmPerson03=='1'||sms_clmPerson04=='1'||sms_clmPerson05=='1'){
		        	closeDiv('cxOpenMse'); 
	        		 alert("发送成功！");
	        		 $('#clmPerson').attr('class',"check_no");
	        		 $('#salesman').attr('class',"check_no");
	        		 $("#operator").val('');
	        		 $('#clmPerson02').attr('class',"check_no");
	        		 $('#clmPerson03').attr('class',"check_no");
	        		 $('#clmPerson04').attr('class',"check_no");
	        		 $('#clmPerson05').attr('class',"check_no");
	        	}	        		  	
	        }
	    });
	   $("#smsbuttom").removeAttr("onclick");
	   
}
   