<template>
	<view class="bg">
		<!-- <headerVue /> -->
		<image :src="showImg(detail.head_img)" mode="widthFix" class="topImg"></image>
		
		<view class="box">
			<view v-for="(item,index) in list" :key="index" class="item" @click="goDetailByType(item)">
				<image :src="showImg(item.image)" mode="aspectFill" class="headimg"></image>
				<view class="content">
					<view class="title text-overflow">{{item.title}}</view>
					<view class="flex-between">
						<view class="price">￥{{(item.money / 100).toFixed(2)}}</view>
						<image src="https://static.ticket.sz-trip.com/epicSoul/readingBody/gwc.png" mode="" class="gwc"></image>
					</view>
				</view>
			</view>
		</view>
		
		<view style="margin: 80rpx 50rpx;" v-html="formateRichText(detail.content)"></view>
	</view>
</template>

<script>
	import headerVue from "@/components/header.vue"
	export default {
		components: {
			headerVue
		},
		data() {
			return {
				detail: {},
				list: []
			}
		},
		onLoad(option) {
			this.Post({
				id: option.id,
			}, '/api/goods/goods_type_detail').then(res => {
				if(res.data) {
					this.detail = res.data
				}
			});
			
			this.Post({
				type_id: option.id,
				offset: 0,
				limit: 100,
			},'/api/goods/getGoodsByType').then(res => {
				this.list = res.data;
			})
		}
	}
</script>

<style lang="scss" scoped>
	.bg {
		padding-bottom: 200rpx;
	}
	
	.topImg {
		width: 100%;
	}
	
	.box {
		margin: 95rpx 45rpx 0;
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
		
		.item {
			margin-bottom: 45rpx;
			
			.headimg {
				width: 204rpx;
				height: 204rpx;
			}
			
			.content {
				width: 204rpx;
				margin-top: 5rpx;
				
				.flex-between {
					margin-top: 10rpx;
				}
				
				.title {
					font-weight: 400;
					font-size: 30rpx;
					color: #000000;
				}
				
				.price {
					font-size: 18rpx;
				}
				
				.gwc {
					width: 28.18rpx;
					height: 24.58rpx;
				}
			}
		}
	}
</style>