<template>
	<view class="border-box">
		<view class="content">
			<!-- <view style="width:100%;height: 20px;"></view> -->
			<view class="top-box">
				<view class="back-box x-f">
					<image src="/static/image/device/back_icon32.png"></image>
					<view @click="goBack()">返回</view>
				</view>
				<view class="title">
					体质辨识
				</view>
				<view class="select" @click="onOpenList">
					<view class="date x-bc">
						<image src="/static/image/device/user_icon32.png"></image>
						<text class="text">
							{{selectUser!==null?selectUser.nickName:'选择用户'}}
						</text>
						<image src="/static/image/device/arrow_icon16.png"></image>
					</view>
				</view>
			</view>
			<view class="list">
				<view class="tab-box">
					<view class="tabs">
						<view class="item" @click="navTo('/pages/device/tongue/index')">
							<image src="/static/image/device/tongue_icon68.png"></image>
							<view class="title">舌面诊</view>
						</view>
						<view class="item active">
							<image src="/static/image/device/pulse_diagnosis_on_icon68.png"></image>
							<view class="title">脉诊</view>
						</view>
					</view>
					<view class="test-box">
						<!-- <view class="note">请选择手腕，再点击开始测量</view> -->
						<view class="note2">蓝牙版</view>
						<view class="img-box">
							<image class="bg-box" src="/static/image/device/pulse_diagnosis_img.png"></image>
							<!-- 	<view class="left">
								<view class="bg">
									<image src="/static/image/device/left_hand_img.png"></image>
								</view>

								<view class="btn">
									<view class="checkbox-icon">
										<image src="/static/image/device/radio_default_icon16.png" v-show="!left">
										</image>
										<image src="/static/image/device/radio_choose_icon16.png" v-show="left"></image>
									</view>
									<text>左手</text>
								</view>
							</view> -->
							<!-- <view class="right">
								<view class="bg">
									<image src="/static/image/device/right_hand_img.png"></image>
								</view>
								<view class="btn">
									<view class="checkbox-icon">
										<image src="/static/image/device/radio_default_icon16.png" v-show="!right">
										</image>
										<image src="/static/image/device/radio_choose_icon16.png" v-show="right">
										</image>
									</view>
									<text>右手</text>
								</view>
							</view> -->
						</view>
						<view class="btn-box" @click="toConnect">
							去测脉
						</view>
					</view>

				</view>
			</view>
			<!-- <u-popup :show="isConnect" @close="close" mode="center" :round="10">
				<view style="width: 400px;height: 200px;display: flex;align-items: center;justify-content: center;">
					<u-loading-icon  color="#8F6726"></u-loading-icon>
					<view style="color: #8F6726;font-size:32px;margin-left: 10px;">设备连接中</view>
				</view>
			           
			</u-popup> -->
			<!-- <u-popup :show="left" @close="closeLeft" mode="center" :round="10">
				<view style="width: 400px;height: 200px;display: flex;align-items: center;justify-content: center;">
					<u-loading-icon color="#8F6726"></u-loading-icon>
					<view style="color: #8F6726;font-size:32px;margin-left: 10px;">左手测量中</view>
				</view>

			</u-popup>
			<u-popup :show="right" @close="closeRight" mode="center" :round="10">
				<view style="width: 400px;height: 200px;display: flex;align-items: center;justify-content: center;">
					<u-loading-icon color="#8F6726"></u-loading-icon>
					<view style="color: #8F6726;font-size:32px;margin-left: 10px;">右手测量中</view>
				</view>

			</u-popup> -->
			<view v-if="isResult" class="mask">
				<view class="popup-container2">
					<view class="title-t">测量完成</view>
					<view class="title-r">点击确认查看检测报告</view>
					<!-- <image style="width: 200px;height: 200px;margin-bottom: 20px;" :src="qUrl"></image> -->
					<view class="btn-r" @click="closeP">确认</view>
				</view>
			</view>
			
			<view v-if="showList" class="mask">
				<!-- 弹窗内容 -->
				<view class="popup-container">
					<!-- 弹窗头部 -->
					<view class="popup-header">
						<text class="popup-title">选择用户</text>
						<view class="close-btn" @click="onCloseList">
							<image src="/static/image/device/close_icon32.png"></image>
						</view>
					</view>
					<!-- 弹窗主体内容 -->
					<view class="popup-content">
						<view class="search-cont">
							<input type="text" v-model="keyword" class="form-input" placeholder="请输入用户姓名或者手机号"
								placeholder-class="text-input" />
							<view class="search-btn" @click="doSearch">
								<image src="/static/image/device/search_icon24.png"></image>
								<text>搜索</text>
							</view>
						</view>
						<view class="userList-box">
							<view class="userList" v-if="dataList.length>0">
								<view class="item" v-for="(item,index) in dataList" :key="index">
									<view class="title">{{item.nickName||''}}-{{item.phone||''}}</view>
									<view class="right-box">
										<view class="rest" @click="onOpenDetail(item)">
											查看
										</view>
										<view class="rest" @click="editDetail(item)">
											编辑
										</view>
										<view :class="item.userId==aIndex?'select active':'select'"
											@click="select(item)">
											选择
										</view>
									</view>
								</view>
							</view>
						</view>
						<view v-if="dataList.length==0" class="isNull">暂无数据</view>
					</view>

					<!-- 弹窗底部按钮 -->
					<view class="popup-footer">
						<view class="btn2 confirm-btn" @click="onOpen">
							<image src="/static/image/device/add_icon32.png"></image>
							<text>新建用户</text>
						</view>
					</view>
				</view>
			</view>
			<user-card :show="show" :initial-form="initData" @close="onClose" @confirm="onConfirm" @update="onEdit"></user-card>
			<view v-if="showDetail" class="mask">
				<!-- 弹窗内容 -->
				<view class="popup-container">
					<!-- 弹窗头部 -->
					<view class="popup-header">
						<view class="goback" @click="onOpenList">返回</view>
						<text class="popup-title">选择用户</text>
						<view class="close-btn" @click="onCloseDetail">
							<image src="/static/image/device/close_icon32.png"></image>
						</view>
					</view>
					<!-- 弹窗主体内容 -->
					<view class="popup-content">
						<view class="userDetail">
							<view class="item">
								<view class="label">姓名：</view>
								<text>{{detail.username||'-'}}</text>
							</view>
							<view class="item">
								<view class="label">性别：</view>
								<text>{{detail.sex==1?"男":"女"}}</text>
							</view>
							<view class="item">
								<view class="label">年龄：</view>
								<text>{{detail.age||'-'}}岁</text>
							</view>
							<view class="item">
								<view class="label">身高：</view>
								<text>{{detail.height||'-'}}cm</text>
							</view>
							<view class="item">
								<view class="label">体重：</view>
								<text>{{detail.weight||'-'}}kg</text>
							</view>
							<view class="item">
								<view class="label">手机号：</view>
								<text>{{detail.phone||'-'}}</text>
							</view>
							<view class="item">
								<view class="label">既往病史：</view>
								<text>{{detail.previousMedicalHistory||'-'}}</text>
							</view>
							<view class="item">
								<view class="label">过敏史：</view>
								<text>{{detail.historyOfAllergies||'-'}}</text>
							</view>
							<view v-if="detail.habitList.length>0" class="item" v-for="item in detail.habitList"
								:key="item.optionId">
								<view class="label">{{item.typeName ||'-'}}：</view>
								<text>{{item.optionName||'-'}}</text>
							</view>

						</view>
					</view>

					<!-- 弹窗底部按钮 -->
					<view class="popup-footer">
						<view class="btn2 confirm-btn" @click="selectBtn(detail)">
							<text>选择该用户</text>
						</view>
					</view>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	import {
		selectUsernameOrPhoneOrTime,
		addUser,
		selectQueryFsUser,
		editUser
	} from '@/api/user.js'
	import {
		addPulse
	} from '@/api/healthTongue.js'
	import {
		getDictByKey
	} from '@/api/common.js'
	import {
		tr
	} from "date-fns/locale";
	import userCard from "@/components/userCard.vue"
	export default {
		components: {
			userCard
		},
		mixins: [MescrollMixin], // 使用mixin
		data() {
			return {
				isResult: false,
				selectedDate: "",
				selectUser: null,
				show: false,
				showList: false,
				showDetail: false,
				total: 0,
				aIndex: '',
				createTimes: null,
				keyword: '',
				type: 0,
				left: false,
				right: false,
				isConnect: false,
				dataList: [],
				detail: {},
				status: 'loading',
				loadingText: '设备连接中',
				form: {
					sex: 0
				},
				info: null,
				// 插件实例
				tyPulse: null,
				// 状态
				initStatus: false,
				deviceConnected: false,
				measuring: false,
				// 设备信息
				deviceInfo: null,
				// 测量相关
				measureProgress: 0,
				currentStage: '待机',
				lastResult: null,
				appId: "nehijR6y",
				appSecret: "f740435d1b84b9944a52f064dd1ecf6e8a76f546",
				uid: "userid000067",
				qUrl: '',
				initData:{}
			}
		},
		onLoad(options) {
			this.userId = options.userId
			this.selectUser = uni.getStorageSync('selectUser') || null;
			// this.selectUsernameOrPhoneOrTime()
			this.initPlugin()
			// var info=uni.getSystemInfoSync()
			// console.log('info',info)
			// this.getDictByKey("sys_hospital_level");
		},
		methods: {
			goBack() {
				uni.navigateBack({
					delta:1
				})
			},
			// 初始化插件
			async initPlugin() {
				try {
					// this.addLog('开始初始化插件...');
					// 获取插件实例
					this.tyPulse = uni.requireNativePlugin('TyPulseManager');
					if (!this.tyPulse) {
						throw new Error('无法获取插件实例');
					}
					// 初始化
					await new Promise((resolve, reject) => {
						this.tyPulse.initSDK(this.appId, this.appSecret, this.uid, (
							result) => {
							if (result.success) {
								resolve();
							} else {
								reject(new Error(result.error));
							}
						});
					});

					this.initStatus = true;
					console.log('插件初始化成功');
					// uni.showToast({
					// 	title: '初始化成功',
					// 	icon: 'success'
					// });

				} catch (error) {
					console.log(`初始化失败: ${error.message}`);
					uni.showToast({
						title: '初始化失败',
						icon: 'error'
					});
				}
			},
			toMeasure() {
				try {
					// 设置自动屏幕方向
					this.tyPulse.toMeasure((result) => {
						if (result.success) {
							if (result.cmdType == "pulseResult") {
								this.info = result;
								console.log('脉诊回调结果:', result);
								this.addPulse()
							}
							if (result.cmdType == "deviceConnect") {
								//获取设备信息
								this.getDeviceInfo();
							}
						}
					});
				} catch (error) {
					console.log(`测脉失败: ${error.message}`);
				}
			},
			// 获取设备信息
			getDeviceInfo() {
				try {
					this.tyPulse.getDeviceInfo((result) => {
						if (result.success && result.data) {
							this.deviceInfo = result.data;
							this.deviceConnected = result.data.isConnected;
							//console.log('设备信息获取成功:' + JSON.stringify(result.data));
						}
					});
				} catch (error) {
					console.log(`获取设备信息失败: ${error.message}`);
				}
			},
			doSearch() {
				console.log(this.keyword, '---')
				// if(this.keyword!==''){
				this.selectUsernameOrPhoneOrTime()
				// }
			},
			// 选择
			handleLeft() {
				this.left = !this.left
				this.right = !this.left
			},
			// 选择
			handleRight() {
				this.right = !this.right
				this.left = !this.right
			},
			toConnect() {
				if (this.$isEmpty(this.selectUser)) {
					uni.showToast({
						title: '请先选择就诊人',
						icon: 'none'
					});
					return;
				}
				this.isConnect = true
				this.toMeasure()
			},
			addPulse() {
				if (this.$isEmpty(this.info)) {
					uni.showToast({
						title: '测量失败,请重试',
						icon: 'none'
					});
					return;
				}
				const data = {
					userId: this.selectUser.userId,
					sex: this.selectUser.sex,
					name: this.selectUser.nickName,
					pulseEquipmentResult: {
						reportData: JSON.parse(this.info.reportData),
						success: this.info.success,
						measureId: this.info.measureId,
						pulseUrl: JSON.parse(this.info.pr)
					}
				}
				console.log("qxj addPulse data",data);
				uni.showLoading({
					title: "处理中...",
					mask: true
				})
				addPulse(data).then(res => {
						console.log('zaizz', data, res)
						if (res.code == 200) {
							uni.hideLoading();
							// this.qUrl = res.codeImage
							this.isConnect = false
							this.isResult = true
						} else {
							uni.hideLoading();
							this.isConnect = false
							this.errMsg = res.msg;
							uni.showToast({
								icon: 'none',
								title: res.msg,
							});
						}
					},
					rej => {}
				);
			},
			close() {
				this.isConnect = false
			},
			closeLeft() {
				this.left = false
			},
			closeRight() {
				this.right = false
			},
			select(item) {
				this.aIndex = item.userId
				this.selectUser = item
				uni.setStorageSync("selectUser", item)
				this.showList = false
			},
			selectBtn(item) {
				if(item.id==null){
					uni.showToast({
						title: '请先完善用户基本信息',
						icon: 'none'
					});
					return;
				}
				this.selectUser = this.dataList.find(it => it.userId === item.fsUserId);
				uni.setStorageSync("selectUser", this.selectUser)
				this.show = false
				this.showList = false
				this.showDetail = false
			},
			createTimesChange(e) {
				this.selectedDate = e.detail.value; // 例如："2025-09-17"
				this.form.birthday = this.selectedDate.replace(/-/g, ""); // 去除 "-"
			},
			genderChange(type) {
				this.form.sex = type
			},
			onOpen() {
				this.show = true
				this.showList = false
			},
			onOpenList() {
				this.selectUsernameOrPhoneOrTime()
				this.showList = true
				this.showDetail = false
			},
			onOpenDetail(item) {
				this.showDetail = true
				this.showList = false
				this.detail={}
				this.selectQueryFsUser(item.userId)
			},
			editDetail(item){
				this.show = true
				this.showList = false
				this.selectQueryFsUser(item.userId,'edit')
			},
			// 关闭弹窗
			onClose() {
				this.show = false
			},
			onCloseList() {
				this.showList = false
				this.keyword=''
			},
			onCloseDetail() {
				this.showDetail = false
			},
			closeP() {
				this.isResult = false
				uni.navigateTo({
					url: "/pages/user/healthReport?userId="+this.selectUser.userId
				})
			
			},
			// 点击确认按钮
			onConfirm(data) {
				// var data=this.form
				//var data = this.form
				uni.showLoading({
					title: "处理中...",
					mask: true
				})
				addUser(data).then(res => {
						if (res.code == 200) {
							setTimeout(() => {
								uni.showToast({
									icon: 'success',
									title: "创建成功",
								});
							}, 200)
							uni.hideLoading();
							this.show = false
							this.showList = true
							this.form = {
								sex: 1
							}
							this.selectUsernameOrPhoneOrTime()
						} else {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
						}
					},
					rej => {}
				);
			},
			// 点击确认按钮
			onEdit(data) {
				// var data=this.form
				//var data = this.form
				uni.showLoading({
					title: "处理中...",
					mask: true
				})
				data.userId=this.initData.userId
				data.fsUserId=this.initData.userId
				editUser(data).then(res => {
						if (res.code == 200) {
							setTimeout(() => {
								uni.showToast({
									icon: 'success',
									title: "修改成功",
								});
							}, 200)
							uni.hideLoading();
							this.show = false
							this.showList = true
							this.form = {
								sex: 1
							}
							this.selectUsernameOrPhoneOrTime()
						} else {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
						}
					},
					rej => {}
				);
			},
			selectUsernameOrPhoneOrTime() {
				var data = {
					nickName: this.keyword,
					phone: this.keyword
				}
				uni.showLoading({
					title: "加载中..."
				})
				// var user=uni.getStorageSync('userInfo');
				selectUsernameOrPhoneOrTime(data).then(res => {
						if (res.code == 200) {
							uni.hideLoading();
							this.dataList = res.data
							this.total = res.data.total || 0
						} else {
							uni.hideLoading();
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
						}
					},
					rej => {}
				);
			},
			selectQueryFsUser(id,val) {
				selectQueryFsUser({
					userId: id
				}).then(res => {
						if (res.code == 200) {
							this.detail = res.data
							if(val=='edit'){
								this.initData=res.data
								this.initData.userId=id
							}
						} else {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
						}
					},
					rej => {}
				);
			},
			getDictByKey(key) {
				var data = {
					key: key
				}
				getDictByKey(data).then(
					res => {
						if (res.code == 200) {
							if (key == "sys_hospital_level") {
								this.hosLevelOptions = res.data;
							}
						}
					},
					err => {}
				);

			},
			navTo(url) {
				uni.redirectTo({
				  url: url + '?userId=' + this.userId
				})


			},
			// 手机号校验函数
			checkPhone(val) {
				const phone = val?.trim(); // 去除首尾空格

				// 1. 非空校验
				if (!phone) {
					uni.showToast({
						title: "手机号不能为空",
						icon: "none"
					});
					return "请输入正确的手机号";
				}

				// 2. 格式校验（中国大陆手机号规则：11位数字，以1开头）
				const phoneReg = /^1[3-9]\d{9}$/; // 正则表达式
				if (!phoneReg.test(phone)) {
					uni.showToast({
						title: "请输入正确的手机号",
						icon: "none"
					});
					return "请输入正确的手机号";
				}

				// 校验通过
				return '';
			}


		}
	}
