mui.init({})
var id = helper.request.queryString("id");
var UserCode = helper.cookies.get("usercode");
var openid = helper.cookies.get("openid");
//var areaID = helper.request.queryString("areaID");
var tate= helper.request.queryString("tate");
//var openid = "oXF5e1mWpX5DajW5_yjNLPKb8ThE";
$(function() {
//	投诉咨询切换
	$('.order_type').find('input[type="radio"]').on('change', function() {
			if($(this).val() === "1") { //抽检
				$('#consult').show();  //kehmm qtton
				$('#complaint').hide();
				$('#spot').hide();
				$('#kehmm').hide();
				$('#qtton').hide();
			} else if($(this).val() === "2"){
				$('#complaint').show();
				$('#consult').hide();
				$('#spot').hide();
				$('#kehmm').show();
				$('#qtton').hide();
			}else if($(this).val() === "3"){
				$('#spot').show();
				$('#consult').hide();
				$('#complaint').hide();
				$('#kehmm').show();
				$('#qtton').hide();
			}else if($(this).val() === "4"){
				$('#spot').hide();
				$('#consult').hide();
				$('#complaint').hide();
				$('#kehmm').hide();
				$('#qtton').show();
			}
			
		});
// 完结不完结切换		
$('.wjbwj').find('input[type="radio"]').on('change', function() {
			if($(this).val() === "1") { //投诉
			  //receive
				$('#zhipaiyin').hide();
				$('#wanji').show();
                $('#zhipaaa').hide();
                $('#submit').hide();
			} else if($(this).val() === "2"){
				$('#zhipaiyin').show();
				$('#wanji').hide();
                $('#zhipaaa').hide();
                $('#submit').hide();
			}
		});
// 指派切换		
$('.zhipp').find('input[type="radio"]').on('change', function() {
			if($(this).val() === "3") { //投诉
			  //receive
				$('#zhipaaa').show();
				$('#buzp').show();
                $('#submit').hide();
                $('#wanji').hide();
			} else if($(this).val() === "4"){
				$('#zhipaaa').hide();
				$('#buzp').hide();
                $('#submit').show();
                $('#wanji').hide();
			}
		});
	//工单有效性 
	$('#order_valid').find('input[type="radio"]').on('change', function() {
		//是否有效工单项(0有效，1无效)
		if($(this).val() === "1") { //无效
			$('.order_note').show();
		} else {
			$('.order_note').hide();
		}
	});
	
	Ajax1() 	
//修改获取详情
function Ajax1() {
				$.ajax({
					url: huayi.config.callcenter_url + 'WxLogin/GetDetails',
					data: {
						id:id, //工单编号
						OpenId: openid, //微信openid,
					},
					async: true,
					dataType: 'json',
					type: 'get', //HTTP请求类型
					success: function(data) {
						if(data.state.toLowerCase() == "success") {
							var result = data.rows[0];
	                        		$('#order_source').text(result.F_Source), //工单来源
//									F_Type: $('.order_type').find('input[type="radio"]:checked').val(), //工单类型
				           //	咨询模块
				                    $("#order_category").text(result.F_AddressFull), //问题类别
									$("#order_productname").text(result.F_TS_Category), //产品名称
									$("#order_Claimnumber").text(result.F_ZX_Quantity), //咨询数量
									$("#order_macrocell").text(result.F_ZX_Area), //大区
									$("#order_branch").text(result.F_ZX_Branch), //分公司
							//投诉模块
							        $("#order_coding").val(result.F_CustomerID), //客户编码
									$("#order_material").val(result.F_MaterialID), //物料编码
									$("#order_cat").val(result.F_QuestionTypeone), //问题类别1
									$("#order_question").val(result.F_QuestionTypetwo), //问题类别2
									$("#order_matter").val(result.F_QuestionType), //问题类别3
									$("#order_batch").val(result.F_BatchNumber), //生产批号
//									$("#order_recipe").val(result.F_TS_Formula), //配方
									$("#order_product").val(result.F_TS_Category), //产品名称
//									$("#order_qi").val(result.F_TS_Category), //其他输入
									$("#order_Claimnumber").val(result.F_TS_Quantity), //问题数量
									$("#order_rank").val(result.F_TS_Level), //重要级别
							//抽检模块
							        $("#order_wentlb").val(result.F_QuestionType), //问题类别  ower_Sales_base
							        $("#ower_relationship").val(result.F_SalesBase),
							        $("#ower_Sales_base").val(result.F_SalesBase),
							        
							        
									$("#order_time").val(result.F_CJ_Time), //抽检时间
//									$("#order_response").val(result.F_QuestionType), //问题类别
							        $("#order_samplingle").val(result.F_CJ_Level), //抽检级别
							        $("#order_lingunit").val(result.F_CJ_Unit), //抽检单位
							        $("#order_assay").val(result.F_CJ_TestUnit), //化验单位
							        $("#order_tunnage").val(result.F_CJ_Tonnage), //抽检吨数
							        $("#order_algebra").val(result.F_CJ_BagNo), //抽检袋数
							        $("#order_money").val(result.F_CJ_Outlay), //费用金额
							//建议及其他
							        $("#order_texta").val(result.F_QuestionType), //问题类别
							        $("#order_chpi").val(result.F_CustomerID), //产品名称
									$("#order_wensu").val(result.F_MaterialID), //问题数量
									$("#ower_showCpke").val(result.F_SalesBase	), //销售基地
							//公共字段
									$('#order_name').val(result.F_CusName), //客户姓名
									$('#order_phone').val(result.F_CusPhone), //否	string	客户电话
//									$("#order_tel").val(result.F_CompanyName), //公司名称
//									$("#order_rengin").text(result.F_IncidentProvince), //省
//									$("#choworder_rengin option:selected").text(result.F_IncidentProvince); // 省
				                    $("#choworder_rengin").val(result.F_IncidentProvince); // 省
									$("#shouorder_shi").val(result.F_IncidentCity), //市
									$("#chouorder_xian").val(result.F_IncidentCountry), //县
									$("#chouorder_xiang").val(result.F_IncidentTownship), //乡
									$("#choworder_tower").val(result.F_IncidentDetailed), //详细地址
									$("#ower_relationship").val(result.F_SalesBase), //销售基地
									$("#order_reception").text(result.F_Description), //问题描述
//									F_WxOpenId: openid, //微信openid,
							
									$(".WordID").text(result.ID);
//									$("#Work_classname").text(result.F_TypeName); //工单类型
									$("#section").val(result.F_DeptName); //部门
									
									$("#Work_areaname").attr('data-index',result.IsAdminSend);
									$("#order_yewuyi").val(result.F_Salesman); //业务员
									$("#order_yewu").val(result.F_SalesPhone); //电话号
									$("#Work_houseID").val(result.F_CreateBy); //添加人工号
									$("#Work_ownerRelations").val(result.F_DealBy); //处理人
//									$("#Work_source").val(result.F_DealTime); //处理时间
//									$(".Work_lastDealUser").val(result.F_DealContent); //处理内容
//									$(".Work_last").val(result.F_DealResult); //处理结果
//									$("#Work_workOrderID").val(result.F_DealReasons); //未处理原因
//									$("#Work_workOrderID").val(result.F_IsVisit); //是否回访
									$("#Work_detail").val("问题描述：" + result.F_Description); //描述详情
									
							if(result.F_TypeName === "咨询") {
								$("input[type=radio][name=form][value='1']").prop("checked", true);
								$('#consult').show(); //receive
								$('#complaint').hide();
								$('#spot').hide();
								$('#qtton').hide();
								$('#kehmm').hide();
								
							} else if(result.F_TypeName === "投诉") {
								$("input[type=radio][value='2']").prop("checked", true);
								$('#consult').hide(); //receive
								$('#complaint').show();
								$('#spot').hide();
								$('#qtton').hide();
								$('#kehmm').show();
							} else if(result.F_TypeName === "抽检") {
								$("input[type=radio][value='3']").prop("checked", true);
								$('#consult').hide(); //receive
								$('#complaint').hide();
								$('#spot').show();
								$('#qtton').hide();
								$('#kehmm').show();
							} else if(result.F_TypeName == "建议及其他") {
								$("input[type=radio][name=form][value='4']").prop("checked", true);
								$('#consult').hide(); //receive
								$('#complaint').hide();
								$('#spot').hide();
								$('#qtton').show();
								$('#kehmm').hide();
							}
				
						}
					},
					error: function(xhr, type, errorThrown) {
						//异常处理；
					}
				})
			}		
	
	
	
	
	
var catt;//问题类别
var cttt;//投诉问题类别
var comdi;//产品名称
var coint; //销售基地
var stion; //问题数量
var shengch; //生产批次号
var jyppai;
var daqu;
var fengo;
var orderIsover;
function typePro(){
	orderIsover=$('input:radio[name="form"]:checked').val();
	if(orderIsover === '1'){
//		debugger
		catt = $('#order_category').attr('data-index');//问题类别
		comdi = $('#order_productname').val();//产品名称
		stion = $('#order_Claimnumber').val();//问题数量
		coint=$('#ower_relationship').val();//销售基地
		daqu='';
		fengo='';
		jyppai='';
		cttt='';
		shengch='';
		$('#wlbm').hide();
		$('#wlmcc').hide();
		$('#clie').hide();
		$('#mate').hide();


	}else if(orderIsover=== '2'){
		daqu=$('#order_macrocell').val();
		fengo=$('#order_branch').val();
		jyppai=$('#order_pinpa').val();
		comdi = $('#order_product').val();//产品名称
		cttt = '';
		// if($("#catego").val()){
		// 	cttt = $("#cat").val()+"|"+$("#catego").val();
		// 	if($("#cate").val()){
		// 		cttt = $("#cat").val()+"|"+$("#catego").val()+"|"+$("#cate").val();
		// 	}
		// }
		catt = $("#order_matter").attr('data-index');
		shengch=$('#order_batch').val();//生产批次号
		stion = '';//问题数量
		coint=$('#ower_Sales_base').val();//销售基地
	}else if(orderIsover === '3'){
		daqu=$('#order_macrocell').val();
		fengo=$('#order_branch').val();
		jyppai=$('#order_pinpai').val();
		shengch=$('#batch_num').val();//生产批次号 
		catt = $('#order_wentlb').attr('data-index');
		cttt='';
		comdi ='';
		coint='';
		stion='';
	}else if(orderIsover === '4'){
		catt = $('#order_texta').attr('data-index');//问题类别
		comdi = $('#order_chpi').val();//产品名称
		stion = $('#order_wensu').val();//问题数量
		coint=$('#ower_showCpke').val();//销售基地
		daqu='';
		fengo='';
		jyppai='';
		cttt='';
		shengch='';
		$('#wlbm').hide();
		$('#wlmcc').hide();
		$('#clie').hide();
		$('#mate').hide();

	}
}

	
	//提交按钮
	$('#submit').on('tap', function() {
		typePro();
//		var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
		var myreg11 = /^(([0\+]\d{2,3}-)?((0\d{2,3}))?(-)?)?(\d{7,8})(-(\d{3,}))?$/;
		var str = $("#order_tel").val();
		if($('#order_name').val() == '') {
			mui.alert('请输入客户姓名！') //请输入工单类型
		} else if($('#order_phone').val() == '') {
			mui.alert('请输入客户电话！') //请输入客户姓名
		}else {
			$.ajax({
				type: "post",
				dataType: 'json',
				url: huayi.config.callcenter_url + 'WxLogin/Update',
				async: true,
				data: {
					F_ID:id,
//					F_State:0,
					F_WxOpenId: openid, //微信openid,
					F_Source: $('#order_source').attr('data-index'), //工单来源
					F_Type: $('.order_type').find('input[type="radio"]:checked').val(), //工单类型
					//公共字段
			        F_CusName: $('#order_name').val(),//客户姓名
					F_CusPhone: $('#order_phone').val(),//客户电话
					F_CompanyName: $('#order_tel').val(),//公司名称
                    F_IncidentProvince:$("#choworder_rengin").attr('data-index'), //省
                    F_IncidentCity: $("#shouorder_shi").attr('data-index'), //市
                    F_IncidentCountry:$("#chouorder_xian").attr('data-index'), //县
                    F_IncidentTownship: $("#chouorder_xiang").attr('data-index'), //乡
                    F_IncidentDetailed: $("#choworder_tower").val(), //详细地址
				    F_Description:$("#order_reception").val(), //问题描述
                 //咨询模块
                    F_QuestionType:catt,//问题类别
                    F_TS_Category: comdi,//产品名称
                    F_ZX_Quantity:stion,//问题数量
                    F_SalesBase:coint,//销售基地 
               //投诉模块
                    F_BatchNumber:shengch,//生产批号
//                  F_TS_Formula: $('#formula').val(),//配方
                    F_TS_Quantity:$("#order_Claimnu").val(), //问题数量  order_Claimnumber
                    F_TS_Level: $('#order_rank').val(),//重要界别    
                    F_SalesPhone: $('#telephone').val(),//电话
                    F_ZX_Area: daqu,//大区
                    F_ZX_Branch:fengo,//分公司
                    F_Brand: jyppai,//经营品牌
                    F_Salesman: $('#order_yewu').val(),//业务员
                    F_MaterialID: $('#order_material').val(),//物料编码
                    F_CustomerID: $('#order_coding').val(),//客户编号
                    F_Model: $('#order_xinghao').val(),//型号
                    F_Specs: $('#order_guige').val(),//规格
                    F_Level1: $('#order_yiji').val(),//一级分类
                    F_Level2: $('#order_erji').val(),//二级分类
                    F_Level3: $('#order_sanji').val(),//三级分类
                    // F_Brand: $('#brand_name').val(),//品牌
                    F_MaterialEffect: $('#order_fuhefei').val(),//复合肥肥效
                    F_Pipeline: $('#order_chanpinxian').val(),//产品线
                    F_Craft: $('#order_gongyi').val(),//工艺
//                  F_Formula: $('#enter_formula').val(),//配方
                    
                    
                    
                    //抽检模块
					// F_CusName: $('#kxing').val(),//客户姓名
					// F_CusPhone: $('#kdian').val(),//客户电话
//                     F_QuestionType:cttt, //问题类别
                    F_CJ_Time: $('#order_time').val(),//抽检时间
                    F_CJ_Level: $('#order_samplingle').attr('data-index'), //抽检级别
                    F_CJ_Unit: $('#order_lingunit').attr('data-index'), //抽检单位
                    F_CJ_TestUnit: $('#order_assay').val(),//化验单位
                    F_CJ_Tonnage: $('#order_tunnage').val(),//抽检吨数
                    F_CJ_BagNo: $('#order_algebra').val(),//抽检袋数
                    F_CJ_Outlay: $('#order_money').val(),//公关费用金额
//					F_Source: $('#order_source').attr('data-index'), //工单来源
//					F_Type: $('.order_type').find('input[type="radio"]:checked').val(), //工单类型
					
			
					
				},
				success: function(data) {
					if(data.state == "success") {
						debugger
						//alert($('#order_reception').val()), //描述详情
						mui.toast('创建成功');
//						$('#order_type').val(''); //工单类型
//						$('#order_name').val(''), //客户姓名
//						$('#order_tel').val(''), //否	string	联系电话
//						$("#order_rengin").attr(''), //区域名称
//						$("#order_pro").attr(''), //项目名称
//						$("#order_floor").attr(''), //楼号
//						$('#order_room').val(''), //房间号
//						$('#ower_relationship').attr(''), //房东关系
//						$('#order_response').find('input[type="radio"]:checked').val(), //否	int	客户反应
//						$('#complaintOrder_type').attr(''), //否	int	处理部门（投诉类型）
//						$('#serviceOrder_type').attr(''), //否int	客服类类型	
//						$('#is_quality_assurance').attr(''), //否	int	是,//否过质保
//						//$('#order_reception').val(''), //描述详情
//						$('#order_responsible').val(''), //否	string	受理人
//						$('#order_valid').find('input[type="radio"]:checked').val(), //	否	int	是否有效工单项(0有效，1无效)
//						$('#order_note').val(''), // 无效原因	否	string	备注 (iseffective，1无效时填写备注)
//						$('#recive_type').attr(''), //$('#order_transfer_dept').attr('data-id')	否	int	咨询类工单指派部门id
//						$('#ower_recive').attr(''), //	否	string	接收人id $(this)
						window.location.href = "Have_list.html";
					} else {
						mui.toast(data.message);
					}
				}
			});
		}
	})



function getDepts() {}


//	投诉省市县乡
	
	var recivesww = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'RegionCategory/GetAllList',
		async: false,
		data: {
			F_Layer: 1,
			F_RegionName: $('#touorder_rengin').attr('data-index'),
		},
		dataType: 'json',
		success: function(res) {
			if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length > 0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_RegionId;
							obj.text = v.F_RegionName;
							recivesww.push(obj);
						});
						console.log(recivesww)
//						cityPicker5.setData(recive);
					}
				}
			
			//recive = res.data;
			//console.log(recive)
			//alert(JSON.stringify(data));
		}
	});	
	function getRecect(){
	  var  renyuaee = []
		$.ajax({
			url: huayi.config.callcenter_url + 'RegionCategory/GetAllList',
			type: 'get',
			data: {	
				F_Layer: 2,
				F_RegionName: $('#touorder_rengin').attr('data-index'),
			},
			dataType: "json",
			async: true,
			success: function(res) {

				if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length >0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_RegionId;
							obj.text = v.F_RegionName;
							renyuaee.push(obj);
							//$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
						});
						console.log(renyuaee)
						RCiPickee2.setData(renyuaee);
					}
				}
			},
		});
   }
	//区县
	function getRtt(){
	  var  rener = []
		$.ajax({
			url: huayi.config.callcenter_url + 'RegionCategory/GetAllList',
			type: 'get',
			data: {	
				F_Layer:3,
				F_RegionName: $('#touorder_shi').attr('data-index'),
			},
			dataType: "json",
			async: true,
			success: function(res) {

				if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length >0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_RegionId;
							obj.text = v.F_RegionName;
							rener.push(obj);
							//$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
						});
						console.log(rener)
						RCiPic2.setData(rener);
					}
				}
			},
		});
   }
	//乡
	function villagoo(){
	  var  viyy = []
		$.ajax({
			url: huayi.config.callcenter_url + 'RegionCategory/GetAllList',
			type: 'get',
			data: {	
				F_Layer:4,
				F_RegionName: $('#touorder_xian').attr('data-index'),
			},
			dataType: "json",
			async: true,
			success: function(res) {

				if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length >0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_RegionId;
							obj.text = v.F_RegionName;
							viyy.push(obj);
							//$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
						});
						console.log(viyy)
						RCimm.setData(viyy);
					}
				}
			},
		});
   }

	
	

