<template>
	<view class="wrap">
		<view class="top">
			<view class="name">{{ form.classificationName }}</view>
		</view>
		
		<view class="detail">
			<ul class="tabs">
				<li :class="{active: curTab === 0}" @click="tabChange(0)">主页</li>
				<li :class="{active: curTab === 1}" @click="tabChange(1)">商品</li>
			</ul>
		</view>
		
		<view v-if="!curTab" class="detail">
			<view class="title">公司简介</view>
			<view v-html="form.briefIntroduction"></view>
		</view>
		<view v-else class="list">
			<!-- <view class="item">
				<image class="pic" src="@/static/image/info-bg.jpg"></image>
				<view class="texts">
					<view class="name">测试标题</view>
					<view class="price">￥12.8</view>
				</view>
			</view>
			<view class="item">
				<image class="pic" src="@/static/image/info-bg.jpg"></image>
				<view class="texts">
					<view class="name">测试标题</view>
					<view class="price">￥12.8</view>
				</view>
			</view>
			<view class="item">
				<image class="pic" src="@/static/image/info-bg.jpg"></image>
				<view class="texts">
					<view class="name">测试标题</view>
					<view class="price">￥12.8</view>
				</view>
			</view>
			<view class="item">
				<image class="pic" src="@/static/image/info-bg.jpg"></image>
				<view class="texts">
					<view class="name">测试标题</view>
					<view class="price">￥12.8</view>
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	import { queryTeamInfo } from '@/apis/modules/user.js'
	export default {
		data() {
			return {
				teamId: '',
				curTab: 0,
				tabs: [
					{
						name: '详情介绍',
						id: 0
					},
					{
						name: '界面图',
						id: 1
					},
					{
						name: '参数',
						id: 2
					}
				],
				form: {
					classificationName: '',
					briefIntroduction: ''
				},
				shopCartTotal: 0,
				types: [],
				dotsStyles: {
					backgroundColor: 'rgba(83, 200, 249,0.3)',
					border: '1px rgba(83, 200, 249,0.3) solid',
					color: '#fff',
					selectedBackgroundColor: 'rgba(83, 200, 249,0.9)',
					selectedBorder: '1px rgba(83, 200, 249,0.9) solid'
				},
				mpStyle: {
					p: 'font-size: 25rpx !important;font-family: Microsoft Yahei !important;font-weight: 400 !important;color: #333 !important;',
					span: 'font-size: 25rpx !important;font-family: Microsoft Yahei !important;font-weight: 400 !important;color: #333 !important;'
				}
			}
		},
		onShow() {
			const pages = getCurrentPages()
			const { options } = pages[pages.length - 1]
			this.teamId = options.teamId
			this.getInfo()
		},
		methods: {
			// 获取详情
			async getInfo() {
				uni.showLoading({
					title: '加载中'
				})
				const res = await queryTeamInfo({
					teamId: this.teamId
				})
				this.form = res.teamInfo
				uni.hideLoading()
			},
			// tab切换
			tabChange(id) {
				this.curTab = id
			},
		}
	}
</script>

<style scoped lang="scss">
.wrap {
	padding-bottom: 140rpx;
}
.top {
	padding: 20rpx;
	.name {
		font-size: 30rpx;
	}
}
.tabs {
	display: flex;
	justify-content: center;
	margin-bottom: 32rpx;
	li {
		width: 33.33%;
		text-align: center;
		font-size: 28rpx;
		color: #333;
		white-space: nowrap;
	}
	.active {
		color: #007EFF;
		&:after {
			content: '';
			display: block;
			width: 40rpx;
			height: 8rpx;
			margin: 18rpx auto 0;
			border-radius: 4px;
			background-color: #007EFF;
		}
	}
}
.detail {
	padding: 34rpx 32rpx;
	margin: 16rpx 0;
	border-radius: 20px;
	background-color: #fff;
}
.list {
	display: flex;
	flex-wrap: wrap;
	padding: 0 10rpx;
	.item {
		width: calc((100% - 40rpx) / 2);
		margin: 20rpx 10rpx;
		background-color: #fff;
		border-radius: 8px;
		overflow: hidden;
	}
	.pic {
		width: 100%;
		height: 200rpx;
	}
	.texts {
		padding: 20rpx;
	}
	.name {
		margin-bottom: 10rpx;
		font-size: 30rpx;
		font-weight: 600;
	}
	.price {
		font-size: 26rpx;
		color: #ff0047;
	}
}
</style>
