<template>
	<view class="page-container">
		<view class="banner-section">
			<image class="main-img" src="https://pic.3gbizhi.com/uploadmark/20251230/38976dd1110e4374e3d4aa5c319b65e4.webp" mode="aspectFill"></image>
			<view class="back-icon">
				<u-icon name="arrow-left" color="#333" size="20"></u-icon>
			</view>
		</view>

		<view class="info-section">
			<view class="header-row">
				<u-avatar src="https://via.placeholder.com/100" size="128rpx"></u-avatar>
				<view class="base-info">
					<view class="flex">
						<view>
							<view class="name-row">
								<text class="name">赵青青</text>
								<text class="level-tag">资深</text>
							</view>
							<view class="stats-row flex">
								<text class="score">5.0分</text>
								<u-line color="#000" direction="col" length="18rpx" margin="0 12rpx"></u-line>
								<text>服务 32 单</text>
								<u-line color="#000" direction="col" length="18rpx" margin="0 12rpx"></u-line>
								<text>收藏量 56</text>
							</view>
						</view>
						<view class="collect-btn" :class="{ active: isCollect }">
							<u-icon :name="isCollect ? 'heart-fill' : 'heart'" 
								:color="isCollect ? '#F53E54' : '#999'"
								size="48rpx"
							></u-icon>
							<text class="c-text">{{ isCollect ? '已收藏' : '点击收藏' }}</text>
						</view>
					</view>
					<view class="tags-row">
						<view class="tag-item shop"><u-icon name="home" size="14"></u-icon> 小雨养生</view>
						<view class="tag-item time">最早可约今 19:00</view>
						<text class="dist">距您 348m</text>
					</view>
				</view>
			</view>
			<view class="intro-text">
				我擅长中式按摩，泰式拉伸，精油spa，头疗等项目，按摩让疲惫的心灵找到港湾，让您沉浸在spa的温柔乡里感受身心的舒缓与释放。
			</view>
			<view class="service-guard">
				<view class="g-title flex">
					<u-icon name="checkmark-circle" color="#00cba3" top="1"></u-icon>
					<text>服务保障</text>
				</view>
				<text class="g-item">实名认证</text>
				<text class="g-item">爽约包赔</text>
				<text class="g-item">商户认证</text>
			</view>
		</view>

		<u-sticky bgColor="#fff">
			<u-tabs :list="tabs" :current="currentTab" lineColor="#00cba3"
				activeStyle="color: #00cba3;" 
				@change="tabChange"></u-tabs>
		</u-sticky>

		<view class="main-section">
			<view v-if="currentTab === 0" class="project-list">
				<view class="project-item" v-for="(item, index) in projects" :key="index">
					<u-image :src="item.image" width="160rpx" height="160rpx" radius="12rpx" mode="aspectFit"></u-image>
					<view class="p-info">
						<view class="p-name">{{ item.name }}</view>
						<view class="p-desc">{{ item.time }}分钟 | 释放压力，舒缓疲劳</view>
						<view class="p-price">
							<text class="now">￥{{ item.price }}</text>
							<text class="old">￥{{ item.oldPrice }}</text>
						</view>
					</view>
					<u-button text="去下单" color="#00cba3" size="mini" shape="circle"
						customStyle="width: 140rpx;"
					></u-button>
				</view>
			</view>

			<view v-if="currentTab === 1" class="comment-list">
				<view class="comment-item" v-for="(comment, index) in comments" :key="index">
					<view class="u-info">
						<u-avatar :src="comment.avatar" size="35"></u-avatar>
						<view class="u-name-date">
							<view class="top">
								<text class="u-name">{{ comment.userName }}</text>
								<u-rate :count="5" v-model="comment.rate" readonly size="12"
									activeColor="#ffca28"></u-rate>
							</view>
							<text class="c-date">{{ comment.date }}</text>
						</view>
					</view>

					<view class="comment-text">{{ comment.content }}</view>

					<view class="comment-imgs" v-if="comment.imgs && comment.imgs.length">
						<image v-for="(img, idx) in comment.imgs" :key="idx" :src="img" mode="aspectFill"
							@click="previewImg(img, comment.imgs)"></image>
					</view>

					<view class="reply-box" v-if="comment.reply">
						<view class="reply-header">
							<text class="reply-title">商户回复：</text>
							<text class="reply-date">{{ comment.replyDate }}</text>
						</view>
						<view class="reply-content">{{ comment.reply }}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			isCollect: false,
			currentTab: 0,
			tabs: [{ name: '推荐项目' }, { name: '客户评价(4.9分)' }],
			projects: [
				{ name: '古韵舒经', time: 120, price: 598, oldPrice: 1200, image: 'https://via.placeholder.com/150' },
				{ name: '泰式唤醒', time: 120, price: 598, oldPrice: 1200, image: 'https://via.placeholder.com/150' },
				{ name: '养生SPA', time: 120, price: 598, oldPrice: 1200, image: 'https://via.placeholder.com/150' }
			],
			comments: [
				{
					userName: '匿名客户',
					avatar: 'https://cdn.uviewui.com/uview/album/1.jpg',
					rate: 5,
					date: '2025-12-17 08:23:43',
					content: '服务过程十分有耐心，非常有礼貌，热情开朗，手法也非常专业，按完之后感觉整个人都轻松了，很值得推荐！',
					imgs: ['https://via.placeholder.com/200'],
					reply: '感谢您的好评！您的认可就是我们最大的动力，欢迎下次光临，祝您生活愉快~',
					replyDate: '2025-12-17 10:00:00'
				},
				{
					userName: '张**',
					avatar: 'https://cdn.uviewui.com/uview/album/2.jpg',
					rate: 5,
					date: '2025-12-16 15:40:12',
					content: '环境不错，技师赵老师手法很地道，力度控制得刚刚好。',
					reply: '谢谢您的信任，我们会继续努力提供更优质的服务！',
					replyDate: '2025-12-16 18:20:00'
				}
			]
		};
	},
	methods: {
		tabChange(e) {
			this.currentTab = e.index;
		},
		previewImg(current, list) {
			uni.previewImage({ current, urls: list });
		}
	}
};
</script>

