<template>
	<view class="content">
		<view class="container">
			<view class="header-">
				<view class="" @click="goback">
					<u-icon name="arrow-left" color="#fff" size="20"></u-icon>
				</view>
				<view class="input-k">
					<u-icon name="search" size="18"></u-icon>
					<input type="text" placeholder="请输入银行名称" />
				</view>
				<view class=""></view>
			</view>
			<view class="box-" v-for="(item,index) in bankList" :key="index" @click="goNextBankList(item.id)">
				{{item.bankName}}
			</view>

		</view>

	</view>
</template>

<script>
	import request from '../../utils/request.js'
	import headers from '../../components/header/headers.vue'

	export default {
		data() {
			return {
				page: 1,
				totalPage: 0,
				bankList: [],
				titles: "默认",
				msg: "1",
				dataList: [],
				show: false,
				status: 'loading',
			}
		},
		onShow() {
			this.getBankList();
			// this.actList = ["1", "1", "1", "1", "1", ]
			// this.status = "nomore" 底部刷新结束
		},
		onPullDownRefresh() {
			console.log("刷新");
			uni.stopPullDownRefresh()
		},
		onReachBottom() {
			if (this.bankList.length < totalPage) {
				this.page++
				this.getNextBankList()
			} else {
				uni.showToast({
					title: "没有下一页数据",
					icon: 'none'
				})
			}
			// this.show = true
			setTimeout(() => {
				console.log("加载执行");
			}, 2000)
		},
		components: {
			headers
		},
		methods: {
			//一级银列表
			getBankList() {
				request({
					url: '/app/salesman/headquarters',
					method: 'post',
					data: {}
				}).then(res => {
					if (res.bank) {
						this.bankList = res.bank
						console.log("银行列表", this.bankList);
					}
				})
			},

			goNextBankList(id) {
				uni.navigateTo({
					url: '/homePages/Agent/nextBankList?id=' + id
				})
			},
			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;
	}

	.header- {
		width: 100%;
		height: 88px;
		background: #E4612E;
		position: fixed;
		top: 0px;
		display: flex;
		box-sizing: border-box;
		padding: 15px;

		padding-top: 50px;
		justify-content: space-between;
		color: white;

	}

	.input-k {
		width: 80%;
		height: 24px;
		background: #fff;
		border-radius: 50px;
		box-sizing: border-box;
		padding: 0px 15px;
		display: flex;
		align-items: center;

	}

	.box- {
		width: 100%;
		box-sizing: border-box;
		padding: 15px;
		border-bottom: 1px solid #d9d9d9;
	}
</style>