</script>

<style lang="scss">
	page {
		height: 100%;
		background: #f6f6f6;
	}
</style>
<style scoped lang="scss">
	.border-box {
		width: 100vw;
		height: 100vh;
		background-image: url(/static/image/device/ipad_yjf_boder.png);
		background-repeat: no-repeat;
		position: relative;
		background-size: 100% 100%;
		box-sizing: border-box;
		padding: 12px;
	}

	.content {
		// height: 100%;
		width: 100%;
		height: 100%;
		background-image: url(/static/image/device/inner_page_bg.png);
		background-repeat: no-repeat;
		background-size: 100% 100%;
		position: relative;
		padding: 30px;

		.top-box {
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-bottom: 30px;

			.title {
				font-family: Source Han Serif CN, Source Han Serif CN;
				font-weight: bold;
				font-size: 30px;
				color: #8F6726;
				text-align: center;
			}

			.back-box {
				width: 102px;
				height: 47px;
				background: #FFFFFF;
				border-radius: 6px 6px 6px 6px;
				border: 1px solid #8F6726;
				// padding: 12px 8px;
				justify-content: center;

				view {
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 18px;
					color: #8F6726;
					text-align: center;
					margin-left: 10px;
				}

				// position: absolute;
				// left: 30px;
				image {
					width: 24px;
					height: 24px;
				}
			}

			.select {
				min-width: 160px;
				height: 47px;
				background: #FFFFFF;
				border-radius: 6px 6px 6px 6px;
				border: 1px solid #8F6726;
				padding: 12px;
				display: flex;
				align-items: center;
				justify-content: center;

				image {
					width: 24px;
					height: 24px;

					&:last-child {
						width: 12px;
						height: 12px;
					}
				}

				.date {
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: space-between;
				}

				.text {
					margin-left: 10px;
					margin-right: 10px;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 18px;
					color: #8F6726;
					text-align: center;
				}
			}
		}

		.list {
			width: 100%;
			height: calc(100% - 76px);
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.tab-box {
			width: 100%;
			height: 100%;
			// margin-top: 40px;
			display: flex;
			align-items: center;

			// justify-content: center;
			.tabs {
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: flex-start;

				.item {
					// padding:40px;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					width: 113px;
					height: 163px;
					background: #FBF4EE;
					border-radius: 18px 0px 0px 18px;
					border: 2px solid rgba(143, 103, 38, 0.3);

					&:last-child {
						margin-top: 30px;
					}

					image {
						width: 50px;
						height: 50px;
						margin-bottom: 12px;
					}

					.title {
						font-family: PingFang SC, PingFang SC;
						font-weight: 600;
						font-size: 24px;
						color: #8F6726;
						text-align: center;
					}


					&.active {
						background: linear-gradient(180deg, #E3B379 0%, #8F6726 100%);
						border: 2px solid #8F6726;

						.title {
							color: #fff;
						}
					}
				}
			}
		}

		.test-box {
			flex: 1;
			height: 100%;
			// width: 1460px;
			// height: 862px;
			border-radius: 15px;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			padding: 80px 20px;
			background: #FFFFFF;
			border: 2px solid #8F6726;

			.note {
				width: 100%;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 24px;
				color: #8F6726;
				text-align: center;
				margin-bottom: 20px;
			}

			.note2 {
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 21px;
				color: #A14212;
				text-align: center;
				margin-bottom: 40px;
			}

			.img-box {
				display: flex;
				align-items: center;
				justify-content: center;

				.bg-box {
					width: 396px;
					height: 370px;
					background: #FBF4EE;
					border-radius: 12px 12px 12px 12px;
					border: 1px solid #8F6726;
				}
			}

			.left {
				width: 320px;
				height: 400px;
				background: #FBF4EE;
				border-radius: 16px;
				border: 1px solid #8F6726;
				margin-right: 70px;

				.bg {
					width: 100%;
					height: 320px;
					border-radius: 16px 16px 0 0;
					background-image: url(/static/image/device/left_hand_img.png);
					background-repeat: no-repeat;
					background-size: 100% 100%;
					display: flex;
					align-items: center;
					justify-content: center;

					image {
						width: 68px;
						height: 68px;
					}
				}

				.btn {
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: center;
					text-align: center;

					image {
						width: 24px;
						height: 24px;
						margin-right: 10px;
					}

					text {
						line-height: 80px;
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 24px;
						color: #8F6726;
					}
				}
			}

			.right {
				width: 320px;
				height: 400px;
				background: #FBF4EE;
				border-radius: 16px;
				border: 1px solid #8F6726;

				.bg {
					width: 100%;
					height: 320px;
					border-radius: 16px 16px 0 0;
					background-image: url(/static/image/device/right_hand_img.png);
					background-repeat: no-repeat;
					background-size: 100% 100%;
					display: flex;
					align-items: center;
					justify-content: center;

					image {
						width: 68px;
						height: 68px;
					}
				}

				.btn {
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: center;
					text-align: center;

					image {
						width: 24px;
						height: 24px;
						margin-right: 10px;
					}

					text {
						line-height: 80px;
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 24px;
						color: #8F6726;
					}
				}
			}

			.btn-box {
				margin-top: 40px;
				width: 196px;
				height: 53px;
				line-height: 53px;
				border-radius: 12px 12px 12px 12px;
				display: flex;
				align-items: center;
				justify-content: center;
				background: #8F6726;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 21px;
				color: #FFFFFF;
				text-align: center;
			}
		}
	}

	.connect-box {}

	/* 遮罩层样式 */
	.mask {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: rgba(0, 0, 0, 0.5);
		display: flex;
		justify-content: center;
		align-items: center;
		z-index: 999;
		animation: fadeIn 0.3s ease;
	}

	/* 弹窗容器样式 */
	.popup-container2 {
		//width: 50%;
		min-height: 250px;
		background: #FBF4EE;
		border-radius: 12px;
		box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
		animation: scaleIn 0.3s ease;
		overflow: hidden;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: space-between;
		padding: 30px 50px;

		.title-t {
			font-size: 24px;
			font-weight: bold;
			color: #8F6726;
			text-align: center;
			margin-bottom: 10px;
		}

		.title-r {
			font-size: 20px;
			color: #8F6726;
			text-align: center;
			padding: 20px 0;
		}

		.btn-r {
			text-align: center;
			background: #8F6726;
			font-size: 20px;
			color: #FBF4EE;
			border-radius: 12px;
			width: 100%;
			height: 50px;
			line-height: 50px;
			margin-top: 10px;
		}
	}

	/* 弹窗容器样式 */
	.popup-container {
		width: 80%;
		//min-width: 840px;
		background: #FBF4EE;
		border-radius: 12px;
		box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
		animation: scaleIn 0.3s ease;
		overflow: hidden;
	}

	/* 弹窗头部样式 */
	.popup-header {
		padding: 20px;
		display: flex;
		justify-content: space-between;
		align-items: center;
		background: #E9DDCD;

		.goback {
			background: #FFFFFF;
			border-radius: 4px;
			border: 1px solid #8F6726;
			padding: 8px 16px;
			font-size: 16px;
			color: #8F6726;
			text-align: center;
		}
	}

	.popup-title {
		flex: 1;
		font-family: Source Han Serif CN, Source Han Serif CN;
		font-weight: bold;
		font-size: 24px;
		color: #8F6726;
		text-align: center;
	}

	.close-btn {
		display: flex;
		justify-content: center;
		align-items: center;
		transition: all 0.2s ease;

		image {
			width: 24px;
			height: 24px;
		}
	}

	/* 弹窗内容样式 */
	.popup-content {
		width: 90%;
		padding: 40px 30px;
		font-size: 20px;
		color: #666;
		line-height: 1.6;
		background: #FBF4EE;
		display: flex;
		flex-direction: column;
		align-items: center;
		margin: auto;

		.form-item {
			display: flex;
			align-items: center;
			margin-bottom: 20px;

			.label {
				width: 100px;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 20px;
				color: #8F6726;
				text-align: right;
			}

			.form-input {
				width: 400px;
				height: 47px;
				box-sizing: border-box;
				background: #FFFFFF;
				border-radius: 6px;
				border: 1px solid #8F6726;
				padding: 15px 26px;
			}

			.text-input {
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 18px;
				color: #9B9B9B;
				text-align: left;
			}

			.r-box {
				width: 400px;
				height: 47px;
			}

			.picker-box {

				// width: 540px;
				// height: 64px;
				// box-sizing: border-box;
				// background: #FFFFFF;
				// border-radius: 8px;
				// border: 2px solid #8F6726;
				// padding: 15px 26px;
				.date {
					image {
						width: 32px;
						height: 32px;
					}
				}

			}

			&:last-child {
				margin-bottom: 0;
			}

		}

		.form-item2 {
			display: flex;
			align-items: center;
			margin-bottom: 20px;

			.label {
				width: 120px;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 20px;
				color: #8F6726;
				text-align: right;
			}

			.form-input {
				width: 150px;
				height: 47px;
				box-sizing: border-box;
				background: #FFFFFF;
				border-radius: 6px;
				border: 1px solid #8F6726;
				padding: 15px 26px;
			}

			.text-input {
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 18px;
				color: #9B9B9B;
				text-align: left;
			}

			.r-box {
				width: 400px;
				height: 47px;
			}

			.picker-box {

				// width: 540px;
				// height: 64px;
				// box-sizing: border-box;
				// background: #FFFFFF;
				// border-radius: 8px;
				// border: 2px solid #8F6726;
				// padding: 15px 26px;
				.date {
					image {
						width: 32px;
						height: 32px;
					}
				}

			}

		}
	}

	.search-cont {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.form-input {
			flex: 1;
			height: 47px;
			margin-right: 15px;
			box-sizing: border-box;
			background: #FFFFFF;
			border-radius: 8px;
			border: 1px solid #8F6726;
			padding: 11px 20px;
		}

		.text-input {
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			font-size: 18px;
			color: #9B9B9B;
			text-align: left;
		}

		.search-btn {
			width: 108px;
			height: 47px;
			background: #8F6726;
			border-radius: 6px 6px 6px 6px;
			display: flex;
			align-items: center;
			justify-content: center;

			image {
				width: 18px;
				height: 18px;
				margin-right: 5px;
			}

			text {
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 18px;
				color: #FFFFFF;
				text-align: center;
			}
		}
	}

	.isNull {
		text-align: center;
		color: #8F6726;
	}

	.userList-box {
		margin-top: 30px;
		width: 100%;
		background: #FFFFFF;
		border-radius: 12px;
		overflow: hidden;
	}

	.userList {
		width: 100%;
		height: 330px;
		overflow-y: auto;

		&::-webkit-scrollbar {
			display: block !important;
			width: 10px !important;
			/* 滚动条宽度 */
		}

		&::-webkit-scrollbar-thumb {
			background: #8F6726 !important;
			/* 滚动条滑块颜色 */
			border-radius: 5px !important;
			/* 滑块圆角 */
		}

		.item {
			width: 100%;
			padding: 17px 22px;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.title {
				flex: 1;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 18px;
				color: #8F6726;
				text-align: left;
			}

			.right-box {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.rest {
					display: flex;
					align-items: center;
					justify-content: center;
					width: 59px;
					height: 33px;
					border-radius: 6px 6px 6px 6px;
					border: 1px solid #8F6726;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 16px;
					color: #8F6726;
					margin-right: 16px;
				}

				.select {
					display: flex;
					align-items: center;
					justify-content: center;
					width: 59px;
					height: 33px;
					border-radius: 6px 6px 6px 6px;
					border: 1px solid #8F6726;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 16px;
					color: #8F6726;

					&.active {
						background: #8F6726;
						color: #fff;
					}
				}
			}
		}
	}

	.userDetail {
		// margin-top: 30px;
		width: 100%;
		background: #FFFFFF;
		border-radius: 12px;
		padding: 0 30px;
		height: 50vh;
		overflow-y: auto;

		&::-webkit-scrollbar {
			display: block !important;
			width: 10px !important;
			/* 滚动条宽度 */
		}

		&::-webkit-scrollbar-thumb {
			background: #8F6726 !important;
			/* 滚动条滑块颜色 */
			border-radius: 5px !important;
			/* 滑块圆角 */
		}

		.item {
			width: 100%;
			padding: 15px 0px;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			font-size: 20px;
			color: #8F6726;
			border-bottom: 1px dashed #8F6726;

			text {
				flex: 1
			}

			&:last-child {
				border: 0;
			}
		}
	}

	/* 弹窗底部样式 */
	.popup-footer {
		display: flex;
		align-items: center;
		justify-content: center;
		margin-bottom: 30px;
		// background: #FBF4EE;
		// border-top: 1px solid #eee;
	}

	.btn2 {
		// flex: 1;
		padding: 26px 0;
		text-align: center;
		font-size: 20px;
		transition: all 0.2s ease;
	}

	.confirm-btn {
		width: 185px;
		height: 53px;
		background: #8F6726;
		border-radius: 12px 12px 12px 12px;
		display: flex;
		align-items: center;
		justify-content: center;

		text {
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			font-size: 20px;
			color: #FFFFFF;
			text-align: center;
		}

		image {
			width: 24px;
			height: 24px;
			margin-right: 10px;
		}
	}

	.confirm-btn2 {
		width: 113px;
		height: 53px;
		background: #8F6726;
		border-radius: 12px;
		display: flex;
		align-items: center;
		justify-content: center;

		text {
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			font-size: 20px;
			color: #FFFFFF;
			text-align: center;
		}
	}

	/* 动画效果 */
	@keyframes fadeIn {
		from {
			opacity: 0;
		}

		to {
			opacity: 1;
		}
	}

	@keyframes scaleIn {
		from {
			transform: scale(0.9);
			opacity: 0;
		}

		to {
			transform: scale(1);
			opacity: 1;
		}
	}
</style>