<template>
	<view class="content">
		<view class="acountbox">
			<view class="inacount">
				<text class="acoutitle">承兑人名称</text>
				<input type="text" v-model="form.name" class="checkword" placeholder="请输入承兑人名称"
					placeholder-style="font-size:30rpx;color:#68625B" />
			</view>
			<view class="inacount">
				<text class="acoutitle">账号</text>
				<input type="text" v-model="form.bankAccount" class="checkword" placeholder="请输入账号(选填)"
					placeholder-style="font-size:30rpx;color:#68625B" />
			</view>
			<view class="inacount">
				<text class="acoutitle">服务费率	</text>
				<input type="text" v-model="form.serviceRate" class="checkword" placeholder="请输入服务费率"
					placeholder-style="font-size:30rpx;color:#68625B" />
			</view>
			<view class="inacount">
				<text class="acoutitle">利率</text>
				<input type="text" v-model="form.interest"  class="checkword" placeholder="请输入利率"
					placeholder-style="font-size:30rpx;color:#68625B" />
			</view>
			<view class="inacount">
				<text class="acoutitle">开户行名称</text>
				<input type="text" v-model="form.bankName"  class="checkword" placeholder="请输入开户行名称(选填)"
					placeholder-style="font-size:30rpx;color:#68625B" />
			</view>
			<view class="inacount">
				<text class="acoutitle">开户行行号</text>
				<input type="text" v-model="form.bankNo"  class="checkword" placeholder="请输入开户行行号(选填)"
					placeholder-style="font-size:30rpx;color:#68625B" />
			</view>
			<view class="inacount">
				<text class="acoutitle">合同服务信息</text>
				<text style="margin-left: 20rpx;" class="pt" @click="addpdf(form.templateServiceContract)">获取服务合同信息</text>
			</view>
		</view>
		<view class="logininbtn" @click="MakeSure">
			<text>确认修改</text>
		</view>
	</view>
</template>

<script>
	let that
	export default {
		data() {
			return {
				id:'',
				form: {
					name: '',
					bankAccount:'',
					serviceRate:'',
					interest:'',
					bankName:'',
					templateServiceContract:''
				},
				
			}
		},
		onLoad(o) {
			that=this
			if(o.id){
				this.id=o.id
			}
			this.init()
		},
		methods: {
			init(){
				uni.showLoading()
				uni.$u.http.get(`/api/Acceptor/${this.id}`,{
					custom: {
						auth: true
					}
				}).then((res) => {
					uni.hideLoading()
					this.form=res
					
				}).catch((err) => {
					uni.hideLoading()
					console.log(err)
				})
			},
			MakeSure() {
				let form=this.form
				form.id=this.id
				if(that.form.name.length==0){
					that.$toast("请输入承兑人名称")
					return
				}
				
				if(that.form.serviceRate.length==0){
					that.$toast("请输入服务费率")
					return
				}
				if(that.form.interest.length==0){
					that.$toast("请输入利率")
					return
				}
				uni.showModal({
					title: '提示',
					content: '是否确认修改？',
					success: function(res) {
						if (res.confirm) {
							uni.showLoading()
							uni.$u.http.post('/api/Acceptor/update', form, {
								custom: {
									auth: true
								}
							}).then((res) => {
								uni.hideLoading()
								// that.$toast("修改成功,请到PC端上传最新的服务合同信息")
								uni.showToast({
									icon:'none',
									title: '修改成功!请到PC端上传最新的服务合同信息',
									duration: 2000
								});
								
								
								// that.form = res
							}).catch((err) => {
								uni.hideLoading()
								that.$toast(err.msg)
			
							})
						}
					}
				});
			
			},
			addpdf(msg) {
				uni.showModal({
					title: '提示',
					content: "是否获取服务合同信息？",
					success: function(res) {
						msg.forEach(item=>{
							if(res.confirm){
								uni.setClipboardData({
									data: item,
									success: function() {
										that.$toast("复制成功，请到浏览器下载")
									}
								});
							}else if(res.cancel){
								console.log('取消');
							}
							
							
						})
					}
				})
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	/* uni.scss */
	@import 'uview-ui/theme.scss';

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

	}

	.loginbg {
		background-image: url("https://t39.9026.com/web/uploads/thumbs/mall10000/20220629/e01b927c95ee1f05364f5e456f281388.png");
		height: 559rpx;
		width: 750rpx;
		background-size: 100% 100%;

		// display: flex;
		// align-items: center;
		// justify-content: center;
	}

	.logo {
		margin: 0 auto;
		height: 200rpx;
		width: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}

	.logobox {
		margin: 0 auto;
		margin-top: 212rpx;
		width: 269rpx;
		height: 191rpx;
		// background-color: #F1F1F1;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.checkbox {}

	.business {
		width: 305rpx;
		height: 90rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		// background-color: #D8AB5A;
		border-raotherdius: 20rpx;
		color: #FFFFFF;
		margin-top: 57rpx;
	}

	.bnesper {
		background-size: 100%;
		background-image: url("@/static/img/loginbtn4.png");
		padding-top: 10rpx;
		color: #FFF1D8;
		line-height: 90rpx;
	}

	.applyper {
		background-image: url("@/static/img/loginbt1.png");
		background-size: 100%;
		padding-top: 10rpx;
		color: #FFF1D8;
	}

	.actapp {
		background-image: url("@/static/img/loginbtn3.png");
		background-size: 100%;
		color: #D05C39;
	}

	.actbnes {
		background-image: url("@/static/img/loginbt2.png");
		background-size: 100%;
		color: #D05C39;
	}

	.acountbox {
		.inacount {
			display: flex;
			padding: 35rpx 20rpx;
			box-sizing: border-box;
			width: 690rpx;
			margin-top: 40rpx;
			background-color: #F6F6F6;
			border-radius: 20rpx;
			font-size: 30rpx;
			color: #1F242A;

			input {
				width: 360rpx;
			}
		}

		.acoutitle {
			font-weight: 600;
		}

		.checkword {
			padding-left: 20rpx;
			color: #1F242A;
			font-size: 30rpx;
		}
	}

	.otherbt {
		width: 606rpx;
		display: flex;
		justify-content: space-between;
		font-size: 24rpx;
		padding-top: 30rpx;
	}

	.regbt {
		color: $uni-all-theme;
	}

	.logininbtn {
		margin-top: 80rpx;
		width:690rpx;
		border-radius: 20rpx;
		box-shadow: 0 10rpx 20rpx 1rpx rgba(179, 116, 5, 0.2);
		background: linear-gradient(to right, #FFE1AD,#D8AB5A);
		height: 100rpx;
		text-align: center;
		color: #fff;
		line-height: 100rpx;
	}


	
</style>
