<template>
	<view class="ConsumptionQuota container">
		<!-- 自定义消费限额开关 -->
		<view class="customSwitch" v-if="schoolConsumeLimit.parentConsumeLimit == 1">
			<view class="itemInfo">
				<view class="">
					<text class="name">自定义消费限额</text>
				</view>
				<view class="value">
					<switch color="#04B871" :checked="parentConsumeLimit.switch" @change="switchChange"
						v-model="parentConsumeLimit.switch" />
				</view>
			</view>
		</view>
		<!-- 消费限额设置 -->
		<view class="ConsumptionSetting">
			<!-- 默认消费限额 -->
			<view class="SchoolSetting">
				<view class="lable">
					<text>{{parentConsumeLimit.switch && schoolConsumeLimit.parentConsumeLimit == 1 ? '自定义' : '默认'}}消费限额</text>
				</view>
				<view class="itembox">
					<view class="itemInfo">
						<view class="">
							<text class="name">单笔限额</text>
						</view>
						<view class="value"
							v-if="parentConsumeLimit.switch && schoolConsumeLimit.parentConsumeLimit == 1">
							<input type="digit" @blur="handleInput_0" v-model="parentConsumeLimit.singleLimit"
								placeholder="请输入金额" placeholder-class="placeholders" />
							<view>元</view>
						</view>
						<view class="value" v-else>
							<text>{{schoolConsumeLimit.singleLimit}}元</text>
						</view>
					</view>
					<view style="height: 1rpx;background:  #EEEEEE;">
					</view>
					<view class="itemInfo">
						<view class="">
							<text class="name">单日限额</text>
						</view>
						<view class="value"
							v-if="parentConsumeLimit.switch && schoolConsumeLimit.parentConsumeLimit == 1">
							<input type="digit" @blur="handleInput_1" v-model="parentConsumeLimit.dailyLimit"
								placeholder="请输入金额" placeholder-class="placeholders" />
							<view>元</view>
						</view>
						<view class="value" v-else>
							<text>{{schoolConsumeLimit.dailyLimit}}元</text>
						</view>
					</view>
					<view style="height: 1rpx;background:  #EEEEEE;">
					</view>
				</view>
			</view>
			<view class="senceTip" v-if="parentConsumeLimit.switch && schoolConsumeLimit.parentConsumeLimit == 1">
				<image class="sumTip" :src="ImgUrl2+'sumTip.png'" mode="aspectFit"></image>所有场景实际消费之和不高于单日限额
			</view>
			<!-- 默认场景限额 -->
			<view class="ParentSetting">
				<view class="lable">
					<text>{{parentConsumeLimit.switch && schoolConsumeLimit.parentConsumeLimit == 1 ? '自定义' : '默认'}}场景限额</text>
					<text class="grey"
						v-if="parentConsumeLimit.switch && schoolConsumeLimit.parentConsumeLimit == 1 ">每个场景限额不高于{{parentConsumeLimit.dailyLimit}}元</text>
				</view>
				<view class="Settings">
					<view class="itembox">
						<view class="itemInfo">
							<text class="cantTip"
								v-if="parentConsumeLimit.switch && canteenTip && schoolConsumeLimit.parentConsumeLimit == 1">限额0元，将无法在食堂消费</text>
							<view style="position: relative;">
								<text class="name">食堂</text>
							</view>
							<view class="value" style="display: flex;align-items: center;"
								v-if="parentConsumeLimit.switch && schoolConsumeLimit.parentConsumeLimit == 1">
								<input type="digit" @blur="handleInput"
									v-model="parentConsumeLimit.canteenConsumptionLimit" placeholder="请输入0 ~150之间整数"
									placeholder-class="placeholders" />
								<view>元</view>
							</view>
							<view class="value" style="display: flex;align-items: center;" v-else>
								<view>{{schoolConsumeLimit.canteenConsumptionLimit}}元</view>
							</view>
						</view>
						<view style="height: 1rpx;background:  #EEEEEE;">
						</view>
						<view class="itemInfo">
							<text class="cantTip"
								v-if="parentConsumeLimit.switch && superTip && schoolConsumeLimit.parentConsumeLimit == 1">限额0元，将无法在超市消费</text>
							<view class="">
								<text class="name">超市</text>
							</view>
							<view class="value" style="display: flex;align-items: center;"
								v-if="parentConsumeLimit.switch && schoolConsumeLimit.parentConsumeLimit == 1">
								<input type="digit" @blur="handleInput2"
									v-model="parentConsumeLimit.supermarketConsumptionLimit" placeholder="请输入0 ~150之间整数"
									placeholder-class="placeholders" />
								<view>元</view>
							</view>
							<view class="value" style="display: flex;align-items: center;" v-else>
								<view>{{schoolConsumeLimit.supermarketConsumptionLimit}}元</view>
							</view>
						</view>
						<view style="height: 1rpx;background:  #EEEEEE;">
						</view>
						<view class="itemInfo">
							<text class="cantTip"
								v-if="parentConsumeLimit.switch && otherTip && schoolConsumeLimit.parentConsumeLimit == 1">限额0元，将无法在其他场景消费</text>
							<view class="">
								<text class="name">其他</text>
							</view>
							<view class="value" style="display: flex;align-items: center;"
								v-if="parentConsumeLimit.switch && schoolConsumeLimit.parentConsumeLimit == 1">
								<input type="digit" @blur="handleInput3"
									v-model="parentConsumeLimit.otherConsumptionLimit" placeholder="请输入0 ~150之间整数"
									placeholder-class="placeholders" />
								<view>元</view>
							</view>
							<view class="value" style="display: flex;align-items: center;" v-else>
								<view>{{schoolConsumeLimit.otherConsumptionLimit}}元</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 提示文字 -->
		<view class="tisptxt">
			<view class="" v-if="schoolConsumeLimit.parentConsumeLimit && schoolConsumeLimit.parentConsumeLimit == 1">
				<text>· 用户消费限制优先级高于学校消费限制</text>
			</view>
			<view class="">
				<text>· 消费限额仅在学校消费机联网状态下生效</text>
			</view>
		</view>
		<!-- 消费会员限制弹框 -->
		<van-dialog v-model="contractMenber" :show-confirm-button="false">
			<view class="modalDlgBox">
				<view class="modalDlgHeader">
					<text>您还未开通消费会员</text>
				</view>
				<view class="contentt">
					<image class="quanyi" :src="ImgUrl2+'quanyi.png'" mode="aspectFit"></image>
				</view>
				<view class="btngroup">
					<button @tap="BtnEvent(1)" style="border: none;">残忍拒绝</button>
					<button @tap="BtnEvent(2)" style="border: none;">立即开通</button>
				</view>
			</view>
		</van-dialog>
		<!-- 设置保存按钮 -->
		<view class="savebtn" @tap="ConsumptionQuota" v-if="schoolConsumeLimit.parentConsumeLimit == 1">
			<text>保存</text>
		</view>
	</view>
