<template>
	<view class="form">
		<view class="card">
			<view class="row" @click="showReason=true">
				<view class="lab">退款原因</view>
				<view class="val">申请同城转校</view>
				<view class="icon">
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<!-- <view class="tpsBlue">此操作容易造成您已有学时丢失，请谨慎！</view> -->
			<view class="row">
				<view class="lab">退款金额</view>
				<view class="val">
					<u--input placeholder="请输入" border="none" clearable type="number" maxlength="11" v-model="FormData.phone"></u--input>
				</view>
			</view>
			<view class="tpsHui">退款金额不可超过¥2000.00</view>
		</view>
		<view class="h1">收款信息</view>
		<view class="card">
			<view class="row">
				<view class="lab">持卡人</view>
				<view class="val">
					<u--input placeholder="请输入" border="none" clearable type="number" maxlength="11" v-model="FormData.phone"></u--input>
				</view>
			</view>
			<view class="row">
				<view class="lab">手机号</view>
				<view class="val">
					<view class="flex-b">
						<view class="inputBox">
							<u--input placeholder="请输入" border="none" clearable type="number" maxlength="11" v-model="FormData.phone"></u--input>
						</view>
						<view class="code"  @click='goSms'  :class="{active: isPhone&&!codeOn}">获取验证码</view>
					</view>
				</view>
			</view>
			<view class="row">
				<view class="lab" >验证码</view>
				<view class="val">
					<u--input placeholder="请输入" border="none" clearable type="number" maxlength="11" v-model="FormData.phone"></u--input>
				</view>
			</view>
			<view class="row">
				<view class="lab">卡号</view>
				<view class="val">
					<view class="flex-b">
						<view class="inputBox">
							<u--input placeholder="请输入" border="none" clearable type="number" maxlength="11" v-model="FormData.phone"></u--input>
						</view>
						<view class="scan">
							<image src="@/static/images/userCenter/btn_yinhangkax.png" mode=""></image>
						</view>
					</view>
				</view>
			</view>
			<view class="row">
				<view class="lab">开户行</view>
				<view class="val">
					<u--input placeholder="请输入" border="none" clearable type="number" maxlength="11" v-model="FormData.phone"></u--input>
				</view>
			</view>
		</view>
		<u-picker :show="showReason" :columns="reasonArr" keyName="lab" @confirm="confirmReason" @cancel="showReason=false"></u-picker>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				FormData: {
					
				},
				
				showReason: false ,
				codeOn: false,
				reasonArr: [
					[
						{lab: '不想学了',id: 1},
						{lab: '有事情',id: 2},
						{lab: '去别的地方学',id: 3},
					]
				],
			}
		},
		computed: {
			isPhone() {
				return uni.$u.test.mobile(this.FormData.phone)
			}
		},
		methods: {
			confirmReason(val) {
				let item = val.value[0]
				this.showReason = false
				console.log(item)
			},
			// 发送短信验证码
			async goSms() {
				const {
					FormData
				} = this
				if (!FormData.phone) return this.$u.toast('请输入手机号');
				if (!this.isPhone) return this.$u.toast('手机号格式有误');
				if (this.codeOn) return
				const data = await getLoginCode({
					codeType: 1,
					phone: FormData.phone,
				})
				console.log(data)
				// 获取验证码
				var time = 60;
				var timer = setInterval(() => {
					time--;
					this.codeText = time + "秒后重新发送"
					this.codeOn = true;
					if (time == 0) {
						clearInterval(timer);
						this.codeText = "获取验证码";
						this.codeOn = false;
					}
				}, 1000);
			},
		}
	}
</script>

<style lang="scss" scoped>
	  
	.h1 {
		margin: 20rpx 0;
	}
	  .card {
		  padding: 12rpx 28rpx;
		  margin-bottom: 24rpx;
	    .row {
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 80rpx;
			line-height: 80rpx;
	      .lab {
			font-size: 28rpx;
			color: #333;
			font-weight: 500;
			width: 152rpx;
	      }
	
	      .val {
			flex: 1;
			&.tpsBlue {
				font-size: 24rpx;
			}
			.flex-b {
				.scan {
					width: 44rpx;
					height: 44rpx;
				}
				.code {
					flex-shrink: 0;
					color: #ADADAD;
					&.active {
						color: $themC;
					}
				}
			}
	      }
	
	      .icon {
	        u-icon {
	
	        }
	      }
	    }
		.tpsBlue {
			color: $themC;
			margin-bottom: 10rpx;
			padding-left: 152rpx;
			font-size: 24rpx;
		}
	    .tpsHui {
			font-size: 24rpx;
			color: #ADADAD;
			padding: 0rpx 0 16rpx 0;
	    }
	  }
	
	  
	
	  
</style>