<!--决标备案-->
<template>
	<div class="">

		<block v-if="isShow">
			<div class='base-info pb20'>
				<view class="content-title">{{baseData.TENDER_NAME}}</view>

				<view class="main-card">
					<div class="base-body">
						<p>
							<i class="ico ico-zbr"></i>
							<span class="item-title">招标人：</span>
							<span >{{baseData.TENDEREE_NAME}}</span>
						</p>

					</div>

					<div class="base-body">
						<p>
							<i class="ico ico-zbfs"></i>
							<span class="item-title">招标方式：</span>
							<span>{{baseData.TENDER_TYPENAME }}</span>
						</p>
						<p>
							<i class="ico ico-shijian"></i>
							<span class="item-title">开标日期：</span>
							<span>{{baseData.BIDOPENING_DATE  }}</span>
						</p>
					</div>
					<div class="base-body">
						<p>
							<i class="ico ico-ndbz"></i>
							<span class="item-title">总金额：</span>
							<span class="item-price">{{baseData.BID_AMOUNT}}</span>
							<span class="ml10"> 万元</span>
						</p>
					</div>
					<div class="base-body" v-if="baseData.SEGMENTED_PRICE" >
						<div class="uni-flex uni-rows" style="align-items: flex-start;">
							<p class="uni-flex uni-rows" style="align-items: center;">
								<i class="ico ico-ndbz"></i>
								<span class="item-title">分段金额：</span>

							</p>


							<span>{{baseData.SEGMENTED_PRICE}}</span>
						</div>
					</div>
					<div class="base-body bb">

						<p>
							<i class="ico ico-user"></i>
							<span class="item-title">联系人员：</span>
							<span>{{baseData.LINKER_PERSON}}</span>
						</p>
						<p>
							<i class="ico ico-lxfs"></i>
							<span class="item-title">联系方式：</span>
							<span>{{baseData.LINKER_TELE}}</span>
						</p>
					</div>
					<div class="base-body">
						<p>
							<i class="ico ico-jdr"></i>
							<span class="item-title">监督人员：</span>
							<span>{{baseData.SUPERVISOR_NAME}}</span>
						</p>
					</div>
					<div class="base-body">
						<p>
							<i class="ico ico-bm"></i>
							<span class="item-title">所在部门：</span>
							<span>{{baseData.LINKER_DEPARTMENT}}</span>
						</p>
					</div>

					<div class="detail-other bb" v-if="baseData.TENDER_INDEX">
						<p class="item-title">
							<i class="ico ico-xmgm"></i>
							<span>项目规模及主要技术指标：</span>
						</p>
						<p class="detail-cont">{{baseData.TENDER_INDEX}}</p>
					</div>
					<div class="detail-other" v-if="baseData.ORGANIZING_COMMITTEE">
						<p class="item-title">
							<i class="ico ico-pwh"></i>
							<span>评委委员会组成人员：</span>
						</p>
						<p class="detail-cont">{{baseData.ORGANIZING_COMMITTEE}}</p>
					</div>
					<div class="detail-other" v-if="baseData.RECOMMEND_APPROVEINFO">
						<p class="item-title">
							<i class="ico ico-qtyq"></i>
							<span>评标委员会推荐意见：</span>
						</p>
						<p class="detail-cont">{{baseData.RECOMMEND_APPROVEINFO}}</p>
					</div>
				</view>
				<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=" !isSign && 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>
		<div v-else-if="isLoading===false">
			<noFound :nodata="baseData.HIGHWAYPROINST_ID ? false : true"/>
		</div>
	</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: {} // 会签信息
			}
		},
		computed:{
			...mapGetters({'users':'getUser'})
		},
		components:{
			filesUnit,
			processUnit
		},

		methods: {

			getDetail (id) {
				let _this = this

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

						let _data = res.Data

						_this.baseData = res.Data
						_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) {
			let _this = this
			uni.showLoading({
				title:'正在加载'
			})
			this.isLoading = true
			this.getDetail(option.HIGHWAYPROINST_ID)

			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");

</style>