//	咨询省市县乡
	
	var recives = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'RegionCategory/GetAllList',
		async: false,
		data: {
			F_Layer: 1,
			F_RegionName: $('#choworder_rengin').attr('data-index'),
		},
		dataType: 'json',
		success: function(res) {
			if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length > 0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_RegionId;
							obj.text = v.F_RegionName;
							recives.push(obj);
						});
						console.log(recives)
//						cityPicker5.setData(recive);
					}
				}
			
			//recive = res.data;
			//console.log(recive)
			//alert(JSON.stringify(data));
		}
	});	
	//市
	function getRece(){
	  var  renyuann = []
		$.ajax({
			url: huayi.config.callcenter_url + 'RegionCategory/GetAllList',
			type: 'get',
			data: {	
				F_Layer: 2,
				F_RegionName: $('#choworder_rengin').attr('data-index'),
			},
			dataType: "json",
			async: true,
			success: function(res) {

				if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length >0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_RegionId;
							obj.text = v.F_RegionName;
							renyuann.push(obj);
							//$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
						});
						console.log(renyuann)
						RCiPickee1.setData(renyuann);
					}
				}
			},
		});
   }

//区/县
function getReee(){
	  var  rennn = []
		$.ajax({
			url: huayi.config.callcenter_url + 'RegionCategory/GetAllList',
			type: 'get',
			data: {	
				F_Layer:3,
				F_RegionName: $('#shouorder_shi').attr('data-index'),
			},
			dataType: "json",
			async: true,
			success: function(res) {

				if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length >0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_RegionId;
							obj.text = v.F_RegionName;
							rennn.push(obj);
							//$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
						});
						console.log(rennn)
						RCiPi1.setData(rennn);
					}
				}
			},
		});
   }

