<!-- 资金拨付审批 -->
<template>
	<view class="reimbursement" v-show="isShow">
		<view class="travel-top">
			<h3>{{ExpenseBill.PROINST_NAME}}</h3>
				<!-- <h4>{{getName}}</h4> -->
			<div class="detail-top-base">
				<view class="span24">
					<text class="text-title">申请人：</text>
					<text >{{ExpenseBill.STAFF_NAME}}</text>
				</view>
				<text>{{$util.cutDate(ExpenseBill.HIGHWAYPROINST_CREATEDATE)}}</text>
			</div>
		
			
			<view class="detail-top-box">
				<view class="detail-top-bottom">
				
					<view class="uni-flex span24" style="align-items: center;">
						<view class="detail-title">
							<i class="ico ico-ndbz"></i><text class="text-title">报销金额：</text>
							
						</view>
						
						<text style="color:#ec8538;">￥{{$util.fmoney(ExpenseBill.PAYMENT_LOWER,2)}}</text>
					
					</view>
					<view class="uni-flex span24 mt8" style="align-items: center;">
						<view class="span24 uni-flex" style="flex: 1;align-items: center;">
							<view class="detail-title">
								
								<i class="ico ico-rzlx"></i>
								<text class="text-title">付款方式：</text>
							</view>
							<text>{{ExpenseBill.PAY_TYPE}}</text>
							
						</view>
						<view class="span24 uni-flex" style="flex: 1;align-items: center;">
							<view class="detail-title">
								<i class="ico ico-bm"></i><text class="text-title">申请单位：</text>
								
							</view>
							<text>{{ExpenseBill.DEPARTMENT_NAME}}</text>
						</view>
					</view>
					<view class="line-block between-circle"></view>
				
					<view class="uni-flex"  style="align-items:center;" v-if="ExpenseBill.PAYEE_UNIT">
						<div class="detail-title">
							<i class="ico ico-dw"></i>
							收款单位：
						</div>
						<text class="span24">{{ExpenseBill.PAYEE_UNIT}}</text>
					</view>
					<view class="uni-flex mt8" style="align-items:flex-start;" v-if="ExpenseBill.BANK_NAME">
						<div class="detail-title">
							<i class="ico ico-skzh"></i>
							开户银行：
						</div>
						<text class="span24">{{ExpenseBill.BANK_NAME}}</text>
					</view>
					<view class="uni-flex mt8" style="align-items:center;" v-if="ExpenseBill.BANK_ACCOUNT">
						<div class="detail-title">
							<i class="ico ico-khyh"></i>
							银行账号：
						</div>
						<text class="span24">{{ExpenseBill.BANK_ACCOUNT}}</text>
					</view>
					<view class="uni-flex mt8" style="align-items:flex-start;" v-if="ExpenseBill.PAYMENT_DETAIL">
						<div class="detail-title">
							<i class="ico ico-bz"></i>
							需求说明：
						</div>
						<text class="span24">{{ExpenseBill.PAYMENT_DETAIL}}</text>
					</view>
				
				</view>
				<view class="detail-middle-box">		
					<view class="attachment" v-if="ExpenseBill.ImgList && ExpenseBill.ImgList.length>0">
						<div class="detail-title">
							<i class="ico ico-fj"></i>
							附件图片
						</div>
						<div class="imgBox">
							<image v-for="(arr,i) in ExpenseBill.ImgList" :key="i" :src="arr.IMAGE_URL" @tap="showImg(arr,i)" mode="aspectFill" />
						</div>
					</view>
					
				</view>
			</view>
			<view class="button-box" v-if="ExpenseBill.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="ExpenseBill.CAN_REJECT===1"><image src="/static/images/bh-btn.png" mode="aspectFit"></image> 驳回</span>
			</view>
		
		</view>
		

		<!-- 审批流程 -->
		<view class="base-info" v-if="ExpenseBill.RejectList && ExpenseBill.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 v-for="item in ExpenseBill.RejectList" :item="item" :key="item.APPROVED_DATE" :approveType='0' />
				</div>
			</div>
		</view>
		<view class="base-info" v-if="ExpenseBill.ApprovedList && ExpenseBill.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 ExpenseBill.ApprovedList" :item="item" :key="item.APPROVED_DATE" :approveType='1' />
				</div>
			</div>
		</view>

	</view>
