myDaili.vue 4.6 KB
<template>
	<view class="dlBox-container">
		<!-- 代理表单内容 -->
		<view class="dlContent" v-if="isShow">
			<view class="name dlItem">
				<view class="name-left">
					<text>*</text>真实姓名
				</view>
				<view class="name-right">
					<input :disabled='qwer'   type="text" v-model="userName" placeholder="请输入您的姓名" />
				</view>
			</view>
			<view class="id dlItem">
				<view class="name-left">
					<text>*</text>身份证号
				</view>
				<view class="name-right">
					<input :disabled='qwer' maxlength="18" type="idcard" v-model="userID"  placeholder="请输入您的身份证号" />
				</view>
			</view>
			<view class="workAddress dlItem">
				<view class="name-left s6 ">
					单位名称
				</view>
				<view class="name-right ml">
					<input :disabled='qwer' type="text" v-model="danweiAddress" placeholder="请输入您的单位名称" />
				</view>
			</view>
			<view class="telPhone dlItem">
				<view class="name-left">
					<text>*</text>联系电话
				</view>
				<view class="name-right">
					<input :disabled='qwer' maxlength="11" type="number" v-model="telPhone" placeholder="请输入您的联系电话" />
				</view>
			</view>
		</view>
		<!-- 代理申请按钮 -->
		<view class="dlBtn flex justifyBetween">
			<view class="qxBtn btnCom" @click="FhBtn">
				取消
			</view>
			<view class="qdBtn btnCom" @click="isjiance">
				确认
			</view>
		</view>
	</view>
</template>

<script>
	let that;
	export default {
		data() {
			return {
				qwer: false, //false是能修改
				isShow:false,
				newArry: [],
				userName: "",
				userID: "",
				danweiAddress: '',
				telPhone: '',
				showImg: true,
			}
		},
		onShow() {
			that = this;
			this.$rqs('/api/agent/index').then(res=>{
				if(res.data.code == 1){
				this.userName =res.data.data.nickname 
				this.userID =res.data.data.identity
				this.telPhone = res.data.data.mobile
				this.danweiAddress =''|| res.data.data.unit
				this.isShow = true;
				}else{
					this.isShow = true;
				}
			})

		},
		mounted() {
			
		},
		onLoad(e) {
			console.log(e)
			console.log(typeof e.showImg);
			if(e.showImg == "false"){
				this.qwer = true
			}else if(e.b){
				this.qwer = true
			}
		},
		watch: {

		},
		methods: {
			//验证输入内容
			isjiance(e) {
				if(/^(?:[\u4e00-\u9fa5·]{2,16})$/.test(this.userName)){
					if(/^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(this.userID)){

						if(/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/.test(this.telPhone)){
								let data = {
									unit:this.danweiAddress || '',
									identity:this.userID,
									mobile:this.telPhone,
									name:this.userName
								}
								console.log(data.unit);
							this.$rqs('/api/agent/add',data).then(res=>{
								console.log(res.errMs == 'request:ok');//false
								// if(res.errMs == 'request:ok' || )
								uni.setStorageSync("phone",this.telPhone)
								uni.reLaunch({
									url:'../my?a=1'
								})
							})
						}else{
							uni.showToast({
								icon: 'none',
								title: '电话号填写有误'
							})
						}
					}else{
						uni.showToast({
							icon: 'none',
							title: '身份证号填写有误'
						})
					}
				}else{
						uni.showToast({
							icon: 'none',
							title: '真实姓名填写有误'
						})
					
				}
				


			},
			FhBtn() {
				uni.navigateBack({
					delta: 1
				})
			},
			QdBtn() {
				this.showImg = false;
				uni.reLaunch({
					url: "../my?e=" + this.showImg
				})
			}
		}
	}
</script>

<style>
	page {
		width: 100%;
		height: 100%;
		background-color: #EBEBEB;
	}

	.dlBox-container {
		width: 100%;
		box-sizing: border-box;
		padding: 32rpx 32rpx 0;

	}

	.dlContent {
		height: 472rpx;
		border-radius: 16rpx;
		box-sizing: border-box;
		margin-bottom: 100rpx;
		padding: 40rpx 32rpx;
		background: rgba(255, 255, 255, 1);
	}

	.dlItem {
		display: flex;
		height: 74rpx;
		margin-bottom: 32rpx;
		border-bottom: 2px solid #f1f1f1;

	}

	.dlItem:last-child {
		margin-bottom: 0;
	}

	.name-left {
		height: 40rpx;
		margin-right: 32rpx;
	}

	.dianhu {
		color: #323233;

	}

	.s,
	.ml {
		margin-left: 14rpx;
	}

	.name-left text {
		color: #FC4338;
	}

	.name-right {
		height: 40rpx;
		font-size: 28rpx;
	}

	.s6 {
		padding-left: 8rpx;
	}

	.dlBtn {
		height: 80rpx;
	}

	.qxBtn {
		background: rgba(255, 255, 255, 1);
	}

	.qdBtn {
		background: linear-gradient(119.1deg, rgba(52, 94, 71, 1) 0%, rgba(62, 85, 78, 1) 100%);
		color: #FFFFFF;
	}

	.aa {
		margin-left: 14rpx;
	}

	.btnCom {
		width: 326rpx;
		text-align: center;
		line-height: 80rpx;
	}
</style>