<template>
	<view class="xkl-com-bg">
		<view style="height: 20rpx;"></view>
		<view style="background-color: #ffffff;padding: 30rpx;">
			<u--form labelPosition="top" :model="form" :rules="rules" ref="uForm" labelWidth="200rpx">
				<u-form-item label="公司名称" prop="realname" borderBottom>
					<u-input v-model="form.realname" placeholder="请输入" border="none" />
				</u-form-item>
				<u-form-item label="开户行" prop="subname" borderBottom>
					<u-input v-model="form.subname" placeholder="请输入" border="none" />
				</u-form-item>
				<u-form-item label="银行账号" prop="num" borderBottom>
					<u-input v-model="form.num" placeholder="请输入" border="none" />
				</u-form-item>
			</u--form>
			<view style="height: 50rpx;"></view>
			<view>
				<view style="font-size: 28rpx;color: coral;">请仔细核对信息，填写错误会导致提现失败。</view>
			</view>
			<view style="height: 50rpx;"></view>
			<u-button type="primary" @click="submit">提交</u-button>
			<view style="height: 50rpx;"></view>
		</view>
	</view>

</template>

<script>
	let self;
	export default {
		data() {
			return {
				rules: {
					subname: [{
						required: true,
						message: '请输入',
						trigger: ['blur', 'change']
					}],
					realname: [{
						required: true,
						message: '请输入',
						trigger: ['blur', 'change']
					}],
					num: [{
						required: true,
						message: '请输入',
						trigger: ['blur', 'change']
					}],
				},
				form: {
					id: '',
					role: 2,
					subname: '',
					realname: '',
					idcard: '',
					num: '',
					mobile: '',
				},

			}
		},
		mounted() {

		},
		onLoad(option) {
			self = this;
			if (option && option.item) {
				self.form = JSON.parse(decodeURIComponent(option.item));
			}
		},
		onShow() {

		},
		onReady() {
			//如果需要兼容微信小程序，并且校验规则中含有方法等，只能通过setRules方法设置规则。
			self.$refs.uForm.setRules(self.rules)
		},
		methods: {
			submit() {
				this.$refs.uForm.validate().then(res => {
					self.$http.post('/shop/v10/account/org', self.form).then(({
						data,
						success
					}) => {
						if (success) {
							uni.navigateBack();
						}
					})
				}).catch(errors => {

				})
			},
		}
	}
</script>

<style lang="scss">

</style>