<template>
	<view class="content">
		<view class="container">
			<headers :titles="titles"><uni-icons type="arrow-left" color="#fff" size="22px"></uni-icons></headers>
			<view class="dai-" v-for="(item,index) in dataList" :key="index">
				<view class="dis">
					<view class="imgurl">
						<image src="../../static/home/dai.png" mode=""></image>
					</view>
					<view class="">
						<view class="title_">代理商-交易分润</view>
						<view class="size_">交易金额:{{item.trxAmt}}</view>
						<view class="size_">商户名称:{{item.merchantName}}</view>
						<view class="time_">交易时间:{{item.createDate}}</view>
					</view>
				</view>
				<view class="red-num">+{{item.amt}}</view>
			</view>
			<u-loadmore :status="status" v-if="show == true" />
		</view>

	</view>
</template>

<script>
	import headers from '../../components/header/headers.vue'
	import request from '../../utils/request.js'
	export default {
		data() {
			return {
				titles: "收入",
				msg: "1",
				dataList: [],
				show: false,
				status: 'loading',
				page: 1,
				limit: 10,
				totalPage: 0
			}
		},
		onShow() {
			this.page = 1,
				this.limit = 10,
				this.getMerList();
		},
		onPullDownRefresh() {
			this.page = 1,
				this.limit = 10,
				this.totalPage = 0,
				this.merList = [],
				this.getMerList();
			console.log("刷新");
			uni.stopPullDownRefresh()
		},
		onReachBottom() {
			// 触底加载
			if (this.merList.length < this.totalPage) {
				this.page++
				this.getMerList()

			} else {
				uni.showToast({
					title: '没有下一页数据',
					icon: 'none'
				})
			}
		},
		components: {
			headers
		},
		methods: {
			getMerList() {
				request({
					url: 'app/uaAgent/achievementList',
					method: 'post',
					data: {
						limit: this.limit,
						page: this.page,
						type: "2"
					}
				}).then(res => {
					if (res.data) {
						if (this.page != 1) {
							this.dataList = this.dataList.concat(res.data)
						} else {
							this.dataList = res.data
						}
						this.totalPage = res.total

					}
				})
			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #fff;
		height: 100vh;
	}

	.container {
		width: 100%;
		background: #fff;
		box-sizing: border-box;
		padding-top: 88px;
	}

	.dai- {
		width: 100%;
		display: flex;
		box-sizing: border-box;
		padding: 15px;
		justify-content: space-between;
		border-bottom: 1px solid #dddddd;

	}

	.red-num {
		font-size: 18px;
		font-weight: bold;
		color: #fd140b;
	}

	.dis {
		display: flex;
		align-items: center;
	}

	.imgurl {
		width: 55px;
		height: 55px;
		border-radius: 50%;
		overflow: hidden;
		margin-right: 10px;

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

	.title_ {
		font-size: 18px;
		font-weight: bold;

	}

	.size_ {
		font-size: 14px;
	}

	.time_ {
		font-size: 12px;
		color: #5b5b5b;
	}
</style>