<template>
	<view class="commodity">
		<search></search>
		<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y" @scrolltolower="lower">
			<view class="li" v-for="(item,index) in list" :key="index">
				<view class="h2_box">
					<view class="h2_left">
						<view class="btn">
							启动
						</view>
						<h2>绿卡通{{item.id}}</h2>
					</view>
					<img src="@/static/images/moreHorizontal@2x.png" alt="" @click="activeId = item.id">
				</view>
				<p>创建时间：2023-12-23 12:23</p>
				<p>所属店铺：燕塘分店</p>
				<u-transition :show="item.id == activeId">
					<moreShow @moreShowActive="moreShowActive"></moreShow>
				</u-transition>
			</view>
			<view style="height:110rpx;"></view>
		</scroll-view>
		<view class="footer_btn">
			添加分类
		</view>
	</view>
</template>

<script>
	import moreShow from "@/pagesA/components/more_show/index.vue"
	import search from "@/pagesA/components/search/index.vue"
	export default {
		components: {
			search,
			moreShow
		},
		data() {
			return {
				list: [{
					id: 1
				}, {
					id: 2
				}, {
					id: 3
				}, {
					id: 4
				}, {
					id: 5
				}, {
					id: 6
				}, {
					id: 7
				}],
				scrollTop: 0,
				activeId: 0, //当前展开ID
			};
		},
		methods: {
			moreShowActive(int) {
				console.log(this.activeId, int)
				this.activeId = 0 //完成操作置空
			},
			//触底
			lower: function(e) {
				console.log(e)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.strikeBalance {
		background-color: #f7f7f7;
	}

	.footer_btn {
		height: 104rpx;
		text-align: center;
		position: fixed;
		bottom: 0rpx;
		left: 32rpx;
		right: 32rpx;
		line-height: 104rpx;
		border-radius: 24rpx;
		background-color: #363c4f;
		font-size: 32rpx;
		font-weight: bold;
		color: #FFFFFF;
	}

	.scroll-Y {
		background-color: #fff;
		height: calc(100vh - 100rpx);

		.li {
			border-bottom: 2rpx solid #e9e9e9;
			padding: 40rpx 32rpx 30rpx;
			position: relative;

			.h2_box {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 24rpx;

				img {
					width: 40rpx;
					height: 40rpx;
				}

				.h2_left {
					display: flex;
					align-items: center;

					&>.btn {
						background: #DEF6E8;
						border-radius: 4rpx;
						font-size: 24rpx;
						font-weight: 400;
						padding: 4rpx 8rpx;
						color: #41CF7D;
						margin-right: 10rpx;
					}

					&>h2 {
						font-size: 32rpx;
						font-weight: 500;
						color: #222222;
					}
				}

			}

			p {
				font-size: 24rpx;
				font-weight: 400;
				color: #767A80;
				padding-bottom: 12rpx;
			}
		}
	}
</style>