//乡
function villagee(){
	  var  villl = []
		$.ajax({
			url: huayi.config.callcenter_url + 'RegionCategory/GetAllList',
			type: 'get',
			data: {	
				F_Layer:4,
				F_RegionName: $('#chouorder_xian').attr('data-index'),
			},
			dataType: "json",
			async: true,
			success: function(res) {

				if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length >0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_RegionId;
							obj.text = v.F_RegionName;
							villl.push(obj);
							//$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
						});
						console.log(villl)
						RCi12.setData(villl);
					}
				}
			},
		});
   }


//投诉省市县乡



//	省
	
	var recive = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'RegionCategory/GetAllList',
		async: false,
		data: {
			F_Layer: 1,
			F_RegionName: $('#order_rengin').attr('data-index'),
		},
		dataType: 'json',
		success: function(res) {
			if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length > 0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_RegionId;
							obj.text = v.F_RegionName;
							recive.push(obj);
						});
						console.log(recive)
//						cityPicker5.setData(recive);
					}
				}
			
			//recive = res.data;
			//console.log(recive)
			//alert(JSON.stringify(data));
		}
	});	
	//市
	function getReceiveUser(){
	  var  renyuan = []
		$.ajax({
			url: huayi.config.callcenter_url + 'RegionCategory/GetAllList',
			type: 'get',
			data: {	
				F_Layer: 2,
				F_RegionName: $('#order_rengin').attr('data-index'),
			},
			dataType: "json",
			async: true,
			success: function(res) {

				if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length >0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_RegionId;
							obj.text = v.F_RegionName;
							renyuan.push(obj);
							//$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
						});
						console.log(renyuan)
						RCiPicke.setData(renyuan);
					}
				}
			},
		});
   }

