<template>
	<view class="yongjin">
		<view class="yongjin-item u-flex" v-for="(item,index) in list" :key="index">
			<view class="left">
				¥
			</view>
			<view class="right u-flex-1">
				<view class="u-flex u-row-between right1">
					<text>{{item.explain}}</text>
					<text>{{item.type == 1 ? '+' : '-'}}{{item.change_amount}}</text>
				</view>
				<view class="u-flex u-row-between right2">
					<text>{{item.create_at}}</text>
					<text>我的佣金 {{item.amount}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				list: []
			}
		},
		onLoad() {
			this.getlist()
		},
		onReachBottom() {
			if (this.list.length % 20 == 0) {
				this.page++
				this.getlist()
			}
		},
		methods: {
			getlist() {
				this.$u.post('/api/Member/balance_list', {
					page: this.page,
					page_num: 20
				}).then(res => {
					this.list = this.list.concat(res.data)
				})
			}
		}
	}

</script>

<style lang="scss">
	.yongjin {
		.yongjin-item {
			height: 164rpx;
			border-bottom: 2rpx solid rgba(245, 245, 245, 1);
			padding: 0 24rpx;

			.right {
				.right2 {
					text:first-child {
						font-size: 24rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #999999;
					}

					text:last-child {
						font-size: 24rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #999999;
					}
				}

				.right1 {
					margin-bottom: 4rpx;

					text:first-child {
						font-size: 28rpx;
						font-family: PingFangSC-Medium, PingFang SC;
						font-weight: 500;
						color: #333333;
					}

					text:last-child {
						font-size: 28rpx;
						font-family: PingFangSC-Medium, PingFang SC;
						font-weight: 500;
						color: #333333;
					}
				}
			}

			.left {
				text-align: center;
				width: 100rpx;
				line-height: 100rpx;
				border-radius: 100rpx;
				font-size: 60rpx;
				color: #fff;
				font-weight: bold;
				background-color: rgba(247, 164, 107, 1);
				margin-right: 32rpx;
			}
		}
	}

</style>
