<template>
	<view class="lockuser">
		<view class="setting-header">
			<view class="setting-header-text">
				<view class="setting-header-text-neishi" @click="topgi">
					<view class="setting-header-text-icon">
						<image src="https://cdn.bjtdba.com/vod/image/2022-08-11/20220811133828415.png" mode="widthFix">
						</image>
					</view>
				</view>
				<view class="setting-header-text-title">
					锁定用户
				</view>
			</view>
		</view>
		<view class="hsuju">
			<view class="neiksd" v-for="(item,index) in ouListAll" :key="index">
				<view class="uisd">
					<view class="sfghj">
						<view class="ledt">
							<view class="" style="font-weight: 400;color: #333333;font-size: 30rpx;">
								{{item.username}}
							</view>

						</view>
						<view class="ledtx">
							<view class="" style="font-weight: normal;color: #999999;font-size: 26rpx;">
								{{item.createTime}}
							</view>
							<view class="" style="font-weight: 400;color: #333333;font-size: 24rpx;margin-top: -10px;">
								消费 <span
									style="font-size: 30rpx;font-weight: normal;color: #333333;">¥{{item.money}}</span>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="" v-if="tihsi==0" style="margin: 60rpx 0 30rpx 0; color: #999999; font-size: 26rpx;">
			—— 已经到最底部了哦 ——
		</view>
	</view>
</template>

<script>
	import {
		queryOrderUser
	} from '@/commit/config.js'
	export default {
		data() {
			return {
				merId: '',
				ouListAll: "",
				page: 1,
				limit: 13,
				is_panudn: true,
				tihsi: ""
			}
		},
		onLoad() {
			let selectmerchant = uni.getStorageSync('selectmerchant')
			this.merId = selectmerchant.merId
			this.queryOrderUser()
		},
		onPullDownRefresh() {
			
			// uni.showLoading({
			// 	title: '加载中',
			// });
			this.page = 1
			this.is_panudn = true
			this.ouListAll = []
			this.queryOrderUser();
		},
		onReachBottom() {
			if (this.is_panudn == true) {
				this.page++;
				this.queryOrderUser();
			} else {
				return
			}
		},
		methods: {
			// 锁定用户信息
			queryOrderUser() {
				uni.showLoading({
					title: '加载中',
				});
				queryOrderUser({
					merId: this.merId,
					pageNum: this.page,
					pageSize: this.limit,
				}).then(res => {
					console.log(res)
					uni.stopPullDownRefresh();
					if (res.data.status == 200) {
						this.tihsi = res.data.data.pageInfo.list.length
						if (res.data.data.pageInfo.list.length > 0) {
							if (this.page == 1) {
								this.ouListAll = res.data.data.pageInfo.list
							} else {
								this.ouListAll = this.ouListAll.concat(res.data.data.pageInfo.list)
							}
						} else {
							this.is_panudn = false
						}
						uni.hideLoading();
					} else {
						uni.hideLoading();
						uni.showToast({
							title: res.message,
							icon: 'none'
						})
					}
				}, fail => {
					console.log(fail)
					uni.hideLoading();
				})
			},
			topgi() {
				uni.switchTab({
					url: '/pages/my/index'
				});
			}
		}
	}
</script>

<style>
	page {
		background-color: #F7F8FC;
	}
</style>
<style lang="scss" scoped>
	.lockuser {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;

		.setting-header {
			position: fixed;
			top: 0;
			left: 0;
			z-index: 111;
			width: 100%;
			height: 176rpx;
			background: #FFFFFF;
			display: flex;
			justify-content: center;

			.setting-header-text {
				width: 686rpx;
				font-size: 36rpx;
				font-weight: 500;
				color: #333333;
				display: flex;
				margin-top: 107rpx;
				align-items: center;

				.setting-header-text-neishi {
					width: 45rpx;
					height: 45rpx;
					margin-right: 17rpx;

					.setting-header-text-icon {
						width: 36rpx;
						height: 36rpx;
						margin-top: 2rpx;

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

		.hsuju {
			width: 100%;
			height: 100%;
			display: flex;
			flex-direction: column;
			align-items: center;
			margin-top: 202rpx;
			background-color: #FFFF;

			.neiksd {
				width: 686rpx;
				height: 100%;

				.uisd {
					width: 100%;
					height: 132rpx;
					border-bottom: 1rpx solid #E5E5E5;
					display: flex;
					align-items: center;

					.sfghj {
						width: 100%;
						height: 68rpx;
						display: flex;
						flex-direction: column;
						justify-content: space-between;

						.ledt {
							width: 100%;
							display: flex;
							justify-content: space-between;
						}

						.ledtx {
							width: 100%;
							display: flex;
							justify-content: space-between;
						}
					}
				}
			}

		}
	}
</style>
