<template>
	<div class="exp-form">
		<van-collapse v-model="activeNames">
			<van-collapse-item title="退款申请单" name="1">
				<van-field v-model="form.tradePartnerCode" label="供应商编码" readonly />
				<van-field v-model="form.tradePartnerName" label="供应商名称" readonly />
				<van-field v-model="form.reqNo" label="申请单号" readonly />
				<van-field v-model="form.reqLn" label="申请单行号" readonly />
				<van-field v-model="form.accountNo" label="结算单号" readonly />
				<van-field v-model="form.invoiceNo" label="发票编号" readonly />
				<van-field v-model="form.purContrCd" label="合同编号" readonly />
				<van-field v-model="form.payedAmount" label="已付金额" readonly />
				<van-field v-model="form.refundAmount" label="退款金额" readonly />
				<van-field v-model="form.refundDate" label="退款日期" readonly />
			</van-collapse-item>
		</van-collapse>
	</div>
</template>

<script setup lang="ts">
	import { ref, reactive, onMounted, getCurrentInstance } from 'vue'
	import { useRouter, useRoute } from 'vue-router'
	import { showToast, showDialog, showLoadingToast, showSuccessToast, closeToast } from 'vant'
	const { proxy } = getCurrentInstance()
	const route = useRoute()
	import {
		useWorkflowStore
	} from "@/stores/workflow"
	const workflow = useWorkflowStore()

	onMounted(() => {
		workflow.setWorkId(route.query.workId);
		getTableData()
	})


	const activeNames = ref(['1'])

	// 查询对账单头信息
	const form = ref({
		id: '',
		pId: '',
		reqNo: '',
		reqLn: '',
		accountNo: '',
		invoiceNo: '',
		purContrCd: '',
		payedAmount: '',
		refundAmount: '',
		reqTy: '',
		payMth: '',
		refundDate: '',
		tradePartnerCode: '',
		tradePartnerName: '',
		addId: '',
		addCode: '',
		addName: '',
		addDeptId: '',
		addDeptCode: '',
		addDeptName: '',
		addTime: '',
		modifyId: '',
		modifyCode: '',
		modifyName: '',
		modifyTime: '',
		cancelId: '',
		cancelCode: '',
		cancelName: '',
	})

	const getTableData = () => {
		var url = 'pur/PayRefund/queryByWorkId'
		var param = {
			workId: workflow.workId
		}

		proxy.$axios.get(url, param).then((response : any) => {
			if (response.data.code == '0') {
				form.value = response.data.data
			} else {
				showToast('操作失败！' + response.data.msg)
			}
		})
	}
</script>

<style lang="scss" scoped>
	.exp-form {
		background: #f7f8fa;
		padding-bottom: 20px;
	}

	.van-collapse-item {
		padding: 10px;
		border-radius: 45px !important;

		.van-cell--clickable {
			border-radius: 10px 10px 0 0;
		}
	}

	:deep .van-cell {
		border-radius: 10px 10px 0 0;
	}

	:deep .van-collapse-item__wrapper {
		border-radius: 0 0 10px 10px;
	}
</style>