<template>
	<view class="container">
		<view class="ulBox">
			<view class="liBox" v-for="item in userCourses" :key="item.orderId">
				<course-item :thumbnailPath="item.displayImage" :title="item.fileTitle" :summaryBox="item.fileSynopsis" :dataList="{coursePrice:item.coursePrice,salesNumber:item.salesNumber}" :fileLecturerId="item.fileLecturerId"></course-item>
				<view class="statusBox">
					<text>{{item.orderStatusName}}</text>
					<text @click="goDetail(item)">查看详情></text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import api from "@/api/api";
	import courseItem from "@/components/courseItem/courseItem.vue";
	export default {
		components:{
			courseItem
		},
		data() {
			return {
				userId: uni.getStorageSync('cffp_userId'),
				userCourses:[],
				afterSalesFlag:3
			};
		},
		methods:{
			goDetail(item){
				uni.navigateTo({
					url:`/pages/afterSaleDetail/afterSaleDetail?orderNo=${item.orderNo}&afterSalesFlag=${this.afterSalesFlag}`
				})
			},
			userAfterSales(){
				const param = {
					userId:this.userId,
					afterSalesFlag:this.afterSalesFlag
				}
				api.userAfterSales(param).then(res=>{
					if(res['success']){
						console.log(res);
						this.userCourses = res['data']['userCourses']
					}
				})
			}
		},
		onLoad() {
			this.userAfterSales()
		}
	}
</script>

<style lang="scss">
	.container{
		height: 100%;
		.ulBox{
			padding: 10rpx 20rpx;
			.liBox{
				background-color: #fff;
				margin-bottom: 20rpx;
				padding: 18rpx 10rpx;
				.statusBox{
					display: flex;
					justify-content: space-between;
					text{
						color: #333;
						font-size: 32rpx;
						&:last-child{
							color: #666;
							font-size: 28rpx;
						}
					}
				}
			}
		}
	}
</style>