</template>

<script>
	import {
		Dialog
	} from 'vant';
	import config from '../common/config.js'
	import {
		requestGet,
		requestPost
	} from '../common/request.js'
	export default {
		components: {},
		name: "ConsumptionQuota",
		data() {
			return {
				phone: '***********',
				ImgUrl2: this.$ImgUrl + 'xzfalipay/',
				ImgUrl: this.$ImgUrl + '/static/weapp/',
				usertype: ['', '学生', '老师'],
				// 消费限额选择胡用户
				ConsumptionQuotaUser: {
					userName: '李书记',
					usertype: 1
				},
				// 自定义限额设置
				parentConsumeLimit: {
					"dailyCntLimit": 0, //单日累计次数限制
					"dailyLimit": 0, //单日累计消费上限 单位分
					"singleLimit": 0, //单笔消费上限  单位分
					"switch": true, //限额开关 1开启 0关闭
					"supermarketConsumptionLimit": "", // 超市
					"canteenConsumptionLimit": "", // 食堂
					"otherConsumptionLimit": "", // 其他
				},
				// 默认限额设置
				schoolConsumeLimit: {
					// 20230706
					'parentConsumeLimit': 1,
					"dailyLimit": 0, //单日累计消费上限 单位分
					"singleLimit": 0, //单笔消费上限 单位分
					"dailyCntLimit": 0, //单日累计次数限制
					"supermarketConsumptionLimit": "", // 超市
					"canteenConsumptionLimit": "", // 食堂
					"otherConsumptionLimit": "", // 其他
				},
				canteenTip: false,
				otherTip: false,
				superTip: false,
				// 消费会员弹框
				contractMenber: false,
			};
		},
		onLoad: function() {
			this.getConsumeLimitData()
		},
		methods: {
			// 弹框点击事情
			async BtnEvent(type) {
				if (type == 1) {
					setTimeout(() => {
						uni.navigateBack()
					}, 300)
				}
				if (type == 2) {
					jWeixin.miniProgram.navigateTo({
						url: '/pages/nationalCenterForLesbianRights/index'
					})
				}
				this.contractMenber = false
			},
			// 查询消费会员权益项
			async QueryProductContractItem(serviceItemCode = '1008') {
				const data = await requestPost('/cgi-xpay/app/h5/QueryProductContractItem', {
					accountId: sessionStorage.getItem('accountId') * 1,
					serviceItemCode
				})
				if (data['code'] != 200) {
					await Dialog({
						title: '温馨提示',
						message: data['message'],
						confirmButtonText: "知道了"
					})
					return
				}
				if (data.data['result'] == "fail") {
					this.contractMenber = true
					throw ('您还未开通消费会员，')
				}
			},
			handleInput_0(e) {
				let price = e.detail.value;
				let that = this;
				price = price.replace(/[^\d.]/g, "");
				price = price.replace(/\.{2,}/g, ".");
				price = price.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
				price = price.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');
				if (price.indexOf(".") < 0 && price != "") {
					price = parseFloat(price);
				}
				that.parentConsumeLimit.singleLimit = price
				console.warn("handleInput", price)
				return {
					value: price,
				}
			},
			handleInput_1(e) {
				let price = e.detail.value;
				let that = this;
				price = price.replace(/[^\d.]/g, "");
				price = price.replace(/\.{2,}/g, ".");
				price = price.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
				price = price.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');
				if (price.indexOf(".") < 0 && price != "") {
					price = parseFloat(price);
				}
				that.parentConsumeLimit.dailyLimit = price
				console.warn("handleInput", price)
				return {
					value: price,
				}
			},
			handleInput(e) {
				let price = e.detail.value;
				let that = this;
				if (price == 0 && price != "") {
					that.canteenTip = true;
				} else {
					that.canteenTip = false;
				}
				price = price.replace(/[^\d.]/g, "");
				price = price.replace(/\.{2,}/g, ".");
				price = price.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
				price = price.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');
				if (price.indexOf(".") < 0 && price != "") {
					price = parseFloat(price);
				}
				price = price > 150 ? 150 : price;
				that.parentConsumeLimit.canteenConsumptionLimit = price
				console.warn("handleInput", price)
				return {
					value: price,
				}
			},
			handleInput2(e) {
				let price = e.detail.value;
				let that = this;
				if (price == 0 && price != "") {
					that.superTip = true;
				} else {
					that.superTip = false;
				}
				price = price.replace(/[^\d.]/g, "");
				price = price.replace(/\.{2,}/g, ".");
				price = price.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
				price = price.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');
				if (price.indexOf(".") < 0 && price != "") {
					price = parseFloat(price);
				}
				price = price > 150 ? 150 : price;
				console.warn("handleInput2", price)
				that.parentConsumeLimit.supermarketConsumptionLimit = price
				return {
					value: price,
				}
			},
			handleInput3(e) {
				let price = e.detail.value;
				let that = this;
				// price = price.replace(/[^\d.]/g, "");
				// price = price.replace(/\.{2,}/g, ".");
				// price = price.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
				// price = price.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');
				// if (price.indexOf(".") < 0 && price != "") {
				// 	price = parseFloat(price);
				// }
				price == 0 && price != "" ? (price = 0, that.otherTip = true) : ("", that.otherTip = false);
				price = price > 150 ? 150 : price;
				price = price != 0 ? price.replace(/[^\d]/g, '') : "0"
				that.parentConsumeLimit.otherConsumptionLimit = price
				return {
					value: price,
				}
			},
			async switchChange(e) {
				console.warn("开启限额", e.detail.value)
				await this.QueryProductContractItem()
				this.parentConsumeLimit.switch = e.detail.value
				if (this.parentConsumeLimit.singleLimit == 0) {
					this.parentConsumeLimit.singleLimit = '50.00';
				}
				if (this.parentConsumeLimit.dailyLimit == 0) {
					this.parentConsumeLimit.dailyLimit = '200.00';
				}
				if (this.parentConsumeLimit.dailyCntLimit == 0) {
					this.parentConsumeLimit.dailyCntLimit = 30;
				}
			},
			// 消费限额页数据
			async getConsumeLimitData() {
				try {
					uni.showLoading({
						title: "请稍后",
						// #ifndef MP-ALIPAY
						mask: true,
						// #endif
					})
					await new Promise((res, rej) => {
						setTimeout(() => {
							res()
						}, 10);
					})
					const respes = await requestPost('/cgi-xpay/app/h5/ConsumeLimitData', {
						accountId: sessionStorage.getItem('accountId') * 1
					})
					uni.hideLoading()
					if (respes['code'] != 200) {
						await Dialog({
							title: '温馨提示',
							message: respes['message'],
							confirmButtonText: "知道了"
						})
						return
					}
					// 家长限额设置
					this.parentConsumeLimit = respes.data.parentConsumeLimit || {
						"dailyCntLimit": 0,
						"dailyLimit": 0,
						"singleLimit": 0,
						"switch": false,
						"supermarketConsumptionLimit": "", // 超市
						"canteenConsumptionLimit": "", // 食堂
						"otherConsumptionLimit": "", // 其他
					};

					this.parentConsumeLimit.dailyLimit = (this.parentConsumeLimit.dailyLimit / 100).toFixed(2);
					this.parentConsumeLimit.singleLimit = (this.parentConsumeLimit.singleLimit / 100).toFixed(2);
					this.parentConsumeLimit.switch = this.parentConsumeLimit.switch == 1 ? true : false;
					this.parentConsumeLimit.supermarketConsumptionLimit = this.parentConsumeLimit
						.supermarketConsumptionLimit > 0 ? (this.parentConsumeLimit.supermarketConsumptionLimit / 100)
						.toFixed(2) : "--";
					this.parentConsumeLimit.canteenConsumptionLimit = this.parentConsumeLimit.canteenConsumptionLimit >
						0 ? (this.parentConsumeLimit.canteenConsumptionLimit / 100).toFixed(2) : "--";
					this.parentConsumeLimit.otherConsumptionLimit = this.parentConsumeLimit.otherConsumptionLimit > 0 ?
						(this.parentConsumeLimit.otherConsumptionLimit / 100).toFixed(2) : "--";
					// 默认限额设置
					this.schoolConsumeLimit = respes.data.schoolConsumeLimit || {
						"dailyLimit": 0,
						"singleLimit": 0,
						"dailyCntLimit": 0,
						"supermarketConsumptionLimit": "", // 超市
						"canteenConsumptionLimit": "", // 食堂
						"otherConsumptionLimit": "", // 其他
						"parentConsumeLimit": "" // 自定义消费限额
					}
					this.schoolConsumeLimit.dailyLimit = (this.schoolConsumeLimit.dailyLimit / 100).toFixed(2);
					this.schoolConsumeLimit.singleLimit = (this.schoolConsumeLimit.singleLimit / 100).toFixed(2);
					this.schoolConsumeLimit.supermarketConsumptionLimit = this.schoolConsumeLimit
						.supermarketConsumptionLimit >
						0 ? (this.schoolConsumeLimit.supermarketConsumptionLimit / 100).toFixed(2) : "--";
					this.schoolConsumeLimit.canteenConsumptionLimit = this.schoolConsumeLimit
						.canteenConsumptionLimit >
						0 ? (this.schoolConsumeLimit.canteenConsumptionLimit / 100).toFixed(2) : "--";
					this.schoolConsumeLimit.otherConsumptionLimit = this.schoolConsumeLimit
						.otherConsumptionLimit >
						0 ? (this.schoolConsumeLimit.otherConsumptionLimit / 100).toFixed(2) : "--";
				} catch (error) {
					uni.showToast({
						icon: "error",
						title: error.message
					})
				}
			},
			// 设置保存按钮
			async ConsumptionQuota() {
				try {
					if (this.parentConsumeLimit.singleLimit === 0) {
						uni.showToast({
							icon: "none",
							// #ifndef MP-ALIPAY
							mask: true,
							// #endif
							title: "单笔消费上限不能为0"
						})
						return
					}
					if (this.parentConsumeLimit.singleLimit === "") {
						uni.showToast({
							icon: "none",
							// #ifndef MP-ALIPAY
							mask: true,
							// #endif
							title: "单笔消费上限不能为空"
						})
						return
					}
					if (this.parentConsumeLimit.singleLimit > 100) {
						uni.showToast({
							icon: "none",
							// #ifndef MP-ALIPAY
							mask: true,
							// #endif
							title: "单笔上限不能高于100元"
						})
						return
					}
					if (this.parentConsumeLimit.dailyCntLimit === 0) {
						uni.showToast({
							icon: "none",
							// #ifndef MP-ALIPAY
							mask: true,
							// #endif
							title: "单日累计次数限制不能为0"
						})
						return
					}
					if (this.parentConsumeLimit.dailyCntLimit === "") {
						uni.showToast({
							icon: "none",
							// #ifndef MP-ALIPAY
							mask: true,
							// #endif
							title: "单日累计次数限制不能为空"
						})
						return
					}
					if (this.parentConsumeLimit.dailyLimit === 0) {
						uni.showToast({
							icon: "none",
							// #ifndef MP-ALIPAY
							mask: true,
							// #endif
							title: "单日累计消费上限不能为0"
						})
						return
					}
					if (this.parentConsumeLimit.dailyLimit === "") {
						uni.showToast({
							icon: "none",
							// #ifndef MP-ALIPAY
							mask: true,
							// #endif
							title: "单日累计消费上限不能为空"
						})
						return
					}
					if (this.parentConsumeLimit.dailyLimit > 500) {
						uni.showToast({
							icon: "none",
							// #ifndef MP-ALIPAY
							mask: true,
							// #endif
							title: "单日上限不能高于500元"
						})
						return
					}
					let sumTip = Number(this.parentConsumeLimit.canteenConsumptionLimit) + Number(this
						.parentConsumeLimit.otherConsumptionLimit) + Number(this.parentConsumeLimit
						.supermarketConsumptionLimit)
					if (this.parentConsumeLimit.dailyLimit < sumTip) {
						uni.showToast({
							icon: "none",
							// #ifndef MP-ALIPAY
							mask: true,
							// #endif
							title: "所有场景限额之和不高于单日限额"
						})
						return
					}
					uni.showLoading({
						title: "请稍后",
						// #ifndef MP-ALIPAY
						mask: true,
						// #endif
					})
					await new Promise((res, rej) => {
						setTimeout(() => {
							res()
						}, 10);
					})
					let switchs = this.parentConsumeLimit.switch ? 1 : 0;
					let dailyLimit = parseInt(this.parentConsumeLimit.dailyLimit * 100);
					let singleLimit = parseInt(this.parentConsumeLimit.singleLimit * 100);
					let canteenConsumptionLimit = this.parentConsumeLimit.canteenConsumptionLimit > 0 ? (parseInt(this
						.parentConsumeLimit.canteenConsumptionLimit * 100) + "") : "";
					let otherConsumptionLimit = this.parentConsumeLimit.otherConsumptionLimit > 0 ? (parseInt(this
						.parentConsumeLimit.otherConsumptionLimit * 100) + "") : "";
					let supermarketConsumptionLimit = this.parentConsumeLimit.supermarketConsumptionLimit > 0 ? (
						parseInt(this.parentConsumeLimit.supermarketConsumptionLimit *
							100) + "") : "";
					let dailyCntLimit = parseInt(this.parentConsumeLimit.dailyCntLimit);
					if (switchs == 1) {
						if (dailyLimit == 0 || singleLimit == 0) {
							uni.showToast({
								icon: "none",
								// #ifndef MP-ALIPAY
								mask: true,
								// #endif
								title: "消费上限设置不能为0"
							})
							uni.hideLoading()
							return
						}
						if (dailyLimit < singleLimit) {
							uni.showToast({
								icon: "none",
								// #ifndef MP-ALIPAY
								mask: true,
								// #endif
								title: "单日累计需要大于单笔限额"
							})
							uni.hideLoading()
							return
						}
					}
					let params = {
						switch: switchs,
						dailyLimit: dailyLimit,
						singleLimit: singleLimit,
						dailyCntLimit: dailyCntLimit,
						canteenConsumptionLimit: canteenConsumptionLimit,
						otherConsumptionLimit: otherConsumptionLimit,
						supermarketConsumptionLimit: supermarketConsumptionLimit,
					};
					// 设置消费限额
					const respes = await requestPost('/cgi-xpay/app/h5/SetParentConsumeLimit', Object.assign({
						accountId: sessionStorage.getItem('accountId') * 1, // 消费用户账户id
					}, params))
					if (respes.code != 200) {
						uni.showToast({
							icon: "none",
							// #ifndef MP-ALIPAY
							mask: true,
							// #endif
							title: respes.message
						})
						return
					}
					uni.hideLoading()
					uni.showToast({
						icon: "success",
						title: "保存成功！"
					})
					setTimeout(() => {
						uni.navigateBack()
					}, 1000)
				} catch (error) {
					uni.showToast({
						icon: "error",
						title: error.message
					})
				}
			},
		}
	}
