<template>
	<ciy-header title="设置提现账号"></ciy-header>
	<form @submit="submit" class="char3">
		<view class="ciy-card">
			<view class="content char4">
				<view class="ciy-form">
					<label class="imp">提现方案</label>
					<view style="text-align: left;">
						<ciy-selbool name="cashtype" v-model="me.cashtype" y="独立纳税" n="个人微信"></ciy-selbool>
					</view>
				</view>
				<view class="ciy-form" v-if="me.cashtype == 1">
					<label class="imp">银行卡号</label>
					<view>
						<ciy-input name="bankno" v-model="me.bankno" type="text" bb></ciy-input>
					</view>
				</view>
				<view class="ciy-form" v-if="me.cashtype == 1">
					<label class="imp">开户银行</label>
					<view>
						<ciy-input name="bankname" v-model="me.bankname" type="text" bb></ciy-input>
					</view>
				</view>
				<view class="ciy-form" v-if="me.cashtype == 1">
					<label class="imp">账户名称</label>
					<view>
						<ciy-input name="bankaccount" v-model="me.bankaccount" type="text" bb></ciy-input>
					</view>
				</view>
				<view class="ciy-form-bottom">
					<button class="btn lg cc" form-type="submit">设置</button>
				</view>
			</view>
		</view>
	</form>
	<view class="ciy-tip">
		个人微信提现<br />
		　每次最低提现金额为1元。<br />
		　统一代扣缴20%个税，每月汇总申报个税。<br />
		　以实名认证姓名、身份证号及手机号为准。<br />
		<br />
		独立纳税提现<br />
		　每次最低提现金额为1000元。<br />
		　申请提现后，平台收到电子发票后打款。<br />
		　注意: 电子发票抬头与账户名称一致。<br />
	</view>
</template>

<style>
</style>

<script>
	export default {
		data() {
			return {
			}
		},
		onLoad() {},
		methods: {
			async submit(e) {
				if (e.detail.value.cashtype == 1) {
					e.detail.value.bankno = e.detail.value.bankno.trim();
					if (e.detail.value.bankno.length < 6)
						return this.toast('请输入银行卡号');
					if (e.detail.value.bankname.length == 0)
						return this.toast('请输入开户行');
					if (e.detail.value.bankaccount.length == 0)
						return this.toast('请输入账户名称');
				}
				if (this._loading)
					return;
				this._loading = true;
				var retjson = await this.callajax({
					func: 'me.userbank_change',
					data: e.detail.value
				});
				this._loading = false;
				if (retjson.code != 1)
					return this.alert(retjson.errmsg);
				this.me.cashtype = e.detail.value.cashtype;
				this.me.bankno = e.detail.value.bankno;
				this.me.bankname = e.detail.value.bankname;
				this.me.bankaccount = e.detail.value.bankaccount;
				this.setstorage('me', this.me);
				await this.toast('修改成功');
				uni.navigateBack();
			}
		}
	}
</script>