auditDetail.vue 5.16 KB
<template>
	<view class="hasfixedbottom">
		<view class="wBox">
			<view class="tt">{{form.content?.name}}</view>
			<view class="info">
				<view><text class="text-danger"> {{ form.content?.personCount }} </text></view>
				<view>合计缴费年限 <text class="text-primary"> {{totalYear }} </text></view>
			</view>
			<!-- 成员 -->
			<view class="userlist">
				<view class="item" v-for="n in list">
					<view class="photobox">
						<image class="photo" v-if="n.photo" :src="config.baseUrl_api+n.photo" mode='aspectFill'></image>
						<view class="colorful" v-else>{{n.personName?.slice(0,1)}}</view>
					</view>
					<view>
						<view class="name">{{n.personName}}<text>({{n.memberInfoName}})</text></view>
						<view class="date">原有效期至 {{n.originValidityDate||'--'}}</view>
					</view>
					<view class="nian">
						{{n.payYear}}
					</view>
				</view>
			</view>

		</view>

		<view class="h3-padding">审核流程</view>
		<view class="wBox">
			<view class="stepItem" v-for="(n,index) in feelList">
				<view class="time">{{n.handleDate||'待审批'}}</view>
				<view class="content">
					<view class="status">
						<text v-if="n.auditStatus==1" class="text-success">审核通过</text>
						<text v-if="n.auditStatus==2" class="text-danger"> 审核拒绝</text>
						<text v-if="n.auditStatus==0||n.auditStatus==100" class="text-primary"> 审核中</text>
						<text v-if="n.auditStatus==3" class="text-warning"> 已退回</text>
					</view>
					<!-- <view class="name">{{index+1}}</view> -->
					<view class="deptName">{{n.handlerDeptName||n.auditBy}}</view>
					<view v-if="n.auditStatus==2" >
						备注:{{n.reason||'/' }} 
					</view>
				</view>
			</view>
		</view>
	
		<view class="fixedBottom" v-if="form.auditStatus == 0">
			<button class="btn-red-kx" @click="audit(form.recordId,'0')">拒绝</button>
			<button class="btn-red" @click="audit(form.recordId,'1')">同意</button>
		</view>
	
	</view>
</template>

<script setup>
	import * as api from '@/common/api.js'
	import config from '@/config.js'
	import {
		onMounted,
		ref
	} from 'vue'
	import {
		onLoad
	} from '@dcloudio/uni-app'
		const app = getApp();
	const queryParams = ref({
		// pageNum: 1,
		// pageSize: 10
		// mergeFlag: 0,
		auditStatus: ''
	})
	const wfId = ref('')
	const form = ref([])
	const list = ref([])
	const feelList = ref([])
	const total = ref(0)
	const totalYear = ref(0)
	const deptType = ref()
	onLoad((option) => {
		wfId.value = option.wfId
		queryParams.value.auditStatus = option.auditStatus
		
		if (app.globalData.isLogin) {
			init()
		} else {
		
			app.firstLoadCallback = () => {
				init()
			};
		}

	})
	function init(){
		deptType.value = app.globalData.deptType
		getForm()
	}
	function getForm() {
		uni.showLoading({
			title: '加载中'
		})
		totalYear.value = 0
		if(deptType.value==2||deptType.value==3){
			queryParams.value.mergeFlag = 0
		}
		api.getVerifyList(queryParams.value).then(res => {
			uni.hideLoading()
			if(res.rows)
			for (var n of res.rows) {
				if (n.wfId == wfId.value) {
					form.value = n
				}
			}
			if(form.value.content){
				form.value.content = JSON.parse(form.value.content)
				list.value = form.value.content.personList
				for (var n of list.value) {
					totalYear.value += n.payYear
				}
			}

			getFillList(list.value[0]?.rangeId)
		})
	}

	function getFillList(id) {
		if(id)
		api.getHistoryByRelateId(id).then(res => {
			feelList.value = res.data
			uni.hideLoading()
		})
	}
	function audit(recordId, flag) {
		if (flag == '0') {
			// 拒绝
			// 弹出框填写理由
			uni.showModal({
				title: '请输入拒绝理由',
				editable: true,
				success: function(res) {
					if (res.confirm) {
						if (!res.content) {
							uni.showToast({
								title: '请输入拒绝理由',
								icon: 'none'
							})
						} else {
							doApproval(recordId, flag, res.content)
						}
					}
				}
			})
		} else if (flag == '1') {
			// 二次确认
			uni.showModal({
				title: '提示',
				content: `确定审批通过吗`,
				success: function(res) {
					if (res.confirm) {
						doApproval(recordId, flag)
					}
				}
			})
		}
	}
	
	function doApproval(recordId, flag, reason) {
		var obj = {
			flag: flag,
			reason: reason||'',
			recordIds: []
		}
		obj.recordIds.push(recordId)
		console.log(obj)
		api.audit(obj).then((res) => {
			uni.showToast({
				title: '操作成功',
				icon: 'none'
			})
			uni.navigateBack()
		})
	}
</script>

<style scoped lang="scss">
.wBox{
	width: 700rpx;padding: 30rpx;margin: 20rpx auto 0;
	background: #FFFFFF;
	box-shadow: 0rpx 12rpx 116rpx 0rpx rgba(196,203,214,0.1);
	border-radius: 15rpx;
	.tt{
color: #0A1629;
font-size: 30rpx;}
}

.userlist{
	.item{border-bottom: 1px dashed #e5e5e5;position: relative;
	.date{margin-top: 10rpx;}
		.name{
			text{margin-left: 1em;
color: #4C5359;
font-size: 26rpx;}
		}
		.nian{position: absolute;right: 0;
font-size: 30rpx;
color: #AD181F;}
	}
}
.info{display: flex;margin: 30rpx 0 20rpx;
font-size: 28rpx;
	view{color: #7D8592;margin-right: 20rpx;
	}
}
.fixedBottom{justify-content: center;
	button{margin: 0 20rpx;width: 286rpx;}
	.btn-red{width: 286rpx;}
}
</style>