<template>
	<!-- <el-descriptions title="详情信息">
		<el-descriptions-item label="姓名">{{tableData.name}}</el-descriptions-item>
		<el-descriptions-item label="服务费率">{{tableData.serviceRate}}%</el-descriptions-item>
		<el-descriptions-item label="利率">{{tableData.interest}}%</el-descriptions-item>
		<el-descriptions-item label="银行账户">{{tableData.bankAccount}}</el-descriptions-item>
		<el-descriptions-item label="银行名称">{{tableData.bankName}}</el-descriptions-item>
	</el-descriptions> -->
	<div class="form">
		<el-form ref="form" :model="tableData" label-width="80px" >
		  <el-form-item label="姓名" prop="tableData.name">
		    <el-input v-model="tableData.name" style="width: 300px;"></el-input>
		  </el-form-item>
		  <el-form-item label="服务费率" prop="tableData.serviceRate">
		    <el-input v-model="tableData.serviceRate" style="width: 300px;"></el-input>
		  </el-form-item>
		  <el-form-item label="利率" prop="tableData.interest">
		    <el-input v-model="tableData.interest" style="width: 300px;"></el-input>
		  </el-form-item>
		  <el-form-item label="银行账户" prop="tableData.bankAccount">
		    <el-input v-model="tableData.bankAccount" style="width: 300px;"></el-input>
		  </el-form-item>
		  <el-form-item label="银行名称" prop="tableData.bankName">
		    <el-input v-model="tableData.bankName" style="width: 300px;"></el-input>
		  </el-form-item>
		   <el-form-item>
		      <el-button type="primary" @click="onSubmit">提交修改</el-button>
			  <el-button type="primary" @click="back">返回</el-button>
		    </el-form-item>
		</el-form>
	</div>
	
</template>

<script>
	export default {
		data() {
			return {
				tableData: {
					name:'',
					serviceRate:'',
					interest:'',
					bankAccount:'',
					bankName:'',
					id:''
				},
			}
		},
		mounted() {
			let id = this.$route.query.id
			this.$request({
				url: '/api/Acceptor/' + id,
				method: 'get',
			}).then((res) => {
				this.tableData = res.data
				this.tableData.id=this.$route.query.id
				console.log(this.tableData)
			})
		},
		methods:{
			onSubmit(){
				this.$request({
					url:'/api/Acceptor/update',
					method:'post',
					data:this.tableData
				}).then((res)=>{
					if(res.code==200){
						this.$message({
							type:'success',
							message:'修改成功!'
						})
					}else{
						this.$message({
							type:'danger',
							message:'修改失败!'
						})
					}
				})
			},
			back(){
				this.$router.go(-1)
			}
		}
	}
</script>

<style lang="scss">
	.form{
		margin: auto 0;
		display: flex;
		justify-content: center;
	}
</style>
