<template>
	<view class="clued navbar">
		<!-- 顶部 -->
		<view class="pfixed">
		<uni-nav-bar  left-icon="left" fixed="true" :border='border'   statusBar='true'  title="线索详情" rightWidth='180rpx' @clickRight="clickRight" @clickLeft='getBack'>
			<block slot="right">
				<view class="min_top" >
					<image :src="moreimg"></image>
				</view>
			</block>
		</uni-nav-bar>
			<tab-list :tablist='tablist' :tabidx='tabidx' :height='90' @getCheck="goCheck"></tab-list>
			<!-- 市值单位审核通过只能看到自己的 -->
			<!-- <block >
				<view class="clued_tong btn flexcc" v-if="datacominfo.shjg==1">审核已通过</view>
				<view class="clued_tong btn1 flexcc" v-if="datacominfo.shjg==2">审核已拒绝</view>
			</block>
			<block >
				<view class="clued_tong btn flexcc" v-if="datacominfo.shjg==1">审核已通过</view>
				<view class="clued_tong btn1 flexcc" v-if="datacominfo.shjg==2">审核已拒绝</view>
			</block>
			<block >
				<view class="clued_tong btn flexcc" v-if="datacominfo.shjg==1">审核已通过</view>
				<view class="clued_tong btn1 flexcc" v-if="datacominfo.shjg==2">审核已拒绝</view>
			</block> -->
			<!--  progress    1:项目首谈 2:项目承接 3:项目签约 4:项目开工 5:项目投产-->
			<!-- 市直立单位 承接地-->
		</view>
		<!-- 站位的 -->
		<uni-nav-bar  left-icon="left" :border='border'   statusBar='true' />
		<view style="height: 90rpx;"></view>
		<view class="zhanline"></view>
		
		
		<!-- 线索详情 -->
		<view class="cldetail" v-if="(datainfoa&&tabidx==0)||(datainfob&&tabidx==1)||(datainfoc&&tabidx==2)||(datainfod&&tabidx==3)">
			
			<uni-steps :options="list1" :active="active" active-icon="smallcircle-filled" active-color='#FD8218' />
			
			<view class="cldelist">
				<view class="flexc pdtb10">
					<view class="flex0 f16 fw c34">上报单位</view>
					<view class="flex1 f16 c6 txr">{{datacominfo.sbdw}}</view>
				</view>
				<view class="flexc pdtb10">
					<view class="flex0 f16 fw c34">填表日期</view>
					<view class="flex1 f16 c6 txr">{{datacominfo.tbrq}}</view>
				</view>
				<view class="flexc pdtb10">
					<view class="flex0 f16 fw c34">项目负责人</view>
					<view class="flex1 f16 c6 txr">{{datacominfo.zszxfzr}}</view>
				</view>
			</view>
			
			<view >
				<!-- 线索 -->
				<block v-if="tabidx==0"><clue :datainfo='datainfoa' :yzadr='yzadr' :cytype="cytype" :projectlist="projectlist" :backgroundlist="backgroundlist" @getDown="getDown" :qiaddlist="qiaddlist" :ziaddlist="ziaddlist"></clue></block>
				
				<!-- 签约 -->
				<block v-if="tabidx==1"><sign-up :datainfo='datainfob' @getDown="getDown"></sign-up></block>
				
				<!-- 开工 -->
				<block v-if="tabidx==2"><start-work :datainfo='datainfoc' :ratelist="ratelist"  @getDown="getDown"></start-work></block>
				
				<!-- 投产 -->
				<block v-if="tabidx==3"><put-into :datainfo='datainfod'  @getDown="getDown"></put-into></block>
				
				
				<!-- 按钮 -->
				<view class="pfixedb flexc" >
					<!-- <view class="cluebtn btn2" @click="getOperate(2)">审核</view> -->
					<!-- 领导批示 -->
					<view v-if="checkPermi(['system:ldps:add'])" class="cluebtn btn2"  @click="getLdFn">批示</view>
					<!-- 招商中心 -->
					<block v-if="addinfotype=='-1'">
						
							<!-- <view class="cluebtn btn2" v-if="(roles=='cjd'||roles=='szbm')&&progress==2&&xmStatus==1" @click="getOperate(2)">审核</view> -->
							
							<!-- <view class="cluebtn btn2" v-if="roles=='szbm'&&progress==1&&xmStatus==1" @click="getOperate(2)">审核</view> -->
						

						<!-- <block v-if="roles=='manage'||roles=='admin'"> -->
							
							<block v-if="checkPermi(['projectV2:common:xszc'])">
								<!-- 线索和签约之间 -->
								<view v-if="progress==1||progress==2" class="cluebtn btn1" @click="getOperate(1)">暂缓/销号</view>
							</block>
							<block v-if="checkPermi(['projectV2:common:xssh'])">
								<!-- 中心线索审核 -->
								<!-- 项目状态 1:待审核 2:已通过 3:被退回 -->
								<view class="cluebtn btn2" v-if="xmStatus==1&&progress!=2" @click="getOperate(2)">审核</view>
							</block>
							<block v-if="checkPermi(['projectV2:common:xszp'])">
								<!-- 线索审核过后 ||(progress==1&&xmStatus==3)-->
								<view class="cluebtn btn2" v-if="(progress==1&&xmStatus==2)"  @click="getYuShenFn">项目分派</view>
							</block>
						<!-- </block>
						
						<block v-else> -->
							<!-- 要素部门 &&roles=='ysbm'-->
							<view   class="cluebtn btn2" v-if="checkPermi(['projectV2:common:xsshYsbm'])&&progress==2&&userroles=='ysbm'" @click="getOperate(2,'ysbm')">审核</view>
							<!-- 承接地 &&roles=='cjd'-->
							<!-- 市值部门  招商引进单位 和承接地功能一样-->
							<view class="cluebtn btn2" v-if="checkPermi(['projectV2:common:xsshCjd'])&&progress==2&&userroles=='cjd'" @click="getOperate(2,'cjd')">审核</view>
						<!-- </block> -->
					</block>
					<!-- 1 3 4 6 8 10 -->
					<!--  progress   项目进度 1:项目首谈 2:项目承接 3:项目签约 4:项目开工 5:项目投产 -->
					<!--  xmStatus   1:待审核 2:已通过 3:被退回 -->
					<!-- 市直立单位 承接地-->
