applayruzhu.vue 3.7 KB
<template>
	<view class="content">

		<view class="writebox commnonpadding">
			<view class="companyitem flextwo">
				<view class="companyitemleft">姓名</view>
				<view class="cright">
					<input type="text" placeholder="请填写姓名" placeholder-class="entercom" @input="entername"/>
				</view>
			</view>
			<view class="companyitem flextwo">
				<view class="companyitemleft">省份</view>
				<view class="cright">
					<picker @change="bindproChange" :value="index" :range="provincelist" range-key="name">
						<view class="entercom">{{provincename}}</view>
					</picker>
				</view>
			</view>
			<view class="companyitem flextwo">
				<view class="companyitemleft">联系电话</view>
				<view class="cright">
					<input type="number" placeholder="请填写联系电话" placeholder-class="entercom" @input="enterphone" />
				</view>
			</view>
			


		<view class="huiyuanbot boxsizing shenhe">
			<view class="behuiyuanbtn" @click="submitshen">提交</view>
		</view>
		
		</view>
	</view>
</template>

<script>
	import app from "../../App.vue";
	    export default {
	        data() {
	            return {
					atten:false,
					provincename:'请选择省份',
					index:0,
					provincelist:[],
					province_id:'',
					name:'',
					phone:''
	            }
	        },
	        onLoad() {  
			this.getprolist()
	        },
	        methods: {
				
	           enterword(e){
				   let name=e.currentTarget.dataset.name;
				   console.log(name);
				   this.obj[name]=e.detail.value;
				   
			   },
			   // 获取省份
			   getprolist(){
				   let that = this;
				   var url = 'forum/get_province';
				   var params = {
				   	is_forum_hot: ''
				   }
				   console.log('7766554', params)
				   app.post(url, params).then((res) => {
				   	console.log(res);
				   	that.provincelist = res.data.data;
				   	
				   }).catch((err) => {
				   	           
				   })
			   },
			    bindproChange: function(e) {
			          this.index = e.target.value;
					  this.provincename=this.provincelist[e.target.value].name;
					  this.province_id=this.provincelist[e.target.value].id
			      },
				  //填写姓名
				  entername(e){
					this.name=e.detail.value  
				  },
				  // 填写手机号
				  enterphone(e){
					this.phone=e.detail.value  
				  },
			 
				// 提交审核
				submitshen(){
					let that = this;
					if(that.name==''){
						uni.showToast({
							title:"请填写姓名",
							icon:"none"
						})
						return false
					}
					if(that.province_id==''){
						uni.showToast({
							title:'请选择省份',
							icon:'none'
						})
						return false
					}
					if(that.phone==''){
						uni.showToast({
							title:"请填写手机号",
							icon:"none"
						})
						return false
					}
					if(that.phone!=''){
						if (!(/^1[3456789]\d{9}$/.test(that.phone))) {
							wx.showToast({
								title: '请输入正确手机号',
								icon: 'none'
							})
							return false;
						}
					}
						
					var url = 'enter/apply_enter';
					var params = {
						name:that.name,
						mobile:that.phone,
						province_id:that.province_id
					}
					console.log('7766554', params)
					app.post(url, params).then((res) => {
						uni.showToast({
							title:"提交成功",
							icon:"none"
						})
						
						setTimeout(function(){
							uni.navigateBack({
								checked:true
							})
						},1500)
						console.log(res);		
					}).catch((err) => {
						console.log(err)
						uni.showToast({
							title:err.msg,
							icon:'none'
						})
								
					})
				},
	      
	        }
	
	    }
</script>

<style>
	@import url('../../base/usercenter');

	page {
		background: #F9F9FB;
	}
	.huiyuanbot{
		position: fixed;
		bottom:0;
		left:0;
	}

	
	.writebox {
		background: #fff;
	}
</style>