<template>
	<view>
		<u-navbar title="充值记录"></u-navbar>
		<view class="rechargeTime" @click="show = true">
			<u-picker mode="time" v-model="show" :params="params" @confirm="confirmTime" @cancel="cancelTime"></u-picker>
			<span>{{date.month}}月</span>
			<u-icon name="arrow-down-s-fill" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
		</view>
		<view class="rechargeList">
			<view class="rechargeList-item" @click="gotoUrl('pages/user/finance/rechargeDet?id=')">
				<view class="rechargeList-row"><span>充值金额</span><h4>100.00</h4></view>
				<view class="rechargeList-row"><p>微信支付</p><p>2021-12-31 09:00</p></view>
			</view>
			<view class="rechargeList-item">
				<view class="rechargeList-row"><span>充值金额</span><h4>100.00</h4></view>
				<view class="rechargeList-row"><p>微信支付</p><p>2021-12-31 09:00</p></view>
			</view>
			<view class="rechargeList-item">
				<view class="rechargeList-row"><span>充值金额</span><h4>100.00</h4></view>
				<view class="rechargeList-row"><p>微信支付</p><p>2021-12-31 09:00</p></view>
			</view>
			<view class="rechargeList-item">
				<view class="rechargeList-row"><span>充值金额</span><h4>100.00</h4></view>
				<view class="rechargeList-row"><p>微信支付</p><p>2021-12-31 09:00</p></view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				params: {
					year: true,
					month: true,
					day: false,
					hour: false,
					minute: false,
					second: false,
					timestamp: true,
				},
				show: false,
				date: {
					year: '',
					month: '',
				},
			}
		},
		onReady() {
			var date = new Date();
			this.date.year = date.getFullYear();
			this.date.month = date.getMonth() + 1;
			console.log(this.date)
		},
		methods: {
			confirmTime(params) {
				var m = params.month.slice(0,1)
				if(m == '0') {
					this.date.month = params.month.slice(1,2);
				} else {
					this.date.month = params.month;
				}
				
				this.date.year = params.year;
				this.show = false;
			},
			cancelTime() {
				this.show = false;
			}
		}
	}
</script>

<style lang="scss" scoped>
	.rechargeTime{
		background-color: #fff;
		height: 44px;
		display: flex;
		align-items: center;
		padding: 12px 16px;
		border-bottom: 1px solid #f7f7f7;
		span{
			margin-right: 4px;
		}
	}
	.rechargeList{
		background-color: #fff;
		padding-left: 16px;
		.rechargeList-item{
			padding: 12px 16px 12px 0;
			border-bottom: 1px solid #f7f7f7;
			&:last-child{
				border-bottom: none;
			}
		}
		.rechargeList-row{
			display: flex;
			align-items: center;
			justify-content: space-between;
			h4{
				font-size: 16px;
			}
			p{
				font-size: 12px;
				margin-top: 4px;
				color:#888;
			}
		}
	}
</style>
