<template>
	<view class="details">
		<view class="zxtop">
			<!-- 风险部 -->
			<view class="failtit" v-if="datainfo.auditType==4">该业务申请未通过审核，可完善信息后进行申诉</view>
			<view class="detop">
				<!-- 归档 归档后没有业务进度-->
				<image :src="gdicoimg" class="gdimg" v-if="gdflag"></image>
				<block v-else>
					<view class="speed" v-if="checkPermi(['system:schedule:list'])" @click="getSpeedFn" :style="type=='ywjd'?'z-index: 6;':''">
						<image :src="speedimg"></image>
						<view>业务进度</view>
					</view>
				</block>
				
				<view class="head">
					<view class="top">
						<view class="toptit">{{datainfo.enterpriseName}}</view>
						<view class="statbox" v-if="datainfo.isNew=='Y'">专精特新<image :src="start"></image></view>
					</view>
					<view class="adr">企业地址 | {{datainfo.enterpriseName}}</view>
					<view class="adr">申报时间 | {{datainfo.applicationTime}}</view>
					<view class="adr" v-if="datainfo.fileTime">归档时间 | {{datainfo.fileTime}}</view>
				</view>
				<view class="deta">
					<view class="lists">
						<view class="tit">申请额度</view>
						<view class="txt">{{datainfo.applicationAmount}}<text>/万元</text></view>
					</view>
					<view class="lists">
						<view class="tit">使用期限</view>
						<view class="txt">{{datainfo.usagePeriod}}<text>/个月</text></view>
					</view>
					<view class="lists">
						<view class="tit">申贷银行</view>
						<view class="txt">{{kaType(datainfo.applicationBank,sdyhlist)}}</view>
					</view>
					<view class="lists">
						<view class="tit">资金用途</view>
						<view class="txt">{{datainfo.purposeFunds}}</view>
					</view>
					<view class="lists">
						<view class="tit">还款来源</view>
						<view class="txt">{{datainfo.repaymentSource}}</view>
					</view>
					<view class="lists">
						<view class="tit">担保类型</view>
						<view class="txt">{{kaType(datainfo.guaranteeType,dblxlist)}}</view>
					</view>
				</view>
			</view>
		</view>
		
		<view class="main">
			<!-- tab -->
			<view class="tabs" :class="fixedflag?'tabfix':''">
				<view class="tab" :class="tabval==ite.val?'act':''" v-for="(ite,idx) in tabList" :key="idx" @click="getTab(ite.val)">{{ite.tit}}</view>
			</view>
			<view style="height:116rpx;" v-if="fixedflag"></view>
			<!-- 企业信息 -->
			<view class="mainb" :style="'min-height: ' + minheight + 'px;'">
				<block v-if="tabval==0">
					<aqyxx @getDown="getDown" :qyinfo="qyinfo" :datainfo="datainfo" :basicFj="basicFj" ></aqyxx>
				</block>
				<block v-if="tabval==1">
					<bfrxx @getDown="getDown" :datainfo="datainfo" :yhlxlist="yhlxlist" :hyztlist="hyztlist" :basicFj="basicFj"></bfrxx>
				</block>
				<block v-if="tabval==2">
					<cfdbrxx @getDown="getDown" :datainfo="datainfo" :hyztlist="hyztlist" :basicFj="basicFj"></cfdbrxx>
				</block>
				<block v-if="tabval==3">
					<dfjxx @getDown="getDown" :datainfo="datainfo" :declareFj="datainfo.declareFj" :sbfjlist="sbfjlist" @getXzFn="getXzFn"></dfjxx>
				</block>
				<block v-if="tabval==4">
					<ewjcj @getDown="getDown" :datainfo="datainfo"  @getDelwjFj="getDelwjFj" @getfjEdit="getfjEdit" :wjcjlist="wjcjlist" :qtfileFj="datainfo.otherFj" :fileFj="datainfo.fileFj"></ewjcj>
				</block>
				<block v-if="tabval==5">
					<fshxx @getDown="getDown" :shjdlist="shjdlist"  :datalist="shlist" ></fshxx>
				</block>
			</view>
			<!-- 法人信息 -->
			
		</view>
		<block v-if="!gdflag">
			<view class="h50"></view>
			<view class="footbtns">
				<!-- (业务进度表查询进度列表)：1：申报提交 stepval
				2：业务审核/分配 
				3：担保初审 
				4：尽职调查 
				5：初审风险合规 
				6：评审会 
				7：合同签约 
				8：放款合规风险审核 
				9：放款通知 
				10：归档 -->
				
				<!-- 审核进度  auditSchedule
				1：业务审核/分配 
				2：A角色审核 
				3：B角色审核 
				4：风险审核 
				5：尽职调查 
				6：初审风险合规 
				7：上会评审 -->
				<!-- 申请审核 start-->
				<view class="fbtns bga" v-if="checkPermi(['system:application:edit'])&&stepval<2" @click="getedit">修改</view>
				<!-- <view class="fbtns bgc" v-if="checkPermi(['system:application:remove'])" @click="getDel">删除</view> -->
				<view class="fbtns bga" v-if="auditSchedule==1&&checkPermi(['system:application:sh'])" @click="getShFn('sh')">审核</view>
				<view class="fbtns bga" v-if="auditSchedule==4&&datainfo.auditType!=4&&checkPermi(['system:application:sh'])" @click="getShFn('fxsh')">风险审核</view>
				
				
				<!-- end -->
				<!-- a,b角按钮 start-->
				<view class="fbtns bgb" v-if="checkPermi(['system:application:sh'])&&userId==datainfo.aUserId&&auditSchedule==5" @click="getShFn('jztcsh')">尽职调查反馈</view>
				<view class="fbtns bga" v-if="checkPermi(['system:application:sh'])&&userId==datainfo.aUserId&&auditSchedule==2&&datainfo.auditType==1" @click="getShFn('ajssh')">a审核</view>
				<view class="fbtns bga" v-if="checkPermi(['system:application:sh'])&&userId==datainfo.bUserId&&auditSchedule==3" @click="getShFn('bjssh')">b审核</view>
				<!-- 审核后 -->
				<!-- <view class="fbtns bga" @click="getMoreFn('more')">更多操作</view> -->
				<!-- 未通过申诉 风险不通过，上会不通过-->
				<!-- 撤销， 业务分配，a,b角撤销 -->
				<view class="fbtns bga" v-if="checkPermi(['system:application:ss'])&&datainfo.auditType==4&&userId==datainfo.aUserId" @click="getSsFn">申诉</view>
				<!-- <block ></block> -->
				<!-- 申诉的时候不能撤销 -->
				<view class="fbtns" :class="auditSchedule==5?'bga':'bgb'" v-if="checkPermi(['system:application:cx'])&&(stepval!=1&&stepval!=10&&(datainfo.auditType!=1||auditSchedule<6&&auditSchedule>1))" @click="getCxFn">撤销</view>
				<!-- 回收站，暂存，归档不能撤  项目进度是申报提交-->
				<!-- 撤销，管理员在 a待审核 可以撤，  
					a,b角是自己的时候可以撤
				-->
				<view class="fbtns bga" v-if="checkPermi(['system:application:cx'])&&stepval<10&&stepval>6" @click="getXybFn">项目推进</view>
				<!-- end -->
				<!-- 管理员业务初审审核后出具担保意向函-->
				<block v-if="auditSchedule>1&&stepval<3">
					<view class="fbtns bgb" @click="getfjEdit('dbyxh')">上传文件</view>
					<view class="fbtns bga">查看担保意向函</view>
				</block>
				<!-- 风险部门 start-->
				<block v-if="stepval==5">
					<view class="fbtns bgb" v-if="checkPermi(['system:hyperlink:list'])" @click="getMoreFn('wb')">外部工具平台</view>
					<view class="fbtns bga" @click="getMoreFn('fxmore')">更多操作</view>
				</block>
				
				<!-- end -->
				<!-- 上会管理员 start -->
				<block v-if="stepval==6">
					<view class="fbtns bgb" @click="getMoreFn('shmore')">更多操作</view>
					<view class="fbtns bga" @click="getShFn('shsh')">审核</view>
				</block>
				<!-- 上会管理员 end -->
				<!-- 合同签约start -->
				<!-- 上传附件 是上传其他 和出具合同的附件-->
				<block v-if="stepval==7">
					<view class="fbtns bgb" @click="getMoreFn('htsc')">上传附件</view>
					<view class="fbtns bga" @click="getMoreFn('htqy')">出具合同</view>
				</block>
				<!-- <view class="fbtns bga" @click="getqmFn">签名</view> -->
				<!-- 合同签约end -->
				<!-- 风险部放款 start-->
				<block v-if="stepval==8">
					<view class="fbtns bgb" @click="getfjEdit('fkhgb')">上传附件</view>
					<view class="fbtns bga" @click="">出具放款合规表</view>
				</block>
				<!-- end -->
				<block v-if="stepval==9">
					<view class="fbtns bgb" @click="getfjEdit('fktzs')">上传附件</view>
					<view class="fbtns bga" @click="">放款通知书</view>
				</block>	
				<view class="fbtns bga" v-if="stepval==10&&datainfo.loanApplicationType!=4" @click="getGdFn">一键归档</view>
			</view>
		</block>
		<!-- 更多操作 -->
		<view class="bgbox" @click="getClose" v-if="mtype"></view>
		<view v-if="mtype" class="morebox">
			<view class="molists">
				<!-- 审核详情后 -->
				<!-- <block v-if="mtype=='more'">
					<view class="mcoa" @click="getShFn('shhj')">上传附件</view>
					<view>撤回</view>
				</block> -->
				<!--风险部门 start 外部工具平台 -->
				<block v-if="mtype=='wb'">
					<view v-for="(ite,idx) in linkList" :key="idx" @click="getWebUel(ite.url)">{{ite.name}}</view>
				</block>
				<!-- 更多操作 -->
				<block v-if="mtype=='fxmore'">
					<view @click="getShFn('fxbmsh')" v-if="auditSchedule==6&&checkPermi(['system:application:sh'])">审核</view>
					<view>出具材料合规表</view>
					<!-- <view @click="getfjEdit('clhgb')">上传附件</view> -->
					<view @click="getfjEdit('clhgb')">上传材料合规表</view>
					<view v-if="checkPermi(['system:application:cx'])" @click="getCxFn">撤回</view>
				</block>
				<!-- 风险部门 end -->
				<!-- 上会管理员 start -->
				<block v-if="mtype=='shmore'">
					<view>出具评审意见签批表</view>
					<view>上会纪要</view>
					<view @click="getfjEdit('psyjqpb')">上传评审意见签批表</view>
					<view @click="getfjEdit('gdhyjy')">上传上会纪要</view>
				</block>
				<!-- 上会管理员 end -->
				<!-- 合同签约 start -->
				<!-- 合同上传信息 -->
				<block v-if="mtype=='htsc'">
					<view @click="getfjEdit('wtdbht')">上传委托保证合同</view>
					<block v-if="datainfo.guaranteeType=='2'">
						<view @click="getfjEdit('bzfdbhtfr')">上传保证反担保合同(法人)</view>
						<view @click="getfjEdit('bzfdbhtzrr')">上传保证反担保合同(自然人)</view>
					</block>
					<block v-if="datainfo.guaranteeType=='1'">
						<view @click="getfjEdit('dyfdbhtfr')">上传抵押反担保合同(法人)</view>
						<view @click="getfjEdit('dyfdbhtzrr')">上传抵押反担保合同(自然人)</view>
					</block>
					<view @click="getQtfjEdit('qtfj')">其他附件</view>
				</block>
				<block v-if="mtype=='htqy'">
					<view @click="get">委托保证合同</view>
					<block v-if="datainfo.guaranteeType=='2'">
						<view>保证反担保合同(法人)</view>
						<view>保证反担保合同(自然人)</view>
					</block>
					<block v-if="datainfo.guaranteeType=='1'">
						<view>抵押反担保合同(法人)</view>
						<view>抵押反担保合同(自然人)</view>
					</block>
				</block>
				<!-- 合同签约 end -->
				
			</view>
			<!-- <view class="surbtns" @click="getMoreSure">确认</view> -->
		</view>
		<pop-up :type="type" :shtg="shtg" :loanApplicationId="datainfo.loanApplicationId" :loanApplicationNumber="datainfo.loanApplicationNumber" :userList="userList" 
		:stepList="stepList" :wjcjobj='wjcjobj' :qtfjobj="qtfjobj" :stepval="stepval" :fjval="fjval"
		 @getfjAdd="getfjAdd"
		 @getClose="getClose" @getupSubmit="getupSubmit" @getSure="getSure"></pop-up>
	</view>
