<template>
	<view style="text-align: left">
		<view v-if="list.length" v-for="(item, index) in list" :key="index" class="item">
			<view>
				<view style="margin-bottom: 8upx;text-align: right;">
					<text style="margin-bottom: 8upx;color: green" v-if="item.state==1"> 提现成功</text>
					<text style="margin-bottom: 8upx;color: green" v-if="item.state==0"> 提现中</text>
					<text style="margin-bottom: 8upx;color: #FD6416" v-if="item.state==-1"> 提现失败</text>
				</view>

				<view style="color: #999999;font-size: 28upx;">
					<view style="margin-bottom: 8upx"> 收款人账号：{{item.zhifubao}}</view>
					<view style="margin-bottom: 8upx"> 收款人姓名：{{item.zhifubaoName}}</view>
					<view style="margin-bottom: 8upx"> 发起时间：{{item.createAt}}</view>
					<view style="margin-bottom: 8upx" v-if="item.state==1">成功时间 {{item.outAt}}</view>
					<view style="margin-bottom: 8upx;color: #FD6416" v-if="item.state==-1">{{item.refund}}</view>

					<view style="margin-bottom: 8upx;text-align: right;">
						<!-- 提现金额： -->
						<text style="color: #FD6416;font-size: 32upx;font-weight: 600"> ￥{{item.money}}</text>
					</view>
				</view>
			</view>
		</view>

		<view class="page-box" v-if="!list.length">
			<view class="centre">
				<image src="../../static/images/learn/none.png" mode=""></image>
				<view class="tips">
					暂无记录
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				limit: 10,
				totalCount: 0,
			}
		},
		onLoad: function(e) {
			this.getMoney();
		},

		methods: {
			getMoney() {
				let that = this;
				let token = uni.getStorageSync('token')

				if (token) {
					//可以提现金额查询预估收入查询
					let data = {
						page: this.page,
						limit: this.limit
					}
					this.$Request.getT('app/cash/selectPayDetails', data).then(res => {
						this.totalCount = res.data.totalCount;
						if ( res.data.list.length > 0) {
							this.list = [...this.list,...res.data.list];
						}
					})
				}

			},
		},
		onReachBottom: function() {
			if (this.page*this.limit < this.totalCount) {
				this.page = this.page + 1;
				this.getMoney();
			}
		},
		onPullDownRefresh: function() {
			this.page = 1;
			// that.list = []
			this.getMoney();
		},
	}
</script>

<style lang='scss' scoped>
	/* @import "../../static/css/index.css"; */

	page {
		background: #FFFFFF;
	}

	.item {
		background: white;
		padding: 32rpx;
		margin: 32rpx;
		font-size: 28rpx;
		box-shadow: 7px 9px 34px rgba(0, 0, 0, 0.1);
		border-radius: 16upx;
	}

	.centre {
		text-align: center;
		padding: 200rpx 0;
		font-size: 32rpx;
		box-sizing: border-box;

		image {
			width: 360rpx;
			height: 360rpx;
			// margin-bottom: 20rpx;
			margin: 0 auto 20rpx;
			// border: 1px dotted #000000;
		}

		.tips {
			font-size: 34rpx;
			color: #999999;
			margin-top: 20rpx;
		}

		.btn {
			margin: 80rpx auto;
			width: 600rpx;
			border-radius: 32rpx;
			line-height: 90rpx;
			color: #ffffff;
			font-size: 34rpx;
			background: #ff7581;
		}
	}
</style>