<template>
	<!-- <view class="container">
		<view class="list" v-for="(item,index) in list">
			<view class="title">
				<span>{{item.title}}</span>
				
				<span class="money" v-if="item.type == 1">+{{item.money}}元</span>
				<span class="money" v-if="item.type == 2">-{{item.money}}元</span>
			</view>
			<view class="times">{{item.createTime}}</view>
		</view>
		<empty v-if="list.length == 0" des="暂无余额信息" show="true"></empty>
		<view v-if="list.length > 0">
			<load-more :loadingType="loadingType" :contentText="contentText"></load-more>
		</view>
	</view> -->
	
	<view style="text-align: left">
		<view v-for="(item, index) in list" :key="index" class="item">
			<view>
				<view style="color: #000000;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 style="color: #FF2638;font-size: 32upx;font-weight: 600" v-if="item.type == 1">+{{item.money}}元</text>
						<text style="color: #FF2638;font-size: 32upx;font-weight: 600" v-if="item.type == 2">-{{item.money}}元</text>
					</view>
				</view>
			</view>
		</view>
		<empty v-if="list.length == 0" des="暂无余额信息" show="true"></empty>
		<view v-if="list.length > 0">
			<load-more :loadingType="loadingType" :contentText="contentText"></load-more>
		</view>
	
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				limit: 15,
				loadingType: 0,
				contentText: {
					contentdown: '上拉显示更多',
					contentrefresh: '正在加载...',
					contentnomore: '没有更多数据了'
				},
			};
		},
		onLoad() {
			this.getList();
		},
		methods: {
			getList() {
				this.loadingType = 1;
				this.$queue.showLoading('加载中...');
				let userId = this.$queue.getData('userId');
				this.$Request.getT('/goodsMerchant/selectMerchantMoneyDetails?page=' + this.page + '&limit=' + this.limit +
					'&userId=' + userId).then(res => {
					if (res.code == 0 && res.data) {
						if (this.page == 1) {
							this.list = [];
						}
						
						if(res.data.data && res.data.data.records.length > 0){
							res.data.data.records.forEach(d => {
								this.list.push(d);
							});
						}

						if (res.data.data.records.length === this.limit) {
							this.loadingType = 0;
						} else {
							this.loadingType = 3;
						}
					} else {
						this.loadingType = 2;
					}
					uni.hideLoading();
				});
			},
			topScrollTap: function() {
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 300
				});
			}
		},
		onPageScroll: function(e) {
			this.scrollTop = e.scrollTop > 200;
		},
		onReachBottom: function() {
			this.page = this.page + 1;
			this.getList();
		}
	}
</script>

<style lang='scss'>
	page {
		background: #fff;
	}
	
	.item {
		background: white;
		padding: 32rpx;
		margin: 32rpx;
		font-size: 28rpx;
		box-shadow: 7px 9px 34px rgba(0, 0, 0, 0.1);
		border-radius: 16upx;
	}
	
	.container {
		padding: 0 4%;

		.list {
			padding: 30rpx 0;
			border-bottom: 1rpx solid #E6E6E6;

			.title {
				line-height: 70rpx;
				font-size: 34rpx;
				color: #333;
				font-weight: bold;
				position: relative;

				.money {
					position: absolute;
					right: 0;
				}
			}

			.times {
				color: #999;
			}
		}
	}
</style>
