<template>
	<view class="content">
		
		<view class="mt20">
			
			<view class="re-card-p32">
				<view class="flex-sb">
					<view class="re-from-label">写在前面</view>
				</view>
				<view class="re-card-context">
					您添加的员工账号将允许登陆，管理订单，管理设备，请谨慎确认后添加。
				</view>
			</view>
			
			<view class="re-card-p32">
				<view class="re-from-line">
					<view class="re-from-label">员工姓名</view>
					<view class="b-relative">
						<input v-model="form.name" maxlength="8" class="re-from-input" placeholder="请填写真实姓名" />
						<image class="re-from-icon" src="/static/icons/icon01.png"></image>
					</view>
				</view> 
				<view class="re-from-line">
					<view class="re-from-label">员工号码</view>
					<view class="b-relative">
						<input v-model="form.mobile" type="number" maxlength="11" class="re-from-input" placeholder="用于接验证码登陆" />
						<image class="re-from-icon" src="/static/icons/icon02.png"></image>
					</view>
				</view> 
			</view>	
			
			<view class="b-fiexd re-end-pand">
				<button @click="submit">提交审核</button>
			</view>
		
		</view>
		
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				show: false,
				form: {
					name:  "",
					mobile:"",
				}
			}
		},
		onLoad() {
			
		},
		methods: {
			submit(){
				if(!this.form.name){
					uni.showToast({ icon: "none", title: "请填写姓名" })
					return
				}
				if(!this.form.mobile){
					uni.showToast({ icon: "none", title: "请填写手机" })
					return
				}
				this.doSubmit()
			},
			doSubmit(){
				uni.showLoading({})
				this.form.id = this.$utils.generateUUID()
				this.form.status = 1
				this.form.area = uni.getStorageSync("area")
				this.form.enter_id = uni.getStorageSync("enter_id")
				this.$httpPost("/api/emp/push", this.form, (res) => {
					console.log('[/emp/push]', res);
					if(res.data || res.data == 1){
						uni.hideLoading({})
						uni.showToast({ icon: "none", title: "数据已提交" })
						setTimeout(()=>{
							uni.navigateBack({ delta: 1 })
						}, 1500)
					} 
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #F5F5F5;
	}
	
	/deep/ uni-radio .uni-radio-input{
		background-color: #F40000 !important;
		border-color: #F40000 !important;
	}
	
	/deep/ uni-radio .uni-radio-input:empty{
		background-color: #ffffff !important;
		border-color: #888888 !important;
	}
	
	.b-fiexd{
		min-height: 88rpx;
		width: calc(100vw); 
		padding: 30rpx 0;
		position: fixed; 
		left: 0; 
		bottom: 0; 
		box-shadow: -20rpx 10rpx 10rpx #000;
		background-color: #ffffff;
	}
</style>
