<template>
	<view class="content">
		<view class="body user-insert">账号：{{joinpayMchCheck.userName}}</view>
		<view class="" v-if="joinpayMchCheck.idCardNo!=null">
			<form >
				<view class="body user-insert-line">旧银行卡号：{{oldJoinpayMchCheck.bankAccountNo}}</view>
				<view class="body user-insert-line">旧银行账户名：{{oldJoinpayMchCheck.bankAccountName}}</view>
				<view class="body user-insert-line">旧法人姓名：{{oldJoinpayMchCheck.legalPerson}}</view>
				<view class="body user-insert-line">旧身份证：{{oldJoinpayMchCheck.idCardNo}}</view>
				<view class="body user-insert-line">旧银联号：{{oldJoinpayMchCheck.bankChannelNo}}</view></br>
			</form>
			<view class="body user-insert">-------------------------------</view>
			<form >
				<view class="body user-insert-line">新银行卡号：{{joinpayMchCheck.bankAccountNo}}</view>
				<view class="body user-insert-line">新银行账户名：{{joinpayMchCheck.bankAccountName}}</view>
				<view class="body user-insert-line">新法人姓名：{{joinpayMchCheck.legalPerson}}</view>
				<view class="body user-insert-line">新身份证：{{joinpayMchCheck.idCardNo}}</view>
				<view class="body user-insert-line">新银联号：{{joinpayMchCheck.bankChannelNo}}</view>
				<view class="body user-insert-line">提交时间：{{joinpayMchCheck.createDate}}</view>
				<view class="btn-area">
					<button type="primary" @click="agree(joinpayMchCheck.id)" style="margin-right: 20px;" >通过</button>
					<button type="primary"  @click="unagree(joinpayMchCheck.id)" >撤销</button>
				</view>
			</form>
		</view>
		<view class="" v-else>
			<form >
				<view class="body user-insert-line">旧杉德宝账号：{{oldJoinpayMchCheck.bankAccountNo}}</view>
				<view class="body user-insert-line">旧杉德宝账户名：{{oldJoinpayMchCheck.bankAccountName}}</view>
				<view class="body user-insert-line">旧杉德宝类型：{{oldJoinpayMchCheck.bankAccountType==0?'企业':'个人'}}</view>
				<view class="body user-insert-line">旧联行号：{{oldJoinpayMchCheck.bankChannelNo}}</view>
				<view class="body user-insert-line">旧开户行：{{oldJoinpayMchCheck.bankChannelName}}</view>
			</form>
			<view class="body user-insert">-------------------------------</view>
			<form >
				<view class="body user-insert-line">新杉德宝账号：{{joinpayMchCheck.bankAccountNo}}</view>
				<view class="body user-insert-line">新杉德宝账户名：{{joinpayMchCheck.bankAccountName}}</view>
				<view class="body user-insert-line">新杉德宝类型：{{joinpayMchCheck.bankAccountType==0?'企业':'个人'}}</view>
				<view class="body user-insert-line">联行号：{{joinpayMchCheck.bankChannelNo}}</view>
				<view class="body user-insert-line">开户行：{{joinpayMchCheck.bankChannelName}}</view>
				<view class="body user-insert-line">提交时间：{{joinpayMchCheck.createDate}}</view>
				<view class="btn-area">
					<button type="primary" @click="agreeShande(joinpayMchCheck.id)" style="margin-right: 20px;" >通过</button>
					<button type="primary"  @click="unagreeShande(joinpayMchCheck.id)" >撤销</button>
				</view>
			</form>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				oldJoinpayMchCheck:{},
				joinpayMchCheck:{},
			}
		},
		onLoad: function(option) {
			const joinpayMchCheck = JSON.parse(decodeURIComponent(option.joinpayMchCheck));
			//idCardNo
			this.joinpayMchCheck = joinpayMchCheck;
			this.getOldJoinpayMch(joinpayMchCheck.adminId);
		},
		onShow() {
		},
		methods: {
            getOldJoinpayMch(adminId){
				var token = uni.getStorageSync("token");
				if(this.joinpayMchCheck.idCardNo!=null){
					uni.request({
						url: this.serverurl + '/TJoinpayMch/getMch',
						data: {
							"adminId": adminId,
						},
						header: {
							'token': token
						},
						method: "POST",
						success: (res) => {
							var date  = res.data.data;
							this.oldJoinpayMchCheck = date;
						},
					});
				}else{
					uni.request({
					url: this.serverurl + '/TShandeMch/getMch',
					data: {
						"adminId": adminId,
					},
					header: {
						'token': token
					},
					method: "POST",
					success: (res) => {
						var date  = res.data.data;
						this.oldJoinpayMchCheck = date;
					},
				});
				}
				
			},
			agree(id){
				var that = this;
				uni.showModal({
					title: '提示',
					content: '是否通过？',
					success: function(res) {
						if (res.confirm) {
							var token = uni.getStorageSync("token");
							uni.request({
								url: that.serverurl + '/TJoinpayMchCheck/agree?id=' + id,
								header: {
									'token': token
								},
								method: "GET",
								success: (res) => {
									uni.showToast({
										title: res.data.message,
										duration: 2000
									});
								},
							});
						} else if (res.cancel) {}
					}
				});
			},
			unagree(id){
				var that = this;
				uni.showModal({
					title: '提示',
					content: '是否不通过？',
					success: function(res) {
						if (res.confirm) {
							var token = uni.getStorageSync("token");
							uni.request({
								url: that.serverurl + '/TJoinpayMchCheck/unagree?id=' + id,
								header: {
									'token': token
								},
								method: "GET",
								success: (res) => {
									uni.showToast({
										title: res.data.message,
										duration: 2000
									});
								},
							});
						} else if (res.cancel) {}
					}
				});
			},
			agreeShande(id){
				var that = this;
				uni.showModal({
					title: '提示',
					content: '是否通过？',
					success: function(res) {
						if (res.confirm) {
							var token = uni.getStorageSync("token");
							uni.request({
								url: that.serverurl + '/TShandeMchCheck/agree?id=' + id,
								header: {
									'token': token
								},
								method: "GET",
								success: (res) => {
									uni.showToast({
										title: res.data.message,
										duration: 2000
									});
								},
							});
						} else if (res.cancel) {}
					}
				});
			},
			unagreeShande(id){
				var that = this;
				uni.showModal({
					title: '提示',
					content: '是否不通过？',
					success: function(res) {
						if (res.confirm) {
							var token = uni.getStorageSync("token");
							uni.request({
								url: that.serverurl + '/TShandeMchCheck/unagree?id=' + id,
								header: {
									'token': token
								},
								method: "GET",
								success: (res) => {
									uni.showToast({
										title: res.data.message,
										duration: 2000
									});
								},
							});
						} else if (res.cancel) {}
					}
				});
			}
		}
	}
	
</script>

<style>
	.content{
			padding-top:20upx;
			margin-left:20upx;
	}
	.body {
		background-color: #FFFFFF;
		padding: 10upx 20upx 10upx 20upx;
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
	}

	.input {
		/* padding: 10upx 20upx 10upx 0upx; */
		padding-left: 20upx;
		padding-top: 10upx;
		background-color: #FFFFFF;
		width: 500upx;
		height: 50upx;
		box-shadow: 0upx 0upx 20upx #D3D3D3;
		border-radius: 5upx;
	}

	.button {
		margin: 0 auto;
		display: inline-block;
	}

	button[type=primary] {
	    background-color: #007aff;
	    color: #fff;
		display: inline-block;
	}	
	.btn-area{
		padding-top:60upx;
		margin: 0 auto;
		width: 50%;
	}
	.user-insert-line {
	  width: 500upx;
	  height: 23px;
	  border-bottom:solid black 1px;
	  margin: 0 auto;
	}
	.user-insert{
		width: 400upx;
		margin: 0 auto;
	}
	view{
		font-size: 30rpx;
	}
</style>
