<template>
	<view class="total-page page-box page-env-20 scroll_content task-bg">
		<Nav title="征信报告" :genre="1" is_fixed></Nav>
		<view class="header-filter">
			<view class="row-justify-sb center m-20">
				<view class="subsection">
					<uv-subsection :list="list" :bgColor="'#FFF'" :barBg="'#0FB160'" :activeColor="'#fff'"
						:inactiveColor="'#0FB160'" :fontSize="14" custom-style="height: 70rpx;border-radius: 30rpx;"
						custom-item-style="border-radius: 30rpx;" :current="subCurrent"
						@change="onSubChange"></uv-subsection>
				</view>
				<view class="row credit_earch center sys-background-fff r-30 p-l16">
					<uni-icons type="search" size="18" color="#999"></uni-icons>
					<input class="flex m-l10 m-r20 size-28 sys-background-fff" type="text" placeholder="搜索姓名/电话"
						placeholder-style="font-size:28rpx;color:#999" v-model="value" />
				</view>
			</view>
			<view style="height: 100rpx;">
				<z-tabs ref="tabs" :list="tabsList" :active-style="{color:'#10B261',fontWeight:'bold',fontSize:'28rpx'}"
					:bar-style="{background:'#10B261'}" :inactive-style="{fontWeight:'bold',fontSize:'28rpx'}"
					:current="current" :bar-animate-mode="'worm'" @change="tabsChange" />
			</view>
		</view>
		<EnScroll ref="scroll" :navHeight="navHeight" is_tabHeight @onRefresh="onRefresh"
			@onScrollBottom="onScrollBottom">
			<CreditItem></CreditItem>
		</EnScroll>
		<view class="fixed-button p-t20 p-lr30">
			<button class="en-button button-background sys-weight-500 row-justify-c center" type="default"
				hover-class="is-hover" @click="onSubmit">
				<image class="wh-36 m-lr16" src="/static/img/task/task-phone.png" mode="aspectFill"></image>
				邀请客户添加征信报告
			</button>
		</view>
	</view>
</template>
<script>
	import CreditItem from "./components/credit-item.vue";

	export default {
		components: {
			CreditItem,
		},
		data() {
			return {
				value: '',
				current: 0,
				navHeight: 0,
				swiperCurrent: 0,
				tabsList: [{
					name: '全部',
					dot_color: 'red',
					disabled: false,
					'id': 0,
				}, {
					name: '待验证',
					dot_color: 'yellow',
					disabled: false,
					'id': 6,
				}, {
					'id': 1,
					name: '已通过',
					dot_color: '',
					disabled: false
				}, {
					'id': 2,
					name: '已拒绝',
					dot_color: '',
					disabled: false
				}],
				subCurrent: 0,
				list: ['全部', '当日', '本周'],
			}
		},
		onReady() {
			this.getFilterHeight()
		},
		onLoad() {},
		mounted() {},
		methods: {
			tabsChange(index) {
				if (index !== this.current) {
					this.current = index;
					this.startList()
				}
			},
			onSubChange(current) {
				this.subCurrent = current
			},
			// 下拉刷新
			onRefresh() {
				console.log('下拉刷新');
				setTimeout(() => {
					this.$refs.scroll.onEndPulling()
				}, 500)
			},
			// 滚动到底部
			onScrollBottom() {
				console.log('滚动到底部');
			},
			getFilterHeight() {
				const query = uni.createSelectorQuery().in(this);
				query.select('.header-filter').boundingClientRect(data => {
					if (data) {
						console.log(data.height);
						this.navHeight = data.height
					}
				}).exec();
			}
		},
	}
</script>
<style lang="scss" scoped>
	.subsection {
		width: 430rpx;
	}

	.credit_earch {
		width: 250rpx;
		height: 69rpx;
	}

	.en-button {
		border: none;
		color: #fff;
		font-size: 30rpx;
		border: 1rpx solid #0FB160 !important;
		line-height: 80rpx;
		border-radius: 100rpx;
		background-color: #0FB160;
	}

	.fixed-button {
		position: fixed;
		bottom: 0;
		z-index: 10;
		background: #fff;
		width: calc(100% - 60rpx);
		padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
	}

	button::after {
		border: none;
	}
</style>