<template>
	<view class="store">
		
		<view class="bg">
			<view class="info">
				<view class="num">
					3399
				</view>
				<view class="label">
					剩余积分
				</view>
			</view>
			<view class="rule">
				积分规则
			</view>
		</view>
		
		<view class="tab-group">
			<view class="tab" @click="jump('./shop')">
				<image class="icon" src="../static/store.png" mode=""></image>
				<view class="tab-name">
					积分商城
				</view>
			</view>
			
			<view class="tab" @click="jump('./logs')">
				<image class="icon" src="../static/diamon.png" mode=""></image>
				<view class="tab-name">
					积分明细
				</view>
			</view>
			
		</view>
		
		<view class="title">
			虚拟兑换
		</view>
		<view class="sub-title">
			热门虚拟权益服务
		</view>
		
		<view class="goods-box">
			
			<view class="store-title">
				人气兑换
				<u-icon name="arrow-right" color="#000000" size="38"></u-icon>
			</view>
			
			<view class="box">
				<view class="item" v-for="(item,index) in list" :key="index">
					<image :src="item.src" mode="aspectFill" class="icon"></image>
					<view class="item-title">
						{{item.title}}
					</view>
					<view class="handle-box">
						<view class="price">
							{{item.score}}分
						</view>
						<view class="exchange-btn">
							兑换
						</view>
					</view>
				</view>
				
			</view>
			
			<view class="store-title">
				生活出行
				<u-icon name="arrow-right" color="#000000" size="38"></u-icon>
			</view>
			
			<view class="box">
				<view class="item" v-for="(item,index) in list" :key="index">
					<image :src="item.src" mode="aspectFill" class="icon"></image>
					<view class="item-title">
						{{item.title}}
					</view>
					<view class="handle-box">
						<view class="price">
							{{item.score}}分
						</view>
						<view class="exchange-btn">
							兑换
						</view>
					</view>
				</view>
			</view>
			
		</view>
		<zs-skeleton :loading="loading" type="integral"></zs-skeleton>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loading: false,
				list:[
					{
						src:'http://t14.baidu.com/it/u=1060435979,471196002&fm=224&app=112&f=JPEG?w=500&h=500',
						title:'宅小鹿芒果干',
						score:6000,
					},
					{
						src:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi2%2F2207895997260%2FO1CN01Ogi5ab23V8BwbWSzn_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1695440007&t=24ed88d94f8a1820a4411241c3bd5940',
						title:'麻辣王子地道辣条',
						score:6000,
					},
					{
						src:'https://img2.baidu.com/it/u=248724739,3924050991&fm=253&fmt=auto&app=138&f=JPEG?w=616&h=500',
						title:'良品铺子酥脆薄饼',
						score:6000,
					},
				]
			}
		},
		methods: {
			jump(url) {
				uni.navigateTo({
					url
				})
			}
		},
		onLoad() {
			this.loading = true
			setTimeout(()=>{
				this.loading = false
			},1000)
		}
	}
</script>

<style lang="scss">
.store{
	padding-bottom: 80rpx;
	.bg{
		// background: #3884ea;
		background: url('../static/top-bg.png') no-repeat #f9f9f9;
		height: 430rpx;
		background-size: 100% 430rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		color: #fff;
		position: relative;
		.info{
			text-align: center;
			.num{
				font-size: 56rpx;
				font-weight: bold;
			}
			.label{
				font-size: 24rpx;
			}
		}
		.rule{
			position: absolute;
			top: 50%;
			right: 0%;
			transform: translateY(-50%);
			background: #fff;
			color: $uni-text-primary;
			font-size: 28rpx;
			padding:10rpx 18rpx;
			border-radius: 12rpx;
		}
	}
	
	.tab-group{
		display: flex;
		align-items: center;
		width: 680rpx;
		// padding: 20rpx 0;
		height: 184rpx;
		box-shadow: rgba(0, 0, 0, 0.4) 0px 0px 4px 0px;
		border-radius: 12rpx;
		position: relative;
		z-index: 2;
		margin-left: 35rpx;
		margin-top: -100rpx;
		margin-bottom: 40rpx;
		background: #fff;
		.tab{
			flex: 1;
			display: flex;
			flex-direction: column;
			align-items: center;
			.icon{
				width: 52rpx;
				height: 52rpx;
			}
			.tab-name{
				text-align: center;
				font-size: 28rpx;
				margin-top: 10rpx;
			}
		}
	}
	
	.title{
		font-size: 30rpx;
		text-align: center;
		font-weight: bold;
	}
	.sub-title{
		color: #cacaca;
		font-size: 26rpx;
		position: relative;
		text-align: center;
		margin-top: 16rpx;
	}
	.sub-title::before{
		width: 200rpx;
		height: 1rpx;
		background: #cacaca;
		position: absolute;
		display: block;
		content: '';
		top: 50%;
		left: 40rpx;
	}
	.sub-title::after{
		width: 200rpx;
		height: 1rpx;
		background: #cacaca;
		position: absolute;
		display: block;
		content: '';
		top: 50%;
		right: 40rpx;
	}
	
	.goods-box{
		padding: 20rpx 50rpx;
		.store-title{
			font-size: 34rpx;
			display: flex;
			align-items: center;
			position: relative;
			padding-left: 18rpx;
			font-weight: bold;
			margin: 20rpx 0 30rpx;
		}
		.store-title::before{
			width: 7rpx;
			height: 100%;
			background: rgb(57, 81, 251);
			content: '';
			display: flex;
			position: absolute;
			top: 0%;
			left: 0;
			
		}
		.box{
			display: flex;
			justify-content: space-between;
			border-bottom: 1rpx solid #cacaca;
			padding-bottom: 30rpx;
			.item{
				width: 200rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				.icon{
					width: 100%;
					height: 210rpx!important;
					border-radius: 12rpx;
					object-fit: cover;
				}
				.item-title{
					font-size: 26rpx;
					 display: -webkit-box;
					-webkit-box-orient: vertical;
					overflow: hidden;
					-webkit-line-clamp: 2;
					text-overflow: ellipsis;
					margin-top: 10rpx;
				}
				.handle-box{
					display: flex;
					justify-content: space-between;
					align-items: center;
					margin-top: 15rpx;
					.price{
						font-size: 26rpx;
						color: #FE5B47;
					}
					.exchange-btn{
						width: 96rpx;
						height: 40rpx;
						line-height: 40rpx;
						background: $uni-color-primary;
						border-radius: 20rpx;
						text-align: center;
						color: #fff;
						font-size: 22rpx;
					}
				}
			}
		}
	}
	
}
</style>