<!--招标变更-->
<template>
	<div>
		<div v-if="isShow">
			<div class='base-info pb20 pt20'>
				<view class="content-title" :class="{'is-important':baseData.ISFORMAT}">{{baseData.COMPACT_NAME}}</view>
				<view class="box-top">
					<view class="item-title">{{baseData.ORGANIZER}}：<text style="color:#333;font-size:24upx;">{{baseData.ORGANIZER_LINKMAN}}</text></view>
					<view class="item-title">报审时间：<text style="color:#333;font-size:24upx;">{{baseData.HIGHWAYPROINST_CREATEDATE}}</text></view>
				</view> 
				<view class="main-card">
					<div class="base-body" v-if="baseData.COMPACT_STARTDATE && baseData.COMPACT_ENDDATE">
						<p> 
							<i class="ico ico-sj"></i>
							<span class="item-title">起止时间：</span>
							<span>{{baseData.COMPACT_STARTDATE}} - {{baseData.COMPACT_ENDDATE}}</span>
						</p>
					</div>
					<div class="base-body" v-if="baseData.COMPACT_AMOUNT>0 && baseData.COMPACT_TYPE_TEXT!=='经营管理合同'">
						<p>
							<i class="ico ico-htje"></i>
							<span class="item-title">合同金额：</span>
							<span class="item-price">{{baseData.COMPACT_AMOUNT}} 万元</span>
							<!-- <span class="ml10"> 万元</span> -->
						</p>
						
					</div>
					<div class="base-body" v-else>
						<p>
							<i class="ico ico-ndbz"></i>
							<span class="item-title">保底营业：</span>
							<span class="item-price">{{baseData.COMPACT_AMOUNT}} 万元</span>
							<!-- <span class="ml10"> 万元</span> -->
						</p>
						<p v-if="baseData.GUARANTEERATIO">
							<i class="ico ico-tcbl"></i>
							<span class="item-title">提成比例：</span>
							<span >{{baseData.GUARANTEERATIO}}</span>
							<span class="ml10"> %</span>
						</p>
					</div>
					<div class="base-body">
						<p>
							<i class="ico ico-htlx"></i>
							<span class="item-title">合同类型：</span>
							<span >{{baseData.COMPACT_TYPE_TEXT}}</span>
						</p>
						<p>
							<i class="ico ico-qdcx"></i>
							<span class="item-title">签订程序：</span>
							<span>{{baseData.SECONDPART_OBLIGOR_TEXT}}</span>
						</p>
					</div>
					<div class="base-body">
						<p>
							<i class="ico ico-bzj"></i>
							<span class="item-title">保 证 金：</span>
							<span >{{baseData.SECURITYDEPOSIT}}</span>
							<span class="ml10"> 万元</span>
						</p>
						<p>
							<i class="ico ico-dyj"></i>
							<span class="item-title">抵 押 金：</span>
							<span>{{baseData.SAFETYRISKMORTGAGE}}</span>
							<span class="ml10"> 万元</span>
						</p>
					</div>
				</view>
				
				<div class="main-card">
					<div class="card-title">
						<span class="card-heeader-text">甲方</span>
						{{baseData.FIRSTPART_NAME}}
					</div>
					<div class="card-content">
						<span class="man-name" style="flex:1;">{{baseData.FIRSTPART_LINKMAN}}</span>
						<span class="ico ico-dh" style="flex:2;">{{baseData.FIRSTPART_TEL}}</span>
						<span class="ico ico-mobile" style="flex:2;">{{baseData.FIRSTPART_MOBILE}}</span>
					</div>
				</div>
				<div class="main-card">
					<div class="card-title">
						<span class="card-heeader-text">乙方</span>
						{{baseData.SECONDPART_NAME}}
					</div>
					<div class="card-content">
						<span class="man-name" style="flex:1;">{{baseData.SECONDPART_LINKMAN}}</span>
						<span class="ico ico-dh" style="flex:2;">{{baseData.SECONDPART_TEL}}</span>
						<span class="ico ico-mobile" style="flex:2;">{{baseData.SECONDPART_MOBILE}}</span>
					</div>
				</div>
			
				<div class="main-card detail-other" v-if="baseData.COMPACT_DPDESC">
					<p class="item-title">
						<i class="ico ico-bz"></i>
						<span>备注说明：</span>
					</p>
					<p class="detail-cont">{{baseData.COMPACT_DPDESC}}</p>
				</div>
				
				<div class="main-card detail-other" v-if="baseData.FileList.length>0">
					<p class="item-title">
						<i class="ico ico-fj"></i>
						<span>附 件：</span>
					</p>
					<div class="imgBox">
						<filesUnit v-for="(file,i) in baseData.FileList" :fileItem="file" :key="i"></filesUnit>
						
					</div>
				</div>
					
			<!-- v-if="isResolve" -->
				<view class="button-box" v-if="baseData.USER_ID==users.UserId" >
					<span @tap="showPop(4000)"><image src="../../static/images/yj-btn.png" mode="aspectFit"></image> 移交 </span>
					<span @tap="showPop(2000)"><image src="../../static/images/sh-btn.png" mode="aspectFit"></image> 审核 </span>
					<span @tap="showPop(3000)" v-if="baseData.CAN_REJECT===1"><image src="../../static/images/bh-btn.png" mode="aspectFit"></image> 驳回</span>
				</view>
				
			</div>
			
			
			<view class="base-info" v-if="baseData.RejectList.length>0">
				<div class="uni-list-cell uni-collapse">
					<div class="cat-box uni-list-cell-navigate">
						<b>驳回意见</b>
					</div>
					<div class="process-box uni-collapse-content uni-active">
						<processUnit :item="baseData.RejectList[0]" :approveType="0"/>
					</div>
				</div>
			</view>
			<view class="base-info" v-if="baseData.ApprovedList.length>0">
				<div class="uni-list-cell uni-collapse">
					<div class="cat-box uni-list-cell-navigate" :class="cardShow ? ' uni-navigate-bottom' : 'uni-navigate-right'" @tap="cardShow =!cardShow">
						<b>审批流程</b>
					</div>
					<div class="process-box uni-collapse-content" :class="cardShow ? 'uni-active' : ''" v-show="cardShow">
						<processUnit v-for="item in baseData.ApprovedList" :item="item" :key="item.APPROVED_ID" :approveType="1"/>
					</div>
				</div>
			</view>
		</div>
		<block v-else>
			<noFound v-if="loadingType === 2" :foundType="foundType" />
		</block>
		
	</div>
