<template>
	<!-- 20221216 -->
	<view class="project-question-detail-page">
		<!-- 页面内容 -->
		<view class="page-content padding-bottom-safe-footer-20">
			<view class="padding-30 bg-ff text-40 text-1a">
				{{question.title}}
			</view>

			<!-- 商品详情 -->
			<view class="padding-lr-30 padding-bottom-30 bg-ff">
				<view>
					<ty-text-rich-text :html="question.content"></ty-text-rich-text>
				</view>
			</view>

			<!-- 底部条 -->
			<view class="jc-footer-safe padding-lr-30 bg-ff">
				<view class="line-height-80 radius-40 bg-main text-center text-28 text-ff" style="margin:9rpx 0;"
					@click="callLayerShow = true">
					<text class="tyIcon-dianhua text-34 text-ff"></text>
					拨打客服热线
				</view>
			</view>
		</view>

		<!-- 页面浮层 -->
		<view class="page-layer">
			<!-- 拨打热线浮层 -->
			<jc-project-callLayer :show.sync="callLayerShow" :service-time="serviceTime"
				:service-hot-line="serviceHotLine"></jc-project-callLayer>
		</view>
	</view>
</template>

<script>
	import project from "./api/project.js"
	export default {
		data() {
			return {
				// 常见问题ID
				questionId: '',
				// 服务时间
				serviceTime: '',
				// 服务热线
				serviceHotLine: '',
				// 热线浮层是否显示
				callLayerShow: false,
				// 问题
				question: {}
			}
		},

		onLoad(options) {
			this.questionId = options.id || 0
		},

		onReady() {
			// 加载配置
			this.getConfig()
			// 加载详情
			this.getDetail()
		},

		methods: {
			/**
			 * 获取配置
			 * @date 2022-12-16
			 */
			getConfig() {
				project.getQuestionConfig().then(res => {
					if (res.code == 0) {
						this.serviceTime = res.data.service_time
						this.serviceHotLine = res.data.service_hotline
					}
				})
			},

			/**
			 * 获取详情
			 * @date 2022-12-16
			 */
			getDetail() {
				project.getQuestion(this.questionId).then(res => {
					if (res.code == 0) {
						this.question = res.data.question
					}
				})
			}
		}
	}
</script>

<style scoped>

</style>