<style lang="scss" scoped>
.page-container {
	min-height: 100vh;
	background-color: #f8f8f8;

	.banner-section {
		position: relative;

		.main-img {
			width: 100%;
			height: 700rpx;
		}

		.back-icon {
			width: 70rpx;
			height: 70rpx;
			position: absolute;
			top: 30rpx;
			left: 30rpx;
			background: rgba(255, 255, 255, 0.8);
			border-radius: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}

	.info-section {
		margin: -60rpx 24rpx 24rpx;
		padding: 30rpx;
		background: #fff;
		border-radius: 24rpx;
		position: relative;
		z-index: 10;
		box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);

		.header-row {
			display: flex;

			.base-info {
				flex: 1;
				margin-left: 20rpx;

				.name-row {
					display: flex;
					align-items: center;
					margin-bottom: 10rpx;

					.name {
						font-size: 36rpx;
						font-weight: 500;
						color: #333;
					}

					.level-tag {
						color: #fff;
						font-size: 22rpx;
						padding: 6rpx 16rpx;
						margin-left: 20rpx;
						background: linear-gradient(111deg, #5590B8 0%, #3D5695 100%);;
						border-radius: 100rpx;
					}
				}

				.collect-btn {
					width: 100rpx;
					height: 100rpx;
					margin-left: auto;
					background: #F9F9F9;
					border: 2rpx solid #D8D8D8;
					border-radius: 24rpx;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;

					.c-text {
						font-size: 20rpx;
						color: #999;
						margin-top: 4rpx;
					}

					&.active {
						background: linear-gradient(180deg, #FEEAEA 0%, #FFFFFF 100%);
						border: 2rpx solid #FFD7D7;

						.c-text {
							color: #F64E63;
						}
					}
				}

				.stats-row {
					font-size: 24rpx;
					color: #666;
					line-height: 1;

					.score {
						color: #EB5137;
						font-weight: bold;
					}
				}

				.tags-row {
					font-size: 22rpx;
					margin-top: 12rpx;
					display: flex;
					align-items: center;

					.tag-item {
						padding: 4rpx 10rpx;
						margin-right: 16rpx;
						border-radius: 8rpx;
					}

					.shop {
						background: #f0f4ff;
						color: #5c7fa9;
						display: flex;
						align-items: center;
					}

					.time {
						background: #eefaf8;
						color: #00cba3;
					}

					.dist {
						margin-left: auto;
						color: #999;
					}
				}
			}
		}

		.intro-text {
			font-size: 26rpx;
			color: #606D6E;
			line-height: 1.6;
			margin: 24rpx 0;
			background: #f9f9f9;
			padding: 8rpx 14rpx;
			border-radius: 12rpx;
		}

		.service-guard {
			padding: 20rpx;
			line-height: 1;
			gap: 20rpx;
			display: flex;
			align-items: center;
			background: linear-gradient(0deg, #F6FFFD 0%, #DEF5F0 100%);

			.g-title {
				font-weight: bold;
				font-size: 32rpx;
				color: #333;

				text {
					margin-left: 12rpx;
				}
			}

			.g-item {
				font-size: 24rpx;
				color: #0A726A;
				display: flex;
				align-items: center;
			}
		}
	}

	.main-section {
		padding: 0 30rpx;
		background: #fff;
	}
}

/* 推荐项目样式 */
.project-item {
	display: flex;
	align-items: center;
	padding: 30rpx 0;
	border-bottom: 1rpx solid #f5f5f5;

	.p-info {
		flex: 1;
		margin-left: 24rpx;

		.p-name {
			font-size: 30rpx;
			font-weight: bold;
			color: #333;
		}

		.p-desc {
			font-size: 22rpx;
			color: #999;
			margin: 8rpx 0;
		}

		.p-price {
			.now {
				color: #ff5e5e;
				font-size: 32rpx;
				font-weight: bold;
			}

			.old {
				color: #ccc;
				font-size: 22rpx;
				text-decoration: line-through;
				margin-left: 10rpx;
			}
		}
	}
}

/* 客户评价样式 */
.comment-item {
	padding: 30rpx 0;
	border-bottom: 1rpx solid #f5f5f5;

	.u-info {
		display: flex;
		align-items: center;
		margin-bottom: 20rpx;

		.u-name-date {
			flex: 1;
			margin-left: 20rpx;

			.top {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.u-name {
					font-size: 28rpx;
					color: #333;
					font-weight: 500;
				}
			}

			.c-date {
				font-size: 22rpx;
				color: #bbb;
				margin-top: 4rpx;
			}
		}
	}

	.comment-text {
		font-size: 27rpx;
		color: #444;
		line-height: 1.6;
		margin: 15rpx 0;
	}

	.comment-imgs {
		display: flex;
		margin-bottom: 20rpx;

		image {
			width: 160rpx;
			height: 160rpx;
			border-radius: 8rpx;
			margin-right: 10rpx;
		}
	}

	/* 商户回复盒子样式 */
	.reply-box {
		background: #f4f6f8;
		border-radius: 12rpx;
		padding: 20rpx;
		position: relative;

		&::before {
			/* 气泡小箭头效果 */
			content: '';
			position: absolute;
			top: -16rpx;
			left: 30rpx;
			border: 10rpx solid transparent;
			border-bottom-color: #f4f6f8;
		}

		.reply-header {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 10rpx;

			.reply-title {
				font-size: 24rpx;
				color: #333;
				font-weight: bold;
			}

			.reply-date {
				font-size: 20rpx;
				color: #aaa;
			}
		}

		.reply-content {
			font-size: 24rpx;
			color: #666;
			line-height: 1.5;
		}
	}
}
</style>