<template>
	<view>
		<view class="top">
			<uni-search-bar class="search" radius="5" placeholder="请输入产品名称" clearButton="auto" cancelButton="none" @confirm="search" />
			<uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="18" color="#007eff"></uni-icons>
		</view>
		
		<ul class="tab">
			<li v-for="(tab, i) in tabs" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li>
		</ul>
		
			<ul class="list">
				<li @click="toDetail">
					<view class="line thead">
						<view class="text">产品名称</view>
						<view class="text">起止日期</view>
						<view class="text">订阅状态</view>
						<view class="text">产品状态</view>
					</view>
					<view class="line tbody">
						<view class="text">数据平台</view>
						<view class="text">2022-01-01 ~ 2022-02-02</view>
						<view class="text uni-success">生效</view>
						<view class="text uni-error">禁用</view>
					</view>
				</li>
			</ul>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				curTab: 0,
				tabs: [
					{
						name: '全部',
						id: 0
					},
					{
						name: '实训课程',
						id: 1
					},
					{
						name: '理论课程',
						id: 2
					},
					{
						name: '数据产品',
						id: 3
					}
				]
			}
		},
		methods: {
			search(res) {
				uni.showToast({
					title: '搜索：' + res.value,
					icon: 'none'
				})
			},
			// tab切换
			tabChange(tab) {
				this.curTab = tab.id
			},
			// 跳转详情
			toDetail() {
				this.$util.to('../clientDetail/clientDetail')
			}
		}
	}
</script>

<style scoped lang="scss">
.top {
	display: flex;
	align-items: center;
	padding: 5px 15px 5px 5px;
	margin-bottom: 10px;
	background-color: #fff;
	.search {
		flex: 1;
	}
}
.list {
	background-color: #fff;
	li {
		padding: 20px;
		border-bottom: 2px solid #f8f8f8;
	}
	.line {
		display: flex;
		justify-content: space-between;
		margin-bottom: 10px;
	}
	.text {
		width: 25%;
		font-size: 14px;
		&:nth-child(3), &:last-child {
			text-align: center;
		}
	}
	.thead {
		.text {
			color: #767676;
		}
	}
}
</style>
