<template>
	<view class="evan-form-show">
		<view class="bottom-border">
			<view class="left-border"><text class="mgl10">基本信息</text></view>
		</view>
		<uni-forms :value="formData" ref="form" validate-trigger="bind" err-show-type="toast">
			<uni-forms-item name="cusType" :label="fromData[0]?fromData[0].name:'客户类型'">
				<uni-data-checkbox v-model="cusType" :localdata="cusTypeList"></uni-data-checkbox>
			</uni-forms-item>
			<uni-forms-item name="code" :label="fromData[1]?fromData[1].name:'客户编号'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="code" :placeholder="fromData[1]&&fromData[1].prompt?fromData[1].prompt:'请输入'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="name" :label="fromData[2]&&fromData[2].name?fromData[2].name:'客户名称'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="name" :placeholder="fromData[2]&&fromData[2].prompt?fromData[2].prompt:'请选择'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="socialUnifiedCode" :label="fromData[3]&&fromData[3].name?fromData[3].name:'社会统一代码'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="clientMessageFrom.socialUnifiedCode" :placeholder="fromData[3]&&fromData[3].prompt?fromData[3].prompt:'系统读取'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone" :label="fromData[4]&&fromData[4].name?fromData[4].name:'联系电话'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="clientMessageFrom.phone" :placeholder="fromData[4]&&fromData[4].prompt?fromData[4].prompt:'系统读取'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone" :label="fromData[5]&&fromData[5].name?fromData[5].name:'注册时间'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="clientMessageFrom.registerTime" :placeholder="fromData[5]&&fromData[5].prompt?fromData[5].prompt:'系统读取'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone" :label="fromData[6]&&fromData[6].name?fromData[6].name:'注册资金(万元)'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="clientMessageFrom.registeredCapital" placeholder="注册资金"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone" :label="fromData[7]&&fromData[7].name?fromData[7].name:'注册地址'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="clientMessageFrom.registerAddr" :placeholder="fromData[7]&&fromData[7].prompt?fromData[7].prompt:'系统读取'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone" :label="fromData[8]&&fromData[8].name?fromData[8].name:'员工人数'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="clientMessageFrom.empNum" :placeholder="fromData[8]&&fromData[8].prompt?fromData[8].prompt:'系统读取'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone" :label="fromData[9]&&fromData[9].name?fromData[9].name:'经营地址'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="clientMessageFrom.businessAddr" :placeholder="fromData[9]&&fromData[9].prompt?fromData[9].prompt:'系统读取'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone" :label="fromData[10]&&fromData[10].name?fromData[10].name:'业务类别'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="enterpriseForm.businessType" :placeholder="fromData[10]&&fromData[10].prompt?fromData[10].prompt:'业务类别'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone" :label="fromData[11]&&fromData[11].name?fromData[11].name:'经营范围'">
				<uni-easyinput disabled type="textarea" v-model="clientMessageFrom.businessScope" :placeholder="fromData[11]&&fromData[11].prompt?fromData[11].prompt:'经营范围'"></uni-easyinput>
			</uni-forms-item>
		</uni-forms>
				
		<view class="bottom-border">
			<view class="left-border"><text class="mgl10">法人信息</text></view>
		</view>
		
		<uni-forms :value="enterpriseFrom" ref="form" validate-trigger="bind" err-show-type="toast">
			<uni-forms-item name="cusType" :label="fromData[12]&&fromData[12].name?fromData[12].name:'姓名'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="clientMessageFrom.legalName" :placeholder="fromData[12]&&fromData[12].prompt?fromData[12].prompt:'系统读取'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="gender" :label="fromData[13]&&fromData[13].name?fromData[13].name:'性别'">
				<uni-data-checkbox disabled v-model="clientMessageFrom.legalGender" :localdata="genderList"></uni-data-checkbox>
			</uni-forms-item>
			<uni-forms-item name="name" :label="fromData[14]&&fromData[14].name?fromData[14].name:'身份证号码'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="clientMessageFrom.legalIdNumber" :placeholder="fromData[14]&&fromData[14].prompt?fromData[14].prompt:'系统读取'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="socialUnifiedCode" :label="fromData[15]&&fromData[15].name?fromData[15].name:'联系电话'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="clientMessageFrom.legalPhone" :placeholder="fromData[15]&&fromData[15].prompt?fromData[15].prompt:'系统读取'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone" :label="fromData[16]&&fromData[16].name?fromData[16].name:'户口所在地'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="clientMessageFrom.legalHukouAddr" :placeholder="fromData[16]&&fromData[16].prompt?fromData[16].prompt:'系统读取'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone" :label="fromData[17]&&fromData[17].name?fromData[17].name:'家庭住址'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="clientMessageFrom.legalHomeAddr" :placeholder="fromData[17]&&fromData[17].prompt?fromData[17].prompt:'系统读取'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="isExist" :label="fromData[18]&&fromData[18].name?fromData[18].name:'是否存在关联人'">
				<uni-data-checkbox v-model="enterpriseForm.isExistRelated" :localdata="isExistList"></uni-data-checkbox>
			</uni-forms-item>
		</uni-forms>
		
		<view class="bottom-border" v-if="enterpriseForm.isExistRelated">
			<view class="left-border"><text class="mgl10">关联人信息</text></view>
		</view>
			
		<!-- 展示关联人,传递handle默认false不禁用，传递companyId调用获取关联人接口 -->
		<linkMan v-if="enterpriseForm.isExistRelated==1" :handle="true" :companyId="companyId"></linkMan>
		
		
		<view class="bottom-border">
			<view class="left-border"><text class="mgl10">申请贷款相关信息</text></view>
		</view>
		
		<uni-forms :value="enterpriseFrom" ref="form" validate-trigger="bind" err-show-type="toast">
			<uni-forms-item name="cusType" :label="fromData[19]&&fromData[19].name?fromData[19].name:'申请额度(万元)'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="enterpriseForm.applyAmount" :placeholder="fromData[19]&&fromData[19].prompt?fromData[19].prompt:'请输入申请额度'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="name" :label="fromData[20]&&fromData[20].name?fromData[20].name:'申请期限'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="enterpriseForm.applyTime" :placeholder="fromData[20]&&fromData[20].prompt?fromData[20].prompt:'申请期限'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="name" :label="fromData[21]&&fromData[21].name?fromData[21].name:'贷款银行'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="mainbank" :placeholder="fromData[21]&&fromData[21].prompt?fromData[21].prompt:'请输入银行名称'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="name" label="分行">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="elsebank" @input="bankgroup($event,'else')" placeholder="分行名称"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="name" :label="fromData[22]&&fromData[22].name?fromData[22].name:'贷款用途'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="enterpriseForm.amountWide" :placeholder="fromData[22]&&fromData[22].prompt?fromData[22].prompt:'选择贷款用途'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item v-if="enterpriseForm.amountWide=='其他'" name="name" label="其他贷款用途">
				<uni-easyinput :disabled="handle=='watch'" type="text" :inputBorder="true" v-model="enterpriseForm.otherAmountWide" placeholder="其他贷款用途"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item  name="enGuaranteeMeasures" :label="fromData[23]&&fromData[23].name?fromData[23].name:'反担保措施'">
				<uni-data-checkbox disabled multiple mode="list" @change='test' v-model="enterpriseForm.enGuaranteeMeasures" :localdata="easuresList"></uni-data-checkbox>
			</uni-forms-item>
			<uni-forms-item name="name"  label="反担保措施描述">
				<uni-easyinput disabled type="textarea" v-model="enterpriseForm.remarks" :placeholder="fromData[23]&&fromData[23].prompt?fromData[23].prompt:'反担保措施描述'"></uni-easyinput>
			</uni-forms-item>
		</uni-forms>
		
		<view class="bottom-border">
			<view class="left-border"><text class="mgl10">资产信息</text></view>
		</view>
		
		<uni-forms :value="enterpriseFrom" ref="form" validate-trigger="bind" err-show-type="toast">
			<uni-forms-item  name="cusType" :label="fromData[36]&&fromData[36].name?fromData[36].name:'资产评估报告(名称)'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="assetFromData.assetsName" :placeholder="fromData[36]&&fromData[36].prompt?fromData[36].prompt:'资产评估报告'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="name" :label="fromData[37]&&fromData[37].name?fromData[37].name:'资产评估报告编号'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="assetFromData.assetsCode" :placeholder="fromData[37]&&fromData[37].prompt?fromData[37].prompt:'资产评估报告编号'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="amountSum" required :label="fromData[38]&&fromData[38].name?fromData[38].name:'评估价值(万元)'">
				<!-- <uni-data-checkbox @change="getCost" :inputVisble="true" :multiple="true" mode="list" v-model="enterpriseFrom.gender" :localdata="EvaluationList"></uni-data-checkbox> -->
				<!-- :checked="item.selected" 是否勾选 -->
				<checkbox-group class="coust">
					<label class="flex-end coust">
						<uni-data-checkbox  v-model="house" :checked="house" :localdata="houses" @tap="Checked(1)"></uni-data-checkbox>
						<uni-easyinput @input='allTotal' class="wd60" disabled type="digit" :inputBorder="true"  v-model="assetFromData.houseMoney" placeholder="房产价值"></uni-easyinput>
					</label>
					<label class="flex-end margin-tb-sm">
						<uni-data-checkbox v-model="car" :localdata="cars" @tap="Checked(2)"></uni-data-checkbox>
						<uni-easyinput @input='allTotal' class="wd60" disabled type="digit" :inputBorder="true" v-model="assetFromData.carMoney" placeholder="车辆价值"></uni-easyinput>					
					</label>
					<label class="flex-end">
						<uni-data-checkbox v-model="equipment" :localdata="equipments" @tap="Checked(3)"></uni-data-checkbox>
						<uni-easyinput @input='allTotal' class="wd60" disabled type="digit" :inputBorder="true" v-model="assetFromData.equipmentMoney" placeholder="设备价值"></uni-easyinput>
					</label>
					<label class="flex-end margin-tb-sm">
						<uni-data-checkbox v-model="elseMoney" :localdata="elseMoneys" @tap="Checked(4)"></uni-data-checkbox>
						<uni-easyinput @input='allTotal' class="wd60" disabled type="digit" :inputBorder="true" v-model="assetFromData.otherMoney" placeholder="其他资产"></uni-easyinput>					
					</label>
				</checkbox-group>
				<view class="flex-end">
					<text>合计</text>
					<uni-easyinput disabled type="text" :inputBorder="true" v-model="assetFromData.amountSum" placeholder="自动合计"></uni-easyinput>
				</view>
			</uni-forms-item>
			<uni-forms-item name="assetsTime" :label="fromData[39]&&fromData[39].name?fromData[39].name:'评估日期'">
				<uni-easyinput  disabled type="text" :inputBorder="true" v-model="assetFromData.assetsTime" :placeholder="fromData[39]&&fromData[39].prompt?fromData[39].prompt:'评估日期'">></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="auditCode" required :label="fromData[40]&&fromData[40].name?fromData[40].name:'审计编号'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="assetFromData.auditCode" :placeholder="fromData[40]&&fromData[40].prompt?fromData[40].prompt:'审计编号'"></uni-easyinput>
			</uni-forms-item>	
			<uni-forms-item name="auditName" required :label="fromData[42]&&fromData[42].name?fromData[42].name:'审计报告(名称)'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="assetFromData.auditName" :placeholder="fromData[42]&&fromData[42].prompt?fromData[42].prompt:'审计报告'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="time" required :label="fromData[41]&&fromData[41].name?fromData[41].name:'审计日期'">
				<uni-easyinput  disabled type="text" :inputBorder="true" v-model="assetFromData.auditTime" :placeholder="fromData[41]&&fromData[41].prompt?fromData[41].prompt:'审计日期'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="auditAmount" required :label="fromData[43]&&fromData[43].name?fromData[43].name:'审计价值(万元)'">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="assetFromData.auditAmount" :placeholder="fromData[43]&&fromData[43].prompt?fromData[43].prompt:'审计价值'"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone"  label="担保部期限">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="assetFromData.guaranteeTerm" placeholder="审计价值"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone"  label="担保部金额">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="assetFromData.guaranteeAmount" placeholder="审计价值"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone"  label="资产部期限">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="assetFromData.term" placeholder="审计价值"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item name="phone"  label="资产部金额">
				<uni-easyinput disabled type="text" :inputBorder="true" v-model="assetFromData.amount" placeholder="审计价值"></uni-easyinput>
			</uni-forms-item>
		</uni-forms>
		
		<view class="bottom-border">
			<view class="left-border"><text class="mgl10">附件</text></view>
		</view>
		
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[24].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[24]&&fromData[24].name?fromData[24].name:'上传营业执照'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[0]" :handle="false"></upload>
		</view>
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[25].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[25]&&fromData[25].name?fromData[25].name:'上传法定代表人夫妻及企业实际经营者身份证附件'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[1]" :handle="false"></upload>
		</view>
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[26].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[26]&&fromData[26].name?fromData[26].name:'上传法定代表人夫妻户口本、结婚证（离婚证）'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[2]" :handle="false"></upload>
		</view>
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[27].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[27]&&fromData[27].name?fromData[27].name:'上传法定代表人身份证证明'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[3]" :handle="false"></upload>
		</view>
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[28].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[28]&&fromData[28].name?fromData[28].name:'上传公司章程'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[4]" :handle="false"></upload>
		</view>
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[29].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[29]&&fromData[29].name?fromData[29].name:'上传由会计师事务所审计的上一年度及本年度审计报告'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[5]" :handle="false"></upload>
		</view>
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[30].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[30]&&fromData[30].name?fromData[30].name:'上传企业信用报告'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[6]" :handle="false"></upload>
		</view>
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[31].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[31]&&fromData[31].name?fromData[31].name:'上传企业法人夫妇信用报告、实际经营者信用报告'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[7]" :handle="false"></upload>
		</view>
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[32].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[32]&&fromData[32].name?fromData[32].name:'上传征信业务授权书、承诺书'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[8]" :handle="false"></upload>
		</view>
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[33].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[33]&&fromData[33].name?fromData[33].name:'上传增值税纳税报表首表/完税证明'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[9]" :handle="false"></upload>
		</view>
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[34].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[34]&&fromData[34].name?fromData[34].name:'上传股东会会议纪要'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[10]" :handle="false"></upload>
		</view>
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[35].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[35]&&fromData[35].name?fromData[35].name:'上传反担保资料和评估报告'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[11]" :handle="false"></upload>
		</view>
		<view class="cu-bar bg-white">
			<view class="action">
				<text v-if="!fromData[44].ifRequired" class="is-required">*</text>
				<text class="label-color">{{fromData[44]&&fromData[44].name?fromData[44].name:'其他'}}</text>
			</view>
		</view>
		<view >
			<upload :files="filesArray[12]" :handle="false"></upload>
		</view>
		
		<!-- 判断当前是否调查员查看，调查员可查看当前数据，待完善 -->
		<view class="bottom-border" v-if="handle==='survey'||handle=='watch'&&roleSurvey">
			<view class="left-border"><text class="mgl10">调查信息</text></view>
		</view>
		<view class="cu-bar bg-white" v-if="handle==='survey'||handle=='watch'&&roleSurvey">
			<view class="action">
				<text class="is-required">*</text>
				<text class="label-color">上传附件</text>
			</view>
		</view>
		<upload v-if="handle==='survey'||handle=='watch'&&roleSurvey" @upload="uploadFile" :files="filesArray[12]" :handle="handle=='survey'"></upload>
		
		<!-- 调查员审核意见 -->
		<view v-if="handle==='survey'||handle=='watch'&&roleSurvey" class="self margin-top">
			<text style="color: #00B9FF;" class="label-audit">审核意见</text>
			<uni-easyinput :disabled="handle=='watch'" type="textarea" v-model="complianceSurveyFrom.opinion" placeholder="请输入审核意见"></uni-easyinput>
		</view>
		<view class="bottom-border" v-if="handle==='audit'||handle=='watch'&&roleManage||handle=='watch'&&roleLeader">
			<view class="left-border"><text class="mgl10">审核意见</text></view>
		</view>
		<!-- 领导审核意见--在领导查看时展示，需要角色进行判断，待完善 -->
		<view v-if="handle==='audit'||handle=='watch'&&roleManage||handle=='watch'&&roleLeader" class="self margin-top" >
			<text style="color: #00B9FF;" class="label-audit">审核意见</text>
			<uni-easyinput :disabled="handle=='watch'" type="textarea" v-model="complianceAuditFrom.opinion" placeholder="请输入审核意见"></uni-easyinput>
		</view>
		
		<view class="foot-btn btn-rig pad-bt margin-top">
			<button plain class="mini-btn round plain-btn" type="primary" size="mini" @tap="back()">返回</button>
			<!-- 调查员 -->
			<button v-if="handle==='survey'" class="mini-btn round def-btn mar-lr" type="primary" size="mini" @tap="complianceSurvey(1)">同意</button>
			<button v-if="handle==='survey'" class="mini-btn round suc-btn" type="primary" size="mini" @tap="complianceSurvey(2)">驳回</button>
			<!-- 经理/领导 -->
			<button v-if="handle==='audit'" class="mini-btn round suc-btn" type="primary" size="mini" @tap="complianceAudit(1)">同意</button>
			<button v-if="handle==='audit'" class="mini-btn round suc-btn" type="primary" size="mini" @tap="complianceAudit(3)">拒绝</button>
			<button v-if="handle==='audit'" class="mini-btn round suc-btn" type="primary" size="mini" @tap="complianceAudit(2)">驳回</button>
		</view>
		
		<timeline></timeline>
		<!-- <multiple-select
			v-model="show"
			:data="enGuaranteeDatas"
			:default-selected="defaultSelected"
			@confirm="confirm"
		></multiple-select> -->
	</view>
