operateList.vue 5.1 KB
<template>
	<view class="operate">
		<view class="operate_list">
			<view class="operate_item">
				<text class="operate_btn" :class="{active: current === 0 }" @click="handleSuccess">通过</text>
			</view>
			<view class="operate_item">
				<text class="operate_btn" :class="{active: current === 1 }" @click="handleReturn">退回</text>
			</view>
			<view class="operate_item">
				<text class="operate_btn" :class="{active: current === 2 }" @click="handleInvalid">作废</text>
			</view>
			<view class="operate_item">
				<text class="operate_btn" :class="{active: current === 3 }" @click="handleUpdate">修改</text>
			</view>
			<view class="operate_item">
				<text class="operate_btn" :class="{active: current === 4 }" @click="handleCirculation">流转</text>
			</view>
		</view>
		<!-- 作废回馈弹出框 -->
		<up-modal :show="showDefeat" showCancelButton title="填写作废回馈" @confirm="sunmitDeprecated" @cancel="showDefeat = false">
			<up-textarea v-model="DefeatContent" 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>
					 <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>
		</up-modal>
	</view>
</template>

<script setup>
import { ref, reactive} from 'vue'
import { disposeUser, listDept } from '@/api/work.js'
const props = defineProps({
	carInfo: {
		type: Object,
		require: true
	}
})
const emit = defineEmits(['refreshList'])
const deptOptions = ref([]);
const companyQueryParams = reactive({
  deptName: undefined,
  status: undefined,
});
const deptId = ref(0)
const current = ref(9)
const showDefeat = ref(false)
const DefeatContent = ref('')
const showCompany = ref(false)
// 通过
const handleSuccess = () => {
	current.value = 0
	uni.showModal({
		title: '提示',
		content: '是否通过',
		success: function (res) {
			if (res.confirm) {
				disposeUser({ associationapprove: '0' }, props.carInfo.taskId).then((res) => {
					uni.$u.toast('保单已通过')
					emit('refreshList')
				});
			} else if (res.cancel) {
				console.log('用户点击取消');
			}
		}
	});
}
// 退回
const handleReturn = () => {
		current.value = 1
		uni.showModal({
			title: '提示',
			content: '是否退回',
			success: function (res) {
				if (res.confirm) {
					disposeUser({ associationapprove: '1' }, props.carInfo.taskId).then((res) => {
						uni.$u.toast('保单已退回')
						emit('refreshList')
					});
				} else if (res.cancel) {
					console.log('用户点击取消');
				}
			}
		});
	}
	// 作废
	const handleInvalid = () => {
		current.value = 2
		showDefeat.value = true
	}
	// 修改
	const handleUpdate = () => {
		current.value = 3
		const id = props.carInfo.businessKey
		uni.navigateTo({
			url: `/pages/carDetail/carDetail?carInfoId=${id}&roleId=1`
		})
	}
	// 分配
	const handleCirculation = () => {
		current.value = 4
		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 submitForm = () => {
	  const data = {
	    associationapprove: '0',
	    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;
	}
}
</style>