<template>
	<view class="mine-wealth_content">
		<view class="item" v-for="(item,index) in data_list" :key="index"
		@click="clickType(item.id)">
			<view class="item__left">
				<view class="item__left__icon">
					<image class="image" :src="item.icon" mode=""></image>
				</view>
				<view class="item__left__name">
					{{item.name}}
				</view>
			</view>
			<view class="item__right">
				<view v-if="item.id==1" class="item__right__info">
					{{user_data.coin}}
				</view>
				<view v-else class="item__right__info">
					{{user_data.is_vip==true?util.timeFormat(user_data.vip_effective_time_time)+'到期':''}}
				</view>
				<uni-icons class="item__right__icon" type='right' size="14"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script setup lang="ts">
    import { util } from '../../framework/util';
    import { UserData } from '../../stores/userDataManager';
    import { config } from '../../config/config';
	let data_list = [
		{'id':config.mine_goto_type.SHUBI,'name':'书币','icon':'../../static/imgs/public/img_coin.png'},
	    {'id':config.mine_goto_type.VIP,'name':'VIP','icon':'../../static/imgs/public/img_crown.png'},
	] 
	let user_data = UserData().getData()
	
	const emits = defineEmits(['clickType'])
	function clickType(type:number){
		emits('clickType',type)
	}
	
</script>

<style lang="scss">
	.mine-wealth_content{
		display: flex;
		flex-direction: column;
		margin: 30px 30rpx;
		padding: 10rpx 20rpx;
		border-radius: 20rpx;
		box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.1);
		background-color: #ffffff;
		
		.item{
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;
			height: 100rpx;
			
			&__left{
				display: flex;
				flex-direction: row;
				align-items: center;
				&__icon {
					flex-shrink: 0;
					width: 52rpx;
					height: 52rpx;
					.image{
						width: 100%;
						height: 100%;
					}
				}
				&__name {
					margin-left: 15rpx;
					font-size: 17px;
				}
			}
			&__right {
				display: flex;
				flex-direction: row;
				align-items: center;
				&__info{
					margin-right: 10rpx;
					font-size: 17px;
					color: #484848;
				}
			}
		}
	}
</style>