<template>
	<view class="content">
		<view class="top-input">
			<u-search placeholder="课程名称" v-model="queryParams.name" @change="getDataInfo()"></u-search>
		</view>

		<view class="box-ds" v-for="(item,index) in dataList" :key="index">
			<view class="d-s">
				<view class="left-box">
					<image :src="imageUrl+item.photo" mode=""></image>
				</view>
				<view class="">
					<view class="box-title" v-if="item.name == 1">成人班</view>
					<view class="box-title" v-if="item.name == 2">学生班</view>
					<view class="wrap-box" style="	margin-bottom: 5px;">
						<view class="icon-lv">{{item.automatic}}</view>
						<view class="icon-h">{{item.license}}</view>
					</view>
					<view class="wrap-box">
						<view class="price_">￥{{item.price}}</view>
						<view class="sc">定金：{{item.reserveMoney}}</view>
					</view>
				</view>
			</view>
			<view class="b-botttom">
				<view class="ds-s">
					<u-icon name="trash" color="##999999" size="16"></u-icon>
					<view class="" @click="handleDelClick(item.id)">删除课程</view>
				</view>
				<view class="ds-s">
					<u-icon name="edit-pen" color="#4AA76F" size="16"></u-icon>
					<view style="color:#4AA76F ;" @click="handleEditClick(item.id)">课程编辑</view>
				</view>
			</view>

		</view>

		<view style="width: 100%; height: 70px;"></view>
		<view class="botttom-box" @click="handleAddClick">
			<view class="anniu">添加课程</view>
		</view>


	</view>
</template>

