<!-- 流水页面 -->
<template>
	<view class="running-water bx">
		<navbar :leftClick="leftClick" :title="$t('page.runningWater.title')"></navbar>
		
		<u-list @scrolltolower="scrolltolower" height="calc(100vh - 90rpx)">
			<!-- 流水列表 -->
			<view class="running-water-list content">
				<view v-for="item in runningWaterList" :key="item.id" class="running-water-item">
					<image src="@/static/runningWater/money.png" mode="aspectFit"></image>
					<view class="descript">[balance]</view>
					<view class="time">{{ item.createTime }}</view>
					<view class="money-detail">
						<text>{{ item.type == '0' ? '+' : '-' }}</text>
						{{ item.money }}
					</view>
				</view>
			</view>
		</u-list>
	</view>
</template>

<script>
	import navbar from '@/components/base/m-navbar.vue'

	export default {
		components: {
			navbar
		},
		data() {
			return {
				queryparams: {
					pageNo: 1,
					pageSize: 10
				},
				runningWaterList: []
			}
		},
		onShow() {
			this.getRunningWater()
		},
		methods: {

			leftClick() {
				uni.navigateTo({
					url: '/pages/home/home'
				})
			},

			//获取流水
			getRunningWater() {
				this.request('WaterPage', {}, this.queryparams).then(res => {
					if (res.code == 200) {
						this.runningWaterList = res.result.records
					}
				})
			},
			
			//滑动到页面底部
			scrolltolower(){
				this.queryparams.pageSize += 10
				this.getRunningWater()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.running-water {
		width: 750rpx;
		min-height: 100vh;
		// background-color: black;
		margin: 0 auto;
		background-size: 100%;
		background-repeat: no-repeat;

		.content {
			width: 96%;
			margin: 0 auto;
		}

		.running-water-list {
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;
			margin-top: 20rpx;

			.running-water-item {
				display: flex;
				flex-direction: column;
				align-items: center;
				box-sizing: border-box;
				padding: 15rpx;
				width: calc(50% - 15rpx);
				border: 1px solid #00000080;
				margin-bottom: 25rpx;

				image {
					width: 100rpx;
					height: 100rpx;
				}

				.descript {
					// color: #AEC43C;
					font-size: 36rpx;
				}

				.time {
					color: #989898;
					margin: 15rpx 0rpx;
				}

				.money-detail {
					// color: #3AA56B;
					font-size: 36rpx;
				}
			}
		}
	}
</style>