<template>
	<view class="content">
		<!-- 分类 -->
		<u-sticky bgColor="#fff" zIndex="99">
			<u-tabs :list="classify" lineColor="#34CE98" @click="onTabs()"></u-tabs>
		</u-sticky>
		<!-- 分类商品 -->
		<oct-goods
			:lists="goodsArr"
			color="#e6576b"
			@onGoods="$Router.push({ name: 'StoreGoods', params: {id: $event.goods_id}})"
		/>
	</view>
</template>

<script>
	import { lists } from "@/apis/interfaces/store"
	export default {
		data() {
			return {
				goodsArr: [],
				classify: [
					{ name: "全部" },
					{ name: "21天盒子" },
					{ name: "7天盒子" },
					{ name: "3天盒子" },
					{ name: "复食餐" },
				]
			};
		},
		mounted(){
			uni.setNavigationBarTitle({
				title: this.$Route.query.title
			})
			this.getLists()
		},
		methods:{
			// 商品列表
			getLists() {
				// {
				// 	this.$Route.query.id
				// }
				lists({}).then(res => {
					this.goodsArr = res.data
					uni.stopPullDownRefresh()
				})
			},
			// 二级分类筛选
			onTabs(){
				this.goodsArr = []
				this.getLists()
			}
		},
		onPullDownRefresh() {
			this.getLists()
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		background: $window-color;
		min-height: 100vh;
	}
</style>