<script>
	import request from '../../utils/request'
	export default {
		data() {
			return {
				imageUrl: this.$imagesUrl,
				keyword: '',
				tabindex: 0,
				tabindex2: 1,
				show: false,
				tabList: [
					'教学学员', '教学课程',
				],
				queryParams: {
					pageNum: 1,
					pageSize: 100,
					deptId: uni.getStorageSync("deptId"),
					name: null

				},
				dataList: {}

			}
		},
		onShow() {
			this.getDataInfo()
		},
		onPullDownRefresh() {
			console.log("刷新");
			uni.stopPullDownRefresh()
		},
		onReachBottom() {
			// this.show = true
			setTimeout(() => {
				console.log("加载执行");
			}, 2000)
		},

		methods: {
			getDataInfo() {
				request({
					url: '/drivingSchool/system/driveSchoolCourse/list',
					method: 'get',
					params: this.queryParams
				}).then((res) => {
					if (res.code == 200) {
						this.dataList = res.rows
					}
				})
			},
			handleAddClick() {
				uni.navigateTo({
					url: '/pages/index/addCoach'
				})
			},
			handleEditClick(id) {
				uni.navigateTo({
					url: '/pages/index/addCoach?id=' + id
				})
			},
			handleDelClick(id) {
				request({
					url: '/drivingSchool/system/driveSchoolCourse/' + id,
					method: 'delete',
					params: this.queryParams
				}).then((res) => {
					uni.showToast({
						title: "删除成功"
					})
					this.getDataInfo()
				})
			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.botttom-box {
		width: 100%;
		height: 70px;
		background: #FFFFFF;
		position: fixed;
		left: 0px;
		bottom: 0px;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.content {
		width: 100%;
		background: #f7f7f7;
		height: 100vh;
		box-sizing: border-box;

	}

	.qiu {
		width: 21px;
		height: 21px;
		border-radius: 50%;
		border: 1px solid #DCDCDC;
	}

	.ds-s {
		width: 33.3%;
		display: flex;
		align-items: center;
		font-size: 14px;
		justify-content: center;

	}

	.qiu-x {
		width: 21px;
		height: 21px;
		border-radius: 50%;
		border: 1px solid #4AA76F;
		background: #4AA76F;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.container {
		width: 100%;
		background: #f7f7f7;
		box-sizing: border-box;

	}

	.d-s {
		display: flex;
		align-items: center;

	}

	.top-d-s {
		width: 95%;
		margin: 10px auto;
		display: flex;
		align-items: center;
	}

	.touxiang {
		width: 56px;
		height: 56px;
		border-radius: 0px 0px 0px 0px;
		overflow: hidden;
		border-radius: 50%;
		margin-right: 10px;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.touxiang1 {
		width: 36px;
		height: 36px;
		border-radius: 0px 0px 0px 0px;
		overflow: hidden;
		border-radius: 50%;
		margin-right: 10px;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.name_ {
		font-weight: bold;
		font-size: 16px;
		color: #FFFFFF;
	}

	.bai-box {
		width: 95%;
		margin: 10px auto;
		background: #FFFFFF;
		border-radius: 8px;
		box-sizing: border-box;
		padding: 15px;
	}

	.tab-box {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 10px;
	}

	.t-box {
		width: 50%;
		text-align: center;
		font-weight: 400;
		font-size: 14px;
		color: #333333;
	}

	.b-botttom {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;

		border-top: 1px solid #DDDDDD;
		box-sizing: border-box;
		padding-top: 10px;
		margin-top: 10px;
	}

	.gang {
		width: 16px;
		height: 3px;
		margin: 0px auto;
		margin-top: 5px;
		// background: #4AA76F;
	}

	.lvsize {
		color: #4AA76F !important;
	}

	.lvback {
		background: #4AA76F;
	}

	.box-ds {
		width: 95%;
		margin: 15px auto;

		background-color: #fff;
		border-radius: 4px;
		box-sizing: border-box;
		padding: 10px;
	}

	.left-box {
		width: 106px;
		height: 66px;
		overflow: hidden;
		border-radius: 6px;
		margin-right: 10px;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.box-title {
		font-weight: 800;
		font-size: 14px;
		color: #333333;
		margin-bottom: 5px;
	}

	.wrap-box {
		width: 100%;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		flex-wrap: wrap;

	}

	.icon-lv {
		background: #E6F5F0;
		border-radius: 2px 2px 2px 2px;

		box-sizing: border-box;
		padding: 5px;
		font-weight: 400;
		font-size: 10px;
		font-size: 10px;
		color: #4AA76F;
		margin-right: 10px;
	}

	.icon-h {
		background: #FFEDD4;
		border-radius: 2px 2px 2px 2px;

		box-sizing: border-box;
		padding: 5px;
		font-weight: 400;
		font-size: 10px;
		font-size: 10px;
		color: #EDA23A;
	}

	.price_ {
		font-weight: bold;
		font-size: 14px;
		color: #FB423B;
		margin-right: 15px;
	}

	.sc {
		font-size: 10px;
		color: #AAAAAA;

		text-transform: none;
	}

	.liang-box {
		border-top: 1px solid #DDDDDD;

		box-sizing: border-box;
		padding: 10px 0px;
		margin-top: 10px;
	}

	.lb-box {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 12px;
		color: #999999;
		margin-bottom: 5px;

	}

	.right-icon {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: flex-end;
		font-size: 12px;
		font-weight: bold;
		margin-top: 10px;

	}

	.h-bs- {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		border-bottom: 1px solid #EEEEEE;
		box-sizing: border-box;
		padding: 10px 0px;
		font-size: 12px;
	}

	.anniu {
		width: 313px;
		height: 40px;
		background: #FFFFFF;
		border-radius: 20px 20px 20px 20px;
		border: 1px solid #4AA76F;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #4AA76F;
		margin: 15px auto;
	}

	.top-input {
		width: 100%;
		background: #fff;
		box-sizing: border-box;
		padding: 10px 0px;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.bottom-box {
		width: 100%;
		box-sizing: border-box;
		padding: 5px;
		background: #fff;
		position: fixed;
		bottom: 0px;
		left: 0px;
		height: 70px;
		overflow: hidden;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.anniu {
		width: 311px;
		height: 40px;
		background: #4AA76F;
		border-radius: 20px 20px 20px 20px;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #fff;
	}

	.add-btn {
		position: fixed;
		right: 40rpx;
		/* 距离右边的距离 */
		bottom: 80rpx;
		/* 距离底部的距离 */
		width: 100rpx;
		/* 按钮宽度 */
		height: 100rpx;
		/* 按钮高度 */
		background-color: #55aa00;
		/* 按钮背景色 */
		color: #fff;
		/* 按钮文字颜色 */
		border-radius: 50%;
		/* 设置为圆形按钮 */
		display: flex;
		align-items: center;
		justify-content: center;
		z-index: 999;
		/* 确保按钮在其他内容之上 */
	}

	.btn-text {
		/* 按钮文字样式 */
		font-size: 35rpx;
	}
</style>