<template>
	<view class="container">
		<!-- 课程详情 -->
		<view class="courseInfoContent">
			<view class="thumbnailBox">
				<img :src="courseInfoItem.displayImage" alt="">
			</view>
			<view class="courseDetailBox">
				<h4>{{courseInfoItem.fileTitle}}</h4>
				<view class="summaryBox">
					<text>{{courseInfoItem.fileSynopsis}}</text>
				</view>
				<view class="dataBox">
					<strong>￥{{courseInfoItem.coursePrice}}</strong>
					<text>{{courseInfoItem.salesNumber}}人购买</text>
				</view>
				<view class="tagListBox">
					<view class="tagItem">{{courseInfoItem.fileLecturerName}}</view>
					<view class="tagItem">{{courseInfoItem.fileLecturerRanks}}</view>
				</view>
			</view>
		</view>
		<!-- 价格明细 -->
		<view class="priceInfoContent">
			<h4>价格明细</h4>
			<view><text>现价</text><text>￥{{courseInfoItem.coursePrice}}</text></view>
			<view><text>积分抵扣</text><text></text></view>
			<view><text>合计</text><text>￥{{courseInfoItem.coursePrice}}</text></view>
		</view>
		<!-- 支付方式 -->
		<view class="paymentMethodContent">
			<h4>选择支付方式</h4>
			<view><text>支付宝支付</text></view>
			<view><text>微信支付</text></view>
		</view>
		<!-- 底部 -->
		<view class="totalContent">
			<view class="priceInfoBox">
				<view>合计： <strong style="font-size: 36rpx;">￥{{courseInfoItem.coursePrice}}</strong></view>
				<view>共优惠：<strong style="color:#F15A1F">￥{{courseInfoItem.coursePrice}}</strong> </view>
			</view>
			<view class="confirmOrder">提交订单</view>
		</view>
	</view>
</template>

<script>
	import api from "@/api/api";
	export default {
		data() {
			return {
				courseInfoItem:{},
				fileId:null
			}
		},
		methods: {
			// 课程详情页面
			courseDetail(){
				api.courseDetail({fileId:this.fileId}).then(res=>{
					console.log('课程详情',res);
					if(res['success']){
						this.courseInfoItem =  res['data']['data'];
					}
				})
			},
		},
		onLoad(option){
			console.log(option)
			this.fileId = option.fileId;
			
		},
		mounted() {
			this.courseDetail();
		}
	}
</script>

<style lang="scss">
	.container{
		position: relative;
		height: 100%;
		.courseInfoContent{
			display: flex;
			align-items: center;
			background-color: #fff;
			border-radius: 20rpx;
			margin-bottom: 10rpx;
			padding: 5rpx 10rpx;
			.thumbnailBox{
				width: 200rpx;
				height: 200rpx;
				background-color: #888;
				margin-right: 26rpx;
				img{
					max-width: 100%;
					height: auto;
				}
			}
			.courseDetailBox{
				width: 100%;
				color: #333;
				h4{
					font-size: 32rpx;
				}
				.summaryBox{
					font-size: 24rpx;
					margin: 10rpx 0;
					text{
						margin-right: 20rpx;
					}
				}
				.dataBox{
					strong{
						color: #F15A1F;
						font-size: 30rpx;
						margin-right: 20rpx;
					}
					text{
						font-size: 28rpx;
					}
				}
				.tagListBox{
					display: flex;
					.tagItem{
						color: #20279B;
						font-size: 28rpx;
						border-radius: 20rpx;
						border-top-left-radius: 0;
						border-bottom-right-radius: 0;
						padding: 10rpx 18rpx;
						border: 1px solid #20279B;
						margin-right: 20rpx;
					}
				}
			}
		}
		.priceInfoContent,.paymentMethodContent,.totalContent{
			background-color: #fff;
			margin: 0 10rpx;
			padding: 20rpx;
		}
		.priceInfoContent{
			view{
				display: flex;
				justify-content: space-between;
				text{
					&:last-child{
						font-weight: bold;
					}
				}
			}
		}
		.priceInfoContent,.paymentMethodContent{
			border-bottom: 5px solid #fbfbfb;
			color: #333;
			h4{
				padding: 11rpx 0;
				font-size: 32rpx;
			}
			view{
				margin-bottom: 10rpx;
			}
		}
		.totalContent{
			position: absolute;
			bottom: 0;
			left: 0;
			width: 100%;
			padding: 40rpx 28rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			box-sizing: border-box;
			.priceInfoBox{
				font-size: 30rpx;
				color: #333;
				view:first-child{
					margin-bottom: 10rpx;
				}
			}
			.confirmOrder{
				    background-color: #20269B;
				    color: #fff;
				    padding: 14rpx 38rpx;
					border-radius: 80rpx;
			}
		}
	}

</style>
