<template>
	<view class="content">
		<view class="content-mian">
			<!-- <view v-for="(item, index) in list" :key="index" class="item">
				<view style="color: #999999;font-size: 28upx;">
					<view style="margin-bottom: 8upx">{{item.title}}</view>
					<view style="margin-bottom: 8upx">{{item.content}}</view>
					<view style="margin-bottom: 8upx"> 创建时间：{{item.createTime}}</view>
					<view style="margin-bottom: 8upx;text-align: right;">
						<text v-if="item.type == 2" class="text-olive" style="font-size: 32upx;font-weight: 600"><text class="text-olive">+</text>{{item.money}}元</text>
						<text v-if="item.type == 2" class="text-red" style="font-size: 32upx;font-weight: 600"><text class="text-red">-</text>{{item.money}}元</text>
					</view>
				</view>
			</view> -->
			<view class="content-list" v-for="(item, index) in list" :key="index">
				<view class="list-top">
					<view class="list-top-view">
						<span class="list-top-view-title">{{item.title}}</span>
						<span class="img-span">{{item.blFlag=='1'?'余额':'现金'}}</span>
					</view>
					<text v-if="item.type == 1" class="text-olive" style="font-size: 32upx;font-weight: 600"><text class="text-olive">+</text>{{item.money}}元</text>
					<text v-if="item.type == 2" class="text-red" style="font-size: 32upx;font-weight: 600"><text class="text-red">-</text>{{item.money}}元</text>
				</view>
				<view class="list-bottom">
					<view class="list-bottom-ding">
						{{item.content}}
					</view>
					<view class="list-bottom-time">
						创建时间：{{item.createTime}}
					</view>
				</view>
			</view>
			<empty v-if="list.length == 0" content="暂无明细" ></empty>
		</view>
	</view>
</template>

<script>
	import empty from '@/components/empty.vue'
	export default {
		components: {
			empty
		},
		data() {
			return {
				list: [],
				page: 1,
				limit: 10,
				tabIndex: 1,
				checkReZhiShu: '否',
				checkReTuanZhang: '否',
				checkReFeiZhiShu: '否',
				scrollTop: false,
				contentText: {
					contentdown: '上拉显示更多',
					contentrefresh: '正在加载...',
					contentnomore: '没有更多数据了'
				}
			}
		},
		onLoad() {
			this.$queue.showLoading("加载中...");
			this.getList();
		},
		onPageScroll: function(e) {
			this.scrollTop = e.scrollTop > 200;
		},
		methods: {
			getList() {
				let userId = this.$queue.getData('userId');
				let data = {
					page: this.page,
					limit: this.limit
				}
				this.$Request.getT('/app/userMoney/balanceDetailed',data ).then(res => {
					if (res.code === 0) {
						if (this.page === 1) {
							this.list = res.data.list;
						} else {
							this.list = [...this.list, ...res.data.list];
						}
					}
					uni.stopPullDownRefresh();
					uni.hideLoading();
				});
			}
		},
		onReachBottom: function() {
			this.page = this.page + 1;
			this.getList();
		},
		onPullDownRefresh: function() {
			this.page = 1;
			this.getList();
		}
	}
</script>

<style lang="less">
	.img-span{
		display: block;
		padding: 2px 8px;
		font-weight: 400;
		font-size: 11px;
		color: #FFFFFF;
		background: linear-gradient(-90deg, #FF6F48, #FF9E69);
		border-radius: 10px 0px 10px 0px;
		margin-left: 5px;
	}
	.list-top-view-title{
		color: #13141A;
		font-weight: bold;
		font-size: 35rpx;
	}
	.list-top-view{
		display: flex;
		flex-direction: row;
		align-items: center;
	}
	.list-bottom-time{
		font-weight: 400;
		font-size: 25rpx;
		color: #999999;
		margin-top: 5px;
	}
	.list-bottom-ding{
		font-weight: 400;
		font-size: 29rpx;
		color: #555555;
	}
	.list-bottom{
		width: 100%;
		display: flex;
		flex-direction: column;
	}
	
	.shijiH{
		color: #FF8400;
	}
	.shijiL{
		color: #029D88;
	}
	.list-top{
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		border-bottom: 1px solid #DCDCDC;
		padding-bottom: 15px;
		margin-bottom: 15px;
	}
	.content-list{
		width: 100%;
		height: 235rpx;
		background: #FFFFFF;
		border-radius: 21rpx;
		padding: 15px;
		margin-top: 12px;
	}
	.content-mian{
		width: 95%;
		height: 100%;
		display: flex;
		flex-direction: column;
		margin: 0 auto;
		padding-bottom: 30px;
	}
	.content {
		width: 100%;
		// height: 100vh;
		background: #f7f7f7;
		// overflow: scroll;
	}

	.tui-tab-item-title {
		// color: #ffffff;
		font-size: 30rpx;
		height: 80rpx;
		line-height: 80rpx;
		flex-wrap: nowrap;
		white-space: nowrap;
	}

	.tui-tab-item-title-active {
		border-bottom: 1px solid #557EFD;
		color: #557EFD;
		font-size: 32upx;
		font-weight: bold;
		border-bottom-width: 6upx;
		text-align: center;
	}
	
	.item {
		background: #FFFFFF;
		padding: 32rpx;
		margin: 32rpx;
		font-size: 28rpx;
		box-shadow: 7px 9px 34px rgba(0, 0, 0, 0.1);
		border-radius: 16upx;
	}
</style>