//区/县
function getRe(){
	  var  ren = []
		$.ajax({
			url: huayi.config.callcenter_url + 'RegionCategory/GetAllList',
			type: 'get',
			data: {	
				F_Layer:3,
				F_RegionName: $('#order_shi').attr('data-index'),
			},
			dataType: "json",
			async: true,
			success: function(res) {

				if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length >0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_RegionId;
							obj.text = v.F_RegionName;
							ren.push(obj);
							//$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
						});
						console.log(ren)
						RCiPi.setData(ren);
					}
				}
			},
		});
   }

//乡
function village(){
	  var  vil = []
		$.ajax({
			url: huayi.config.callcenter_url + 'RegionCategory/GetAllList',
			type: 'get',
			data: {	
				F_Layer:4,
				F_RegionName: $('#order_xian').attr('data-index'),
			},
			dataType: "json",
			async: true,
			success: function(res) {

				if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length >0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_RegionId;
							obj.text = v.F_RegionName;
							vil.push(obj);
							//$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
						});
						console.log(vil)
						RCi.setData(vil);
					}
				}
			},
		});
   }


		Ajax();
		function Ajax() {
				$.ajax({
					url: huayi.config.callcenter_url + 'WxLogin/GetDpment',
					data: {
						OpenId: openid, //微信openid,
					},
					async: true,
					dataType: 'json',
					type: 'get', //HTTP请求类型
					success: function(data) {
						if(data.state.toLowerCase() == "success") {
							var result = data.data;
							$("#custo").text(result.F_UserName); 
							$("#cus").text(result.F_UserCode); 
			
						
						}
					},
					error: function(xhr, type, errorThrown) {
						//异常处理；
					}
				})
			}



	//销售基地
	var keyList = [];