</template>

<script>
	import { mapGetters } from 'vuex';
	import processUnit from '@/components/auditingProcess/item.vue'
	export default {

		components: {
			processUnit
		},
		data() {
		
			return {
				ExpenseBill:{},
				doUser: false,
				cardShow: true,
				imageUrls: [],
			
				isShow:false
			};
		},
		computed: {
			...mapGetters({'users':'getUser'}),
		
		},
		methods: {
			// 图片预览
			showImg(src,index) {
				uni.previewImage( {
					urls:this.imageUrls,
					current: index,
					loop: true,
					indicator: 'number'
				});
			},
			showPop(type) {
				let _this = this
				let url = ''
				switch (type) {
					case 4000: 
							url = '/pages/auditingPop/transfer?businessType=5000&PROINST_ID='+_this.ExpenseBill.HIGHWAYPROINST_ID+'&NOWACTINST_ID='+_this.ExpenseBill.NOWACTINST_ID
							
						break;
					case 2000:
							url = '/pages/auditingPop/toExamine?businessType=5000&PROINST_ID='+_this.ExpenseBill.HIGHWAYPROINST_ID+'&NOWACTINST_ID='+_this.ExpenseBill.NOWACTINST_ID+'&ApproName='+_this.ExpenseBill.ACTINST_NAME+'&ACCEPT_TYPE='+_this.ExpenseBill.ACCEPT_TYPE+'&NeedApproved='+_this.ExpenseBill.NeedApproved
					
						break;
					case 3000:
							url = '/pages/auditingPop/reject?businessType=5000&PROINST_ID='+_this.ExpenseBill.HIGHWAYPROINST_ID+'&NOWACTINST_ID='+_this.ExpenseBill.NOWACTINST_ID+'&ACCEPT_TYPE='+_this.ExpenseBill.ACCEPT_TYPE
						
						break;
				}
				_this.$util.toNextRoute('navigateTo', url)
			},
			// 获取页面数据
			getData(_id) {
				let _this = this
					
				this.$request.$get( 'GetFinanceExpenseDetail',{
					action_data: _this.users.UserId,
					HighWayProinstId: _id, //业务内码
				
				}).then(res => {
					if(!res.ResultCode ||res.ResultCode!='100'){
						uni.hideLoading()
					
					}
					
					let _data = res.Data
					
					this.ExpenseBill = _data || {};
					let arr = []
					if(_data.ImgList){
						
						_data.ImgList.map(v => {
							arr.push(v.IMAGE_URL)
						})
					}
					_this.imageUrls = arr
					
					if (_this.ExpenseBill.USER_ID == _this.users.UserId) { // 该用户是当前详情处理人
					
						_this.doUser = true
					}
					_this.$forceUpdate()
					
					
					setTimeout(function(){
						uni.hideLoading()
						_this.isShow  = true
						_this.isLoading  = false
					},500)
					
				})
			},
			
		},
		onLoad(option) {
			let _this = this
			uni.showLoading({
				title:'正在加载'
			})
			
			this.isLoading =true
			this.getData(option.id)
			
			uni.$on('5000', function (data){
				if(data) {
					uni.showLoading({
						title:'正在加载'
					})
					_this.isLoading = true
					_this.isShow  = false
					_this.getData(_this.ExpenseBill.HIGHWAYPROINST_ID)
					
				}
			});
		},
		onShow() {
			
		},
		onUnload() {
			this.$util.addUserBehavior()
			uni.$off('5000');
		},
		onHide() {
			
		}
	}
</script>

<style scoped>
	@import url("/common/css/expensesTop.css");


</style>
