<template>
	<view class="">
		<public-module></public-module>
		<u-sticky h5-nav-height="0">
			<view class="headers dis a-c j-start">
				<u-icon name="arrow-left" color="#333" size="38" @click="back"></u-icon>
				<text style="margin: auto;">转入记录</text>
			</view>
			<view class="filterTime dis j-s a-c ">
				<view class=" dis a-c " @click="searchPopup">
					<text>{{pageQuery.startTime && pageQuery.endTime ? pageQuery.startTime + '-' + pageQuery.endTime : '时间筛选' }}</text>
					<text>▼</text>
				</view>
				<view class=" dis a-c " @click="statusFilterShow=true">
					<text>{{ pageQuery.appStatus == '0'?'正常':pageQuery.appStatus == '1'?'已冻结':pageQuery.appStatus == '2'?'已失效':'全部' }}</text>
					<text>▼</text>
				</view>
			</view>
			<view class="performance dis a-c j-c ">
				共有 5笔订单，保费5元，佣金5元
			</view>
		</u-sticky>
		<view class="content">
			<view class="item" v-for="(item, index) in transferRecords" @click="toReacors(item.id)">
				<view class="info">
					<view class="name">{{ item.grade }}</view>
					<view class="time">{{ item.startTime }}</view>
				</view>
				<view class="amount">{{ item.amount }}</view>
			</view>
		</view>
		<!-- 筛选组件 -->
		<uni-popup :show="statusFilterShow" @close='statusFilterShow=false' headerTitle="筛选状态"
			:statusList="quickOptions" contentType="status" @statusConfirm="statusFilterConfirm">
		
		</uni-popup>
		<u-loadmore v-if="userlist.length!=0" :status="status" />
		<my-date-picker ref="datePicker" @confirmPickDate="confirmPickDate" />
	</view>
</template>
<script>
	import myDatePicker from '../components/todaydate-picker.vue';
	export default {
		components: {
			myDatePicker
		},
		data() {
			return {
				referrerInfo: {}, //个人信息
				userlist: [],
				pageQuery: {
					id: "",
					endTime: "",
					startTime: "",
					appStatus: '',
					pageNum: 1,
					pageSize: 10,
				},
				status: 'loadmore',
				totalPages: 0,
				parentStatus: "",
				transferRecords: [
					{
						grade: '工作室',
						startTime: '2025-09-06',
						amount: 10
					},
					{
						grade: '工作室',
						startTime: '2025-09-06',
						amount: 10
					},
					{
						grade: '工作室',
						startTime: '2025-09-06',
						amount: 10
					}
				],
				statusFilterShow: false,
				quickOptions: [{
						label: "全部",
						value: null,
					},
					{
						label: "正常",
						value: "0",
					},
					{
						label: "已冻结",
						value: "1",
					},
					{
						label: "已失效",
						value: "2",
					}
				],
			}
		},
		onReachBottom() {
			// if (this.pageQuery.pageNum >= this.totalPages) return;
			// this.status = 'loading';
			// this.pageQuery.pageNum = ++this.pageQuery.pageNum;
			// setTimeout(async () => {
			// 	let res = await this.$http.post('/newAppPartner/selectByIdList', this.pageQuery);
			// 	if (res.code == '200') {
			// 		this.userlist = [...this.userlist, ...res.data.list.records];

			// 	}
			// 	if (this.pageQuery.pageNum >= this.totalPages) this.status = 'nomore';
			// 	else this.status = 'loading';
			// }, 1000)
		},
		onLoad(options) {
			this.pageQuery.id = options.id;
			this.querydata();
		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 1, // 返回的页面数，如果是1表示返回上一页
					success: function() {}
				});
			},
			async querydata() {
				let res = await this.$http.post('/partnerExtractHistory/query', {
					...this.pageQuery,
					grage: Number(this.$route.query.grade)
				})
				console.log(12312321, res)
			},
			toReacors(id) {
				uni.navigateTo({
					url: "/pages/institutional/accountFreezeRecord?id="+id + '&&grade=' + this.$route.query.grade + '&&type=2'
				})
			},
			//激活时间选择组件
			searchPopup() {
				this.$refs.datePicker.open()
			},
			//日期选择回调
			confirmPickDate(startdate, enddate) {
				this.pageQuery.startTime = startdate;
				this.pageQuery.endTime = enddate;
			},
			statusFilterConfirm(item) {
				this.pageQuery.appStatus = item.value;
				this.querydata();
				this.statusFilterShow = false;
			},
		}

	}
</script>

<style lang="scss" scoped>
	.headers {
		width: 100%;
		z-index: 999999;
		padding: 30rpx;
		padding-top: 50px;
		background: linear-gradient(180deg, #D1EFFE 0%, #FFFFFF 100%);
		border-bottom: 1rpx solid #f2f2f2;

		text {
			font-size: 36rpx;
			font-weight: bold;
			color: #000;
		}



		.right {
			position: absolute;
			right: 30rpx;

			image {
				width: 28rpx;
				height: 28rpx;
				margin-right: 4rpx;
			}

			text {
				font-weight: 400;
				color: #000;
				font-size: 24rpx;
			}
		}
	}

	//业绩
	.performance {
		width: 100%;
		height: 60rpx;
		background: #EBF4FF;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		font-size: 30rpx;
		color: #2B67EF;
	}

	//时间筛选
	.filterTime {
		width: 100%;
		background: #fff;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		padding: 20rpx 30rpx;
		box-sizing: border-box;

		text:first-child {
			font-size: 26rpx;
			color: #333;
		}

		text:last-child {
			font-size: 19rpx;
			color: #666;
			margin-left: 4rpx;
		}
	}

	.content {
		margin: 20rpx 30rpx;
		box-sizing: border-box;
		background-color: #FFFFFF;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		padding: 30rpx;
		box-sizing: border-box;
		.item{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding:24rpx 0 30rpx;
			border-bottom: 1rpx solid #eee;
			.info{
				.name{
					font-size: 30rpx;
					color: #333;
				}
				.time{
					font-size: 20rpx;
					color: #999;
				}
			}
			.amount{
				font-size: 30rpx;
				color: #333;
				font-weight: 500;
			}
		}
	}
</style>