<template>
	<view class="main main-bg">
		<view class="main-list">
			<view class="list-left font-color3 font-thirty-two">姓名</view>
			<view class="list-right font-color2 font-thirty-two">{{ list.veteransName ? list.veteransName : '' }}</view>
		</view>
		<view class="main-list">
			<view class="list-left font-color3 font-thirty-two">身份证号码</view>
			<view class="list-right font-color2 font-thirty-two">{{ list.veteransIdcard ? change(list.veteransIdcard) : '' }}</view>
		</view>
		<view class="main-list">
			<view class="list-left font-color3 font-thirty-two">电话</view>
			<view class="list-right font-color2 font-thirty-two">{{ list.veteransTel ? changeTel(list.veteransTel) : '' }}</view>
		</view>
		<!-- <view class="main-list">
			<view class="list-left font-color3 font-thirty-two">军人等级</view>
			<view class="list-right font-color2 font-thirty-two">{{ list.level ? list.level : '' }}</view>
		</view> -->
		<view class="footer">
			<view class="left header-long-bg font-color1 font-thirty" @click="gotoshop">惠军购</view>
			<view class="right font-color2 font-thirty" @click="goto">返回店铺</view>
		</view>
	</view>
</template>

<script>
import server from "@/api/index";
export default {
	data() {
		return {
			list:{},
			userId: null,
			type: null
		};
	},
	onLoad(e) {
		this.userId = e.money;
		this.type = e.id;
		this.getInfoFn(e.money, e.id);
	},
	methods:{
		getInfoFn(id, type){
			server.getRegister(id, type).then(res =>{
				this.list = res
			})
		},
		change(name){
			let mystr = name.substring(0,6)+'****'+name.substring(10);
			return mystr
		},
		changeTel(name){
			let mystr = name.substring(0,3)+'****'+name.substring(7);
			return mystr
		},
		goto(){
			uni.reLaunch({
				url: '/pages/index/index'
			})
		},
		gotoshop(){
			console.log(this.userId, this.type, this.list.veteransName)
			uni.navigateTo({
				url: '/pages/merchant/home/shop?userId=' + this.userId + '&type=' + this.type + '&veteransName=' + this.list.veteransName
			})
		}
	}
}
</script>

<style lang="scss" scoped>
	.main{
		width: 100%;
		height: auto;
		min-height: 100vh;
		padding: 30rpx;
		.main-list{
			width: 100%;
			height: 102rpx;
			line-height: 102rpx;
			padding-left: 30rpx;
			padding-right: 30rpx;
			display: flex;
			justify-content: space-between;
			background: #fff;
			border-radius: 24rpx;
			margin-bottom: 30rpx;
			.list-right{
				font-weight: 600;
			}
		}
		.footer{
			width: 100%;
			height: 125rpx;
			background: #FFFFFF;
			position: fixed;
			left: 0rpx;
			bottom: 0rpx;
			padding: 14rpx 30rpx;
			display: flex;
			justify-content: space-between;
			.left{
				width: 330rpx;
				height: 96rpx;
				line-height: 96rpx;
				border-radius: 48rpx;
				text-align: center;
			}
			.right{
				width: 330rpx;
				height: 96rpx;
				line-height: 96rpx;
				border-radius: 48rpx;
				text-align: center;
				border: 4rpx solid #2E4F1C;
			}
		}
	}
</style>
