<template>
	<view class="content">

		<headers :titles="titles"><u-icon name="arrow-left" color="#fff" size="22"></u-icon></headers>
		<view class="top-box">
			<view class="inputbox">
				<u-icon name="search" size="20"></u-icon>
				<input type="text" v-model="paramsQuery.mobile" />

			</view>

			<u-icon name="search" color="#fff" size="38" @click="getList"></u-icon>

		</view>
		<view class="box_" v-for="(item,index) in list" :key="index" @click="toCollection(item.id)">
			<view class="leftbox">
				<view class="title_">会员信息</view>
				<view class="d-s">
					<view class="hui">会员名称:</view>
					<view class="hei"> {{item.name}}</view>
				</view>
				<view class="d-s">
					<view class="hui">手机号:</view>
					<view class="hei"> {{item.mobile}}</view>
				</view>
				<view class="d-s">
					<view class="hui">账户余额:</view>
					<view class="hei"> {{item.cardBalance}}元</view>
				</view>
			</view>


			<view class="rightbox">
				<image src="../../static/imgs/av.png" mode=""></image>
			</view>
		</view>
		<view class="bottom-b"></view>
		<!-- <view class="p-bottom" @click="govipjs()">
			<view class="anniu">
				会员支付
			</view>
		</view> -->
	</view>
</template>

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

	export default {
		data() {
			return {
				titles: "会员查询",
				// 会员列表
				list: [],
				total: 0,
				paramsQuery: {
					page: 1,
					pageSize: 30,
				},
				AmountCollected: "",
				type: "",
			}
		},
		onLoad(e) {
			this.AmountCollected = e.AmountCollected
			this.type = e.type
		},
		onShow() {
			// this.actList = ["1", "1", "1", "1", "1", ]
			// this.status = "nomore" 底部刷新结束
			this.getList()
		},
		onPullDownRefresh() {
			console.log("刷新");
			uni.stopPullDownRefresh()
		},
		onReachBottom() {
			if (this.list.length < this.total) {
				this.paramsQuery.page++;
				this.getList()
			}
			// this.show = true
			setTimeout(() => {
				console.log("加载执行");
			}, 2000)
		},
		components: {
			headers
		},
		methods: {
			toCollection(id) {
				if (this.type && this.type == 1) {
					uni.navigateTo({
						url: "/pagesHome/MemberRecharge/MemberRecharge?userId=" + id
					})
				} else {
					uni.navigateTo({
						url: "/pagesHome/Collection/Collection?userId=" + id + "&AmountCollected=" + this
							.AmountCollected
					})
				}

			},
			getList() {
				request({
					url: '/business/userManager/user/list',
					method: 'get',
					params: this.paramsQuery
				}).then((res) => {
					if (this.paramsQuery.page == 1) {
						this.list = res.data.records
					} else {
						this.list = this.list.concat(res.data.records)
					}
					this.total = res.data.total
				})

			},
			govipjs() {
				uni.navigateTo({
					url: '/pagesHome/PaymentResults/PaymentResults'
				})
			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #0864e9;
		// background: linear-gradient(180deg, #B2D2FC 0%, #B2D2FC 14%, rgba(255, 255, 255, 0.84) 24%, rgba(255, 255, 255, 0.84) 100%);
		height: 30vh;
		box-sizing: border-box;
		padding-top: 88px;
	}

	.container {
		width: 100%;
		background: #f4f5f6;

	}

	.top-box {
		width: 95%;
		margin: 15px auto;

		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.inputbox {
		width: 90%;
		background: #fff;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		padding: 5px 15px;
		border-radius: 50px;
	}

	.box_ {
		width: 95%;
		border-radius: 8px;
		height: 154px;
		background: #fff;
		margin: 15px auto;
		border: 1px solid #0864e9;
		box-sizing: border-box;
		padding: 15px;
		display: flex;
		align-items: center;
		justify-content: space-between;
		position: relative;
		overflow: hidden;

	}

	.d-s {
		display: flex;
		align-items: center;
		margin-bottom: 10px;
	}

	.title_ {
		font-weight: bold;
		font-size: 16px;
		color: #0864E9;
		margin-bottom: 10px;
	}

	.leftbox {
		width: 50%;
	}

	.rightbox {
		position: absolute;
		right: 0px;
		bottom: 0px;

		image {
			width: 145px;
			height: 130px;
		}
	}

	.hui {
		font-weight: 500;
		font-size: 14px;
		color: #333333;
		margin-right: 5px;
	}

	.hei {
		font-weight: bold;
		font-size: 14px;
		color: #333333;
	}

	.bottom-b {
		width: 100%;
		height: 68px;
	}

	.p-bottom {
		width: 100%;
		height: 68px;
		background: #fff;
		position: fixed;
		bottom: 0px;
		left: 0px;
	}

	.anniu {
		height: 40px;
		background: #0864E9;
		width: 80%;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #fff;
		border-radius: 50px;
		margin: 5px auto;
	}
</style>