</template>

<script>
	import {mapGetters} from 'vuex'
	import processUnit from '@/components/auditingProcess/item.vue'
	import filesUnit from '@/components/filesComponent/fileUnit.vue'
	export default {
		data() {

			return {
				baseData: {
					
				},
				isShow: false,
				loadingType: 1,
				foundType:0,
				
				rejectApproved:[],
				approveList: [],
				FileList:[],
				cardShow:true,
				isSign: false,
				isResolve: false,
				signInfo: {
					
				}
			}
		},
		components:{
			processUnit,
			filesUnit
		},
		computed: {
			...mapGetters({'users':'getUser'}),
			
		},
		methods: {
			
			getDetail (id) {
				let _this = this
				_this.$request.$get('GetCompactDetail',{
					HighWayProinstId: id
				}).then(rs => {
					// console.log(_this.loadingType)
					if(!rs.ResultCode ||rs.ResultCode!='100') {
						_this.foundType = 2
						
					}else{
						_this.isShow = true
					}
					uni.hideLoading()
					_this.baseData =  rs.Data
					_this.baseData.COMPACT_STARTDATE = _this.baseData.COMPACT_STARTDATE!='' ? _this.$util.cutDate(_this.baseData.COMPACT_STARTDATE, 'YYYY.MM.DD'): ''
					_this.baseData.COMPACT_ENDDATE = _this.baseData.COMPACT_ENDDATE !='' ? _this.$util.cutDate(_this.baseData.COMPACT_ENDDATE, 'YYYY.MM.DD'): ''
					_this.baseData.HIGHWAYPROINST_CREATEDATE = _this.$util.cutDate(_this.baseData.HIGHWAYPROINST_CREATEDATE, 'YYYY.MM.DD')
					// _this.baseData.BUDGET_AMOUNT = _this.$util.fmoney(_this.baseData.BUDGET_AMOUNT)
					
					_this.baseData.FileList.map(v => {
						let name= v.ATTACHMENT_DESC.split('.')
						v.type = name[name.length-1]
						v.name = v.ATTACHMENT_DESC
						v.path = v.ATTACHMENT_URL
					})
					if(_this.baseData.USER_ID==_this.users.UserId) { // 判断是否是当前审核人
						_this.isResolve= true
					}
						
					
				})
			},
			showPop(type) {
				let _this = this
				let url = ''
				switch (type) {
					case 4000: 
							url = '/pages/auditingPop/transfer?businessType=1000&PROINST_ID='+_this.baseData.HIGHWAYPROINST_ID+'&NOWACTINST_ID='+_this.baseData.NOWACTINST_ID
						break;
					case 2000:
							url = '/pages/auditingPop/toExamine?businessType=1000&PROINST_ID='+_this.baseData.HIGHWAYPROINST_ID+'&NOWACTINST_ID='+_this.baseData.NOWACTINST_ID+'&ApproName='+_this.baseData.ACTINST_NAME+'&NeedApproved='+_this.baseData.NeedApproved
						break;
					case 3000:
							url = '/pages/auditingPop/reject?businessType=1000&PROINST_ID='+_this.baseData.HIGHWAYPROINST_ID+'&NOWACTINST_ID='+_this.baseData.NOWACTINST_ID
						break;
					
				}
				this.$util.toNextRoute('navigateTo', url)
			}
		},
		onLoad(option) {
	
			uni.showLoading({
				title:'正在加载'
			})
			this.getDetail(option.id)
		},
		onShow() {
			let _this = this
			
			this.$eventHub.$once('1000', function (data){
				if(data) {
					uni.showLoading({
						title:'正在加载'
					})
			
					_this.getDetail(_this.baseData.HIGHWAYPROINST_ID)
					
				}
			});
		},
		onUnload() {
			this.$util.addUserBehavior()
		},
		onHide() {
		
			this.$eventHub.$off('1000', function (data) {
				
			 	console.log('scanResult - '+data);
			});
		}
	}
