operateList.vue 6.4 KB
<template>
	<view class="operate">
		<view class="operate_list">
			<view v-if="carInfo.policyStatus != '问题件' && assessor" class="operate_item">
				<text class="operate_btn" :class="{active: current === 0 }" @click="handleSuccess">通过</text>
			</view>
			<view v-if="carInfo.policyStatus != '问题件' && assessor" class="operate_item">
				<text class="operate_btn" :class="{active: current === 1 }" @click="handleReturn">退回</text>
			</view>
			<view v-if="carInfo.policyStatus != '问题件'" class="operate_item">
				<text class="operate_btn" :class="{active: current === 2 }" @click="handleUpdate">审核</text>
			</view>
			<view v-if="carInfo.policyStatus == '问题件'" class="operate_item">
				<text class="operate_btn" :class="{active: current === 3 }" @click="lookReason">查询</text>
			</view>
			<view class="operate_item">
				<text class="operate_btn" :class="{active: current === 4 }" @click="handleInvalid">作废</text>
			</view>
			<view class="operate_item">
				<text class="operate_btn" :class="{active: current === 5 }" @click="handleCirculation">分配</text>
			</view>
		</view>
		<!-- 查询问题件回馈 -->
		<up-modal :show="showIssue" title="作废备注" @confirm="showIssue = false" >
			<up-parse :content="IssueMessage"></up-parse>
		</up-modal>
		<!-- 作废弹出框 -->
		<up-modal :show="showDefeat" showCancelButton title="填写作废内容" @confirm="sunmitDeprecated" @cancel="showDefeat = false">
			<up-textarea v-model="DefeatContent" placeholder="请输入内容" ></up-textarea>
		</up-modal>
		<!-- 退回弹出框 -->
		<up-modal :show="showReturn" showCancelButton title="填写退回内容" @confirm="sunmitReturn" @cancel="showReturn = false">
			<up-textarea v-model="returnContent" placeholder="请输入内容" ></up-textarea>
		</up-modal>
		<!-- 分配保险公司 -->
		<up-modal :show="showCompany" showCancelButton closeOnClickOverlay title="选择分配项" @confirm="submitForm" @cancel="showCompany = false" @close="showCompany = false">
			<view class="slot-content">
				<view class="company_box">
					<view class="header_top">
						<up-input
							placeholder="请输入承保公司名称"
							prefixIcon="search"
							v-model="companyQueryParams.deptName"
						></up-input>
						<view class="btn" @click="getDeptList">查询</view>
					</view>
					<view class="company_content">
						<up-radio-group v-model="deptId" placement="column">
						   <up-radio
						     v-for="(item, index) in deptOptions"
						     :key="index"
						     :label="item.deptName"
						     :name="item.deptId"
						   />
						 </up-radio-group>
					</view>
				</view>
			</view>
		</up-modal>
	</view>
</template>

<script setup>
import { ref, reactive} from 'vue'
import { disposeUser, listDept, queryDefeatContent } from '@/api/work.js'
import useUserStore from '@/store/modules/user';
const props = defineProps({
	carInfo: {
		type: Object,
		require: true
	}
})
const userStore = useUserStore()
const emit = defineEmits(['refreshList'])
const deptOptions = ref([]);
const companyQueryParams = reactive({
  deptName: undefined,
  status: undefined,
});
const deptId = ref(0)
const current = ref(9)
const showIssue = ref(false)
const IssueMessage = ref('')
const showReturn = ref(false)
const returnContent = ref('')
const showDefeat = ref(false)
const DefeatContent = ref('')
const showCompany = ref(false)
const assessor = ref(false)
// 通过
const handleSuccess = () => {
	current.value = 0
	uni.showModal({
		title: '提示',
		content: '是否通过',
		success: function (res) {
			if (res.confirm) {
				disposeUser({ associationapprove: '0', associationapprovetype: "0", deptid: userStore.transferDeptId }, props.carInfo.taskId).then((res) => {
					uni.$u.toast('保单已通过')
					emit('refreshList')
				});
			} else if (res.cancel) {
				console.log('用户点击取消');
			}
		}
	});
}
// 退回
const handleReturn = () => {
	current.value = 1
	showReturn.value = true
}
// 作废
const handleInvalid = () => {
	current.value = 4
	showDefeat.value = true
}
// 查看
const lookReason = async () => {
	current.value = 3
	const { data } = await queryDefeatContent({
		processInstanceId: props.carInfo.processInstanceId,
		type: 0,
	});
	IssueMessage.value = data.message;
	showIssue.value = true;
}
// 审核
const handleUpdate = () => {
	current.value = 2
	assessor.value = true
	const id = props.carInfo.businessKey
	uni.navigateTo({
		url: `/pages/carDetail/carDetail?carInfoId=${id}&roleId=1`
	})
}
// 分配
const handleCirculation = () => {
	current.value = 5
	getDeptList();
	showCompany.value = true
}

/** 查询公司列表 */
const getDeptList = () => {
	listDept(companyQueryParams).then((response) => {
		deptOptions.value = response.data.filter((item) => item.parentId === 100);
	});
}
// 提交作废表单
const sunmitDeprecated = () => {
	const data = {
		associationapprove: '2',
		comment: DefeatContent.value,
	};
	const taskId = props.carInfo.taskId
	disposeUser(data, taskId).then((res) => {
		emit('refreshList')
		uni.$u.toast('保单已作废')
		showDefeat.value = false
	});
}
// 提交退回表单
const sunmitReturn = () => {
	const data = {
		associationapprove: '1',
		comment: returnContent.value,
	};
	const taskId = props.carInfo.taskId
	disposeUser(data, taskId).then((res) => {
		emit('refreshList')
		uni.$u.toast('保单退回')
		showReturn.value = false
	});
}
/** 提交通过分配承保公司 */
const submitForm = () => {
	const data = {
		associationapprove: '0',
		associationapprovetype: "1",
		deptid: deptId.value.toString(),
	};
	const taskId = props.carInfo.taskId
	disposeUser(data, taskId).then((res) => {
		showCompany.value = false;
		emit('refreshList')
		uni.$u.toast('保单已分配成功')
	});
}
</script>

<style lang="scss" scoped>
.operate{
	.operate_list{
		display: flex;
		align-items: center;
		.operate_item{
			display: flex;
			align-items: center;
			justify-content: center;
			flex: 1;
			height: 40rpx;
			border-right: 2rpx solid #3680FE;
			&:last-child{
				border-right: 0;
			}
			.operate_btn{
				width: 100rpx;
				height: 40rpx;
				line-height: 40rpx;
				font-size: 24rpx;
				text-align: center;
				border-radius: 8rpx;
				&.active{
					background: #3680FE;
					color: #fff;
				}
			}
		}
	}
}
.header_top {
  display: flex;
  align-items: center;
  margin-bottom: 20rpx;
	.btn{
		height: 68rpx;
		line-height: 68rpx;
		padding: 0 28rpx;
		font-size: 24rpx;
		color: #fff;
		background-color: #3c9cff;
	}
}

.company_content{
	height: 300rpx;
	overflow-y: scroll;
}
</style>