<template>
	<view class="container">
		<view class="classInfo">
			<course-item :thumbnailPath="courseInfoItem.displayImage" :title="courseInfoItem.fileTitle" :summaryBox="courseInfoItem.fileSynopsis" :dataList="{coursePrice:courseInfoItem.coursePrice,salesNumber:courseInfoItem.salesNumber}" :fileLecturerId="courseInfoItem.fileLecturerId"></course-item>
		</view>
		<!-- 订单支付明细 -->
		<view class="payInfoBox">
			<h4>订单支付明细</h4>
			<view>
				<text>积分抵扣：</text>
				<text class="price">￥{{dropInfo.integralExchange}}</text>
			</view>
			<view>
				<text>实际支付：</text>
				<text>￥{{dropInfo.paymentAmount}}</text>
			</view>
		</view>
		<!-- 退款明细 -->
		<view class="dropDetailInfoBox">
			<h4>退款明细</h4>
			<view>
				<text>支付违约金：<i class="iconfont icon-31tishi" @click="showModal()"></i></text>
				<text class="price">￥{{dropInfo.breachCommission}}</text>
			</view>
			<view>
				<text>退款到账金额：</text>
				<text>￥{{dropInfo.refundFee}}</text>
			</view>
			<view>
				<text>退还积分：</text>
				<text>{{dropInfo.salesCommission}}</text>
			</view>
		</view>
		<!-- 退款原因 -->
		<view class="dropInfoBox">
			<view class="">
				<h4>退款原因</h4>
				<view class="uni-list-cell-db">
					<picker @change="bindPickerChange" :value="orderRemark" :range="dropReasons">
						<view class="uni-input">{{dropReasons[orderRemark]}}</view>
					</picker>
				</view>
			</view>
		</view>
		<!-- 提交申请 -->
		<view class="submitApply">
			<text>提交申请</text>
		</view>
		<!-- 弹窗 -->
		<uni-popup ref="popup" type="bottom" background-color="#fff">
			<view class="popup-content">
				<view class="title">
					<text></text>
					<h3>违约金规则</h3>
					<i class="iconfont icon-guanbi" @click="closePopup()"></i>
				</view>
				<view class="">
					1.购买后14天内未点开学习全额退费； 
				</view>
				<view class="">
					<view class="">2.购买后15-30天未点开学习则：</view>
					<view class="">假如：一个初级课程8000，报名费45 ，违约金比例：15%，那么违约金的费用一共是：8045*15% =1206.75； </view>
				</view>
				<view class="">
					3.已点开课程学习或购买30天后不予退费。
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import api from "@/api/api";
	import courseItem from "@/components/courseItem/courseItem.vue";
	export default {
		components:{
			courseItem
		},
		data() {
			return {
				courseInfoItem:{},
				fileId:null,
				orderId:null,
				userId:'1',
				dropInfo:{},
				orderRemark:'',
				dropReasons:['']
			};
		},
		methods:{
			showModal(){
				this.$refs.popup.open()
			},
			closePopup(){
				this.$refs.popup.close()
			},
			// 课程详情页面
			courseDetail(){
				api.courseDetail({fileId:this.fileId,userId:this.userId}).then(res=>{
					console.log('课程详情',res);
					if(res['success']){
						this.courseInfoItem =  res['data']['data'];
					}
				})
			},
			// 退款明细
			userRefundCourseDtl(){
				api.userRefundCourseDtl({userId:this.userId,orderId:this.orderId}).then(res=>{
					if(res['success']){
						this.dropInfo = res['data']
					}
				})
			},
			// 提交申请
			submit(paymentMethod){
				if(paymentMethod==='1'){
					// 微信
					
				}else if(paymentMethod==='2'){
					// 支付宝
					
				}
			}
		},
		onLoad(option) {
			this.orderId = option.id;
			this.fileId = option.fileId;
			this.courseDetail();
			this.userRefundCourseDtl()
		}
	}
</script>

<style lang="scss">
	.container{
		padding: 10rpx 20rpx;
		height: 100%;
		position: relative;
		.classInfo{
			background-color: #fff;
			padding: 20rpx 14rpx 14rpx 20rpx;
		}
		.payInfoBox,.dropDetailInfoBox,.dropInfoBox{
			padding: 30rpx 14rpx 14rpx 20rpx;
			margin-bottom: 10rpx;
			background-color: #fff;
			view{
				margin-top: 22rpx;
				display: flex;
				justify-content: space-between;
			}
			text{
				&.price{
					color: #FA6900;
				}
			}
			
		}
		.submitApply{
			position: fixed;
			bottom: 20rpx;
			left: 0;
			width: 100%;
			text{
				display: flex;
				color: #fff;
				background: #20269B;
				border-radius: 80rpx;
				height: 80rpx;
				width: 60%;
				justify-content: center;
				align-items: center;
				margin: 0 auto;
				
			}
		}
		.popup-content{
			view{
				font-size: 30rpx;
				color: #666;
				margin-bottom: 10rpx;
			}
			.title{
				display: flex;
				justify-content: space-between;
				align-items: center;
				color: #333;
				font-size: 32rpx;
			}
		}
	}
</style>