<!-- 					<view class="cluebtn btn2"   @click="getYuShenFn">项目分派</view> -->
				</view>
			</view>
		</view>
		<view v-else>
			<!-- 无数据 -->
			<no-data ></no-data>
			
			<!-- 上报签约信息 -->
			<view class="pfixedb flexc" >
				<!-- 领导批示 -->
				<view v-if="checkPermi(['system:ldps:add'])" class="cluebtn btn2"  @click="getLdFn">批示</view>
				<view class="cluebtn btn2" @click="getAddQianFn" v-if="progress==2&&checkPermi(['projectV2:qyxx:add'])">上报签约信息</view>
				<view class="cluebtn btn2" @click="getAddKaiFn" v-if="progress==3&&checkPermi(['projectV2:kgxx:add'])">上报开工信息</view>
				<view class="cluebtn btn2" @click="getAddTouFn" v-if="progress==4&&checkPermi(['projectV2:tcxx:add'])">上报投产信息</view>
			</view>
		</view>
		
		
		<!-- 弹窗 -->
		<pop-up :type="type" @getClose='getClose' :iteminfo="iteminfo" @getzanFn='getzanFn' @getyjSubmit='getyjSubmit' @getXmSubmitFn='getXmSubmitFn' @getzbSubmit="getzbSubmit" @getLinSubmit='getLinSubmit'></pop-up>
		
		<!-- 弹窗 -->
		<view class="bgbox" @click="getClose" v-if="moreflag"></view>
		<view class="more_fixed" v-if="moreflag">
			<view class="more_fixedt">
				<!-- 撤回 &&progress!=2-->
				<view v-if="checkPermi(['projectV2:common:xsch'])&&xmStatus==2"  @click="getXsch">撤回</view>
				<view v-if="checkPermi(['projectV2:sbbzb:edit'])&&progress==1&&addinfotype=='-1'&&xmStatus!=2" @click="getUpdate">修改信息</view>
				<view v-if="checkPermi(['projectV2:qyxx:edit'])&&progress==3&&addinfotype=='-1'&&xmStatus!=2" @click="getUpdate">修改信息</view>
				<view v-if="checkPermi(['projectV2:kgxx:edit'])&&progress==4&&addinfotype=='-1'&&xmStatus!=2" @click="getUpdate">修改信息</view>
				<view v-if="checkPermi(['projectV2:tcxx:edit'])&&progress==5&&addinfotype=='-1'&&xmStatus!=2" @click="getUpdate">修改信息</view>
				<!-- <view v-if="checkPermi(['projectV2:sbbzb:edit'])&&addinfotype=='-1'&&(xmStatus!=2||(progress==4&&xmStatus==2))" @click="getUpdate">修改信息</view> -->
				<!-- checkPermi(['projectV2:kgxx:editKg']) -->
				<view v-if="((progress==5&&xmStatus!=2)||(progress==4&&xmStatus==2))" @click="getUpdatekg">修改开工信息</view>
				<!-- <view>撤回信息</view> -->
				<!-- 专班跟进 -->
				<view @click="getFollowup" v-if="checkPermi(['projectV2:sbbzb:meet'])">专班跟进</view>
				<view v-if="checkPermi(['projectV2:shyj:list'])" @click="getshprogress">审核进度</view>
				<view v-if="checkPermi(['projectV2:jzqk:add'])" @click="getAddProject">添加对接模块</view>
				<view v-if="checkPermi(['projectV2:jzqk:list'])" @click="getProject">查看对接模块</view>
				<view v-if="checkPermi(['system:ldps:list'])" @click="getLdwrlistFn">查看领导批示</view>
				<!-- 查看批示 -->
			</view>
			<view class="more_fixedb" @click="getClose">取消</view>
		</view>
	</view>
