<template>
	<view class="">
		<navigation>
			Add Address
		</navigation>
		<view class="login-body">
			<u-form :model="form" ref="uForm" :rules="rules">
					<u-form-item  prop="name">
						<u-input v-model="form.name" :placeholder="'Full Name'" @input="btnControl()"/>
					</u-form-item>
					<u-form-item  prop="mobile">
						<u-input v-model="form.mobile" :placeholder="'Mobile Number'"/>
					</u-form-item>
					<u-form-item  prop="zip">
						<u-input v-model="form.zip" :placeholder="'Pincode'"/>
					</u-form-item>
					<u-form-item  prop="province">
						<u-input v-model="form.province" :placeholder="'State'"/>
					</u-form-item>
					<u-form-item  prop="city">
						<u-input v-model="form.city" :placeholder="'Town/City'"/>
					</u-form-item>
					<u-form-item  prop="areaInfo">
						<u-input v-model="form.areaInfo" :placeholder="'Detail Address'"/>
					</u-form-item>
				</u-form>
		<button @click="submit" class="login-btn"  :class="btncol==1?'on':''" :disabled="btncol==1?false:true">
			Continue
		</button>
		</view>
	</view>
</template>

<script>
	import api from '@/utils/api'
	import utils from '@/utils'
	import md5 from 'js-md5'
	import store from '@/store'
	import cont from "@/components/navigation/navigation.vue"
	export default {
		data() {
			return {
			    // 判断按钮是否选中
				btncol: 0,
				
					form: {
								province: '',
								name:'',
								city:'',
								state:'',
								areaInfo:'',
								mobile:'',
								zip:'',
								ticket:'',
								
							},
							rules: {
								name: [
									{ 
										required: true, 
										message: 'Please enter your name', 
										// 可以单个或者同时写两个触发验证方式 
										trigger: ['blur'],
									},
								],
								code: [
									{
									    required: true,
										// min: 5, 
										message: 'Please enter IFSC Code', 
										trigger: 'blur'
									}
								],
								baName: [
									{
									    required: true,
										// min: 5, 
										message: 'Please enter Bank Name', 
										trigger: 'blur'
									}
								],
								accout: [
									{
									    required: true,
										// min: 5, 
										message: 'Please enter Bank Accout', 
										trigger: 'blur'
									}
								],
								state: [
									{
									    required: true,
										// min: 5, 
										message: 'Please enter State/Territory', 
										trigger: 'blur'
									}
								],
								city: [
									{
										// min: 5, 
										message: 'Please enter city', 
										trigger: 'blur'
									}
								],
								mobile: [
									{
										required:true,
										// min: 5, 
										message: 'Please enter Mobile Number', 
										trigger: 'blur'
									}
								],
								email: [
									{
										// min: 5, 
										message: 'Please enter email', 
										trigger: 'blur'
									}
								],
							}
			}
		},

		onLoad() {
	        this.form.ticket= uni.getStorageSync('logInfo').data;
		},
		// 必须要在onReady生命周期，因为onLoad生命周期组件可能尚未创建完毕
			onReady() {
				this.$refs.uForm.setRules(this.rules);
			},
		methods: {
			btnControl() {
				this.btncol = 1;
				if (this.form.name == '') {
					this.btncol = 0;
				}
			},
			
			
			submit() {
			
					}
		
}

			}

		
	
</script>

<style>
	@import './index.css';
</style>
