<template>
	<view class="base-container">
		<view class="user-info">
			<view class="user-left">
				<image class="avatar" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"></image>
				<view class="info">
					<text class="name">听妈妈的话</text>
					<view class="text">这是您使用飞鸟有味的第15天</view>
				</view>
			</view>
			<view class="user-right">收货地址</view>
		</view>
		<view class="grid-wrap">
			<view class="grid-item" @click="handlePage('0')">
				<view class="grid-name">守护兑换</view>
				<text class="grid-text">积累能量获大礼</text>
				<image class="image" :src="`${config.BASIC_IMG}img/gift.png`"></image>
			</view>
			<view class="grid-item coupon" @click="handlePage('1')">
				<view class="grid-name">优惠券</view>
				<text class="grid-text">满100减50</text>
				<image class="icon" :src="`${config.BASIC_IMG}img/coupon.png`"></image>
			</view>
		</view>
		<view class="list-wrap">
			<view class="list-card">
				<view class="card-head flex-center">
					<text class="name">我的订单</text>
					<view class="all flex-center">
						<text>全部</text>
						<up-icon name="arrow-right"></up-icon>
					</view>
				</view>
				<view class="card-cont flex-center">
					<view class="cont-item" v-for="(item,index) in orderList" :key="index" @click="handleItem(index)">
						<image class="icon" :src="`${config.BASIC_IMG}img/order-icon-${index+1}.png`"></image>
						<view>{{item}}</view>
					</view>
				</view>
			</view>
			<view class="list-card">
				<view class="card-head flex-center">
					<text class="name">我的守护</text>
					<view class="all flex-center">
						<text>全部</text>
						<up-icon name="arrow-right"></up-icon>
					</view>
				</view>
				<view class="card-cont flex-center">
					<view class="cont-item image-item" v-for="(item,index) in 3" :key="index">
						<image class="img" :src="`https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png`"></image>
						<view class="name">从化荔博园</view>
					</view>
				</view>
			</view>
			<view class="list-item flex-center">
				<text class="name">联系客服</text>
				<up-icon name="arrow-right"></up-icon>
			</view>
			<view class="list-item flex-center">
				<text class="name">意见反馈</text>
				<up-icon name="arrow-right"></up-icon>
			</view>
		</view>
	</view>
</template>

<script setup>
import config from "@/api/config.js"

const orderList = ["待付款","待发货","待收货","待评价","退款/售后"]
const imageList = []

const handlePage = (type) =>{
	uni.navigateTo({
		url: `/pages/tabBar/mine/subPages/exchange?type=${type}`
	});
}

const handleItem = (status) =>{
	uni.navigateTo({
		url: `/pages/tabBar/mine/subPages/order?status=${status + 1}`
	});
}
</script>

<style lang="scss" scoped>
	.base-container {
		.user-info {
			background: #fff;
			border-radius: 16rpx;
			padding: 24rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.user-left{
				display: flex;
				align-items: center;
				.avatar{
					width: 92rpx;
					height: 92rpx;
					margin-right: 28rpx;
					border-radius: 50%;
				}
				.info{
					.name{
						font-family: 'PangMenZhengDao';
					}
					.text{
						font-size: 24rpx;
					}
				}
			}
			.user-right{
				font-size: 24rpx;
				padding: 12rpx 32rpx;
				border-radius: 50rpx;
				color: #000;
				background: #FFD95E;
				font-weight: 500;
			}
		}
		.grid-wrap{
			display: flex;
			margin-top: 20rpx;
			.grid-item{
				padding: 20rpx 28rpx;
				flex: 1;
				border-radius: 16rpx;
				border: 2rpx solid #FFFFFF;
				background-image: linear-gradient(180deg,#FFECAE,#FFFFFF);
				line-height: 42rpx;
				position: relative;
				&.coupon{
					margin-left: 18rpx;
					background-image: linear-gradient(180deg,#FFDFC5,#FFFFFF);
				}
				.grid-name{
					font-family: 'PangMenZhengDao';
				}
				.grid-text{
					font-size: 24rpx;
				}
				.image{
					position: absolute;
					bottom: 0;
					right: 0;
					width: 110rpx;
					height: 120rpx;
				}
				.icon{
					position: absolute;
					bottom: 0;
					right: 0;
					width: 110rpx;
					height: 110rpx
				}
			}
		}
		.list-wrap{
			.list-item,.list-card{
				background: #fff;
				border-radius: 10rpx;
				margin-top: 20rpx;
				padding: 26rpx 20rpx;
				.name{
					font-weight: 500;
				}
				.all{
					color: rgba(0, 0, 0, 0.6);
					font-size: 26rpx;
				}
				.card-cont{
					margin-top: 20rpx;
					.cont-item{
						flex: 1;
						text-align: center;
						font-size: 24rpx;
						.icon{
							width: 36rpx;
							height: 32rpx;
							margin-bottom: 4rpx;
						}
					}
					.image-item{
						border-radius: 16rpx;
						border: 1px solid #E3E3E3;
						padding: 10rpx;
						position: relative;
						.img{
							width: 100%;
							height: 180rpx;
							border-radius: 8rpx;
						}
						.name{
							position: absolute;
							bottom: 0;
							left: 0;
							color: #fff;
							padding: 6rpx;
							width: 100%;
							box-sizing: border-box;
							border-radius: 0 0 16rpx 16rpx;
							text-align: center;
							background: rgba(0, 0, 0, 0.3);
							backdrop-filter: blur(6rpx);
						}
					}
					.image-item + .image-item{
						margin-left: 20rpx;
					}
				}
			}
			.flex-center{
				display: flex;
				align-items: center;
				justify-content: space-between;
			}
		}
	}
</style>