$(function(){
	// 只有卖方基本信息, 卖方为授信主体
	if( creditReportQuery.source == 'sell' ){
		$('.buyerBasicLi,.businessBasicBuyerLi').remove();
	};
	// 只有买方基本信息, 买方为交易对手
	if( creditReportQuery.source == 'buy' ){
		$('.sellerBasicLi,.businessBasicSellerLi').remove();
	};
	// 买方基本信息和卖方基本信息都有, 买方为授信主体，卖方为交易对手
	if( creditReportQuery.source == 'all' ){
		
	};
	
	// 查询买方卖方基本信息
	function getSubjectBasicInfo(){
		var getdata = {'creditReportingId':creditReportQuery.creditReportingId}
		if( creditReportQuery.source=='sell' ){
			getdata.custId = creditReportQuery.creditSubjectId;
		};
		if( creditReportQuery.source=='buy' ){
			getdata.custId = creditReportQuery.counterpartyId;
		};
		if( creditReportQuery.source=='all' ){
			if( $('.sellerBasicLi').hasClass('active') ){
				getdata.custId = creditReportQuery.creditSubjectId;
			};
			if( $('.buyerBasicLi').hasClass('active') ){
				getdata.custId = creditReportQuery.counterpartyId;
			};
		};
		$.ajax({
			url:'/creditReportingBasicInfo/doGetBasicInfoView',
			type:'get',
			data:getdata,
			async:false,
			success:function(data){
				// 通用信息
				if( data.data.orgChnName!=undefined ){
					$('.orgChnName').text(data.data.orgChnName);
				}
				if( data.data.orgEngName!=undefined ){
					$('.orgEngName').text(data.data.orgEngName);
				}
				if( data.data.custId!=undefined ){
					$('.custId').text(data.data.custId);
				}
				if( data.data.loanCardNo!=undefined ){
					$('.loanCardNo').text(data.data.loanCardNo);
				}
				if( data.data.regNoType!=undefined ){
					$('.regNoType').text(data.data.regNoType);
				}
				if( data.data.regNo!=undefined ){
					$('.regNo').text(data.data.regNo);
				}
				if( data.data.orgCode!=undefined ){
					$('.orgCode').text(data.data.orgCode);
				}
				if( data.data.orgCreditCode!=undefined ){
					$('.orgCreditCode').text(data.data.orgCreditCode);
				}
				if( data.data.finOrgCode!=undefined ){
					$('.finOrgCode').text(data.data.finOrgCode);
				}
				if( data.data.bankCode!=undefined ){
					$('.bankCode').text(data.data.bankCode);
				}
				// 机构基本信息-基础段数据项
				if( data.data.orgbase ){
					if( data.data.orgbase.custId!=undefined ){
						$('.orgbase-custId').text(data.data.orgbase.custId);
					}
					if( data.data.orgbase.bankCode!=undefined ){
						$('.orgbase-bankCode').text(data.data.orgbase.bankCode);
					}
					if( data.data.orgbase.orgCode!=undefined ){
						$('.orgbase-orgCode').text(data.data.orgbase.orgCode);
					}
					if( data.data.orgbase.orgCreditCode!=undefined ){
						$('.orgbase-orgCreditCode').text(data.data.orgbase.orgCreditCode);
					}
					if( data.data.orgbase.regNoType!=undefined ){
						$('.orgbase-regNoType').text(data.data.orgbase.regNoType);
					}
					if( data.data.orgbase.regNo!=undefined ){
						$('.orgbase-regNo').text(data.data.orgbase.regNo);
					}
					if( data.data.orgbase.nationalTaxNo!=undefined ){
						$('.orgbase-nationalTaxNo').text(data.data.orgbase.nationalTaxNo);
					}
					if( data.data.orgbase.localTaxNo!=undefined ){
						$('.orgbase-localTaxNo').text(data.data.orgbase.localTaxNo);
					}
					if( data.data.orgbase.finOrgCode!=undefined ){
						$('.orgbase-finOrgCode').text(data.data.orgbase.finOrgCode);
					}
					if( data.data.orgbase.loanCardNo!=undefined ){
						$('.orgbase-loanCardNo').text(data.data.orgbase.loanCardNo);
					}
					if( data.data.orgbase.custType!=undefined ){
						$('.orgbase-custType').text(data.data.orgbase.custType);
					}
					if( data.data.orgbase.accountPermitNo!=undefined ){
						$('.orgbase-accountPermitNo').text(data.data.orgbase.accountPermitNo);
					}
					if( data.data.orgbase.isInstitution!='' ){
						if( data.data.orgbase.isInstitution==2 ){
							$('.orgbase-isInstitution').text('否');
						}else if( data.data.orgbase.isInstitution==1 ){
							$('.orgbase-isInstitution').text('是');
						}
					}
					if( data.data.orgbase.dataExtraDate!=undefined ){
						$('.orgbase-dataExtraDate').text(data.data.orgbase.dataExtraDate);
					}
				};
				// 机构基本信息-基本属性段数据项
				if( data.data.orgAttribute ){
					if( data.data.orgAttribute.custId!=undefined ){
						$('.orgAttribute-custId').text(data.data.orgAttribute.custId);
					}
					if( data.data.orgAttribute.finOrgCode!=undefined ){
						$('.orgAttribute-finOrgCode').text(data.data.orgAttribute.finOrgCode);
					}
					if( data.data.orgAttribute.orgChnName!=undefined ){
						$('.orgAttribute-orgChnName').text(data.data.orgAttribute.orgChnName);
					}
					if( data.data.orgAttribute.orgEngName!=undefined ){
						$('.orgAttribute-orgEngName').text(data.data.orgAttribute.orgEngName);
					}
					if( data.data.orgAttribute.regAddr!=undefined ){
						$('.orgAttribute-regAddr').text(data.data.orgAttribute.regAddr);
					}
					if( data.data.orgAttribute.countryCode!=undefined ){
						$('.orgAttribute-countryCode').text(data.data.orgAttribute.countryCode);
					}
					if( data.data.orgAttribute.regAreaCode!=undefined ){
						$('.orgAttribute-regAreaCode').text(data.data.orgAttribute.regAreaCodeStr);
					}
					if( data.data.orgAttribute.regDate!=undefined ){
						$('.orgAttribute-regDate').text(data.data.orgAttribute.regDate);
					}
					if( data.data.orgAttribute.bizScope!=undefined ){
						$('.orgAttribute-bizScope').text(data.data.orgAttribute.bizScope);
					}
					if( data.data.orgAttribute.capitalCurrency!=undefined ){
						$('.orgAttribute-capitalCurrency').text(data.data.orgAttribute.capitalCurrency);
					}
					if( data.data.orgAttribute.regCapital!=undefined ){
						$('.orgAttribute-regCapital').text(data.data.orgAttribute.regCapital);
					}
					if( data.data.orgAttribute.orgType!=undefined ){
						$('.orgAttribute-orgType').text(data.data.orgAttribute.orgType);
					}
					if( data.data.orgAttribute.orgSubType!=undefined ){
						$('.orgAttribute-orgSubType').text(data.data.orgAttribute.orgSubType);
					}
					if( data.data.orgAttribute.industry!=undefined ){
						$('.orgAttribute-industry').text(data.data.orgAttribute.industry);
					}
					if( data.data.orgAttribute.economicType!=undefined ){
						$('.orgAttribute-economicType').text(data.data.orgAttribute.economicType);
					}
					if( data.data.orgAttribute.regDuee!=undefined ){
						$('.orgAttribute-regDuee').text(data.data.orgAttribute.regDuee);
					}
					if( data.data.orgAttribute.updateDate!=undefined ){
						$('.orgAttribute-updateDate').text(data.data.orgAttribute.updateDate);
					}
				};
				// 机构基本信息-机构状态段数据项
				if( data.data.orgStatus ){
					if( data.data.orgStatus.custId!=undefined ){
						$('.orgStatus-custId').text(data.data.orgStatus.custId);
					}
					if( data.data.orgStatus.finOrgCode!=undefined ){
						$('.orgStatus-finOrgCode').text(data.data.orgStatus.finOrgCode);
					}
					if( data.data.orgStatus.accountStatus!=undefined ){
						$('.orgStatus-accountStatus').text(data.data.orgStatus.accountStatus);
					}
					if( data.data.orgStatus.enterpriseScope!=undefined ){
						$('.orgStatus-enterpriseScope').text(data.data.orgStatus.enterpriseScope);
					}
					if( data.data.orgStatus.orgStatus!=undefined ){
						$('.orgStatus-orgStatus').text(data.data.orgStatus.orgStatus);
					}
					if( data.data.orgStatus.updateDate!=undefined ){
						$('.orgStatus-updateDate').text(data.data.orgStatus.updateDate);
					}
				};
				// 机构基本信息-联络信息段数据项
				if( data.data.orgContact ){
					if( data.data.orgContact.custId!=undefined ){
						$('.orgContact-custId').text(data.data.orgContact.custId);
					}
					if( data.data.orgContact.finOrgCode!=undefined ){
						$('.orgContact-finOrgCode').text(data.data.orgContact.finOrgCode);
					}
					if( data.data.orgContact.officeAddr!=undefined ){
						$('.orgContact-officeAddr').text(data.data.orgContact.officeAddr);
					}
					if( data.data.orgContact.phoneNo!=undefined ){
						$('.orgContact-phoneNo').text(data.data.orgContact.phoneNo);
					}
					if( data.data.orgContact.financePhoneNo!=undefined ){
						$('.orgContact-financePhoneNo').text(data.data.orgContact.financePhoneNo);
					}
					if( data.data.orgContact.updateDate!=undefined ){
						$('.orgContact-updateDate').text(data.data.orgContact.updateDate);
					}
				};
				var num=0,i=0;
				// 机构基本信息-高管及主要关系人段数据项
				if( data.data.orgExecutiveList ){
					var executiveList=data.data.orgExecutiveList;
					if( executiveList.length ){
						var executiveTrs='';
						for( i=0;i<executiveList.length;i++ ){
							num=i+1;
							executiveTrs+='<tr><td style="background:#fff;">'+num+'</td>'+
											'<td style="background:#fff;">'+executiveList[i].stakeHolderTypeCN+'</td>'+
											'<td style="background:#fff;">'+executiveList[i].name+'</td>'+
											'<td style="background:#fff;">'+executiveList[i].certTypeCN+'</td>'+
											'<td style="background:#fff;">'+executiveList[i].certNo+'</td>'+
											'<td style="background:#fff;">'+executiveList[i].updateDate+'</td>'+
											'<td style="background:#fff;">'+
												'<span class="negativeInformationPlus viewTableDetailBtn" dialogUrl="/orgExecutive/getReportingView" dataId="&certType='+executiveList[i].certType+'&certNo='+executiveList[i].certNo+'">查看</span>'+
											'</td></tr>';
						}
						$(".basicInstitutionalInformation-seniorExecutive").append(executiveTrs);
					}
				};
				//机构基本信息-重要股东段数据项
				if( data.data.orgStockholderList ){
					var stockholderList=data.data.orgStockholderList;
					if( stockholderList.length ){
						var stockholderTrs='';
						for( i=0;i<stockholderList.length;i++ ){
							num=i+1;
							stockholderTrs+='<tr><td style="background:#fff;">'+num+'</td>'+
											'<td style="background:#fff;">'+stockholderList[i].stockHolderTypeCN+'</td>'+
											'<td style="background:#fff;">'+stockholderList[i].stockHolderName+'</td>'+
											'<td style="background:#fff;">'+stockholderList[i].certTypeCN+'</td>'+
											'<td style="background:#fff;">'+stockholderList[i].certNo+'</td>'+
											'<td style="background:#fff;">'+stockholderList[i].stockHoldingRatioStr+'</td>'+
											'<td style="background:#fff;">'+stockholderList[i].updateDate+'</td>'+
											'<td style="background:#fff;">'+
												'<span class="negativeInformationPlus viewTableDetailBtn" dialogUrl="/orgStockholder/getReportingView" dataId="&certType='+stockholderList[i].certType+'&certNo='+stockholderList[i].certNo+'">查看</span>'+
											'</td></tr>';
						}
						$(".basicInstitutionalInformation-stockholder").append(stockholderTrs);
					}
				};
				//机构基本信息-主要关联企业段数据项
				if( data.data.orgAffiliatedList ){
					var affiliatedList=data.data.orgAffiliatedList;
					if( affiliatedList.length ){
						var affiliatedTrs='';
						for( i=0;i<affiliatedList.length;i++ ){
							num=i+1;
							affiliatedTrs+='<tr><td style="background:#fff;">'+num+'</td>'+
											'<td style="background:#fff;">'+affiliatedList[i].affiliatedTypeCN+'</td>'+
											'<td style="background:#fff;">'+affiliatedList[i].affiliatedEntName+'</td>'+
											'<td style="background:#fff;">'+affiliatedList[i].regNoTypeCN+'</td>'+
											'<td style="background:#fff;">'+affiliatedList[i].regNo+'</td>'+
											'<td style="background:#fff;">'+affiliatedList[i].updateDate+'</td>'+
											'<td style="background:#fff;">'+
												'<span class="negativeInformationPlus viewTableDetailBtn" dialogUrl="/orgAffiliated/getReportingView" dataId="&regNoType='+affiliatedList[i].regNoType+'&regNo='+affiliatedList[i].regNo+'">查看</span>'+
											'</td></tr>';
						}
						$(".basicInstitutionalInformation-orgAffiliated").append(affiliatedTrs);
					}
				};
				//机构基本信息-上级单位(主管单位)
				if( data.data.orgParentbodyList ){
					var parentbodyList=data.data.orgParentbodyList;
					if( parentbodyList.length ){
						var parentbodyTrs='';
						for( i=0;i<parentbodyList.length;i++ ){
							num=i+1;
							parentbodyTrs+='<tr><td style="background:#fff;">'+num+'</td>'+
											'<td style="background:#fff;">'+parentbodyList[i].parentName+'</td>'+
											'<td style="background:#fff;">'+parentbodyList[i].regNoTypeCN+'</td>'+
											'<td style="background:#fff;">'+parentbodyList[i].regNo+'</td>'+
											'<td style="background:#fff;">'+parentbodyList[i].updateDate+'</td>'+
											'<td style="background:#fff;">'+
												'<span class="negativeInformationPlus viewTableDetailBtn" dialogUrl="/orgParentbody/getReportingView" dataId="&regNoType='+parentbodyList[i].regNoType+'&regNo='+parentbodyList[i].regNo+'">查看</span>'+
											'</td></tr>';
						}
						$(".basicInstitutionalInformation-orgParentbody").append(parentbodyTrs);
					}
				};
				//家族成员信息-基础段数据项
				if( data.data.orgFamilyList ){
					var familyList=data.data.orgFamilyList;
					if( familyList.length ){
						var familyTrs='';
						for( i=0;i<familyList.length;i++ ){
							num=i+1;
							familyTrs+='<tr><td style="background:#fff;">'+num+'</td>'+
											'<td style="background:#fff;">'+familyList[i].managerName+'</td>'+
											'<td style="background:#fff;">'+familyList[i].certTypeCN+'</td>'+
											'<td style="background:#fff;">'+familyList[i].certNo+'</td>'+
											'<td style="background:#fff;">'+familyList[i].memberTypeCN+'</td>'+
											'<td style="background:#fff;">'+familyList[i].memberName+'</td>'+
											'<td style="background:#fff;">'+familyList[i].memberCertTypeCN+'</td>'+
											'<td style="background:#fff;">'+familyList[i].memberCertNo+'</td>'+
											'<td style="background:#fff;">'+familyList[i].updateDate+'</td>'+
											'<td style="background:#fff;">'+
												'<span class="negativeInformationPlus viewTableDetailBtn" dialogUrl="/orgFamily/getReportingView" dataId="&certType='+familyList[i].certType+'&certNo='+familyList[i].certNo+'&memberCertType='+familyList[i].memberCertType+'&memberCertNo='+familyList[i].memberCertNo+'">查看</span>'+
											'</td></tr>';
						}
						$(".basicInstitutionalInformation-orgFamily").append(familyTrs);
					}
				};
				//借款人财务报表-2007版资产负债表段数据项
				if( data.data.finbsList ){
					var finbs=data.data.finbsList;
					if( finbs.length ){
						var finbsTrs='';
						for( i=0;i<finbs.length;i++ ){
							num=i+1;
							var reportTypeCN=finbs[i].reportTypeCN!=undefined?finbs[i].reportTypeCN:'';
							var reportSubTypeCN=finbs[i].reportSubTypeCN!=undefined?finbs[i].reportSubTypeCN:'';
							var reportType=finbs[i].reportType!=undefined?('&reportType='+finbs[i].reportType):'';
							var reportSubType=finbs[i].reportSubType!=undefined?('&reportSubType='+finbs[i].reportSubType):'';
							var dataId="&reportYear="+finbs[i].reportYear+reportType+reportSubType+"&originalReportTime="+finbs[i].originalReportTime;
							finbsTrs+='<tr><td style="background:#fff;">'+num+'</td>'+
											'<td style="background:#fff;">'+finbs[i].originalReportTime+'</td>'+
											'<td style="background:#fff;">'+finbs[i].reportYear+'</td>'+
											'<td style="background:#fff;">'+reportTypeCN+'</td>'+
											'<td style="background:#fff;">'+reportSubTypeCN+'</td>'+
											'<td style="background:#fff;">'+finbs[i].occurDate+'</td>'+
											'<td style="background:#fff;">'+
												'<span class="negativeInformationPlus viewTableDetailBtn" dialogUrl="/finbs/getReportingView" dataId='+dataId+'>查看</span>'+
											'</td></tr>';
						}
						$(".basicInstitutionalInformation-finbsList").append(finbsTrs);
					}
				};
				//借款人财务报表-2007版利润及利润分配表段数据项
				if( data.data.finpsList ){
					var finps=data.data.finpsList;
					if( finps.length ){
						var finpsTrs='';
						for( i=0;i<finps.length;i++ ){
							num=i+1;
							var reportTypeCN=finps[i].reportTypeCN!=undefined?finps[i].reportTypeCN:'';
							var reportSubTypeCN=finps[i].reportSubTypeCN!=undefined?finps[i].reportSubTypeCN:'';
							var reportType=finps[i].reportType!=undefined?('&reportType='+finps[i].reportType):'';
							var reportSubType=finps[i].reportSubType!=undefined?('&reportSubType='+finps[i].reportSubType):'';
							var dataId="&reportYear="+finps[i].reportYear+reportType+reportSubType+"&originalReportTime="+finps[i].originalReportTime;
							finpsTrs+='<tr><td style="background:#fff;">'+num+'</td>'+
											'<td style="background:#fff;">'+finps[i].originalReportTime+'</td>'+
											'<td style="background:#fff;">'+finps[i].reportYear+'</td>'+
											'<td style="background:#fff;">'+reportTypeCN+'</td>'+
											'<td style="background:#fff;">'+reportSubTypeCN+'</td>'+
											'<td style="background:#fff;">'+finps[i].occurDate+'</td>'+
											'<td style="background:#fff;">'+
												'<span class="negativeInformationPlus viewTableDetailBtn" dialogUrl="/finps/doGetReportingView" dataId='+dataId+'>查看</span>'+
											'</td></tr>';
						}
						$(".basicInstitutionalInformation-finpsList").append(finpsTrs);
					}
				};
				//借款人财务报表-2007版现金流量表段数据项
				if( data.data.fincfList ){
					var fincf=data.data.fincfList;
					if( fincf.length ){
						var fincfTrs='';
						for( i=0;i<fincf.length;i++ ){
							num=i+1;
							var reportTypeCN=fincf[i].reportTypeCN!=undefined?fincf[i].reportTypeCN:'';
							var reportSubTypeCN=fincf[i].reportSubTypeCN!=undefined?fincf[i].reportSubTypeCN:'';
							var reportType=fincf[i].reportType!=undefined?('&reportType='+fincf[i].reportType):'';
							var reportSubType=fincf[i].reportSubType!=undefined?('&reportSubType='+fincf[i].reportSubType):'';
							var dataId="&reportYear="+fincf[i].reportYear+reportType+reportSubType+"&originalReportTime="+fincf[i].originalReportTime;
							fincfTrs+='<tr><td style="background:#fff;">'+num+'</td>'+
											'<td style="background:#fff;">'+fincf[i].originalReportTime+'</td>'+
											'<td style="background:#fff;">'+fincf[i].reportYear+'</td>'+
											'<td style="background:#fff;">'+reportTypeCN+'</td>'+
											'<td style="background:#fff;">'+reportSubTypeCN+'</td>'+
											'<td style="background:#fff;">'+fincf[i].occurDate+'</td>'+
											'<td style="background:#fff;">'+
												'<span class="negativeInformationPlus viewTableDetailBtn" dialogUrl="/fincf/getReportingView" dataId='+dataId+'>查看</span>'+
											'</td></tr>';
						}
						$(".basicInstitutionalInformation-fincfList").append(fincfTrs);
					}
				};
				//借款人关注信息表-诉讼信息段数据项
				if( data.data.custLawsuitList ){
					var custLawsuitList=data.data.custLawsuitList;
					if( custLawsuitList.length ){
						var custLawsuitTrs='';
						for( i=0;i<custLawsuitList.length;i++ ){
							num=i+1;
							custLawsuitTrs+='<tr><td style="background:#fff;">'+num+'</td>'+
											'<td style="background:#fff;">'+custLawsuitList[i].lawNo+'</td>'+
											'<td style="background:#fff;">'+custLawsuitList[i].occurDate+'</td>'+
											'<td style="background:#fff;text-align:right;">'+handleListAmountFn(custLawsuitList[i].sentenceExecAmount,custLawsuitList[i].currency)+'</td>'+
											'<td style="background:#fff;">'+custLawsuitList[i].sentenceExecDate+'</td>'+
											'<td style="background:#fff;">'+
												'<span class="negativeInformationPlus viewTableDetailBtn" dialogUrl="/custLawsuit/getReportingView" dataId="&lawNo='+custLawsuitList[i].lawNo+'">查看</span>'+
											'</td></tr>';
						}
						$(".basicInstitutionalInformation-custLawsuit").append(custLawsuitTrs);
					}
				};
				//借款人关注信息表-其他大事信息段数据项
				if( data.data.custEventList ){
					var custEventList=data.data.custEventList;
					if( custEventList.length ){
						var custEventTrs='';
						for( i=0;i<custEventList.length;i++ ){
							num=i+1;
							custEventTrs+='<tr><td style="background:#fff;">'+num+'</td>'+
											'<td style="background:#fff;">'+custEventList[i].eventNo+'</td>'+
											'<td style="background:#fff;">'+custEventList[i].occurDate+'</td>'+
											'<td style="background:#fff;">'+custEventList[i].eventDesc+'</td>'+
											'<td style="background:#fff;">'+
												'<span class="negativeInformationPlus viewTableDetailBtn" dialogUrl="/custEvent/getReportingView" dataId="&eventNo='+custEventList[i].eventNo+'">查看</span>'+
											'</td></tr>';
						}
						$(".basicInstitutionalInformation-custEvent").append(custEventTrs);
					}
				};
				//不良信贷资产处置信息表-资产处置信息段数据项
				if( data.data.badCreditAssetList ){
					var badCreditAssetList = data.data.badCreditAssetList;
					if( badCreditAssetList.length ){
						var badCreditAssetTrs = '';
						for( i=0;i<badCreditAssetList.length;i++ ){
							num = i+1;
							badCreditAssetTrs += '<tr><td style="background:#fff;">'+num+'</td>'+
													'<td style="background:#fff;">'+badCreditAssetList[i].bizNo+'</td>'+
													'<td style="background:#fff;">'+badCreditAssetList[i].occurDate+'</td>'+
													'<td style="background:#fff;text-align:right;">'+handleListAmountFn(badCreditAssetList[i].balance,(badCreditAssetList[i].currency?badCreditAssetList[i].currency.code:''))+'</td>'+
													'<td style="background:#fff;">'+badCreditAssetList[i].disposeDate+'</td>'+
													'<td style="background:#fff;">'+badCreditAssetList[i].disposeType+'</td>'+
													'<td style="background:#fff;text-align:right;">'+handleListAmountFn(badCreditAssetList[i].recycledAmount,(badCreditAssetList[i].currency?badCreditAssetList[i].currency.code:''))+'</td>'+
													'<td style="background:#fff"><span class="negativeInformationPlus viewTableDetailBtn viewBadCredit" bizNo="'+badCreditAssetList[i].bizNo+'" occurDate="'+badCreditAssetList[i].occurDate+'">查看</span></td></tr>';
						};
						$('.basicInstitutionalInformation-badCreditAsset').append(badCreditAssetTrs)
					};
				};
				
			},
			error:function(status){
				new $.zui.Messager('查询基本信息时出错', {
				    type: 'danger'
				}).show();
			}
		})
	};
	getSubjectBasicInfo();
	
	// 切换导航
	$('.projectListTab li.sellerBasicLi').click(function(){// 卖方基本信息
		if( !$(this).hasClass('active') ){
			$(".yk_rightcontent").load("/creditReportingBasicInfo/sellerView");
		};
	});
	$('.projectListTab li.buyerBasicLi').click(function(){// 买方基本信息
		if( !$(this).hasClass('active') ){
			$(".yk_rightcontent").load("/creditReportingBasicInfo/buyerView");
		};
	});
	$('.projectListTab li.businessBasicBuyerLi').click(function(){// 买方业务信息
		if( !$(this).hasClass('active') ){
			$(".yk_rightcontent").load("/creditreporting/businessInfo/buyerView?creditReportingId="+creditReportQuery.creditReportingId+'&custId='+creditReportQuery.counterpartyId);
		};
	});
	$('.projectListTab li.businessBasicSellerLi').click(function(){// 卖方业务信息
		if( !$(this).hasClass('active') ){
			$(".yk_rightcontent").load("/creditreporting/businessInfo/sellerView?creditReportingId="+creditReportQuery.creditReportingId+'&custId='+creditReportQuery.creditSubjectId);
		};
	});
	
	// 查看不良信贷弹框
	function showBadCreditDialogFn(bizNo,occurDate,custId){
		$('#myModal-viewBadCreditDialog').find('input').val('');
		$.ajax({
			url:'/creditReportingBasicInfo/badCreditAsset/getReportingView',
			type:'get',
			data:{
				'custId':custId,
				'bizNo':bizNo,
				'occurDate':occurDate
			},
			success:function(data){
				if( data.success ){
					$('#myModal-viewBadCreditDialog').modal('show');
					$('.badCreditDialog-bizNo').val(data.data.bizNo);
					$('.badCreditDialog-occurDate').val(data.data.occurDate);
					$('.badCreditDialog-borrowerName').val(data.data.borrowerName);
					$('.badCreditDialog-currency').val(data.data.currency.code);
					$('.badCreditDialog-balance').val(commaDelimiter(data.data.balance));
					$('.badCreditDialog-disposeDate').val(data.data.disposeDate);
					$('.badCreditDialog-disposeTypeCN').val(data.data.disposeType);
					$('.badCreditDialog-recycledAmount').val(commaDelimiter(data.data.recycledAmount));
				}else{
					 new $.zui.Messager('查询不良信贷信息失败:'+data.msg, {
					    type: 'danger'
					 }).show();	
				}
			},
			error:function(status){
				 new $.zui.Messager('查询不良信贷信息时出错:'+status, {
				    type: 'danger'
				 }).show();	
			}
		})
	};
	
	//卖方页面的查看按钮的点击
	$(".sellerBasicInfo").delegate(".viewTableDetailBtn","click",function(){
		if( $(this).hasClass('viewBadCredit') ){// 不良信贷
			showBadCreditDialogFn($(this).attr('bizNo'),$(this).attr('occurDate'),creditReportQuery.creditSubjectId);
		}else{
			var url='/creditReportingBasicInfo'+$(this).attr("dialogUrl")+'?creditReportingId='+creditReportQuery.creditReportingId+'&custId='+creditReportQuery.creditSubjectId+$(this).attr("dataId");
			$("#infoDialog").load(url,function(){
				$("#creditReportingDialog").modal("show");
			})
		};
	});
	//买方页面的查看按钮的点击
	$(".buyerBasicInfo").delegate(".viewTableDetailBtn","click",function(){
		if( $(this).hasClass('viewBadCredit') ){// 不良信贷
			showBadCreditDialogFn($(this).attr('bizNo'),$(this).attr('occurDate'),creditReportQuery.counterpartyId);
		}else{
			var url='/creditReportingBasicInfo'+$(this).attr("dialogUrl")+'?creditReportingId='+creditReportQuery.creditReportingId+'&custId='+creditReportQuery.counterpartyId+$(this).attr("dataId");
			$("#infoDialog").load(url,function(){
				$("#creditReportingDialog").modal("show");
			})
		};
	});
	
	// 买方修改按钮
	$('.updateNewsBtnBuy').click(function(){
		$(".yk_rightcontent").load("/creditReportingBasicInfo/buyerEdit?creditReportingId="+creditReportQuery.creditReportingId+'&custId='+creditReportQuery.counterpartyId);
		return false;
	});
	
	
	// 卖方修改按钮
	$('.updateNewsBtnSell').click(function(){
		$(".yk_rightcontent").load("/creditReportingBasicInfo/sellerEdit?creditReportingId="+creditReportQuery.creditReportingId+'&custId='+creditReportQuery.creditSubjectId);
		return false;
	});
	
	// 返回上级列表
	$(".newBackBtn").click(function(){
		$(".yk_rightcontent").load("/creditreporting/list");
		return false;
	});
	
})
