<!--招标备案-->
<template>
	<div class="">
		<block v-if="isShow">
			<div class='base-info pb20'>
				<view class="content-title">{{baseData.TENDER_NAME}}<span class="small-title">专项工程</span></view>
				<view class="box-top" v-if="!baseData.ProdefType">
					<view class="item-title">经办人：<text style="color:#333;">{{baseData.TENDEREE_NAME}}</text></view>
				  	<view class="item-title">申请时间：<text style="color:#333;">{{baseData.BIDOPENING_DATE}}</text></view>
				</view>
				<view class="tip-content">
					现有（{{baseData.PROJECT_NAME}}）已列入（{{baseData.UNIT_NAME}}）年度计划，现已经入招标阶段。先根据规定报备，请予备案。
				</view>
				<view class="main-card" >
					<div class="base-body">
						<p>
							<i class="ico ico-ndbz"></i>
							<span class="item-title">预算金额：</span>
							<span class="item-price">{{baseData.BUDGET_AMOUNT}}</span>
							<span class="ml10">万元</span>
						</p>

					</div>

					<div class="base-body">
						<p>
							<i class="ico ico-ssqy"></i>
							<span class="item-title">服务区：</span>
							<span >{{baseData.Serverpart_Name}}</span>

						</p>

					</div>

				</view>

				<div class="main-card detail-other" v-if="baseData.PROJECT_DESCRIPTION">
					<p class="item-title">
						<i class="ico ico-xmgm"></i>
						<span>项目概况：</span>
					</p>
					<p class="detail-cont">{{baseData.PROJECT_DESCRIPTION}}</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>


				<div v-if="isSign">
					<p class="detail-sign item-title" v-if="baseData.CHANGE_REASON">会签详情</p>
					<div class="main-card detail-other uni-flex" style="align-items: flex-start;" v-if="baseData.CHANGE_REASON">
						<p class="item-title">
							<i class="ico ico-user"></i>
							<span>会签人员：</span>
						</p>
						<text>{{signInfo.USER_NAMES}}</text>
					</div>

					<!-- <p class="detail-cont">会签备注：{{signInfo.JOINTLYSIGN_DESC}}</p> -->
				</div>

				<view class="button-box" v-if="isSign">
					<span @tap="showPop"><image src="https://eshangtech.com/ShopICO/ahyd-BID/sh-btn.png" mode="aspectFit"></image> 会签</span>
					<span @tap="showPop(3000)" ><image src="https://eshangtech.com/ShopICO/ahyd-BID/bh-btn.png" mode="aspectFit"></image>  驳回</span>
				</view>
				<view class="button-box" v-else-if=" baseData.NOWSTAFF_ID==users.UserId">
					<span @tap="showPop(4000)"><image src="https://eshangtech.com/ShopICO/ahyd-BID/yj-btn.png" mode="aspectFit"></image> 移交 </span>
					<span @tap="showPop(2000)"><image src="https://eshangtech.com/ShopICO/ahyd-BID/sh-btn.png" mode="aspectFit"></image> 审核 </span>
					<span @tap="showPop(3000)" ><image src="https://eshangtech.com/ShopICO/ahyd-BID/bh-btn.png" mode="aspectFit"></image> 驳回</span>
				</view>
			</div>


			<view class="base-info" v-if="baseData.RejectApproved.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.RejectApproved[0]" :approveType="0"/>
					</div>
				</div>
			</view>
			<view class="base-info" v-if="baseData.AprovedList.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.AprovedList" :item="item" :key="item.APPROVED_ID" :approveType="1"/>
					</div>
				</div>
			</view>
		</block>
		<block v-else-if="isLoading===false">

			<noFound :nodata="baseData.HIGHWAYPROINST_ID ? false : true"/>

		</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 {
				isShow: false,
				isLoading: true,
				foundType:0,
				baseData: {},

				cardShow:true,
				isSign: false,
				isResolve: false,
				signInfo: {}
			}
		},
		components:{
			filesUnit,
			processUnit
		},
		computed: {
			...mapGetters({'users':'getUser'})
		},
		methods: {

			getDetail (id) {
				let _this = this
				_this.$request.$get('GetTenderFlowDetail',{
					HIGHWAYPROINST_ID: id
				}).then(res => {
					if(!res.ResultCode ||res.ResultCode!='100'){
						_this.isShow = false
					}

					_this.baseData =  res.Data
					_this.baseData.SUBMITTAL_DATE = _this.$util.cutDate(_this.baseData.SUBMITTAL_DATE, 'YYYY-MM-DD')
					_this.baseData.BIDOPENING_DATE = _this.$util.cutDate(_this.baseData.BIDOPENING_DATE, 'YYYY-MM-DD')

					_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.SingInfo) {
						_this.signInfo = _this.baseData.SingInfo[0]
						let userIds= _this.signInfo.USER_IDS.split(',')
						if(userIds.indexOf(_this.users.UserId+'')>-1 ||userIds.indexOf(_this.users.UserId)>-1) {
							_this.isSign = true
						}
					}else{
						if(_this.baseData.NOWSTAFF_ID==_this.users.UserId) {
							_this.isResolve=true
						}

					}
					_this.$forceUpdate()

					uni.hideLoading()
					setTimeout(function(){

						_this.isShow  = true
						_this.isLoading  = false
					},500)
				})
			},
			showPop(type) {
				let _this = this
				let url =''
				switch (type) {
					case 4000:
						url = '/pages/auditingPop/transfer?businessType=4000&PROINST_ID='+_this.baseData.HIGHWAYPROINST_ID+'&NOWACTINST_ID='+_this.baseData.NOWACTINST_ID
						break;
					case 2000:
						url = '/pages/auditingPop/toExamine?businessType=4000&PROINST_ID='+_this.baseData.HIGHWAYPROINST_ID+'&NOWACTINST_ID='+_this.baseData.NOWACTINST_ID+'&ApproName='+_this.baseData.ApproName+'&NeedApproved='+_this.baseData.NeedApproved
						break;
					case 3000:
						url = '/pages/auditingPop/reject?businessType=4000&PROINST_ID='+_this.baseData.HIGHWAYPROINST_ID+'&NOWACTINST_ID='+_this.baseData.NOWACTINST_ID
						break;
					default:
						url = '/pages/auditingPop/jointlySign?businessType=4000&PROINST_ID='+_this.baseData.HIGHWAYPROINST_ID+'&NOWACTINST_ID='+_this.baseData.NOWACTINST_ID+'&ApproName='+_this.baseData.ApproName+'&ACTDEF_ID='+_this.baseData.ACTDEF_ID
						break;
				}
				_this.$util.toNextRoute('navigateTo', url)
			}
		},
		onLoad(option) {
			uni.showLoading({
				title:'正在加载'
			})
			this.isLoading = true
			this.getDetail(option.HIGHWAYPROINST_ID)
			let _this = this
			uni.$on('4000', function (data){
				if(data) {
					uni.showLoading({
						title:'正在加载'
					})
					_this.isLoading = true
					_this.isShow  = false
					_this.getDetail(_this.baseData.HIGHWAYPROINST_ID)

				}
			});
		},
		onShow() {

		},
		onUnload() {
			this.$util.addUserBehavior()
			uni.$off('4000');
		},
		onHide() {

		}
	}
</script>

<style scoped>
	@import url("../../common/css/tenderingDetail.css");
	.ico-ssqy:before{
		background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/contract/htsp_ssqy.png');
	}
	.ico-jys:before{
		background-image: url('https://eshangtech.com/ShopICO/ahyd-BID/tender/jys.png');
	}
	.small-title {
		padding: 0rpx 8rpx;
		border: 1rpx solid #E5A06E;
		color: #E5A06E;
		font-size: 22rpx;
		margin-left: 16rpx;
		border-radius: 8rpx;
	}
	.tip-content {
		margin: 0 30rpx;
		padding: 20rpx 16rpx;
		color: #5E5E6C;
		background: #f6f6fa;
		border-radius: 8rpx 8rpx 0px 0px;
		box-shadow: 0px 1rpx 8rpx 0px rgba(224,224,224,0.25);
		font-size: 22rpx;
	}
</style>
