<template>
	<!-- 我要研学详情 type:1 和 遗产路径详情 type:0 -->
	<view class="page">
		<navbar :title="titles[type]" leftClick @leftClick="$utils.navigateBack" />
		
		<view class="image">
			<!-- <image src="https://img-s-msn-com.akamaized.net/tenant/amp/entityid/BB1msKSi.img" mode="aspectFill"></image> -->
			<uv-swiper
			:list="detail.amusementImage ? 
				detail.amusementImage.split(',') : []" 
			indicator
			height="420rpx"></uv-swiper>
		</view>
		
		<view class="box">
			<view class="info">
				<view class="price" 
				v-if="detail.amusementPrice 
				&& detail.isPay == 1">
					<text>￥{{ detail.amusementPrice }}</text>起
				</view>
				<view class="title">
					{{ detail.amusementTitle }}
				</view>
				<view class="tip">
					{{ detail.amusementBrief }}
				</view>
			</view>
			
			<view class="detail">
				<view class="">
					<uv-tabs :list="tabs"
					lineColor="#B12026"
					lineHeight="8rpx"
					lineWidth="50rpx"
					:scrollable="false"
					@click="clickTabs"></uv-tabs>
				</view>
				
				<view class="content">
					<uv-parse :content="content"></uv-parse>
				</view>
			</view>
		</view>
		
		
		<StudyAndPathDetailSubmit v-if="detail.isPay == 1"/>
	</view>
</template>

<script>
	import StudyAndPathDetailSubmit from '../components/submit/StudyAndPathDetailSubmit.vue'
	export default {
		components : {
			StudyAndPathDetailSubmit,
		},
		data() {
			return {
				titles: ['遗产路径', '我要研学'],
				type: 0,
				tabs: [
					{
						name: '关于行程'
					},
					{
						name: '注意事项'
					},
					{
						name: '出行说明'
					},
				],
				id : 0,
				detail : {},
				contentKey : ['amusementRoute', 'amusementAttention', 'amusementStatement'],
				content : '',
			}
		},
		onLoad(args) {
			this.type = args.type || 0
			this.id = args.id
		},
		onShow() {
			this.getData()
		},
		onShareAppMessage(res) {
		    return {
		      title: this.titles[this.type],
		      desc: this.detail.amusementTitle,
		      path: '/pages_order/service/StudyAndPathDetail?id=' + this.id
		    }
		},
		methods: {
			//点击tab栏
			clickTabs({index}) {
				this.content = this.detail[this.contentKey[index]]
			},
			getData(){
				this.$api('queryAmusementById',
				{
					amusementId : this.id,
				}, res => {
					uni.stopPullDownRefresh()
					if(res.code == 200){
						this.detail = res.result
						this.content = this.detail[this.contentKey[0]]
					}
				})
			},
		}
	}
</script>

<style scoped lang="scss">
.page{
	image{
		width: 100%;
		height: 100%;
	}
	.image{
		width: 100%;
		height: 400rpx;
	}
	.box{
		margin-top: -40rpx;
		border-top-left-radius: 40rpx;
		border-top-right-radius: 40rpx;
		overflow: hidden;
		position: relative;
		.info{
			background-color: #fff;
			padding: 40rpx;
			.price{
				padding: 20rpx 0;
				font-size: 22rpx;
				text{
					font-size: 38rpx;
					color: $uni-color;
					font-weight: 900;
				}
			}
			.title{
				font-weight: 900;
				padding-bottom: 20rpx;
				font-size: 28rpx;
			}
			.tip{
				font-size: 22rpx;
				padding-bottom: 20rpx;
				line-height: 40rpx;
			}
		}
		.detail{
			margin-top: 20rpx;
			background-color: #fff;
			.content{
				padding: 40rpx;
			}
		}
	}
}
</style>
