<template>
	<view class="container">
		<h4 class="noListTip" v-if="!dropLists||dropLists.length <=0 ">暂无退课</h4>
		<template  v-if="dropLists.length >0 ">
			<view class="dropItem" v-for="item in dropLists">
				<view class="ulBox">
					<text>订单编号:</text>
					<text>{{item.orderNo}}</text>
				</view>
				<view class="ulBox">
					<text>课程名称:</text>
					<text>{{item.itemName}}</text>
				</view>
				<view class="ulBox">
					<text>退课积分:</text>
					<text>{{Math.abs(item.commissionAmount)}}</text>
				</view>
				<view class="ulBox">
					<text>积分来源:</text>
					<text>{{item.commissionTypeContent}}</text>
				</view>
				<view class="ulBox">
					<text>课程状态:</text>
					<text @click="viewDetail(item)" class="dropStatus">{{item.orderStatus}}<i class="iconfont icon-youjiantou" style="margin-left: 5rpx;font-size: 26rpx;"></i></text>
				</view>
				<view class="ulBox">
					<text>退课时间:</text>
					<text>{{item.refundTime}}</text>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	import api from "@/api/api";
	export default {
		data() {
			return {
				userId: uni.getStorageSync('cffp_userId'),
				dropLists:[]
			}
		},
		methods: {
			viewDetail(item){
				uni.navigateTo({
					url:`/pages/orderDetail/orderDetail?id=${item.orderId}&type=drop&commissionType=${item.commissionType}`
				})
			},
			queryDropCourseList(){
				api.queryDropCourseList({userId:this.userId}).then(res=>{
					if(res['success']){
						this.dropLists = res['data']['dropCourseListDtos']
					}
				})
			}
		},
		onLoad() {
			this.queryDropCourseList();
		}
	}
</script>

<style lang="scss">
	.container{
		height: 100%;
		margin-bottom: 20rpx;
		.dropItem{
			background-color: #fff;
			border-radius: 20rpx;
			padding: 10rpx 40rpx;
			font-size: 28rpx;
			margin: 20rpx;
			.ulBox{
				margin-bottom: 20rpx;
				position: relative;
				display: flex;
				justify-content: space-between;
				&:first-child{
					&::before{
						content: '';
						position: absolute;
						left: -30rpx;
						top: 20%;
						width:8rpx;
						height: 70%;
						border-radius: 20rpx;
						background-color: #F04604;
					}
				}
				.dropStatus{
					color: #20279B;
				}
			}
		}
	}
</style>
