<template>
	<!-- 弹窗组件 点击确认和取消事件 -->
	<view class="VerifyIdentity">

		<uni-popup :show="showtip" type="center" :mask-click="true" @change="change">
			
			<view class="tipboxs">

				<view class="tipboxs_body" >
					<view class="headsboxs">
						{{title}}
					</view>
					<view class="textmsgs">{{infotext}} </view>
					<!-- <view class="textmsgs">你需要先去小程序或APP 绑定手机号码</view> -->
					
					
					<view class="tipboxs_foot flex">
						<view class="submitbtns submitbtns1" @tap="cancel" >取消</view>
						<view class="submitbtns" @tap="confirm" >确定</view>
					</view>
					
				</view>
				
				<!-- <image @tap="cancel" class="Closeicon" :src="joinurl+'/images/uts/guanbi.png'" mode=""></image> -->
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import uniPopup from '@/components/uni-popup/uni-popup.vue';
	import {userSendSms} from "@/utils/api/api.js";
	export default{
		//props:["title","content"],
		props:{
			title:{
				type:String,
				default:""
			},
			infotext:{
				type:String,
				default:""
			},
			
		},
		name:"moduPopup",
		components:{
			uniPopup,
		},
		computed:{
			joinurl(){
				return this.$store.state.joinurl;
			}
		},
		data(){
			return{
				showtip:false,
				datesis:60,
				phone:this.value,
				code:"",
			}
		},
		methods:{
			changeinput(e){
				this.phone = e.detail.value;
				// this.setValue(e.detail.value);
			},
			//发送验证码按钮点击后
			shendcodefun(){
				if (!(/^1[3456789]\d{9}$/.test(this.value))) {
					this.$api.msg("手机号码有误");
				} else {
					
					userSendSms({
					  mobile: this.value,
					  smstype:this.type,//验证码类型（默认修改密码：sms_user_newpwd，提现：sms_withdraw）
					}).then((res)=>{
					  if(res.code==0){
						this.$api.msg(res.msg);
						//倒计时代码
						let timeid = setInterval(() => {
						  this.datesis--;
						  if (this.datesis <= 0) {
							clearInterval(timeid);
							this.datesis = 60;
						  }
						}, 1000)
			
					  }else{
						
						this.$api.msg(res.msg);
					  }
					}).catch((e)=>{
					  this.$api.msg(e);
					})
				}
			},
			
			//提示弹窗
			change(e) {
				if (!e.show) {
					
					this.showtip = false
				}
			},
			cancel(type) {//关闭
				this.showtip = false;
				this.$emit("cancel",{});//触发回调方法
			},
			show(){
				
				this.showtip = true;
			},
			//确认发布点击
			confirm(){
				this.showtip = false;
				this.$emit("confirm",{});//触发回调方法
			}
		},
		watch:{
			value(e){
				
			}
		}
	}
</script>

<style lang="scss">
	.VerifyIdentity{
		width: 510upx;
	}
	.tipboxs{
		.heads{
			.headimg{
				height: 300upx;
				width: 100%;
			}
		}
		.fromboxs{
			margin-top: 30upx;
			.lablecell{
					height: 88upx;
				  line-height: 88upx;
				  font-size: 30upx;
				  padding:0 24upx ;
				  border-bottom: 1px solid #f5f5f5;
				.cellname{
					margin-right: 10upx;
					width: 140upx;
				}
				.inputbox{
					position: relative;
					height: 88upx;
					.input{
						height: 88upx;
						line-height: 88upx;
						text-align: left;
					}
					.codetag{
					  position: absolute;
					  top: 14upx;
					  right: 0;
					  z-index: 99;
					  color:#FFFFFF;
					  background: #ff6900;
					  font-size: 28upx;
					  padding: 0 30upx;
					  height: 60upx;
					  line-height: 60upx;
					  box-sizing: border-box;
					  border-radius: 4upx;
					}
					.codetagtwo{
					  background: #999;
					}

				}
			}
		}
		.tipboxs_body{
			width: 600upx;
			border-radius: 14upx;
			margin-top: -20upx;
			// padding: 20upx;
			// padding-top: 30upx;
			background: #ffffff;
			text-align: center;
			
			.headsboxs{
				height: 88upx;
				line-height: 88upx;
				color:#000;
				font-weight: 700;
				font-size: 34upx;
				text-align: center;
				border-bottom: 1px solid #eee;
			}
			
			
			.textmsgs{
				color:#333C4C;
				font-size: 32upx;
				font-weight: bold;
				padding: 0 20upx;
				margin: 20upx 0;
				.sum{
					color:#ff6900;
				}
			}
			.tipboxs_foot{
				margin-top: 50upx;
				//background:rgba(255,105,0,1);
				// border-radius:10upx;
				border-bottom-right-radius: 14upx;
				border-bottom-left-radius: 14upx;
				border-top: 1px solid #eee;
			}
			.submitbtns{
				font-size: 32upx;
				width:50%;
				height:83upx;
				line-height: 83upx;
				text-align: center;
				color:#ff6900;
				margin: 0 auto;
			}
			.submitbtns1{
				border-right: 1px solid #eee;
			}
		}
		.Closeicon{
			position: absolute;
			left: 50%;
			margin-left: -30upx;
			margin-top: 40upx;
			width: 60upx;
			height: 60upx;
		}
	}
</style>