//	console.log(keyList);
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlagWx',
		async: false,
		data: {
			flag: 'XSJD'
		},
		dataType: 'json',
		success: function(data) {
			var key_data = data.data;
//			console.log(data.data);
			$(key_data).each(function(i, n) {
				var obj = {};
				obj.value = n.F_DictionaryValueId;
				obj.text = n.F_Name;
				keyList.push(obj)
			})
		}
	});
//	//投诉销售基地
//	var keyLi = [];
////	console.log(keyList);
//	$.ajax({
//		type: "get",
//		url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlagWx',
//		async: false,
//		data: {
//			flag: 'XSJD'
//		},
//		dataType: 'json',
//		success: function(data) {
//			var key_data = data.data;
////			console.log(data.data);
//			$(key_data).each(function(i, n) {
//				var obj = {};
//				obj.value = n.F_DictionaryValueId;
//				obj.text = n.F_Name;
//				keyLi.push(obj)
//			})
//		}
//	});

//问题类别
	 var ke = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'WorkOrder/GetQuestionNameType',
		async: false,
		data: {
			type:3,
		},
		dataType: 'json',
		success: function(res) {
			if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length > 0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.id;
							obj.text = v.text;
							ke.push(obj);
						});
						
//						cityPicker5.setData(recive);
					}
			}
		}
	});		
//抽检问题类别
    var kees = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'WorkOrder/GetQuestionNameType',
		async: false,
		data: {
			type:2,
		},
		dataType: 'json',
		success: function(res) {
			if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length > 0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.id;
							obj.text = v.text;
							kees.push(obj);
						});
						
//						cityPicker5.setData(recive);
					}
			}
		}
	});	
//建议及其他问题类别
 var kisin = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'WorkOrder/GetQuestionNameType',
		async: false,
		data: {
			type:3,
		},
		dataType: 'json',
		success: function(res) {
			if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length > 0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.id;
							obj.text = v.text;
							kisin.push(obj);
						});
						
//						cityPicker5.setData(recive);
					}
			}
		}
	});	
//产品名称
var  keee = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlagWx',
		async: false,
		data: {
			flag: 'CPZL'
		},
		dataType: 'json',
		success: function(data) {
			var key_data = data.data;
//			console.log(key_data);
			$(key_data).each(function(i, n) {
				var obj = {};
				obj.value = n.F_DictionaryValueId;
				obj.text = n.F_Name;
				keee.push(obj)
//				console.log(ke);
			})
		}
	});

//投诉产品名称
var  letter = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlagWx',
		async: false,
		data: {
			flag: 'CPZL'
		},
		dataType: 'json',
		success: function(data) {
			var key_data = data.data;
			$(key_data).each(function(i, n) {
				var obj = {};
				obj.value = n.F_DictionaryValueId;
				obj.text = n.F_Name;
				letter.push(obj)
			})
		}
	});
//投诉重要级别
var  rank = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlagWx',
		async: false,
		data: {
			flag: 'ZYJB'
		},
		dataType: 'json',
		success: function(data) {
			var key_data = data.data;
//			console.log(key_data);
			$(key_data).each(function(i, n) {
				var obj = {};
				obj.value = n.F_DictionaryValueId;
				obj.text = n.F_Name;
				rank.push(obj)
//				console.log(ke);
			})
		}
	});	
//抽检抽检级别
var  check = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlagWx',
		async: false,
		data: {
			flag: 'CJJP'
		},
		dataType: 'json',
		success: function(data) {
			var key_data = data.data;
//			console.log(key_data);
			$(key_data).each(function(i, n) {
				var obj = {};
				obj.value = n.F_DictionaryValueId;
				obj.text = n.F_Name;
				check.push(obj)
			})
		}
	});	
//抽检抽检单位
var  monad = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlagWx',
		async: false,
		data: {
			flag: 'CJDW'
		},
		dataType: 'json',
		success: function(data) {
			var key_data = data.data;
//			console.log(key_data);
			$(key_data).each(function(i, n) {
				var obj = {};
				obj.value = n.F_DictionaryValueId;
				obj.text = n.F_Name;
				monad.push(obj)
			})
		}
	});		