</script>

<style lang="scss">
	page {
		width: 100%;
		background: #F3F3F3;
	}

	.modalDlgBox {
		width: 100%;
		height: 467rpx;
		top: 480rpx;
		background-color: #FFFFFF;
		border-radius: 26rpx;
		margin: 0 auto;
		
		
		background-image: url(https://xiaopay2020.oss-cn-shenzhen.aliyuncs.com/static/weapp/xzfalipay/dlgb.png);
		background-size: 100% 100%;
		background-repeat: no-repeat;

		.modalDlgHeader {
			width: 100%;
			height: 124rpx;
			border-radius: 20rpx 20rpx 0rpx 0rpx;
			line-height: 124rpx;

			font-size: 36rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 600;
			color: #512C19;
			text-align: center;
		}

		
		.contentt {
			width: 504rpx;
			height: 189rpx;
			margin: 0 auto;
			text-align: center;
			// margin-top: 33rpx;
			// line-height: 45rpx;
			.quanyi{
				position: relative;
				height: 100%;
				width: 100%;
			}
		
			.line1 {
				font-size: 34rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 600;
				color: rgba(0, 0, 0, 0.85);
			}
		
			.line2 {
				margin-top: 14rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: rgba(0, 0, 0, 0.85);
			}
		}

		.btngroup {
			display: flex;
			position: absolute;
			left: 0;
			right: 0;
			bottom: 40rpx;
			justify-content: space-around;

			button {
				width: 234rpx;
				height: 78rpx;
				border-radius: 12rpx;
				line-height: 78rpx;
				text-align: center;

				font-size: 30rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
			}

			button::after {
				border:none;
			}

			button:nth-child(1) {
				background: #EBEBEB;
				border-radius: 12rpx;
			}

			button:nth-child(2) {
				background: linear-gradient(90deg, #FFE25E 0%, #FFC222 100%);
				opacity: 0.9;
			}
		}
	}

	.ConsumptionQuota {
		padding-top: 23rpx;
		padding-bottom: 200rpx;

		.customSwitch {
			display: flex;
			padding: 0 24rpx;
			height: 101rpx;
			margin: 24rpx 0;

			.itemInfo {
				width: 100%;
				padding: 0 32rpx 0 24rpx;
				background-color: white;
				border: 1rpx solid white;
				display: flex;
				justify-content: space-between;
				border-radius: 16rpx;

				view {
					align-self: center;
				}
			}
		}

		.senceTip {
			margin-top: 24rpx;
			font-size: 28rpx;
			color: #FA6400;
			height: 40rpx;
			line-height: 40rpx;
			padding: 0 48rpx;
			display: flex;

			.sumTip {
				width: 28rpx;
				height: 28rpx;
				align-self: center;
				margin-right: 6rpx;
			}
		}

		.ConsumptionSetting {
			margin-top: 16rpx;

			.SchoolSetting,
			.ParentSetting {
				width: 702rpx;
				max-height: 503rpx;
				background: #FFFFFF;
				border-radius: 16rpx;
				margin: 0 auto;

				.lable {
					height: 101rpx;
					padding-left: 24rpx;
					font-size: 32rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #333333;
					line-height: 101rpx;
					display: flex;
					justify-content: space-between;

					.grey {
						color: rgba(0, 0, 0, 0.5);
						font-size: 28rpx;
						padding-right: 32rpx;
					}
				}

				.name {
					height: 28rpx;
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #333333;
					line-height: 28rpx;
				}
			}

			.SchoolSetting {
				.itembox {
					width: 654rpx;
					margin: 0 auto;

					.itemInfo {
						display: flex;
						height: 100rpx;
						line-height: 100rpx;
						align-items: center;
						justify-content: space-between;
					}
				}

				.value {
					height: 38rpx;
					font-size: 32rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #333333;
					line-height: 38rpx;
					display: flex;

					input {
						text-align: right;
						align-self: center;
					}
				}
			}

			.placeholders {
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #CCCCCC;
			}

			.ParentSetting {
				margin-top: 24rpx;

				.value {
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #333333;

					input {
						height: 100%;
						text-align: right;
						padding-right: 16rpx;
						width: 320rpx;
					}


				}

				.cantTip {
					position: absolute;
					top: 0;
					left: 104rpx;
					line-height: 100rpx;
					color: #E02020;
					font-size: 24rpx;
					z-index: 1;
				}

				.itembox {
					width: 654rpx;
					margin: 0 auto;

					.itemInfo {
						display: flex;
						height: 100rpx;
						line-height: 100rpx;
						align-items: center;
						justify-content: space-between;
						position: relative;
					}
				}
			}
		}

		.tisptxt {
			height: 33rpx;
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #ABABAB;
			line-height: 33rpx;
			margin-left: 48rpx;
			margin-top: 24rpx;
		}

		.savebtn {
			width: 686rpx;
			height: 90rpx;
			border-radius: 45rpx;
			background: #04B871;
			margin: 0 auto;
			line-height: 90rpx;
			text-align: center;

			font-size: 36rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #FFFFFF;

			position: fixed;
			bottom: 52rpx;
			left: 0;
			right: 0;
		}
	}

	.userInfo {
		width: 702rpx;
		height: 247rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		margin: 0 auto;

		.lablet {
			height: 101rpx;
			// background: #FFFFFF;
			border-bottom: 1rpx solid #F6F6F6;
			line-height: 101rpx;
			padding-left: 24rpx;
		}

		.ItemInfoT {
			display: flex;
			height: 146rpx;
			padding-left: 24rpx;
			padding-top: 34rpx;

			.box2 {
				margin-left: 14rpx;
			}

			.username {
				height: 36rpx;
				font-size: 36rpx;
				font-weight: 500;
				color: #333333;
				line-height: 36rpx;
			}

			.usertype {
				height: 28rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: #666666;
				line-height: 28rpx;
				margin-left: 16rpx;
			}

			.schoolname {
				margin-top: 12rpx;

				height: 28rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: #ABABAB;
				line-height: 28rpx;
			}

		}

		.student {
			width: 72rpx;
			height: 72rpx;
			position: relative;

		}
	}
</style>