<template>
	<view class="container">
		<image class="banner" src="@/static/images/mine/back.png" mode="aspectFill" />
		<view class="title" :style="{ top: `${paddingTop * 2}rpx` }">
			<view class="title_back" @click="handleBack">
				<wd-icon name="thin-arrow-left" color="#001713" size="18"></wd-icon>
			</view>

			使用明细
		</view>

		<!-- 选择时间区域 -->
		<view class="time">
			<wd-datetime-picker type="year-month" v-model="timeValue" @confirm="handleConfirm" />
		</view>

		<!-- 内容区域 -->
		<scroll-view scroll-y class="body" @scrolltolower="scrolltolower">
			<!-- 每一个明细区域 -->
			<view class="body_item" v-for="item in 8" :key="8">
				<view class="item_msg">
					<view class="">订单号：12345678</view>
					<view class="msg_detail">充值+100</view>
				</view>
				<view class="">描述：支付100，赠送补贴包100</view>
				<view class="item_text">主余额：100 补贴余额：100 余额：100</view>
				<view class="item_text">2025-10-16 14：50</view>
			</view>
		</scroll-view>
	</view>
</template>

<script setup>
import { onMounted, ref } from 'vue'

// 胶囊按钮距离页面顶部的距离
const paddingTop = ref(0)

// 当前选择的时间
const timeValue = ref(Date.now())

onMounted(() => {
	paddingTop.value = uni.getMenuButtonBoundingClientRect().top
})

// 选择时间回调
const handleConfirm = (e) => {
	console.log(e)
}

// 页面滚动到底部触发的回调
const scrolltolower = () => {
	console.log(111)
}

// 顶部返回图标回调
const handleBack = () => {
	uni.navigateBack()
}
</script>

<style lang="scss" scoped>
.container {
	position: relative;
	height: 100vh;
	color: #001713;
	background-color: #fff;
	overflow: hidden;

	.banner {
		width: 100%;
		height: 482rpx;
	}

	.title {
		position: absolute;
		display: flex;
		align-items: center;
		width: 100vh;
		font-size: 40rpx;

		.title_back {
			margin-left: 26rpx;
			margin-right: 252rpx;
		}
	}

	.time {
		position: absolute;
		top: 130rpx;
		left: 32rpx;
		width: 250rpx;

		:deep(.wd-cell) {
			background-color: transparent;
		}
	}

	.body {
		position: absolute;
		top: 230rpx;
		box-sizing: border-box;
		padding: 10rpx 30rpx;
		height: calc(100vh - 230rpx);
		color: #001713;
		font-size: 28rpx;
		background-color: #fff;

		.body_item {
			padding: 20rpx 0;
			margin-bottom: 10rpx;
			border-bottom: 2rpx solid #d5d5d5;

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

				.msg_detail {
					font-size: 36rpx;
					font-weight: bold;
				}
			}

			.item_text {
				margin-top: 12rpx;
				color: #aba6a6;
				font-size: 24rpx;
			}
		}
	}
}
</style>