//大区
var lisboa = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'Department/GetList',
		async: false,
		data: {
			F_Layer: 1,
//			F_RegionName: $('#order_macrocell').attr('data-index'),
		},
		dataType: 'json',
		success: function(res) {
			if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length > 0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_DeptId;
							obj.text = v.F_DeptName;
							lisboa.push(obj);
						});
						console.log(lisboa)
//						cityPicker5.setData(recive);
					}
				}
			
			//recive = res.data;
			//console.log(recive)
			//alert(JSON.stringify(data));
		}
	});	
	
	
	//分公司
function fengong(){
	  var  filiale = []
		$.ajax({
			url: huayi.config.callcenter_url + 'Department/GetList',
			type: 'get',
			data: {	
				F_Layer:2,
				F_RegionName: $('#order_macrocell').attr('data-index'),
			},
			dataType: "json",
			async: true,
			success: function(res) {
				if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length >0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.F_DeptId;
							obj.text = v.F_DeptName;
							filiale.push(obj);
							//$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
						});
//						console.log(vil)
						company.setData(filiale);
					}
				}
			},
		});
   }
//投诉问题类别1
	var complaints = [];
	$.ajax({
		type: "get",
		url: huayi.config.callcenter_url + 'WorkOrder/GetQuestionNameType',
		async: false,
		data: {
			type:1,
		},
		dataType: 'json',
		success: function(res) {
			if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length > 0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.id;
							obj.text = v.text;
							complaints.push(obj);
						});
						console.log(lisboa)
//						cityPicker5.setData(recive);
					}
				}
			
			//recive = res.data;
			//console.log(recive)
			//alert(JSON.stringify(data));
		}
	});	
//投诉问题类别2	
function range(){
	  var  more  = []
		$.ajax({
			url: huayi.config.callcenter_url + 'WorkOrder/GetQuestionNameType',
			type: 'get',
			data: {	
				QuestionName:$('#order_cat').val(),
			    type:1,
			},
			dataType: "json",
			async: true,
			success: function(res) {
				if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length >0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.id;
							obj.text = v.text;
							more .push(obj);
//							$('<option value="' + v.id + '">' + v.text + '</option>').appendTo('#order_recive');
						});
//						console.log(more)
						com.setData(more);
					}
				}
			},
		});
   }	
