<template>
	<!-- 0文化遗产详情、1申遗历程详情、2非遗体验详情 三合一 -->
	<view class="page">
		<navbar :title="dict.title" leftClick @leftClick="$utils.navigateBack" />
		<uv-parse :content="detail.articleContent || detail.experienceDetail"></uv-parse>
		
		
		<StudyAndPathDetailSubmit
		article
		submiitTitle="线上预约"
		v-if="type == 'experience'"
		:detail="detail" 
		@getData="queryArticleById"
		@submit="toPayUrl(detail, type)"
		:collectType="dict.collectType"
		/>
	</view>
</template>

<script>
	import StudyAndPathDetailSubmit from '../components/submit/StudyAndPathDetailSubmit.vue'
	export default {
		components : {
			StudyAndPathDetailSubmit,
		},
		data() {
			return {
				detail : {},
				id : 0,
				type : '',
				dict : {},
			}
		},
		onLoad(args) {
			this.id = args.id
			this.type = args.type
			this.dict = this.$config.dict[args.type]
		},
		onShow() {
			this.queryArticleById()
		},
		onPullDownRefresh(){
			this.queryArticleById()
		},
		methods: {
			queryArticleById(){
				this.$api(this.dict.api, {
					articleId : this.id,
					experienceId : this.id,
				}, res => {
					uni.stopPullDownRefresh()
					if(res.code == 200){
						this.detail = res.result
					}
				})
			},
			toPayUrl(item, dictKey){
				uni.navigateTo({
					url: `/pages_order/order/orderSubscribe?type=${dictKey}&id=${item.id}`
				})
			},
		}
	}
</script>

<style scoped lang="scss">
.page{
	
}
</style>