</script>

<style scoped>
	@import url("../../common/css/tenderingDetail.css");
	.pt30 {
		padding-top: 32upx;
	}
	.is-important:after {
		content: '重要';
		padding: 0upx 8upx;
		border: 1rpx solid #E5A06E;
		color: #E5A06E;
		font-size: 22rpx;
		margin-left: 16upx;
		border-radius: 8upx;
	}
	.card-title {
		display: flex;
		color: #333;
		font-size: 26upx;
		justify-content: flex-start; 
		align-items: baseline;
		padding: 0 24upx;
	}
	.card-heeader-text {
		background-color: #A6AECA;
		color: #fff;
		min-width: 80upx;
		text-align: center;
		border-radius: 8upx;
		margin-right: 16upx;
		font-size: 24upx;
		line-height: 1.6;
	}
	.card-content {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 16upx;
		padding: 0 24upx;
		
	}
	.card-content span {
		display: flex;
		align-items: center;
		font-size: 24upx;
	}
	.man-name {
		color: #63A0E5;
		font-size: 24upx;
	}
	.ico-sj:before  {
		background-image: url('../../static/images/contract/htsp_sj.png')
	}
	.ico-htje:before {
		background-image: url('../../static/images/contract/htsp_je.png')
	}
	.ico-ndbz:before {
		background-image: url('../../static/images/contract/htsp_yye.png')
	}
	.ico-tcbl:before {
		background-image: url('../../static/images/contract/htsp_tcbl.png')
	}
	.ico-htlx:before {
		background-image: url('../../static/images/contract/htsp_htlx.png')
	}
	.ico-qdcx:before {
		background-image: url('../../static/images/contract/htsp_qdcx.png')
	}
	.ico-bzj:before {
		background-image: url('../../static/images/contract/htsp_bxj.png')
	}
	.ico-dyj:before {
		background-image: url('../../static/images/contract/htsp_dyj.png')
	}
	.ico-dh:before {
		background-image: url('../../static/images/contract/htsp_dh.png')
	}
	.ico-mobile:before {
		background-image: url('../../static/images/contract/htsp_mobile.png')
	}
</style>
