<template>
	<view class="list">
		<view class="listItem">
			<view class="lable">
				案件编号：
			</view>
			<view class="main">
				{{defalutVal.caseNum}}
			</view>
		</view>
		<view class="listItem" v-if="sysType == 1">
			<view class="lable">
				申请人：
			</view>
			<view class="main">
				{{defalutVal.applicantName}}
			</view>
		</view>
		<view class="listItem" v-if="sysType == 2">
			<view class="lable">
				申请人：
			</view>
			<view class="main">
				{{defalutVal.applicationName}}
			</view>
		</view>
		<view class="listItem" style="margin-top:22rpx">
			<view class="lable">
				被申请人：
			</view>
			<view class="main">
				{{defalutVal.respondentName}}
			</view>
		</view>
		<view class="listItem">
			<view class="lable">
				案件状态：
			</view>
			<view class="main">
				{{defalutVal.caseStatusName}}
			</view>
		</view>
		<view class="btn" v-if="sysType == 2">
			<button class="btnItem" type="primary" size="mini" @tap="modify" v-if="checkPermi(['caseManagement:list:edit'])">修改</button>
			<button class="btnItem" type="primary" size="mini" @tap="deleteCase" v-if="checkPermi(['caseManagement:list:delete'])">删除</button>
			<!-- <button class="btnItem" type="primary" size="mini" @tap="clickPay">申请人缴费</button>
			<button class="btnItem" type="primary" size="mini" @tap="caseDetail">选择调解员</button> -->
			<button class="btnItem" type="primary" @tap="clickType(item.id)" size="mini" v-for="(item) in buttonList"
				:key="item.id"
				v-if="item.id == defalutVal.caseFlowId && checkPermi([item.buttonAuthFlag])">{{ item.nodeName }}</button>
			<!-- <button class="btnItem" type="primary" size="mini" @tap="confirmationEvidence">确认证据</button>
			<button class="btnItem" type="primary" size="mini" @tap="isAssignrbitrators">是否指派仲裁员</button>
			<button class="btnItem" type="primary" size="mini" @tap="isAssignrbitrators">是否指派仲裁员</button>
			<button class="btnItem" type="primary" size="mini" @tap="chooseMethod">选择仲裁方式</button> -->
		</view>
	</view>
</template>

<script>
	import {
		queryCaseFlowInfo,
		caseAppSubmit,
		caseDelete
	} from '@/api/handlecase/index.js'
	export default {
		data() {
			return {
				
			}
		},
		props: {
			defalutVal: {
				type: Object,
				default: () => {}
			},
			sysType: {
				type: Number,
				default: () => {}
			},
			buttonList: {
				type: Array,
				default: () => {}
			}
		},
		methods: {
			/**点击列表按钮*/
			clickType(type) {
				if (type == 1) {
					// 提交案件
					this.onsubmitRow()
				} else if (type == 2) {
					// 缴费
					this.clickPay()
				} else if (type == 3 || type == 45) {
					this.confirmPayments()
					// 确认缴费
				} else if (type == 4) {
					// 受理分配
				} else if (type == 5) {
					// 选择调解员
					this.caseDetail()
				} else if (type == 6) {
					// 核实调解员
				} else if (type == 7) {
					// 确认调解员
				} else if (type == 8) {
					// 确定调解时间
				} else if (type == 9) {
					// 调解
				} else if (type == 10) {
					// 确认调解书
				} else if (type == 11) {
					// 签名
				} else if (type == 12) {
					// 用印申请
				} else if (type == 13) {
					// 用印
				} else if (type == 14) {
					// 归档
				} else if (type == 15) {
					// 申请人签收
				} else if (type == 16) {
					// 被申请人签收
				} else if (type == 17) {
					//结束
				} else if (type == 44) {
					// 被申请人缴费
					this.clickPay()
				}
			},
			// 案件详情以及操作
			caseDetail() {
				uni.navigateTo({
					url: `/pages/handlecase/component/uploadEvidence?id=${this.defalutVal.id}`
				})
			},
			// 缴费
			clickPay() {
				uni.navigateTo({
					url: `/pages/handlecase/component/payList?id=${this.defalutVal.id}`
				})
			},
			// 确认缴费
			confirmPayments(){
				uni.navigateTo({
					url: `/pages/handlecase/component/confirmPayment?id=${this.defalutVal.id}&caseFlowId=${this.defalutVal.caseFlowId}`
				})
			},
			/**提交案件*/
			onsubmitRow() {
				caseAppSubmit().then(res => {
					uni.showToast({
						title: '提交成功',
						icon: 'none',
						duration: 1000
					})
					uni.navigateBack({
						delta: 1
					})
					//this.$emit("getList");
				})
			},
			// 修改
			modify() {
				uni.navigateTo({
					url: `/pages/handlecase/component/newlyAddedCase?id=${this.defalutVal.id}`,
				})
			},
			/*删除*/
			deleteCase() {
				let objValue ={
					id : this.defalutVal.id,
					batchNumber:"",
					caseFlowId:this.defalutVal.caseFlowId
				}
				caseDelete(objValue).then(res =>{
					uni.showToast({
						title: '删除成功',
						icon: 'none',
						duration: 1000
					})
					uni.navigateBack({
						delta: 1
					})
				})
			},
		},
		created() {
		}
	}
</script>

<style lang="scss" scoped>
	.list {
		padding: 15rpx;
		display: flex;
		flex-direction: column;
		background-color: #ffffff;
		border-radius: 30rpx;
		margin-top: 20rpx;

		.listItem {
			width: 100%;
			display: flex;
			height: 50rpx;

			.lable {
				width: 30%;
			}

			.main {
				width: 60%;
			}

		}

		.btn {
			margin-top: 20rpx;
			width: 100%;
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;

			.btnItem {
				height: 50rpx;
				background-color: #5395ff;
				border-radius: 10rpx;
				text-align: center;
				line-height: 50rpx;
			}
		}
	}
</style>