</template>

<script>
	import tabList from "@/components/toptab/tab.vue"
	import { getToken } from '@/utils/auth' 
	import popUp from "@/components/popup/popup.vue"
	import clue from "@/components/clue/clue.vue"  //线索
	import signUp from "@/components/clue/signup.vue"  //签约
	import startWork from "@/components/clue/startwork.vue"  //开工
	import putInto from "@/components/clue/tputinto.vue"  //投产
	import { getsbbzbdetail,getqyxxtail,getkgxxdetail,gettcxxdetail,getCommonXszc,getshyjFn,getCommonXssh,getcommonXsshCjd,getcommonXsshYsbm,getjzqkFn,getrateXschFn ,gesbbzbmeetFn,getldpsFn,getldpsputFn,getldpsdelFn,getldzcFn} from '@/api/work/clue.js'
	import { getDictionaryFn} from '@/api/work/index.js'
	import {getPersionList,getInvestorList,getrateListFn} from "@/api/work/addclue.js"
	import config from '@/config.js';
	const baseUrl = config.baseUrl;
	import {clickPeople } from "@/utils/common.js"
	import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
	import noData from "@/components/nodata/nodata.vue"
	export default{
		data(){
			return{
				border:false,
				tabidx:0,
				id:'',
				tablist:[{tit:'线索',val:0,limt:'projectV2:sbbzb:query'},{tit:'签约',val:1,limt:'projectV2:qyxx:query'},{tit:'开工',val:2,limt:'projectV2:kgxx:query'},{tit:'投产',val:3,limt:'projectV2:tcxx:query'},],
				active: 0,
				list1: [{title: '线索'}, {title: '签约'}, {title: '开工'}, {title: '投产'}],
				
				showArrow:false,
				type:0,//弹窗类型 1暂存/消耗 2审核意见 3批示
				upimg:require('@/static/images/index/up.png'),
				
				moreimg:require("@/static/images/index/more.png"),
				datacominfo:{},
				cytype:[],
				yzadr:[],
				projectlist:[],
				backgroundlist:[],
				fotbtnflag:true,
				moreflag:false,
				userroles:this.$store.state.user.roles[0],
				roles:'',
				progress:'',//项目进度 1:项目首谈 2:项目承接 3:项目签约 4:项目开工 5:项目投产
				xmStatus:'',//1:待审核 2:已通过 3:被退回
				deptId:this.$store.state.user.deptId,
				addinfotype:-1,
				datainfoa:'',
				datainfob:'',
				datainfoc:'',
				datainfod:'',
				qiaddlist:[],
				ziaddlist:[],
				ratelist:[],
				iteminfo:{},
				status:'add'
			}
		},
		components:{
			tabList,popUp,clue,signUp,startWork,putInto,noData
		},
		onUnload(){
			uni.$off('refreshdata')
		},
		onLoad(e) {
			uni.$on('refreshdata',(e) => {
				this.addinfotype=-1;
				this.datainfoa='';
				this.datainfob='';
				this.datainfoc='';
				this.datainfod='';
				this.getDataFn();
				uni.$emit('refreshdatalist');
			})
			this.id=e.id;
			this.addinfotype=-1;
			// 项目进度 1:项目首谈 2:项目承接 3:项目签约 4:项目开工 5:项目投产
			//2,2  上报线索
			//3,2 上报开工
			//4,2 上报项目投产
			if(checkPermi(['projectV2:sbbzb:query'])){
				this.getDataFn()
			}
			// this.getDataFnes()
			// 线索
			this.getinvestmentarea()
			this.getldzcFn()
		},
		methods:{
			checkPermi, checkRole,
			init(){
				this.getInvestorList()//企业列表
				this.getPersionList()//自然人列表
			},
			getLdFn(){
				this.type=3
			},
			getldzcFn(){
				if(checkPermi(['system:ldps:queryZc'])){
					var params={
						xmId:this.id
					}
					getldzcFn(params).then(res=>{
						if(res.code==200){
							this.iteminfo=res.data||{}
							if(res.data){
								this.status='update'
							}else{
								this.status='add'
							}
						}
					})
				}
				
			},
			getLdwrlistFn(){
				this.moreflag=false
				var newobj={
					xmId:this.datacominfo.xmId,
					xmmc:this.datacominfo.xmmc,
					xmbh:this.datacominfo.xmbh,
				}
				this.$tab.navigateTo('/pages/work/ldwritten?data='+encodeURIComponent(JSON.stringify(newobj)))
			},
			getLinSubmit(data){
				var that=this;
				
				var params={};
				var str=''
				if(data.type==0){//暂存
					params.zcpsnr=data.psnr;
					params.type=1;
					str='批示暂存成功'
				}else{
					params.psnr=data.psnr;
					params.type=2;
					str='批示提交成功'
				}
				params.xmId=this.datacominfo.xmId;
				params.xmbh=this.datacominfo.xmbh;
				params.xmmc=this.datacominfo.xmmc;
				// 新增
				// console.log(this.status,85)
				if(this.status=='add'){
					getldpsFn(params).then(res=>{
						if(res.code==200){
							that.$toast(str)
							setTimeout(function(){
								if(data.type!=0){
									uni.$emit('refreshdatalist','ldps');;
								}
								that.getldzcFn()
								that.type=0;
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})	 
				}else{
					params.id=this.iteminfo.id
					getldpsputFn(params).then(res=>{
						if(res.code==200){
							that.$toast(str)
							setTimeout(function(){
								if(data.type!=0){
									uni.$emit('refreshdatalist','ldps');;
								}
								that.getldzcFn()
								that.type=0;
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})	
				}
				
			},
			getFollowup(){
				this.moreflag=false;
				this.type=5
			},
			getzbSubmit(e){
				var params={
					id:this.datacominfo.xmId,
					isMeet:e
				}
				gesbbzbmeetFn(params).then(res=>{
					if(res.code==200){
						this.type=0;
						this.$toast(res.msg)									
					}else{
						this.$toast(res.msg)
					}
				})
			},
			// 项目列表
			getRateList(){
				var params={
					xmbh:this.datacominfo.xmbh
				}
				getrateListFn(params).then(res=>{
					if(res.code==200){
						// 
						var newArr=res.rows||[];
						if(newArr.length){
							newArr.forEach(ite=>{
								ite.photo=ite.photo.split(',')
							})
						}
						this.ratelist=newArr
						// if(res.rows.length){
						// 	this.qiziflag=true
						// }
					}else{
						this.$toast(res.msg)
					}
				})
			},
			getInvestorList(){
				var params={
					xmbh:this.datacominfo.xmbh
				}
				getInvestorList(params).then(res=>{
					if(res.code==200){
						this.qiaddlist=res.rows||[]
					}else{
						this.$toast(res.msg)
					}
				})
			},
			getPersionList(){
				var params={
					xmbh:this.datacominfo.xmbh
				}
				getPersionList(params).then(res=>{
					if(res.code==200){
						this.ziaddlist=res.rows||[];
					}else{
						this.$toast(res.msg)
					}
				})
			},
			getUpdatekg(){
				this.moreflag=false
				var newobj={
					xmId:this.datacominfo.xmId,
					xmmc:this.datacominfo.xmmc,
					xmbh:this.datacominfo.xmbh,
					pagetype:'update',
					dis:true,
					progress:this.progress,
					xmStatus:this.xmStatus
				}
				// progress:'',//项目进度 1:项目首谈 2:项目承接 3:项目签约 4:项目开工 5:项目投产
				// xmStatus:'',//1:待审核 2:已通过 3:被退回
				// 修改开工信息
				this.$tab.navigateTo('/pages/work/addstart?data='+encodeURIComponent(JSON.stringify(newobj)))
			},
			// 修改信息
			getUpdate(){
				var progress=this.progress;
				this.moreflag=false;
				var newobj={
					xmId:this.datacominfo.xmId,
					xmmc:this.datacominfo.xmmc,
					xmbh:this.datacominfo.xmbh,
					progress:this.progress,
					xmStatus:this.xmStatus,
					pagetype:'update'
				}
				if(progress==1||progress==2){
					this.$tab.navigateTo('/pages/work/addclues?data='+encodeURIComponent(JSON.stringify(newobj)))
				}else if(progress==3){
					this.$tab.navigateTo('/pages/work/addcontract?data='+encodeURIComponent(JSON.stringify(newobj)))
				}else if(progress==4){
					this.$tab.navigateTo('/pages/work/addstart?data='+encodeURIComponent(JSON.stringify(newobj)))
				}else if(progress==5){
					this.$tab.navigateTo('/pages/work/addtproduction?data='+encodeURIComponent(JSON.stringify(newobj)))
				}
			},
			getAddQianFn(){
				var newobj={
					xmId:this.datacominfo.xmId,
					xmmc:this.datacominfo.xmmc,
					xmbh:this.datacominfo.xmbh,
					pagetype:'add'
				}
				this.$tab.navigateTo('/pages/work/addcontract?data='+encodeURIComponent(JSON.stringify(newobj)))
			},
			getAddKaiFn(){
				var newobj={
					xmId:this.datacominfo.xmId,
					xmmc:this.datacominfo.xmmc,
					xmbh:this.datacominfo.xmbh,
					progress:this.progress,
					xmStatus:this.xmStatus,
					pagetype:'add'
				}
				this.$tab.navigateTo('/pages/work/addstart?data='+encodeURIComponent(JSON.stringify(newobj)))
			},
			getAddTouFn(){
				var newobj={
					xmId:this.datacominfo.xmId,
					xmmc:this.datacominfo.xmmc,
					xmbh:this.datacominfo.xmbh,
					pagetype:'add'
				}
				this.$tab.navigateTo('/pages/work/addtproduction?data='+encodeURIComponent(JSON.stringify(newobj)))
			},
			getTabchange(){
				var progress=this.progress;
				var xmStatus=this.xmStatus;
				if(xmStatus==2){
					if(progress==2){//上报签约
						this.active=1;
						this.tabidx=1;
					}else if(progress==3){//上报开工
						this.active=2;
						this.tabidx=2;
					}else if(progress==4){//上报投产
						this.active=3;
						this.tabidx=3;
					}else if(progress==5){
						this.active=4;
						this.tabidx=0;
					}
				}else{
					if(progress==1||progress==2){
						this.active=0;
					}else if(progress==3){
						this.active=1;
					}else if(progress==4){
						this.active=2;
					}else if(progress==5){
						this.active=3;
					}
					this.tabidx=this.active;
				}
				if(this.tabidx>this.active){
				}else{
					this.getDataFnes()
				}
				
			},
			getDown(e){
				var url=baseUrl+e;
				// 提示
				uni.showLoading({
					title: '加载中'
				});
				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()
					}
				})
			},
			// 字典值
			getinvestmentarea(){
				// 引资地区
				getDictionaryFn('investment_area').then(res=>{
					if(res.code==200){
						this.yzadr=res.data
					}
				})
				// 产业类型
				// getDictionaryFn('industry_type').then(res=>{
				// 	if(res.code==200){
				// 		this.cytype=res.data
				// 	}
				// })
				//项目类别
				// getDictionaryFn('project_category').then(res=>{
				// 	if(res.code==200){
				// 		this.projectlist=res.data
				// 	}
				// })
				//企业背景
				getDictionaryFn('enterprise_background').then(res=>{
					if(res.code==200){
						this.backgroundlist=res.data
					}
				})
			},
			getXsch(){
				var that=this;
					uni.showModal({
						title: '确认撤回',
						content: '确认撤回项目状态',
						cancelText: '取消',
						confirmText: '确认',
						success: function(res) {
							if (res.confirm) {
								var params={
									id:that.datacominfo.xmId,
									progress:that.progress,
									xmStatus:that.xmStatus
								}
								getrateXschFn(params).then(res=>{
									if(res.code==200){
										that.$toast('撤回成功')
										uni.$emit('refreshdatalist');
										setTimeout(function(){
											uni.navigateBack({
												delta:1
											})	
										},1500)									
									}else{
										that.$toast(res.msg)
									}
								})
							} else if (res.cancel) {
							}
						}
					});
			},
			// 暂缓
			getOperate(e,d){
				this.type=Number(e);
				if(d){
					this.roles=d
				}else{
					this.roles=''
				}
				// console.log(this.roles)
			},
			getAddProject(){
				this.moreflag=false;
				this.type=Number(4)
			},
			getProject(){
				this.moreflag=false;
				this.$tab.navigateTo('/pages/work/projectprogress?id='+this.datacominfo.xmId+'&xmbh='+this.datacominfo.xmbh)
			},
			// 项目进展
			getXmSubmitFn(data){
				var that=this;
				var params=JSON.parse(JSON.stringify(data))
				params.xmId=this.datacominfo.xmId;
				params.xmmc=this.datacominfo.xmmc; 
				params.xmbh=this.datacominfo.xmbh;
				getjzqkFn(params).then(res=>{
					if(res.code==200){
						that.$toast('添加对接模块成功')
						setTimeout(function(){
							that.type=0;
						},1500)									
					}else{
						this.$toast(res.msg)
					}
				})
			},
			getzanFn(e){
				var str='';
				var that=this;
				var params={
					id:this.id
				}
				if(e){
					params.type=2;
					str='暂缓成功'
				}else{
					params.isDel='Y'
					str='销号成功'
				}
				getCommonXszc(params).then(res=>{
					if(res.code==200){
						that.$toast(str)
						uni.$emit('refreshdatalist');
						setTimeout(function(){
							uni.navigateBack({
								delta:1
							})	
						},1500)
					}else{
						this.$toast(res.msg)
					}
				})
				// console.log(params)
			},
			getyjSubmit(data){
				// 承接地 xmjd：4
				// 分发要素部门 xmjd：3
				//招商中心签约审核 6
				//招商中心开工审核 8
				//招商中心投产审核 10
				//项目进度 1:项目首谈 2:项目承接 3:项目签约 4:项目开工 5:项目投产
				 var params=JSON.parse(JSON.stringify(data))
				 params.deptId=this.$store.state.user.deptId;
				 params.shrxm=this.$store.state.user.name;
				 var that=this;
				 params.xmId=this.datacominfo.xmId;
				 params.xmmc=this.datacominfo.xmmc; 
				 params.xmbh=this.datacominfo.xmbh;
				 params.xmjd=this.progress;
				var roles=this.roles;
				// console.log(roles,1)
				// console.log(params,77)
				// return
				if(roles=='cjd'){
					getcommonXsshCjd(params).then(res=>{
						if(res.code==200){
							that.$toast("审核提交成功")
							setTimeout(function(){
								uni.$emit('refreshdatalist');
								that.type=0;
								uni.navigateBack({
									delta:1
								})
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})
				}else if(roles=='ysbm'){
					getcommonXsshYsbm(params).then(res=>{
						if(res.code==200){
							that.$toast("审核提交成功")
							setTimeout(function(){
								uni.$emit('refreshdatalist');
								that.type=0;
								uni.navigateBack({
									delta:1
								})
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})
				}else{
					getCommonXssh(params).then(res=>{
						if(res.code==200){
							that.$toast("审核提交成功")
							setTimeout(function(){
								uni.$emit('refreshdatalist');
								that.type=0;
								if(that.progress==1&&params.shjg==2){
									that.addinfotype=-1;
									that.datainfoa='';
									that.datainfob='';
									that.datainfoc='';
									that.datainfod='';
									that.getDataFn();
									var newobj={
										xmId:that.datacominfo.xmId,
										xmmc:that.datacominfo.xmmc,
										xmbh:that.datacominfo.xmbh,
									}
									that.$tab.navigateTo('/pages/work/xminquiry?data='+JSON.stringify(newobj))
								}else{
									uni.navigateBack({
										delta:1
									})
								}
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})
				}
			},
			//审核
			getYuShenFn(){
				var newobj={
					xmId:this.datacominfo.xmId,
					xmmc:this.datacominfo.xmmc,
					xmbh:this.datacominfo.xmbh,
				}
				this.$tab.navigateTo('/pages/work/xminquiry?data='+encodeURIComponent(JSON.stringify((newobj))))
			},
			getClose(){
				this.type=0;
				this.moreflag=false;
			},
			radioChange(){
				
			},
			getToken(){
				// console.log(this.getToken())
			},
			clickRight(){
				this.moreflag=true
				// if(checkPermi(['projectV2:shyj:list'])){
				// 	this.$tab.navigateTo('/pages/work/shprogress?id='+this.id)
				// }else{
				// 	return
				// }
				
			},
			getshprogress(){
				this.moreflag=false;
				if(checkPermi(['projectV2:shyj:list'])){
					this.$tab.navigateTo('/pages/work/shprogress?id='+this.id)
				}else{
					return
				}
			},
			goCheck(data){
				// 未进行的不能点击
				// this.tabidx=data;
				// return
				// console.log(data)
				if(data>this.active){
				}else{
					this.tabidx=data;
					this.getDataFnes()
				}
			},
			getBack(){
				uni.navigateBack({
					delta:1
				})
			},
			// 拿到当前线进程
			getDataFn(){
				var that=this;

				getsbbzbdetail(this.id).then(res=>{
					if(res.code==200){
						var newobj={
							xmId:res.data.id,
							xmmc:res.data.xmxsmc,
							xmbh:res.data.xmbh,
							sbdw:res.data.sbdw,
							tbrq:res.data.tbrq,
							zszxfzr:res.data.zszxfzr,
							shjg:res.data.shjg,
						}
						this.datacominfo=JSON.parse(JSON.stringify(newobj));
						this.progress=res.data.progress;
						this.xmStatus=res.data.xmStatus;
						// 看是在哪个阶段
						this.getTabchange()
					}else{
						this.$toast(res.msg)
					}
				})
			},
			getDataFnes(){
				// console.log(this.addinfotype,8)
				//1:项目首谈 2:项目承接 3:项目签约 4:项目开工 5:项目投产
				var addinfotype=this.addinfotype;
				// console.log(addinfotype,this.datainfob,8)
				if(this.tabidx==1){//签约
					if(checkPermi(['projectV2:qyxx:query'])&&!this.datainfob&&addinfotype!=1){
						getqyxxtail(this.id).then(res=>{
							if(res.code==200){
								this.datainfob=res.data||'';
								if(!this.datainfob&&addinfotype==-1){
									this.addinfotype=1;
								}
							}else{
								this.$toast(res.msg)
							}
						})
					}
				}else if(this.tabidx==2){//开工
					if(checkPermi(['projectV2:kgxx:query'])&&!this.datainfoc&&addinfotype!=2){
						getkgxxdetail(this.id).then(res=>{
							if(res.code==200){
								this.datainfoc=res.data||'';
								if(!this.datainfoc&&addinfotype==-1){
									this.addinfotype=2;
								}
							}else{
								this.$toast(res.msg)
							}
							this.getRateList()//进度图片
						})
					}
					
				}else if(this.tabidx==3){//投产
					if(checkPermi(['projectV2:tcxx:query'])&&!this.datainfod&&addinfotype!=3){
						gettcxxdetail(this.id).then(res=>{
							if(res.code==200){
								this.datainfod=res.data||'';
								if(!this.datainfod&&addinfotype==-1){
									this.addinfotype=3;
								}
							}else{
								this.$toast(res.msg)
							}
						})
					}
					
				}else{//全部 线索
					if(checkPermi(['projectV2:sbbzb:query'])&&!this.datainfoa&&addinfotype!=0){
						getsbbzbdetail(this.id).then(res=>{
							if(res.code==200){
								this.datainfoa=res.data||'';
								if(!this.datainfoa&&addinfotype==-1){
									this.addinfotype=0;
								}
								// 获取企业，自然人
								this.init()
							}else{
								this.$toast(res.msg)
							}
						})
					}
					
				}
				
			}
			
		}
	}
</script>

<style lang="scss" scoped>
.clued{min-height: 100vh;background-color: #fff;box-sizing: border-box;padding-bottom: 100rpx;}


.cldetail{padding-top: 70rpx;}
.cldelist{padding: 48rpx 28rpx 36rpx;border-bottom: 2rpx solid #E5E5E5;}

.cldelista{
	border-bottom: 2rpx solid #E5E5E5;
	.contentt{padding:48rpx 28rpx;
		.cldelistz{display: flex;align-items: center;justify-content: flex-end;
			image{width: 26rpx;height: 20rpx;margin-left: 20rpx;transition: all .5s; }
		}
	}
	.content{padding: 0rpx 28rpx 40rpx 28rpx;}
	.contenta{padding: 22rpx 0;
		.tit{font-size: 32rpx;font-weight: bold;color: #343434;margin-bottom: 20rpx;}
		.txt{font-size: 32rpx;color: #666666;}
	}
	&.cldelistb{padding: 48rpx 28rpx;}
}

// 操作按钮
.cluebtn{
	display: flex;align-items: center;justify-content: center;font-weight: bold;font-size: 32rpx;color: #ffff;height: 100rpx;
	&.btn1{background-color: #1FB9F7;flex: 1;}
	&.btn2{background-color:#FF6400;flex: 1;}
}


// 审核通过
.clued_tong{width: 100%;height: 70rpx;font-size: 32rpx;font-weight: 500;
&.btn{background: #C0FFC0;color: #28C529;}
&.btn1{background: #ffcaac;color: #ff440b;}
}

// 消息
.min_top{position: relative;width: 44rpx;height: 44rpx;display: flex;align-items: center;justify-content: center;margin-right: 32rpx;
	image{width: 44rpx;height: 34rpx;}
	
}


</style>