//投诉问题类别3	
function which(){
	  var  vector  = []
		$.ajax({
			url: huayi.config.callcenter_url + 'WorkOrder/GetQuestionNameType',
			type: 'get',
			data: {	
				QuestionName:$('#order_question').val(),
			    type:1,
			},
			dataType: "json",
			async: true,
			success: function(res) {
				if(res.state.toLowerCase() === "success") {
					res = res.data;
					console.log(res)
					if(res && res.length >0) {
						res.forEach(function(v, i) {
							var obj = {};
							obj.value = v.id;
							obj.text = v.text;
							vector .push(obj);
//							$('<option value="' + v.id + '">' + v.text + '</option>').appendTo('#order_recive');
						});
//						console.log(vector)
						since.setData(vector);
					}
				}
			},
		});
   }		
	
	
	(function($, doc) {
		$.init();
		$.ready(function() {
			
		
			
			
			
			
			//		咨询	省
			var RCiP = new $.PopPicker({
                F_Layer: 1,
			});
			RCiP.setData(recives);
			var RCss1 = doc.getElementById('chouhuTi');
			var RCResultss = doc.getElementById('choworder_rengin');
			RCss1.addEventListener('tap', function(event) {
				RCiP.show(function(items) {
					console.log(items[0].text)
					RCResultss.value =items[0].text
					RCResultss.setAttribute("data-index", items[0].text);
					//RCResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
					//RCResults.setAttribute("data-index", items[0].id);
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);
		//市
			RCiPickee1 = new $.PopPicker({
                F_Layer: 1,
			});
			
			var RCss2 = doc.getElementById('chowZhuTiPicker');
			var RCResultss2 = doc.getElementById('shouorder_shi');
			RCss2.addEventListener('tap', function(event) {
				getRece(); 
				RCiPickee1.show(function(items) {
					RCResultss2.value =items[0].text
					RCResultss2.setAttribute("data-index", items[0].text);
					//RCResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
					//RCResults.setAttribute("data-index", items[0].id);
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);
			
		//区/县
		  RCiPi1 = new $.PopPicker({
                F_Layer: 1,
			});			
			var RCs22 = doc.getElementById('chowcounty');
			var RCResults22 = doc.getElementById('chouorder_xian');
			RCs22.addEventListener('tap', function(event) {
				getReee(); 
				RCiPi1.show(function(items) {
					RCResults22.value =items[0].text
					RCResults22.setAttribute("data-index", items[0].text);
					//RCResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
					//RCResults.setAttribute("data-index", items[0].id);
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);
	//乡
		   RCi12 = new $.PopPicker({
                F_Layer: 1,
			});			
			var RCs33= doc.getElementById('chowtowns');
			var RCResults33 = doc.getElementById('chouorder_xiang');
			RCs33.addEventListener('tap', function(event) {
				villagee(); 
				RCi12.show(function(items) {
					RCResults33.value =items[0].text
					RCResults33.setAttribute("data-index", items[0].text);
					//RCResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
					//RCResults.setAttribute("data-index", items[0].id);
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);	
			
			
			
			
			
			
			
			
			
			
           //销售基地
			var cityPicker3 = new $.PopPicker();
			cityPicker3.setData(keyList);
			var showCityPickerButton = doc.getElementById('showCityPicker3');
			var cityResult3 = doc.getElementById('ower_relationship');
			showCityPickerButton.addEventListener('tap', function(event) {
				cityPicker3.show(function(items) {
					cityResult3.value = items[0].text;
					cityResult3.setAttribute("data-index", items[0].value);
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);
			  //其他销售基地
			var cityPicker9 = new $.PopPicker();
			cityPicker9.setData(keyList);
			var showCityPickerButton9 = doc.getElementById('showCpke');
			var cityResult9 = doc.getElementById('ower_showCpke');
			showCityPickerButton9.addEventListener('tap', function(event) {
				cityPicker9.show(function(items) {
					cityResult9.value = items[0].text;
					cityResult9.setAttribute("data-index", items[0].value);
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);
			 //投诉销售基地
			var cityPicker4 = new $.PopPicker();
			cityPicker4.setData(keyList);
			var showCityPickerButton4 = doc.getElementById('Sales_base');
			var cityResult4 = doc.getElementById('ower_Sales_base');
			showCityPickerButton4.addEventListener('tap', function(event) {
				cityPicker3.show(function(items) {
					cityResult4.value = items[0].text;
					cityResult4.setAttribute("data-index", items[0].value);
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);
			//问题类别
			var city = new $.PopPicker();
				city.setData(ke);
				var showCityPickerButton = doc.getElementById('question');
				var cityResult = doc.getElementById('order_category');
				showCityPickerButton.addEventListener('tap', function(event) {
					city.show(function(items) {
						cityResult.value = items[0].text;
						cityResult.setAttribute("data-index", items[0].value);
						//返回 false 可以阻止选择框的关闭
						//return false;
					});
			}, false);
			//抽检问题类别
			var cityes = new $.PopPicker();
				cityes.setData(kees);
				var showCityPickerButton6 = doc.getElementById('wentilb');
				var cityResult6 = doc.getElementById('order_wentlb');
				showCityPickerButton6.addEventListener('tap', function(event) {
					cityes.show(function(items) {
						cityResult6.value = items[0].text;
						cityResult6.setAttribute("data-index", items[0].value);
						//返回 false 可以阻止选择框的关闭
						//return false;
					});
			}, false);
			//其他问题类别
			var citytt = new $.PopPicker();
				citytt.setData(kisin);
				var showCityPickerButton7 = doc.getElementById('texta');
				var cityResult7 = doc.getElementById('order_texta');
				showCityPickerButton7.addEventListener('tap', function(event) {
					citytt.show(function(items) {
						cityResult7.value = items[0].text;
						cityResult7.setAttribute("data-index", items[0].value);
						//返回 false 可以阻止选择框的关闭
						//return false;
					});
			}, false);
//			//游客渠道类型
//			var citye = new $.PopPicker();
//				citye.setData(annel);
//				var showCityPickerButt = doc.getElementById('trench');
//				var cityResultion = doc.getElementById('manager');
//				showCityPickerButt.addEventListener('tap', function(event) {
//					citye.show(function(items) {
//						cityResultion.value = items[0].text;
//						cityResultion.setAttribute("data-index", items[0].value);
//						//返回 false 可以阻止选择框的关闭
//						//return false;
//					});
//			}, false);
			//产品名称
			var cityc = new $.PopPicker();
				cityc.setData(keee);
				var showCityPickerButton1 = doc.getElementById('product');
				var cityResultc1 = doc.getElementById('order_productname');
				showCityPickerButton1.addEventListener('tap', function(event) {
					cityc.show(function(items) {
						cityResultc1.value = items[0].text;
						cityResultc1.setAttribute("data-index", items[0].value);
						//返回 false 可以阻止选择框的关闭
						//return false;
					});
			}, false);
			//其他产品名称
			var citycea = new $.PopPicker();
				citycea.setData(keee);
				var showCityPickerButton8 = doc.getElementById('chpi');
				var cityResultc8 = doc.getElementById('order_chpi');
				showCityPickerButton8.addEventListener('tap', function(event) {
					citycea.show(function(items) {
						cityResultc8.value = items[0].text;
						cityResultc8.setAttribute("data-index", items[0].value);
						//返回 false 可以阻止选择框的关闭
						//return false;
					});
			}, false);
//投诉问题类别
//	var tou = new $.PopPicker();
//		tou.setData(tousu);
//		var showCityPickerButton = doc.getElementById('quest');
//		var cityResult = doc.getElementById('order_cat');
//		showCityPickerButton.addEventListener('tap', function(event) {
//			tou.show(function(items) {
//				cityResult.value = items[0].text;
//				cityResult.setAttribute("data-index", items[0].value);
//				//返回 false 可以阻止选择框的关闭
//				//return false;
//			});
//	}, false);
			
	//投诉产品名称
	var lett = new $.PopPicker();
		lett.setData(letter);
		var showCityPickerButton2 = doc.getElementById('produ');
		var cityResultc2 = doc.getElementById('order_product');
		showCityPickerButton2.addEventListener('tap', function(event) {
			lett.show(function(items) {
				cityResultc2.value = items[0].text;
				cityResultc2.setAttribute("data-index", items[0].value);
				//返回 false 可以阻止选择框的关闭
				//return false;
			});
	}, false);		
	//投诉重要级别
	var level = new $.PopPicker();
		level.setData(rank);
		var showCityPickerButton3 = doc.getElementById('rank');
		var cityResultc3 = doc.getElementById('order_rank');
		showCityPickerButton3.addEventListener('tap', function(event) {
			level.show(function(items) {
				cityResultc3.value = items[0].text;
				cityResultc3.setAttribute("data-index", items[0].value);
				//返回 false 可以阻止选择框的关闭
				//return false;
			});
	}, false);		
//抽检抽检级别
	var spott = new $.PopPicker();
		spott.setData(check);
		var showCityPickerButton4 = doc.getElementById('samp');
		var cityResultc4 = doc.getElementById('order_samplingle');
		showCityPickerButton4.addEventListener('tap', function(event) {
			spott.show(function(items) {
				cityResultc4.value = items[0].text;
				cityResultc4.setAttribute("data-index", items[0].value);
				//返回 false 可以阻止选择框的关闭
				//return false;
			});
	}, false);									
//抽检抽检单位
	var unit = new $.PopPicker();
		unit.setData(monad);
		var showCityPick5 = doc.getElementById('ling');
		var cityResultc5 = doc.getElementById('order_lingunit');
		showCityPick5.addEventListener('tap', function(event) {
			unit.show(function(items) {
				cityResultc5.value = items[0].text;
				cityResultc5.setAttribute("data-index", items[0].value);
				//返回 false 可以阻止选择框的关闭
				//return false;
			});
	}, false);	
	
	   var manager = new $.PopPicker({
                F_Layer: 1,
			});
			manager.setData(lisboa);
			var RCs5 = doc.getElementById('qregion');
			var RCResults5 = doc.getElementById('order_macrocell');
			RCs5.addEventListener('tap', function(event) {
				manager.show(function(items) {
					console.log(items[0].text)
					RCResults5.value =items[0].text
					RCResults5.setAttribute("data-index", items[0].text);
					//RCResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
					//RCResults.setAttribute("data-index", items[0].id);
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);
//分公司
	       company = new $.PopPicker({
                F_Layer: 2,
			});
			var RCs4 = doc.getElementById('filial');
			var RCResults8 = doc.getElementById('order_branch');
			RCs4.addEventListener('tap', function(event) {
				fengong();
				company.show(function(items) {
					RCResults8.value =items[0].text
					RCResults8.setAttribute("data-index", items[0].text);
					//RCResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
					//RCResults.setAttribute("data-index", items[0].id);
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);
	//投诉问题类别1		
		   var complai = new $.PopPicker({
                pid:0,
			});
			complai.setData(complaints);
			var RCs12 = doc.getElementById('quest');
			var RCResults12 = doc.getElementById('order_cat');
			RCs12.addEventListener('tap', function(event) {
				complai.show(function(items) {
					console.log(items[0].text)
					RCResults12.value =items[0].text
					RCResults12.setAttribute("data-index", items[0].value);
					//RCResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
					//RCResults.setAttribute("data-index", items[0].id);
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);
		//问题类别2
			com = new $.PopPicker({
                pid:1,
			});
			console.log()
			var RCs13= doc.getElementById('que');
			var RCResults13 = doc.getElementById('order_question');
			RCs13.addEventListener('tap', function(event) {
				range();
				com.show(function(items) {
					RCResults13.value =items[0].text
					RCResults13.setAttribute("data-index", items[0].value);
					//RCResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
					//RCResults.setAttribute("data-index", items[0].id);
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);
	//问题类别3
			since = new $.PopPicker({
                pid:1,
			});
			var RCs14= doc.getElementById('matter');
			var RCResults14 = doc.getElementById('order_matter');
			RCs14.addEventListener('tap', function(event) {
				which();
				since.show(function(items) {
					RCResults14.value =items[0].text
					RCResults14.setAttribute("data-index", items[0].value);
					//RCResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
					//RCResults.setAttribute("data-index", items[0].id);
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);			
			
			
			

			
		})
	})(mui, document);

})





$("#order_productname").click(function(){
	
})





$('#order_productname').find('input[data-index=""]').on('change', function() {
	if($(this).val() == "624") { //业务办理
		$('#qtqcr').show();
	}else{
		$('#qtqcr').hide();
	}
});



$('#order_coding').blur(function () {
//             alert($(this).val());
			// $('#material').show();							
	//根据客户编号获取信息
		$.ajax({
			url: huayi.config.callcenter_url + 'CustomerNew/GetCodeCustomer',
			data: {
				code:$('#order_coding').val(),
				OpenId: openid, //微信openid,
			},
			async: true,
			dataType: 'json',
			type: 'get', //HTTP请求类型
			success: function(data) {
				if(data.state.toLowerCase() == "success") {
					var result = data.data;
					
					$('#order_yewu').val(result.F_Salesman);
					$('#order_yewuphone').val(result.F_SalesPhone);
					$('#order_macrocell').val(result.F_AreaName);
					$('#order_branch').val(result.F_BranchName);
					$('#order_pinpai').val(result.F_Brands);
				}
			},
			error: function(xhr, type, errorThrown) {
				//异常处理；
			}
		})
	
});



$('#order_material').blur(function () {
//             alert($(this).val());
			// $('#material').show();
	//根据物料编码获取信息

		$.ajax({
			url: huayi.config.callcenter_url + 'MaterialManage/GetCodeModel',
			data: {
				code:$('#order_material').val(),
				OpenId: openid, //微信openid,
			},
			async: true,
			dataType: 'json',
			type: 'get', //HTTP请求类型
			success: function(data) {
				if(data.state.toLowerCase() == "success") {
					var result = data.data;
					$("#order_mingcheng").val(result.model.F_MaterialName);//物料名称
					$("#order_xinghao").val(result.model.F_Model),//型号
					$("#order_guige").val(result.model.F_Specs);//规格
					$("#order_yiji").val(result.model.F_Level1);//一级分类
					$("#order_erji").val(result.model.F_Level2);//二级分类
					$("#order_sanji").val(result.model.F_Level3);//三级分类
					$('#order_pinpa').val(result.model.F_Brand);//品牌
					$('#order_fuhefei').val(result.model.F_MaterialEffect); //复合肥肥效
					$('#order_chanpinxian').val(result.model.F_Pipeline); //产品线tensions
					$("#order_gongyi").val(result.model.F_Craft);//工艺
				}
			},
			error: function(xhr, type, errorThrown) {
				//异常处理；
			}
		})
	
});
