<!--招标变更-->
<template>
	<div>
		<div v-if="isShow">
			<div class='base-info pb20'>
				<view class="content-title">{{baseData.TENDER_NAME}}</view>
				<p class="box-top">
					<span class="item-title">实施单位：<text style="color:#333;">{{baseData.IMPLEMENT_UNIT}}</text></span>
					<span class="item-title">{{baseData.HIGHWAYPROINST_CREATEDATE}}</span>
				</p>
				<view class="main-card">
					<div class="base-body">
						<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-zbfs"></i>
							<span class="item-title">实施方式：</span>
							<span >{{baseData.PROJECT_BELONGNAME}}</span>
						</p>
						<p>
							<i class="ico ico-bgw"></i>
							<span class="item-title">需变更为：</span>
							<span>{{baseData.APPLYIMPLEMENT_TYPENAME}}</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="detail-other bb" v-if="baseData.PROJECT_DESCRIPTION">
						<p class="item-title">
							<i class="ico ico-xmgk"></i>
							<span>项目概况：</span>
						</p>
						<p class="detail-cont">{{baseData.PROJECT_DESCRIPTION}}</p>
					</div>
					<div class="detail-other" v-if="baseData.CHANGE_REASON">
						<p class="item-title">
							<i class="ico ico-qtyq"></i>
							<span>变更原因：</span>
						</p>
						<p class="detail-cont">{{baseData.CHANGE_REASON}}</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="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>
		</div>
		<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 {
				baseData: {},
				isShow: false,
				isLoading: true,
				foundType:0,
				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.HIGHWAYPROINST_CREATEDATE = _this.$util.cutDate(_this.baseData.HIGHWAYPROINST_CREATEDATE, '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");

</style>
