<template name="nologin">
	<view class="model-warp">
		<view class="model-alert">
			<view class="alert-content">
				<view class="t-h1">{{text}}</view>
				<view class="t-p">请联系客服获取邀请码后再登录，联系电话：{{telPhones}}</view>
			</view>
			<view class="alert-btn">
				<view class="btn btn-cancel" @click="hideModel">取消</view>
				<view class="btn btn-confirm" @click="goLogin">去登录</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default{
		name:'nologin',
		data(){
			return{
				text:'',
				telPhones:this.telPhone,
				productids:this.productid,
				type:this.alertType,
				tabPath:this.path
			}
		},
		props:{
			productid:Number,
			telPhone:String,
			alertType:String,
			path:Boolean
		},
		created(){
			this.getProductid()
		},
		methods:{
			getProductid(){	
				this.$parent.tel
				switch(this.alertType){
					case '1':
						this.text ='需要登录之后才能加入购物车哟~'
						break;
					case '2':
						this.text ='需要登录之后才能购买哟~'
						break;
					case '3':
						this.text ='需要登录之后查看购物车哟~'
						break;
					case '4':
						this.text ='需要登录才能查看个人中心哟~'
						break;
				}
			},
			hideModel(){
				if(this.tabPath){
					uni.switchTab({
					    url: '/pages/tabBar/home/index'
					});
				}else{
					this.$parent.isShowNoLogin=false;
				}
			},
			goLogin(){
				let self = this
				let url;
				if(self.alertType =='3'){
					url =`/pages/login/login?type=1`
					this.$parent.isShowNoLogin=false;
				}else if(self.alertType =='4'){
					url =`/pages/login/login?type=2`
					this.$parent.isShowNoLogin=true;
				}else{
					url=`/pages/login/login?type=detilType&id=${self.productids}`
					this.$parent.isShowNoLogin=false;
				}
				uni.navigateTo ({
					url
				})
			},
		}
	}
</script>

<style>
	
</style>