</template>

<script>
	import utils from '@/components/evan-form/utils.js'
	import upload from '../../../components/pretty-uploadFile/pretty-uploadFile.vue'
	const CONTACT_INFO={
		name:'',
		phone:'',
		duty:''
	}
	export default {
		components: {
			upload
		},
		data() {
			return {
				code:'',
				name:'',
				show:false,
				cusTypeList: [
					// {
					// 	text: '个人',
					// 	value: '1',
					// 	disabled:true
					// },
				{
					text: '企业',
					value: '2',
					disabled:true
				}],//客户类型列表
				cusType: '2',
				employeeMsg: [{
					name: '个人',
					value: '3'
				},
				{
					name: '企业',
					value: '4'
				}],//客户经理列表
				genders: [{//性别列表-禁用
					text: '男',
					value: 1,
				},
				{
					text: '女',
					value: 0,
				}],
				house:'',
				houses:[{
					text: '房产',
					value: '房产',
					disabled:true
				}],
				car:'',
				cars:[{
					text: '车辆',
					value: '车辆',
					disabled:true
				}],
				equipment:'',
				equipments:[{
					text: '设备',
					value: '设备',
					disabled:true
				}],
				elseMoney:'',
				elseMoneys:[{
					text: '其他',
					value: '其他',
					disabled:true
				}],
				easuresList: [{
					text: '第三方保证',
					value: '第三方保证',
					disabled:true
				},
				{
					text: '抵押',
					value: '抵押',
					disabled:true
				},
				{
					text: '个人无限责任连带',
					value: '个人无限责任连带',
					disabled:true
				},
				{
					text: '质押',
					value: '质押',
					disabled:true
				}],
				imgList: [],
				maritalList: ['未婚','已婚','离异','再婚'],//婚姻状况列表
				educationList: ['本科','大专','高职','中专','其他'],//学历列表
				isExistList: [{
					text: '否',
					value: 0,
					disabled:true
				},
				{
					text: '是',
					value: 1,
					disabled:true
				}],//是否存在关联人列表
				manager: '',
				// enterpriseFrom: {
				// 	maritalStatus: 0,//婚姻状况
				// 	gender: 1,//性别
				// 	education: 0, //学历
				// 	legalGender: 1, //关联人性别
				// 	isExistRelated: 0, //是否存在关联人
				// 	enGuaranteeMeasures:[1,2,3] 
				// },//个人form
				enterpriseForm: {
					enGuaranteeMeasures:[1,2,3],
					
				},//企业form
				hideRequiredAsterisk: false,
				// 表单的内容必须初始化
				info: {
					name: '',
					email: '',
					desc: '',
					phone: '',
					sex: '',
				},
				rules: {
					cusType: {
						required: true,
						message: '请选择客户'
					},
					code: {
						required: true,
						message: '请选择客户编号'
					},
					manager: {
						required: true,
						message: '请选择客户经理'
					},
					name: {
						required: true,
						message: '请输入姓名'
					},
					email: [{
						required: true,
						message: '请输入邮箱'
					}, {
						type: 'email',
						message: '邮箱格式不正确'
					}],
					desc: [{
							required: true,
							message: '请输入简介'
						},
						{
							min: 10,
							max: 30,
							message: '简介必须在10到30个字之间'
						}
					],
					phone: [{
							required: true,
							message: '请输入手机号'
						},
						{
							validator: (rule, value, callback) => {
								// 注意这里如果用的是methods里的isMobilePhone将不生效
								if (this.$utils.isMobilePhone(value)) {
									callback()
								} else {
									callback(new Error('手机号格式不正确'))
								}
							}
						},
						// 或者这样也是可以的
						// {
						// 	validator: this.isMobile
						// }
					],
					sex: {
						required: true,
						message: '请选择性别'
					}
				},
				genderList: [{//性别列表-禁用
					text: '男',
					value: 1,
					disabled:true
				},
				{
					text: '女',
					value: 0,
					disabled:true
				}],
				info2:{
					name:'',
					email:'',
					phone:''
				},
				rules2:{
					name: {
						required: true,
						message: '请输入姓名'
					},
					email: [{
						required: true,
						message: '请输入邮箱'
					}, {
						type: 'email',
						message: '邮箱格式不正确'
					}],
					phone:[{
							required: true,
							message: '请输入手机号'
						},
						{
							pattern:'^1\\d{10}$', // 注意这里由于小程序的缘故正则表达式需要通过string的方式传递并且去除两边的斜杠，中间的斜杠变成两个斜杠
							message:'手机号格式不正确'
						}
					]
				},
				dynamicInfo:{
					test1:'',
					test2:'',
					list:[{...CONTACT_INFO}]
				},
				dynamicRules:{
					test1:[{required:true,message:'请输入rule规则字段'},{min:4,max:8,message:'必须4-8位'}]
				},
				showRuleParam:true,
				showRequiredParam:true,
				mobileRules:[{required:true,message:'请输入手机号'},{pattern:'^1\\d{10}$',message:'手机号格式不正确'}], // 注意这里由于小程序的缘故正则表达式需要通过string的方式传递并且去除两边的斜杠，中间的斜杠变成两个斜杠
				complianceSurveyFrom:{// 调查员上传表单
					opinion:'',// 审核意见
					fileUrls:[]// 上传文件
				},
				complianceAuditFrom:{// 领导表单
					opinion:'',// 审核意见
					
				},
				handle:'',// 操作状态
				getItem:{},// 获取列表传值
				assetFromData:{},// 
				clientMessageFrom:{},// 
				mainbank:'',
				elsebank:'',
				filesArray:[],
				
				roleSurvey:false,
				roleManager:false,
				roleLeader:false,
				companyId:'',
				
				fromData: [],
				upDataArr: [],
				uploadFileList: []
				
			}
		},
		destroyed() {// 销毁组件操作
			uni.removeStorageSync('handleGe')
			uni.removeStorageSync('applyMsg')
			uni.removeStorageSync('copyData')
		},
		created() {
			// 判断来自待处理否
			if(uni.getStorageSync('decideIndex')){
				let data = JSON.parse(uni.getStorageSync('decideIndex'))
				this.getItem.iid = data.detailId
				if(data.btn==='调查'){
					this.handle = 'survey'
				}else{// 审核
					this.handle = 'audit'
				}
				uni.removeStorageSync('decideIndex')
			}else if(uni.getStorageSync('copyData')){
				let data =JSON.parse(uni.getStorageSync('copyData')) 
				this.handle = 'watch'
				this.getItem.iid = data.detailId
			}else{
				this.handle = uni.getStorageSync('handleGe')// 取得操作状态
			}
			// 判断操作禁用
			if(this.handle==='survey'){// 处于调查时
				
			}else{// 非调查时
				
			}
			if(uni.getStorageSync('applyMsg')){ // 取得传参,取得ID等
				this.getItem = JSON.parse(uni.getStorageSync('applyMsg')) 
			}
			this.complianceDetail()// 当前详情
			
			// 判断调查员，经理，领导
			this.roleSurvey = this.judgeRole('69')
			this.roleManager = this.judgeRole('68')
			this.roleLeader = this.judgeRole('70')
			this.designFrom()
		},
		mounted() {
			// 这里必须放在mounted中，不然h5，支付宝小程序等会找不到this.$refs.form
			this.$refs.form.setRules(this.rules)
		},
		methods: {
			designFrom(){// 表单数据接口
				this.$http.get('/api-guarantee/form/design/list',{
					processId: 5
				}).then(res=>{
					if(!res.data||res.data.length==0) return
					this.fromData = res.data 
					this.fromData.sort(this.compare('id'))// 排序对象
					this.upDataArr = []
					this.upDataArr.push(this.fromData[24].ifRequired,this.fromData[25].ifRequired,this.fromData[26].ifRequired,this.fromData[27].ifRequired,this.fromData[28].ifRequired,this.fromData[29].ifRequired,this.fromData[30].ifRequired,this.fromData[31].ifRequired,this.fromData[32].ifRequired,this.fromData[33].ifRequired,this.fromData[34].ifRequired,this.fromData[35].ifRequired )
					// this.uploadFile = []
					// this.uploadFile.push(this.fromData[24].name,this.fromData[25].name,this.fromData[26].name,this.fromData[27].name,this.fromData[28].name,this.fromData[29].name,this.fromData[30].name,this.fromData[31].name,this.fromData[32].name,this.fromData[33].name,this.fromData[34].name,this.fromData[35].name)
				})
			},
			compare(key){ // 用于对象数组排序
				return function(value1,value2){
					let val1=value1[key];
					let val2=value2[key];
					return val1-val2;
				}
			},
			// 判断角色权限方法--小程序版
			judgeRole(role){
				let roleArr = uni.getStorageSync('roleArr')
				if (roleArr.includes(role)) return true
				else return false
			},
			//客户类型选择
			cusChange(e) {
				this.cusType = e.detail.value
			},
			//性别选择
			genderChange(e) {
				this.personageForm.gender = e.detail.value
			},
			//婚姻状况选择
			maritalChange(e) {
				this.personageForm.maritalStatus = e.detail.value
			},
			//学历选择
			educationChange(e) {
				this.personageForm.education = e.detail.value
			},
			//关联人性别选择
			legalGenderChange(e) {
				this.personageForm.legalGender = e.detail.value
			},
			isExistChange(e) {
				this.personageForm.isExistRelated = e.detail.value
			},
			bindPickerChange: function(e) {
				// this.cusType = e.target.value
			},
			save() {
				this.$refs.form.validate((res) => {
					if (res) {
						uni.showToast({
							title: '验证通过'
						})
					}
				})
			},
			promiseSave(){
				this.$refs.form.validate().then((res)=>{
					uni.showToast({
						title: '验证通过'
					})
				}).catch(()=>{
				})
			},
			async asyncSave(){
				try{
					const result=await this.$refs.form.validate()
					if(result){
						uni.showToast({
							title: '验证通过'
						})
					}
				} catch(e){
				}
			},
			saveForm2(){
				this.$refs.form2.validate((res) => {
					if (res) {
						uni.showToast({
							title: '验证通过'
						})
					}
				})
			},
			utilsSave() {
				utils.validate(this.info, this.rules, (res, errors) => {
					if (res) {
						uni.showToast({
							title: '验证通过'
						})
					}
				})
			},
			validateSingle() {
				this.$refs.form.validateField('email', (res) => {
					if (res) {
						uni.showToast({
							title: '验证通过'
						})
					}
				})
			},
			validateMultiple() {
				this.$refs.form.validateField(['email', 'phone'], (res) => {
					if (res) {
						uni.showToast({
							title: '验证通过'
						})
					}
				})
			},
			isMobilePhone() {
				const reg = /^1\d{10}$/
				if (reg.test(value)) {
					return true
				}
				return false
			},
			isMobile(rule, value, callback) {
				if (this.$utils.isMobilePhone(value)) {
					callback()
				} else {
					callback(new Error('手机号格式不正确'))
				}
			},
			sexChange(e) {
				this.info.sex = e.detail.value
			},
			addContact(){
				this.dynamicInfo.list.push({...CONTACT_INFO})
			},
			deleteContact(index){
				this.dynamicInfo.list.splice(index,1)
			},
			toggleRuleParam(){
				this.showRuleParam=!this.showRuleParam
			},
			toggleRequiredParam(){
				this.showRequiredParam=!this.showRequiredParam
			},
			dynamicSave(){
				this.$refs.dynamicForm.validate((res)=>{
					if(res){
						uni.showToast({
							title: '验证通过'
						})
					}
				})
			},
			ViewImage(e) {
				uni.previewImage({
					urls: this.imgList,
					current: e.currentTarget.dataset.url
				});
			},
			DelImg(e) {
				uni.showModal({
					title: '提示',
					content: '确定要删除该文件吗？',
					cancelText: '取消',
					confirmText: '确定',
					success: res => {
						if (res.confirm) {
							this.imgList.splice(e.currentTarget.dataset.index, 1)
						}
					}
				})
			},
			ChooseImage() {
				uni.chooseImage({
					count: 4, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success: (res) => {
						if (this.imgList.length != 0) {
							this.imgList = this.imgList.concat(res.tempFilePaths)
						} else {
							this.imgList = res.tempFilePaths
						}
					}
				});
			},
			test(e){
			},
			// 合规调查
			complianceSurvey(type){
				if(type==1){					
					if(!this.complianceSurveyFrom.fileUrls||this.complianceSurveyFrom.fileUrls&&this.complianceSurveyFrom.fileUrls.length===0){
						return uni.showToast({
							title:'请上传文件后进行操作！',icon:'none'
						})
					}
				}
				if(type==2&&!this.complianceSurveyFrom.opinion){
					return uni.showToast({
						title:'驳回请填写审核意见！',icon:'none'
					})
				}
		
				this.complianceSurveyFrom.iid = this.getItem.iid
				this.complianceSurveyFrom.status = type
				uni.showLoading({
					title:'发送中'
				})
				this.$http.post('/api-guarantee/compliance/investigation/survey',this.complianceSurveyFrom).then(res=>{
					if(res.success){
						uni.showToast({
							title:'操作成功！'
						})
						setTimeout(()=>{
							uni.hideLoading()
							this.back()
						},500)
					}
				})
			},
			
			 // 合规-审核
			complianceAudit(type){
				this.complianceAuditFrom.status = type
				// 判断角色权限
				let btnPermissionsStr = uni.getStorageSync('roleArr').split(',');
				// if(type==1&&btnPermissionsStr.includes('67')){//领导传2
				// 	this.complianceAuditFrom.status = 2
				// }
				this.complianceAuditFrom.iid = this.getItem.iid
				if(type!==1&&!this.complianceAuditFrom.opinion){
					uni.showToast({
						title:'请输入审核意见！',icon:'none'
					})
					return
				}
				if(!this.complianceAuditFrom.opinion)this.complianceAuditFrom.opinion=''
				this.$http.post('/api-guarantee/compliance/investigation/check',this.complianceAuditFrom).then(res=>{
					if(btnPermissionsStr.includes('67')){
						setTimeout(()=>{
							this.back()
						},1000)
					}else{
						uni.showToast({
							title:"操作成功！"
						})
						this.back()						
					}
				})
			},
			// 合规详情
			complianceDetail(){
				// 读取前面的接口，渲染数据
				this.$http.get('/api-guarantee/compliance/investigation/query',{iid:this.getItem.iid}).then(res=>{
					let apply = res.data.guaranteeDetailResponse.dgApplyAmountInfo
					let reg = new RegExp(' ','g')//删除字符里的空格
					let handle = apply.enGuaranteeMeasure//反担保
					if(handle[0]==""){
						handle.splice(0,1)
					}
					handle =  handle.map(i=>{
						return i.replace(reg,"") 
					})
					this.clientMessageFrom = res.data.guaranteeDetailResponse.dgBusinessCompany//企业详情
					this.companyId = apply.companyId
					this.enterpriseForm={
						companyId:apply.companyId,
						businessType:apply.businessType,
						isExistRelated:apply.isExistRelated,
						applyAmount:apply.applyAmount,
						bank:apply.bank,
						applyTime:apply.applyTime,
						amountWide:apply.amountWide,
						enGuaranteeMeasures:handle,
						description:apply.description,
						customerType:apply.customerType,
						otherAmountWide:apply.otherAmountWide
					}
					if(res.data.guaranteeDetailResponse.dgBusinessCompany!==null){
						this.$set(this.enterpriseForm,'isExistRelated',+res.data.guaranteeDetailResponse.dgBusinessCompany.isExistRelated)//是否存在关联人
						this.enterpriseForm.customerId = res.data.guaranteeDetailResponse.dgEnclosureInfo.companyId// 企业id
						this.name = res.data.guaranteeDetailResponse.dgBusinessCompany.name//客户名称
						this.code = res.data.guaranteeDetailResponse.dgBusinessCompany.code //客户编号
						// this.$nextTick(()=>{
							this.getLinkmanList()
						// })
					}
					if(this.enterpriseForm.bank){//银行字符串处理
						let across = this.enterpriseForm.bank.indexOf('-')
						if(across!==-1){
							this.mainbank = this.enterpriseForm.bank.substring(0,across)
							let len = this.enterpriseForm.bank.length
							this.elsebank = this.enterpriseForm.bank.substring(across+1,len)
						}else{
							this.mainbank = this.enterpriseForm.bank
						}
					}
					// 判断调查--调查+查看的情况下赋值
					if(this.surveyModule&&this.handle=='watch'){
						this.$set(this.complianceSurveyFrom,'opinion',res.data.opinion)
					}else if(this.roleLeader&&this.handle=='watch'||this.roleManager&&this.handle=='watch'){// 审核的情况下
						this.$set(this.complianceAuditFrom,'opinion',res.data.opinion)
					}
					
					// 循环赋值12个空数组
					for(let i=0;i<13;i++){
						this.filesArray.push([])
					}
					
					this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.businessLicenseList,0)
					this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.legalCardCopyList,1)
					this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.marriageCopyList,2)
					this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.legalCopyList,3)
					this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.companyConstitutionList,4)
					this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.accountingFirmList,5)
					this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.companyCreditList,6)
					this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.creditReportList,7)
					this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.certificateAuthorizationList,8)
					this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.taxCertificateList,9)
					this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.meetingMinutesList,10)
					this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.assessmentReportList,11)
					// this.disposeFileList(get)
					// 其他文件，调查时上传的
					if(res.data.guaranteeDetailResponse.dgEnclosureInfo.otherFile&&res.data.guaranteeDetailResponse.dgEnclosureInfo.otherFile.length!==0){
						this.otherFiles = res.data.guaranteeDetailResponse.dgEnclosureInfo.otherFile.split(',')
						this.$set(this.complianceSurveyFrom,'fileUrls',res.data.guaranteeDetailResponse.dgEnclosureInfo.otherFile.split(','))
						this.handleFiles(res.data.guaranteeDetailResponse.dgEnclosureInfo.otherFile.split(','),12)
						// this.complianceSurveyFrom.fileUrls
					}
					// 判断资产
					// let assetArr = res.data.assetsResponse.assetsAmountList?res.data.assetsResponse.assetsAmountList:[],
					
					let assetArr = res.data.assetsResponse.assetsAmountList||[]
					assetArr.includes('房产')?this.house = '房产':this.house = ''
					assetArr.includes('车辆')?this.car = '车辆':this.car = ''
					assetArr.includes('设备')?this.equipment = '设备':this.equipment = ''
					assetArr.includes('其他')?this.elseMoney = '其他':this.elseMoney = ''
					
					// 资产信息
					if(res.data.assetsResponse){
						this.assetFromData = res.data.assetsResponse
					}
					this.assetFromData.guaranteeAmount = res.data.guaranteeDetailResponse.assignUser.amount
					this.assetFromData.guaranteeTerm = res.data.guaranteeDetailResponse.assignUser.term
					this.Aname = res.data.cname
					
					if(res.data.assetsResponse&&res.data.assetsResponse.dgAssetsMoney){
						this.assetFromData.houseMoney = res.data.assetsResponse.dgAssetsMoney.houseMoney
						this.assetFromData.carMoney = res.data.assetsResponse.dgAssetsMoney.carMoney
						this.assetFromData.equipmentMoney = res.data.assetsResponse.dgAssetsMoney.equipmentMoney
						this.assetFromData.otherMoney = res.data.assetsResponse.dgAssetsMoney.otherMoney
					}
				})
			},
			// 传入 data 要处理的数据，格式['url1','url2']
			// 传入对应的index
			handleFiles(data,index){
				if(!data||!data.length) return
				if(data[0]==''||data[0]=='ul') data.splice(0,1)
				data.map(e=>{
					if(e=='') return
					let obj = {},
					num= e.lastIndexOf("."),
					ext = e.substr(num+1).toLowerCase();
					// 判断格式--图片或者其他
					let str = 'xxxxxx.png'
					
					if(e.toLowerCase().includes('jpg','jpeg','png','bmp','gif')){
						obj.book = 'img'
					}else{
						obj.book = "file"
						if(ext=='png'){
							obj.book = 'img'
						}
					}
					// 确定文件格式
					obj.ext = ext
					obj.url = e
					// 接收的数组
					this.filesArray[index].push(obj)
				})
			},
			/* 上传文件 */
			uploadFile(e) {
				let fileList = e.map(r => r.url)
				this.complianceSurveyFrom.fileUrls = fileList
			},
			// 关联人列表接口
			getLinkmanList(){
				if(!this.enterpriseForm.customerId) return uni.showToast({title: '请先选择客户！',icon:'none'})
				this.$http.get("/api-crms/crms-company-personal/companyPersonalList",{
					customerId:this.enterpriseForm.customerId,
					page:1,
					size:999  // 不做分页，直接展示所有的关联人或企业
				}).then(res=>{
					this.list = []
					if(res.data.list&&res.data.list.length!==0){
						this.list = res.data.list
						this.list.map(e=>{
							e.educationVal = +e.education
							e.maritalStatusVal = +e.maritalStatus
						})
					} 	
				})
			},
			// 是否有关联人change事件
			hasLinkman(e){
				// 存在关联人
				if(e===1){this.getLinkmanList()}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.evan-form-show {
		padding: 0 30rpx;
		background-color: #fff;

		.form-input {
			font-size: 28rpx;
			color: #333;
			text-align: right;
			width: 100%;
			box-sizing: border-box;
			height: 60rpx;
			&.textarea{
				height: 240rpx;
				padding: 24rpx 0;
				text-align: left;
			}
		}

		.form-input-placeholder {
			font-size: 28rpx;
			color: #999;
		}

		&__button {
			width: 100%;
			height: 88rpx;
			border-radius: 8rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			padding: 0;
			font-size: 36rpx;
			color: #fff;
			margin-top: 20rpx;
			background-color: #2D87D5;

			&::before,
			&::after {
				border: none;
			}
		}

		.customize-form-item {
			&__label {
				font-size: 28rpx;
				color: #333;
				margin-bottom: 16rpx;
			}

			&__radio {
				display: flex;
				align-items: center;
				margin-bottom: 16rpx;

				&__text {
					font-size: 28rpx;
					color: #333;
				}
			}
		}
	}
	.label-color{
		color: #00B9FF;
	}
	// 必填
	.is-required {
		color: $uni-color-error;
	}
	
	
	
	.checklist-group {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		flex-wrap: wrap;
	}
	
	.checklist-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		margin: 10rpx 0;
		margin-right: 50rpx;
	}
	
	.checklist-content {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex: 1;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
	
	.checklist-text {
		font-size: 28rpx;
		color: #333;
		margin-left: 10rpx;
		transition: color 0.2s;
	}
	
	.checkbox__inner {
		flex-shrink: 0;
		position: relative;
		border: 2rpx solid #DCDFE6;
		border-radius: 4rpx;
		box-sizing: border-box;
		width: 32rpx;
		height: 32rpx;
		background-color: #fff;
		z-index: 1;
		transition: border-color 0.1s;
	}
	
	.checkbox__inner-icon {
		border: 2rpx solid #fff;
		border-left: 0;
		border-top: 0;
		height: 16rpx;
		left: 10rpx;
		position: absolute;
		top: 2rpx;
		width: 6rpx;
		opacity: 0;
		transition: transform .2s;
		transform-origin: center;
		transform: rotate(40deg) scaleY(0.4);
	}
	/deep/ .uni-data-checklist{
		width: 110%;
	}
</style>
