<template>
	<view class="cmain">
		<view class="form_group">
			<view class="lable re">开户行</view>
			<input type="text" placeholder="请输入开户行" v-model="item.bankName" />
		</view>
		<view class="form_group">
			<view class="lable re">银行账号</view>
			<input type="text" placeholder="请输入银行账号" v-model="item.bankAccount" />
		</view>
		</br></br></br>
		<button class="btn" @click="save()">提交</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item: {bankName:'',bankAccount:''},
			}
		},
		onLoad() {
			this.http.request({
				url: '/sp-admin/app/AppUser/getBankInfo',
				success: res => {
					console.log("res",res)
					this.item.bankName = res.data.data.bankName;
					this.item.bankAccount = res.data.data.bankAccount;
				}
			})
		},
		methods: {
			save() {
				let rule = [
					{ name: 'bankAccount', checkType: 'bank', errorMsg: '银行账号格式不正确' }
				];
				if (!this.verify.check(this.item, rule)) {
					uni.showModal({ content: this.verify.error, showCancel: false });
					return false;
				}
				this.http.request({
					url: '/sp-admin/app/AppUser/saveBankInfo',
					data: { bankName:this.item.bankName, bankAccount:this.item.bankAccount },
					success: res => {
						uni.showToast({title:"提交成功"})
						uni.switchTab({ url: '/pages/personal/personal' });
					}
				})
			}
		}
	}
</script>

<style>

</style>