</template>

<script>
	import config from '@/config'
	const baseUrl = config.baseUrl
	const baseName = config.baseName
	import popUp from "@/work/components/popup/popup.vue"
	import aqyxx from "@/work/components/business/aqyxx.vue"
	import bfrxx from "@/work/components/business/bfrxx.vue"
	import cfdbrxx from "@/work/components/business/cfdbrxx.vue"
	import dfjxx from "@/work/components/business/dfjxx.vue"
	import ewjcj from "@/work/components/business/ewjcj.vue"
	import fshxx from "@/work/components/business/fshxx.vue"
	import {uploadmore,selectValue} from '@/utils/common.js'
	import {getDictionaryFn} from "@/api/mine/register.js"
	import {getUsernoPageList,getFjAdd,getFjDel} from "@/api/common.js"
	import {getApplicationDet,getScheduleList,getHyperlinkList,getApplicationDel,getApplicationSh,getCommentsList,getApplicationSs,getApplicationCx,getapplicationGd,getapplicationXib} from "@/api/mine/work.js"
	import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
	export default{
		components:{aqyxx,bfrxx,cfdbrxx,dfjxx,ewjcj,fshxx,popUp},
		data(){
			return{
				start:require('@/work/static/images/start.png'),
				titimg:require('@/work/static/images/infotit.png'),
				speedimg:require('@/work/static/images/speed.png'),
				gdicoimg:require('@/work/static/images/gdico.png'),
				tabval:0,
				type:'',
				tabList:[{tit:"企业信息",val:0},{tit:"法人信息",val:1},{tit:"反担保人信息",val:2},{tit:"附件信息",val:3},{tit:"文件出具",val:4},{tit:"审核信息",val:5},],
				stepList:[],
				stepval:0,
				gdflag:false,
				auditSchedule:'',//审核进度
				mtype:'',
				minheight:0,
				listTop:0,//距离顶部的距离
				fixedflag:false,
				dblxlist:[],
				sdyhlist:[],
				qyinfo:{},//企业信息
				datainfo:{
					// "createBy": "",//
					// "createTime": null,//
					// "updateBy": "",//
					// "updateTime": null,//
					// "remark": null,//
					"loanApplicationId": '',//贷款申请id
					"loanApplicationNumber": "",//贷款申请编号
					"applicationAmount": '',//申请额度(万元)
					"applicationBank": "",//申请银行
					"usagePeriod": "",//使用期限(月)
					"purposeFunds": "",//资金用途
					"repaymentSource": "",//还款来源
					"enterpriseName": "",//企业名称
					'sysUserEnterprise':{},//企业对象具体字段查看营业执照
					"categoryType": "",//行业类型
					"isMake": "N",//是否是制造业 
					"isNew": "N",//是否是精特新
					"isSmall": "N",//是否是小微企业
					"isDuty": "N",//是否是免税企业
					"companyIntroduction": "",//公司简介
					"customerType": "",//用户类型
					"corporationFront": "",//法人身份证正面
					"corporationBack": "",//法人身份证反面
					"corporationName": "",//	法人姓名
					"corporationIdCard": "",//法人身份证号
					"corporationPhone": "",//	法人手机号
					"familyPopulation": "",//家庭人口数
					"corporationJob": "",//法人职业
					"isLoan": "",//有无贷款
					"receivablePay": "",//应收应付款
					"businessSituation": "",//经营情况
					"businessEfficiency": "",//经营效益
					"corporationMaritalStatus": "",//法人婚姻状态
					"spouseFront": "",//配偶身份证正面
					"spouseBack": "",//配偶身份证反面
					"spouseName": "",//配偶姓名
					"spouseIdCard": "",//配偶身份证号
					"spousePhone": "",//配偶手机号
					"guaranteeType": "",//担保类型
					"guaranteeFront": "",//反担保人身份证正面
					"guaranteeBack": "",//反担保人身份证反面
					"guaranteeName": "",//反担保人姓名
					"guaranteeIdCard": "",//反担保人身份证号
					"guaranteePhone": "",//反担保人手机号
					// "guaranteeMaritalStatus": "",//反担保人婚姻状态
					// "guaranteeSpouseFront": "",//反担保人配偶身份证正面
					// "guaranteeSpouseBack": "",//反担保人配偶身份证反面
					// "guaranteeSpouseName": "",//反担保人配偶姓名
					// "guaranteeSpouseIdCard": "",//反担保人配偶身份证号
					// "guaranteeSpousePhone": "",//反担保人配偶手机号
					// "userId": '',//申请人用户ID
					// "idCard": "",//申请人身份证号码
					// "applicationTime": "",//申请时间
					"fileTime": "",//归档时间
					"loanSchedule": "",//贷款申请进度(业务进度表查询进度列表)：1：申报提交2：业务审核/分配 3：担保初审 4：尽职调查 5：初审风险合规 6：评审会 7：合同签约 8：放款合规风险审核 9：放款通知 10：归档
					"loanScheduleName": '',//贷款申请进度名称(中文字)
					"auditSchedule": "",//审核进度1：担保初审 2：A角色审核 3：B角色审核 4：风险审核 5：尽职调查 6：上会评审
					"auditType": "",//审核状态  1：待审核 2：已通过 3：未通过 4:申诉
					"loanApplicationType": "",//贷款申请状态 1：暂存 2：正常 3：回收站 4：归档
					"aUserId": "",//A角色用户ID
					"aUserName": "",//A角色用户名称
					"bUserId": "",//B角色用户ID
					"bUserName": "",//B角色用户名称
					"shareholderFjList": [],//全体股东信息附件
					"loanApplicationFjList": [],//相关附件
					"basicFj": {},//基础附件
					"declareFj": {},//申报附件
					"fileFj": {},//文件出具
					"otherFj": {},//其他附件 key值是type类型 value值具体字段查看相关附件新增
				},
				gdlists:[],//股东信息
				basicFj:{},//基础附件 
				yhlxlist:[],//用户类型
				hyztlist:[],//婚姻状态
				sbfjlist:[],//申报附件
				wjcjlist:[],//文件出具
				linkList:[],//外部链接
				userList:[],//用户列表
				shjdlist:[],//审核进度
				shlist:[],//审核信息
				shinfo:{},//审核信息
				wjcjobj:{},//文件出具对象
				qtfjobj:{'qtfj':"其他附件"},//其他附件
				qtfjlist:[],//其他附件
				fjval:'',//附件类型
				userId:this.$store.state.user.userId,
				contype:'',//二次确认弹窗
				mval:-1,
				mite:"",
				shtg:'',
			}
		},
		onUnload() {
			uni.$off('refreshywlist')
		},
		onLoad(e) {
			this.id=e.id;
			uni.$on('refreshywlist',(e) => {
				this.getDetail();
			})
			this.init()
			this.getDetail();
			this.getScheduleList();
			// this.getHyperlinkList();//外部链接stepval==5
			// this.getUsernoPageList();//获取用户列表stepval==2
			this.getCommentsList()//审核意见
		},
		mounted() {
			var that=this;
			uni.getSystemInfo({
				success: (e) => {
					this.minheight = e.screenHeight- 50;
				}
			})
			setTimeout(function(){
				that.getHeightFn()
			},200)
			
		},
		onPageScroll(e) {
			var scrollTop = Number(e.scrollTop);
			var listTop=Number(this.listTop)
			if(scrollTop>listTop){
				this.fixedflag=true
			}else{
				this.fixedflag=false
			}
		},
		methods:{
			checkPermi, checkRole,
			kaType(ite,list){
				return selectValue(list, ite);
			},
			getedit(){
				var obj={
					type:'edit',
					id:this.id,
				}
				this.$tab.navigateTo('/work/pages/business/add?data='+encodeURIComponent(JSON.stringify(obj)))
			},
			// 删除
			getDelwjFj(id){
				var that=this;
				uni.showModal({
					title: '确认删除',
					content: "是否确认删除",
					cancelText: '取消',
					confirmText: '确认',
					success: function(res) {
						if (res.confirm) {
							getFjDel(id).then(res=>{
								if(res.code==200){
									that.$toast("删除成功")
									setTimeout(function(){
										that.getDetail()
									},1200)
									
								}
							})
						} else if (res.cancel) {
						}
					}
				});
			},
			getfjEdit(ite){
				this.type='fjadd';
				this.mtype='';
				this.fjval=ite
			},
			getQtfjEdit(val){
				this.type='qtfjadd';
				this.mtype='';
				this.fjval=val
			},
			// 业务进度
			getScheduleList(){
				var params={
					loanApplicationId:this.id
				}
				getScheduleList(params).then(res=>{
					if(res.code==200){
						this.stepList=res.data
					}
				})
			},
			getWebUel(url){
				// this.mval=idx;
				// this.mite=ite
				this.mtype='';
				this.$tab.navigateTo("/pages/common/webview/index?url="+url)
				
			},
			getMoreSure(){
				var mttype=this.mtype;
				var mite=this.mite;
				if(mttype=='wb'){
					this.mtype='';
					this.$tab.navigateTo("/pages/common/webview/index?url="+mite.url)
				}
			},
			// 外部链接
			getHyperlinkList(){
				var params={
					type:1
				}
				getHyperlinkList(params).then(res=>{
					if(res.code==200){
						this.linkList=res.rows
					}
				})
			},
			// 用户-列表
			//用户类型（00系统用户 01注册用户 02管理用户
			getUsernoPageList(){
				var params={
					// userType:'02'
				}
				getUsernoPageList(params).then(res=>{
					if(res.code==200){
						this.userList=res.rows
					}
				})
			},
			getCommentsList(){
				var params={
					loanApplicationId:this.id,
				}
				getCommentsList(params).then(res=>{
					if(res.code==200){
						var newArr=res.rows;
						newArr.forEach(ite=>{
							if(ite.imageUrl){
								ite.imageUrl=ite.imageUrl.split(',')
							}
						})
						this.shlist=newArr
						// this.shlist = res.rows.map(v => {
						// 	return {
						// 			auditType: v.auditType,
						// 			auditView: v.auditView,
						// 			fjUrl:v.fjUrl,
						// 			imageUrl:v.imageUrl.split(',')||v.imageUrl
						// 		}
						// 	})
						// this.shlist=res.rows
					}
				})
			},
			init(){
				// 用户类型
				getDictionaryFn('customer_type').then(res=>{
					if(res.code==200){
						this.yhlxlist = res.data.map(v => {
							return {
								label: v.dictLabel,
								value: v.dictValue
							}
						})
					}
				})
				// 婚姻状况
				getDictionaryFn('marital_status').then(res=>{
					if(res.code==200){
						this.hyztlist = res.data.map(v => {
							return {
								label: v.dictLabel,
								value: v.dictValue
							}
						})
					}
				})
				// 申贷银行
				getDictionaryFn('shendai_bank').then(res=>{
					if(res.code==200){
						this.sdyhlist = res.data.map(v => {
							return {
								label: v.dictLabel,
								value: v.dictValue
							}
						})
					}
				})
				//担保类型
				getDictionaryFn('guarantee_type').then(res=>{
					if(res.code==200){
						this.dblxlist = res.data.map(v => {
							return {
								label: v.dictLabel,
								value: v.dictValue
							}
						})
					}
				})
				// 附件信息
				getDictionaryFn('application_fj_sb').then(res=>{
					if(res.code==200){
						this.sbfjlist = res.data.map(v => {
							return {
								label: v.dictLabel,
								val: v.dictValue,
								fjlist:[]
							}
						})
					}
				})
				// // 文件出具
				getDictionaryFn('application_fj_wjcj').then(res=>{
					if(res.code==200){
						var obj={}
						this.wjcjlist = res.data.map(v => {
							// var key=v.dictValue
							obj[v.dictValue]=v.dictLabel
							return {
								label: v.dictLabel,
								val: v.dictValue,
								fjlist:[]
							}
						})
						this.wjcjobj=obj
					}
				})
				// 其他附件
				// getDictionaryFn('application_fj_other').then(res=>{
				// 	if(res.code==200){
				// 		var obj={}
				// 		this.qtfjlist = res.data.map(v => {
				// 			// var key=v.dictValue
				// 			obj[v.dictValue]=v.dictLabel
				// 			return {
				// 				label: v.dictLabel,
				// 				val: v.dictValue,
				// 				fjlist:[]
				// 			}
				// 		})
				// 		this.qtfjobj=obj
				// 		console.log(obj,1)
				// 	}
				// })
				//审核进度
				getDictionaryFn('audit_schedule').then(res=>{
					if(res.code==200){
						this.shjdlist = res.data.map(v => {
							return {
								label: v.dictLabel,
								value: v.dictValue,
							}
						})
					}
				})
			},
			getTab(val){
				this.tabval=val;
				uni.pageScrollTo({
					scrollTop: Number(this.listTop),
					duration: 0
				})
				if(val==5){
					this.getCommentsList()
				}
			},
			getClose(){
				this.type='';
				this.mtype='';
			},
			getupSubmit(data){
				this.shinfo=JSON.parse(JSON.stringify(data))
				var type=this.type;
				if(type=='ajssh'||type=='bjssh'){
					this.contype=this.type
					this.type='confirm'
					this.shtg=data.auditType
				}else{
					this.getApplicationSh()
				}
			},
			getSure(){
				this.getApplicationSh()
			},
			getfjAdd(data){
				var that=this;
				var params=JSON.parse(JSON.stringify(data));
				var fjUrl=params.fjUrl
				// params.loanApplicationId=this.id;
				// params.loanApplicationNumber=this.datainfo.loanApplicationNumber;
				// params.auditSchedule=this.auditSchedule;
				getFjAdd(fjUrl).then(res=>{
					if(res.code==200){
						that.$toast('上传附件成功')
						setTimeout(function(){
							that.getDetail();
							uni.$emit('refreshdatalist')
							that.type=''
						},1200)
					}
				})
			},
			getApplicationSh(){
				var that=this;
				var params=this.shinfo;
				params.loanApplicationId=this.id;
				params.loanApplicationNumber=this.datainfo.loanApplicationNumber;
				params.auditSchedule=this.auditSchedule;
				getApplicationSh(params).then(res=>{
					if(res.code==200){
						that.$toast('审核成功')
						setTimeout(function(){
							that.getDetail();
							uni.$emit('refreshdatalist')
							that.type=''
						},1200)
					}
				})
			},
			getShFn(type){
				this.type=type;
				this.mtype='';
			},
			getSsFn(){
				var that=this;
				uni.showModal({
					title: '确认申诉',
					content: "是否确认申诉",
					cancelText: '取消',
					confirmText: '确认',
					success: function(res) {
						if (res.confirm) {
							var params={
								loanApplicationId:that.id,
								aUserId:that.datainfo.aUserId
							}
							getApplicationSs(params).then(res=>{
								if(res.code==200){
									that.$toast("申诉成功")
									setTimeout(function(){
										that.getDetail();
										uni.$emit('refreshdatalist')
										// uni.navigateBack({
										// 	delta:1
										// })
									},1200)
									
								}
							})
						} else if (res.cancel) {
						}
					}
				});
			},
			getCxFn(){
				var that=this;
				uni.showModal({
					title: '确认撤销',
					content: "是否确认撤销",
					cancelText: '取消',
					confirmText: '确认',
					success: function(res) {
						if (res.confirm) {
							var params={
								loanApplicationId:that.id,
								auditSchedule:that.auditSchedule,
								loanSchedule:that.datainfo.loanSchedule,
								loanApplicationType:that.datainfo.loanApplicationType,
								auditType:that.datainfo.auditType
							}
							getApplicationCx(params).then(res=>{
								if(res.code==200){
									that.$toast("撤销成功")
									setTimeout(function(){
										uni.$emit('refreshywlist')
										// uni.navigateBack({
										// 	delta:1
										// })
									},1200)
									
								}
							})
						} else if (res.cancel) {
						}
					}
				});
			},
			getXybFn(){
				var that=this;
				uni.showModal({
					title: '确认推进',
					content: "是否确认推进",
					cancelText: '取消',
					confirmText: '确认',
					success: function(res) {
						if (res.confirm) {
							var params={
								loanApplicationId:that.id,
								// auditSchedule:that.auditSchedule,
								loanSchedule:that.datainfo.loanSchedule,
								// loanApplicationType:that.datainfo.loanApplicationType
							}
							getapplicationXib(params).then(res=>{
								if(res.code==200){
									that.$toast("推进成功")
									setTimeout(function(){
										uni.$emit('refreshywlist')
									},1200)
									
								}
							})
						} else if (res.cancel) {
						}
					}
				});
			},
			getGdFn(){
				var that=this;
				uni.showModal({
					title: '确认归档',
					content: "是否确认归档",
					cancelText: '取消',
					confirmText: '确认',
					success: function(res) {
						if (res.confirm) {
							var params={
								loanApplicationId:that.id,
								auditSchedule:that.auditSchedule,
								loanSchedule:that.datainfo.loanSchedule,
								loanApplicationType:that.datainfo.loanApplicationType,
								loanApplicationNumber:that.datainfo.loanApplicationNumber,
								auditType:that.datainfo.auditType
							}
							getapplicationGd(params).then(res=>{
								if(res.code==200){
									that.$toast("归档成功")
									setTimeout(function(){
										uni.$emit('refreshywlist')
										// uni.navigateBack({
										// 	delta:1
										// })
									},1200)
									
								}
							})
						} else if (res.cancel) {
						}
					}
				});
			},
			getMoreFn(type){
				this.mtype=type;
				this.mval=-1;
				this.mtit=''
			},
			getSpeedFn(){
				if(this.type){
					this.type=''
				}else{
					this.type='ywjd'
				}
			},
			getqmFn(){
				this.$tab.navigateTo("/work/pages/business/sign")
			},
			getDel(){
				var that=this;
				uni.showModal({
					title: '确认删除',
					content: "是否确认删除",
					cancelText: '取消',
					confirmText: '确认',
					success: function(res) {
						if (res.confirm) {
							getApplicationDel(that.id).then(res=>{
								if(res.code==200){
									that.$toast("删除成功")
									setTimeout(function(){
										uni.$emit('refreshdatalist')
										uni.navigateBack({
											delta:1
										})
									},1200)
									
								}
							})
						} else if (res.cancel) {
						}
					}
				});
			},
			getDetail(){
				getApplicationDet(this.id).then(res=>{
					if(res.code==200){
						this.datainfo=res.data;
						this.auditSchedule=res.data.auditSchedule
						if(res.data.sysUserEnterprise){
							this.qyinfo=res.data.sysUserEnterprise
						}
						
						if(res.data.basicFj){
							this.basicFj=res.data.basicFj;
						}
						this.stepval=res.data.loanSchedule||0;
						var auditSchedule=res.data.auditSchedule
						if(auditSchedule==6){
							this.getHyperlinkList();//外部链接stepval==5
						}else if(auditSchedule==1||auditSchedule==7){
							this.getUsernoPageList();//获取用户列表stepval==2||stepval==6
						}
					}
				})
			},
			getHeightFn(){
				let query = uni.createSelectorQuery().in(this);
				//需要给黄色区域设置一个id标识，在这里是demo
				query.select('.zxtop').boundingClientRect(data => {
					this.listTop = data.height//赋值，待会要用
				}).exec();
			},
			getPreview(url) {
				var newArr=[];
				newArr.push(url)
				uni.previewImage({
					urls: newArr,
					current:0,
					success: function(data) {
						
					},
					fail: function(err) {
						
					}
				});
			},
			onuploadEnd(item) {
				var newobj={}
				var responseText=JSON.parse(item.responseText)
				newobj.name=responseText.originalFilename;
				newobj.url=responseText.fileName;
				this.filelist.push(newobj)
				// this.datainfo.zsyzFjList=JSON.parse(JSON.stringify(this.filelist))
			},
			getXzFn(ite){
				// 本地路径开头使用file://，跟上手机文件本地目录storage/emulated/0，
				// 后缀是用于文件命名和格式修改，大家可以使用变量。
				var url = baseUrl + ite.url;
				var name=ite.name;
				let dtask = plus.downloader.createDownload(url, {
					filename: 'file://storage/emulated/0/'+baseName+'/' + name
				}, (d, status) => {
					//d为下载的文件对象
					if (status == 200) {
						uni.hideLoading();
						uni.showToast({
							icon: 'none',
							mask: true,
							title: '已保存到文件夹：/'+baseName+'/'+ name, //保存路径
							duration: 3000,
						});
						
						//下载成功,d.filename是文件在保存在本地的相对路径，使用下面的API可转为平台绝对路径
						let fileSaveUrl = plus.io.convertLocalFileSystemURL(d.filename);
						setTimeout(() => {
							plus.runtime.openFile(d.filename); //选择软件打开文件
						}, 1500)
					} else {
						//下载失败
						uni.hideLoading();
						plus.downloader.clear(); //清除下载任务
						uni.showToast({
							icon: 'none',
							mask: true,
							title: '下载失败，请稍后重试',
						});
					}
				})
				dtask.start();				
			},
			getDown(e){
				uni.showLoading({
					title: '加载中'
				});
				var url=baseUrl+e;
				uni.downloadFile({
					url: url,//文件的下载路径
					success(result) {
							uni.hideLoading()
						var filePath = result.tempFilePath;
						   uni.openDocument({
						     filePath: filePath,
						     showMenu: true,
						     success: function (res) {
						       // console.log('打开文档成功');
						     }
						   });
					},
					fail(res) {uni.hideLoading()}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.failtit{background: #FFECEC;font-weight: 500;font-size: 26rpx;color: #FF6969;text-align: center;line-height: 36rpx;padding: 22rpx;}
.zxtop{padding-bottom: 2rpx;}
.detop{background: #FFFFFF;padding:0rpx 24rpx;margin-bottom: 28rpx;flex: 0 0 auto;
	position: relative;
	.head{
		padding: 40rpx 2rpx;border-bottom: 2rpx solid #E6E6E6;
		.top{display: flex;align-items: center;overflow: hidden;
			.toptit{font-weight: bold;font-size: 40rpx;color: #222327;}
			.statbox{min-width: 140rpx;height: 36rpx;background-color: rgba(255,177,50,0.3);padding: 0 14rpx;box-sizing: border-box;font-weight: bold;font-size: 22rpx;color: #FF6924;display: flex;align-items: center;flex: 0 0 auto;border-radius: 10rpx;margin-left: 34rpx;
				image{width: 22rpx;height: 22rpx;margin-left: 6rpx;}
			}	
		}
		.adr{font-weight: 500;font-size: 26rpx;color: #666666;margin-top: 12rpx;}
	}
	.deta{display: flex;flex-wrap: wrap;padding: 16rpx 0 28rpx;
		.lists{padding:20rpx 0;width: 33.3%;display: flex;flex-direction: column;align-items: center;position: relative;
			&::after{width: 2rpx;height: 60rpx;background: #E6E6E6;content: '';position: absolute;right: 0;top: 50%;margin-top: -30rpx;}
			&:nth-of-type(3n){
				&::after{display: none;}
			}
			.tit{font-weight: 500;font-size: 26rpx;color: #AAAAAA;margin-bottom: 38rpx;}
			.txt{font-weight: bold;font-size: 30rpx;color: #222327;
				text{font-size: 26rpx;color: #666666;font-weight: normal;}
			}
		}
	}
}
.details{
	// display: flex;flex-direction: column;height: 100vh;overflow: hidden;
}
.main{background-color: #FFFFFF;flex: 1;display: flex;flex-direction: column;overflow: hidden;
	.tabs{padding: 0 6rpx 0 36rpx;display: flex;flex-wrap: nowrap;overflow: auto;flex: 0 0 auto;
		&.tabfix{position: fixed;left: 0;right: 0;z-index: 2;top: 0;background-color: #ffffff;border-bottom: 2rpx solid #E6E6E6;}
		.tab{font-weight: 500;font-size: 26rpx;color: #666666;height: 116rpx;display: flex;align-items: center;margin-right: 26rpx;flex: 0 0 auto;position: relative;
			&.act{color: #00A9F0;font-weight: bold;
				&::after{width: 100%;background: #00A9F0;position: absolute;left: 0;bottom: 0;
border-radius: 2rpx;height: 4rpx;content: '';}
			}
		}
	}
	.mainb{flex: 1;overflow: auto;}
}
.speed{width: 96rpx;height: 140rpx;background: #FFFFFF;box-shadow: 0px 0px 14rpx 0px rgba(184,184,184,0.76);border-radius: 20rpx;
	display: flex;align-items: center;flex-direction: column;justify-content: center;
	position: absolute;right: 28rpx;top: 86rpx;z-index: 2;padding: 0 26rpx; 
	image{width: 26rpx;height: 28rpx;margin-bottom: 8rpx;}
	view{font-weight: 500;font-size: 22rpx;color: #666666;}
}
.gdimg{width: 110rpx;height: 86rpx;position: absolute;right: 40rpx;top: 130rpx;}
.footbtns{width: 100%;height: 100rpx;position: fixed;left: 0;right: 0;bottom: 0;display: flex;border-top: 2rpx solid #E6E6E6;
	.fbtns{flex: 1;height: 100rpx;font-weight: bold;font-size: 30rpx;display: flex;align-items: center;justify-content: center;
		&.bga{background: $com-cd3;color: #FFFFFF;}
		&.bgb{background: #FFFFFF;;color: $com-cd3;}
		&.bgc{background: #DF0303;;color: #FFFFFF;}
	}	
}
.morebox{
	position: fixed;left: 0;right: 0;bottom: 0;z-index: 10;
	.molists{
		view{width: 100%;background: #ffffff;font-weight: 500;font-size: 30rpx;color: #222327;border-bottom: 2rpx solid #E6E6E6;min-height: 100rpx;display: flex;align-items: center;justify-content: center;padding: 10rpx;
		box-sizing: border-box;
		 &.mcoa{color: #00A9F0;}
		}
	}
	.surbtns{
		width: 100%;height: 100rpx;background: #00A9F0;display: flex;align-items: center;justify-content: center;
		font-size: 30rpx;color: #ffffff;margin-top: 24rpx;
	}
}
</style>