<template>
	<view class="page">
		<u-navbar title="旅行社" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
			title-size='36' height='36' id="navbar">
		</u-navbar>
        
		<!-- 旅行社详情卡片 -->
		<view class="agency-detail-card" @click="btnxq">
			<image class="agency-detail-image" :src="agencyDetail.picture" mode="aspectFill"></image>
			<view class="agency-detail-info">
				<view class="agency-detail-title">{{ agencyDetail.name }} 				<u-icon name="arrow-right" size="28" color="#000"></u-icon> </view>
				<view class="agency-detail-desc">{{ agencyDetail.description == null ? '暂无简介' : agencyDetail.description }}</view>
				<u-rate :count="5" active-color="#FFB400" size="24" inactive-color="#b2b2b2" v-model="agencyDetail.rating" readonly></u-rate>
			</view>
		</view>

		<!-- 导游推荐区域 -->
		<view class="guide-recommendation">
			<view class="section-header">
				<view class="green-bar"></view>
				<text class="section-title">导游推荐</text>
			</view>
			
			<view class="guide-list">
				<view class="guide-item" v-for="(guide, index) in guideList" :key="index" @click="goToGuideDetail(guide)">
					<image class="guide-avatar" :src="guide.photo" mode="aspectFill"></image>
					<view class="guide-info">
						<view class="guide-name">{{ guide.name }}</view>
						<view class="guide-desc">{{ guide.description == null ? '暂无简介' : guide.description }}</view>
					</view>
				</view>
			</view>
			<view class="" style="width: 100%;margin-top: 30rpx;color: #ccc;text-align: center;" v-if="guideList.length == 0">
				暂无推荐导游...
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
                bgc: {
                	backgroundColor: "#fff",
                },
				agencyDetail: {},
				guideList: [],
				id:'',
				obj:{}
			}
		},
		onLoad(option) {
            console.log(option);
			this.id = option.id
			this.getxq()
			this.getdylist()
		},
		methods: {
			// 请求旅行社详情
			getxq(){
				this.$u.get(`/app/travelAgency/detail/${this.id}`).then((res) => {
					if(res.code == 200){
						this.agencyDetail = res.data
					}
				})
			},
			// 查询推荐导游列表
			getdylist(){
				this.$u.get(`/app/tourGuide/list?pageNum=1&pageSize=999&agencyId=${this.id}`).then((res) => {
					if(res.code == 200){
						this.guideList = res.rows
					}
				})
			},
			
			// 这里可以添加跳转到导游详情页的逻辑
			goToGuideDetail(guide) {
				uni.navigateTo({
					url:'/page_fenbao/daoyou/daoyouxq?id=' + guide.id
				})
			},
			// 点击查看旅行社详情
			btnxq(){
				uni.navigateTo({
					url:'/page_fenbao/daoyou/lvxingshexq?id=' + this.id
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #fff;
	}

	.page {
		background: #fff;
		min-height: 100vh;
	}

	// 旅行社详情卡片样式
	.agency-detail-card {
		display: flex;
		background: #fff;
		margin: 20rpx 30rpx;
		padding: 30rpx;
		border-radius: 15rpx;
		box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
		position: relative;
	}

	.agency-detail-image {
		width: 200rpx;
		height: 200rpx;
		border-radius: 15rpx;
		margin-right: 30rpx;
	}

	.agency-detail-info {
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.agency-detail-title {
		font-size: 36rpx;
		font-weight: 600;
		color: #262B37;
		margin-bottom: 15rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.agency-detail-desc {
		font-size: 26rpx;
		color: #666;
		line-height: 1.4;
		margin-bottom: 20rpx;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		overflow: hidden;
	}

	.arrow-icon {
		position: absolute;
		right: 30rpx;
		top: 50%;
		transform: translateY(-50%);
	}

	// 导游推荐区域样式
	.guide-recommendation {
		margin: 40rpx 30rpx 0;
	}

	.section-header {
		display: flex;
		align-items: center;
		margin-bottom: 30rpx;
	}

	.green-bar {
		width: 8rpx;
		height: 40rpx;
		background: #4CAF50;
		border-radius: 4rpx;
		margin-right: 20rpx;
	}

	.section-title {
		font-size: 32rpx;
		font-weight: 600;
		color: #262B37;
	}

	.guide-list {
		background: #fff;
		border-radius: 15rpx;
		overflow: hidden;
		box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
	}

	.guide-item {
		display: flex;
		padding: 30rpx;
		border-bottom: 1rpx solid #F5F5F5;
		
		&:last-child {
			border-bottom: none;
		}
		
		&:active {
			background: #F8F8F8;
		}
	}

	.guide-avatar {
		width: 176rpx;
		height: 176rpx;
		border-radius: 10rpx;
		margin-right: 30rpx;
	}

	.guide-info {
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.guide-name {
		font-size: 32rpx;
		font-weight: 600;
		color: #262B37;
		margin-bottom: 15rpx;
	}

	.guide-desc {
		font-size: 26rpx;
		color: #666;
		line-height: 1.4;
	}

</style>