<template>
	<view class="page">
		<view class="content-wrapper">
			<!-- 查询条件 -->
			<view class="warpboxss">
				<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
					<view><text class="warpboxs-small-title-line"></text>查询条件</view>
				</view>
				<view class="query-section">
					<view class="form-item">
						<text class="label">月份</text>
						<picker style="flex: 1;" mode="date" fields="month" :value="queryMonth" @change="onMonthChange">
							<view class="picker-view">
								<text>{{ queryMonthText || '请选择月份' }}</text>
								<u-icon name="arrow-down" size="14" color="#666"></u-icon>
							</view>
						</picker>
					</view>
					<view class="query-btn" @click="handleQuery">
						<u-icon name="search" size="18" color="#fff"></u-icon>
						<text>查询</text>
					</view>
				</view>
			</view>

			<!-- 工资详情 -->
			<view class="salary-detail" v-if="salaryData">
				<!-- 基本信息 -->
				<view class="warpboxss">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>基本信息</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">员工姓名：</text>
							<text class="info-value">{{ salaryData.EmployeeName || '无' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店名称：</text>
							<text class="info-value">{{ salaryData.StoreName || '无' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">岗位：</text>
							<text class="info-value">{{ salaryData.Position || '无' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">确认状态：</text>
							<text class="info-value"
								:class="{'confirmed-status': salaryData.EmployeeConfirmStatus === 1, 'unconfirmed-status': salaryData.EmployeeConfirmStatus !== 1}">
								{{ salaryData.EmployeeConfirmStatus === 1 ? '已确认' : '未确认' }}
							</text>
						</view>
						<view class="info-row highlight-row">
							<text class="info-label">实发工资：</text>
							<text class="info-value highlight">￥{{ formatMoney(salaryData.ActualSalary) }}</text>
						</view>
					</view>
				</view>

				<!-- 业绩信息 - 健康师 -->
				<view class="warpboxss" v-if="currentSalaryType === 'healthCoach'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>业绩信息</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">金三角战队：</text>
							<text class="info-value">{{ salaryData.GoldTriangleTeam || '无' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">总业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">基础业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.BasePerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">合作业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CooperationPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">实际基础业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.ActualBasePerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">实际合作业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.ActualCooperationPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">新客业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.NewCustomerPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">升单业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.UpgradePerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店总业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreTotalPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">队伍业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TeamPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">占比：</text>
							<text class="info-value">{{ formatPercent(salaryData.Percentage) }}</text>
						</view>
					</view>
				</view>

				<!-- 消耗数据 - 健康师 -->
				<view class="warpboxss" v-if="currentSalaryType === 'healthCoach'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>消耗数据</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">消耗：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.Consumption) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">项目数：</text>
							<text class="info-value">{{ formatNumber(salaryData.ProjectCount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">到店人头：</text>
							<text class="info-value">{{ formatNumber(salaryData.CustomerCount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">在店天数：</text>
							<text class="info-value">{{ formatNumber(salaryData.WorkingDays) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">请假天数：</text>
							<text class="info-value">{{ formatNumber(salaryData.LeaveDays) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">日均消耗：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.DailyAverageConsumption) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">日均项目数：</text>
							<text class="info-value">{{ formatNumber(salaryData.DailyAverageProjectCount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">战队总消耗：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TeamTotalConsumption) }}</text>
						</view>
					</view>
				</view>

				<!-- 业绩信息 - 店助 -->
				<view class="warpboxss" v-if="currentSalaryType === 'assistant'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>门店业绩信息</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">门店总业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreTotalPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店开单业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreBillingPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店退卡业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreRefundPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店生命线：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreLifeline) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">业绩完成率：</text>
							<text class="info-value">{{ formatPercent(salaryData.PerformanceCompletionRate) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">提成比例：</text>
							<text class="info-value">{{ formatPercent(salaryData.CommissionRate) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">提成金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CommissionAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">进店消耗人数：</text>
							<text class="info-value">{{ formatNumber(salaryData.HeadCount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">第一阶段目标：</text>
							<text class="info-value">{{ formatNumber(salaryData.Stage1TargetHeadCount) }}人</text>
						</view>
						<view class="info-row">
							<text class="info-label">第二阶段目标：</text>
							<text class="info-value">{{ formatNumber(salaryData.Stage2TargetHeadCount) }}人</text>
						</view>
						<view class="info-row">
							<text class="info-label">达到第一阶段：</text>
							<text class="info-value">{{ salaryData.ReachedStage1 || '否' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">达到第二阶段：</text>
							<text class="info-value">{{ salaryData.ReachedStage2 || '否' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">阶段奖励金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StageRewardAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">第一阶段奖励：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.Stage1Reward) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">第二阶段奖励：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.Stage2Reward) }}</text>
						</view>
					</view>
				</view>

				<!-- 业绩信息 - 主任 -->
				<view class="warpboxss" v-if="currentSalaryType === 'director'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>门店业绩信息</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">门店总业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreTotalPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店开单业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreBillingPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店退卡业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreRefundPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店生命线：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreLifeline) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">业绩完成率：</text>
							<text class="info-value">{{ formatPercent(salaryData.PerformanceCompletionRate) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">业绩是否达标：</text>
							<text class="info-value">{{ salaryData.PerformanceReached || '否' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">人头是否达标：</text>
							<text class="info-value">{{ salaryData.HeadCountReached || '否' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">消耗是否达标：</text>
							<text class="info-value">{{ salaryData.ConsumeReached || '否' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">考核扣款金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.AssessmentDeduction) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">未达标指标数量：</text>
							<text class="info-value">{{ formatNumber(salaryData.UnreachedIndicatorCount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">进店消耗人数：</text>
							<text class="info-value">{{ formatNumber(salaryData.HeadCount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">目标人头数：</text>
							<text class="info-value">{{ formatNumber(salaryData.TargetHeadCount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店消耗金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreConsume) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">目标消耗金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TargetConsume) }}</text>
						</view>
					</view>
				</view>

				<!-- 业绩信息 - 店长 -->
				<view class="warpboxss" v-if="currentSalaryType === 'storeManager'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>门店业绩信息</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">门店总业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreTotalPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店开单业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreBillingPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店退卡业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreRefundPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店生命线：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreLifeline) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">业绩完成率：</text>
							<text class="info-value">{{ formatPercent(salaryData.PerformanceCompletionRate) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">业绩是否达标：</text>
							<text class="info-value">{{ salaryData.PerformanceReached || '否' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">人头是否达标：</text>
							<text class="info-value">{{ salaryData.HeadCountReached || '否' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">消耗是否达标：</text>
							<text class="info-value">{{ salaryData.ConsumeReached || '否' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">考核扣款金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.AssessmentDeduction) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">未达标指标数量：</text>
							<text class="info-value">{{ formatNumber(salaryData.UnreachedIndicatorCount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">进店消耗人数：</text>
							<text class="info-value">{{ formatNumber(salaryData.HeadCount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">目标人头数：</text>
							<text class="info-value">{{ formatNumber(salaryData.TargetHeadCount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店消耗金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreConsume) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">目标消耗金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TargetConsume) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">销售业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.SalesPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">产品物料：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.ProductMaterial) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">合作项目成本：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CooperationCost) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">店内支出：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreExpense) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">洗毛巾费用：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.LaundryCost) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">毛利：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GrossProfit) }}</text>
						</view>
					</view>
				</view>

				<!-- 业绩信息 - 大项目部老师 -->
				<view class="warpboxss" v-if="currentSalaryType === 'majorProjectTeacher'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>业绩信息</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">开单业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.OrderAchievement) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">消耗业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.ConsumeAchievement) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">退卡业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.RefundAchievement) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">总业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">在店天数：</text>
							<text class="info-value">{{ formatNumber(salaryData.WorkingDays) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">请假天数：</text>
							<text class="info-value">{{ formatNumber(salaryData.LeaveDays) }}</text>
						</view>
					</view>
				</view>

				<!-- 业绩信息 - 大项目主管 -->
				<view class="warpboxss" v-if="currentSalaryType === 'majorProjectDirector'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>业绩信息</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">总业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">开单金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.BillingAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">退卡金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.RefundAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">在店天数：</text>
							<text class="info-value">{{ formatNumber(salaryData.WorkingDays) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">请假天数：</text>
							<text class="info-value">{{ formatNumber(salaryData.LeaveDays) }}</text>
						</view>
					</view>
				</view>

				<!-- 业绩信息 - 科技老师 -->
				<view class="warpboxss" v-if="currentSalaryType === 'techTeacher'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>业绩信息</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">开单业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.OrderAchievement) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">消耗业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.ConsumeAchievement) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">退卡业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.RefundAchievement) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">总业绩：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalPerformance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">项目数：</text>
							<text class="info-value">{{ formatNumber(salaryData.ProjectCount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">在店天数：</text>
							<text class="info-value">{{ formatNumber(salaryData.WorkingDays) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">请假天数：</text>
							<text class="info-value">{{ formatNumber(salaryData.LeaveDays) }}</text>
						</view>
					</view>
				</view>

				<!-- 提成明细 - 健康师 -->
				<view class="warpboxss" v-if="currentSalaryType === 'healthCoach'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>提成明细</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">提点：</text>
							<text class="info-value">{{ formatPercent(salaryData.CommissionPoint) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">基础业绩提成：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.BasePerformanceCommission) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">合作业绩提成：</text>
							<text
								class="info-value">￥{{ formatMoney(salaryData.CooperationPerformanceCommission) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">顾问提成：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.ConsultantCommission) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">新客业绩提成：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.NewCustomerCommission) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">升单业绩提成：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.UpgradeCommission) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">门店T区提成：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StoreTZoneCommission) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">提成合计：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalCommission) }}</text>
						</view>
					</view>
				</view>

				<!-- 提成明细 - 科技老师 -->
				<view class="warpboxss" v-if="currentSalaryType === 'techTeacher'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>提成明细</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">业绩提成比例：</text>
							<text class="info-value">{{ formatPercent(salaryData.PerformanceCommissionRate) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">业绩提成金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.PerformanceCommissionAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">消耗提成比例：</text>
							<text class="info-value">{{ formatPercent(salaryData.ConsumeCommissionRate) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">消耗提成金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.ConsumeCommissionAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">提成合计：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalCommission) }}</text>
						</view>
					</view>
				</view>

				<!-- 提成明细 - 主任 -->
				<view class="warpboxss" v-if="currentSalaryType === 'director'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>提成明细</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">≤生命线部分提成比例：</text>
							<text class="info-value">{{ formatPercent(salaryData.CommissionRateBelowLifeline) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">>生命线部分提成比例：</text>
							<text class="info-value">{{ formatPercent(salaryData.CommissionRateAboveLifeline) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">≤生命线部分提成金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CommissionAmountBelowLifeline) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">>生命线部分提成金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CommissionAmountAboveLifeline) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">提成总金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalCommissionAmount) }}</text>
						</view>
					</view>
				</view>

				<!-- 提成明细 - 店长 -->
				<view class="warpboxss" v-if="currentSalaryType === 'storeManager'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>提成明细</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">提成比例：</text>
							<text class="info-value">{{ formatPercent(salaryData.CommissionRate) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">提成金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CommissionAmount) }}</text>
						</view>
					</view>
				</view>

				<!-- 提成明细 - 大项目部老师 -->
				<view class="warpboxss" v-if="currentSalaryType === 'majorProjectTeacher'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>提成明细</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">业绩提成比例：</text>
							<text class="info-value">{{ formatPercent(salaryData.PerformanceCommissionRate) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">业绩提成金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.PerformanceCommissionAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">提成合计：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalCommission) }}</text>
						</view>
					</view>
				</view>

				<!-- 提成明细 - 大项目主管 -->
				<view class="warpboxss" v-if="currentSalaryType === 'majorProjectDirector'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>提成明细</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">提成比例：</text>
							<text class="info-value">{{ formatPercent(salaryData.CommissionRate) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">提成金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CommissionAmount) }}</text>
						</view>
					</view>
				</view>

				<!-- 提成明细 - 科技部总经理 -->
				<view class="warpboxss" v-if="currentSalaryType === 'techGeneralManager'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>提成明细</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">溯源金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TraceabilityAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">Cell金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CellAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">溯源金额提成比例：</text>
							<text class="info-value">{{ formatPercent(salaryData.TraceabilityCommissionRate) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">溯源金额提成金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TraceabilityCommissionAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">Cell金额提成比例：</text>
							<text class="info-value">{{ formatPercent(salaryData.CellCommissionRate) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">Cell金额提成金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CellCommissionAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">提成合计：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalCommission) }}</text>
						</view>
					</view>
				</view>

				<!-- 工资明细 -->
				<view class="warpboxss">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>工资明细</view>
					</view>
					<view class="info-card">
						<view class="info-row" v-if="currentSalaryType === 'healthCoach'">
							<text class="info-label">健康师底薪：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.HealthCoachBaseSalary) }}</text>
						</view>
						<view class="info-row" v-else>
							<text class="info-label">底薪：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.BaseSalary) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'techTeacher'">
							<text class="info-label">底薪档位：</text>
							<text class="info-value">{{ formatNumber(salaryData.BaseSalaryLevel) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'assistant'">
							<text class="info-label">手机管理费：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.PhoneManagementFee) }}</text>
						</view>
						<view class="info-row"
							v-if="currentSalaryType === 'healthCoach' || currentSalaryType === 'techTeacher' || currentSalaryType === 'majorProjectTeacher'">
							<text class="info-label">手工费：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.HandworkFee) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'healthCoach'">
							<text class="info-label">额外手工费：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.OutherHandworkFee) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType !== 'healthCoach'">
							<text class="info-label">提成合计：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalCommission) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'healthCoach'">
							<text class="info-label">核算应发工资：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CalculatedGrossSalary) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'healthCoach'">
							<text class="info-label">保底工资：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GuaranteedSalary) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'healthCoach'">
							<text class="info-label">保底请假扣款：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GuaranteedLeaveDeduction) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'healthCoach'">
							<text class="info-label">保底底薪：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GuaranteedBaseSalary) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'healthCoach'">
							<text class="info-label">保底补差：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GuaranteedSupplement) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'healthCoach'">
							<text class="info-label">最终应发工资：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.FinalGrossSalary) }}</text>
						</view>
						<view class="info-row"
							v-if="currentSalaryType === 'assistant' || currentSalaryType === 'director' || currentSalaryType === 'storeManager'">
							<text class="info-label">应发工资：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GrossSalary) }}</text>
						</view>
						<view class="info-row"
							v-if="currentSalaryType === 'director' || currentSalaryType === 'storeManager'">
							<text class="info-label">实际底薪：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.ActualBaseSalary) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'storeManager'">
							<text class="info-label">旗舰店负奖励：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.FlagshipStoreDeduction) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'majorProjectTeacher'">
							<text class="info-label">核算应发工资：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CalculatedGrossSalary) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'majorProjectTeacher'">
							<text class="info-label">保底工资：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GuaranteedSalary) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'majorProjectTeacher'">
							<text class="info-label">保底请假扣款：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GuaranteedLeaveDeduction) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'majorProjectTeacher'">
							<text class="info-label">保底底薪：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GuaranteedBaseSalary) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'majorProjectTeacher'">
							<text class="info-label">保底补差：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GuaranteedSupplement) }}</text>
						</view>
						<view class="info-row"
							v-if="currentSalaryType === 'majorProjectTeacher' || currentSalaryType === 'businessUnitManager' || currentSalaryType === 'techGeneralManager' || currentSalaryType === 'majorProjectDirector'">
							<text class="info-label">核算应发工资：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CalculatedGrossSalary) }}</text>
						</view>
						<view class="info-row"
							v-if="currentSalaryType === 'majorProjectTeacher' || currentSalaryType === 'businessUnitManager' || currentSalaryType === 'techGeneralManager' || currentSalaryType === 'majorProjectDirector'">
							<text class="info-label">最终应发工资：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.FinalGrossSalary) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'techTeacher'">
							<text class="info-label">核算应发工资：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.CalculatedGrossSalary) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'techTeacher'">
							<text class="info-label">保底工资：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GuaranteedSalary) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'techTeacher'">
							<text class="info-label">保底请假扣款：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GuaranteedLeaveDeduction) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'techTeacher'">
							<text class="info-label">保底底薪：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GuaranteedBaseSalary) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'techTeacher'">
							<text class="info-label">保底补差：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.GuaranteedSupplement) }}</text>
						</view>
						<view class="info-row" v-if="currentSalaryType === 'techTeacher'">
							<text class="info-label">最终应发工资：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.FinalGrossSalary) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">补贴合计：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalSubsidy) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">扣款合计：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalDeduction) }}</text>
						</view>
					</view>
				</view>

				<!-- 补贴明细 -->
				<view class="warpboxss"
					v-if="currentSalaryType === 'healthCoach' || currentSalaryType === 'techTeacher' || currentSalaryType === 'majorProjectTeacher' || currentSalaryType === 'businessUnitManager' || currentSalaryType === 'techGeneralManager' || currentSalaryType === 'majorProjectDirector'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>补贴明细</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">车补：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TransportationAllowance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">少休费：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.LessRest) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">全勤奖：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.FullAttendance) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">当月培训补贴：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.MonthlyTrainingSubsidy) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">当月交通补贴：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.MonthlyTransportSubsidy) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">上月培训补贴：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.LastMonthTrainingSubsidy) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">上月交通补贴：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.LastMonthTransportSubsidy) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">补贴合计：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalSubsidy) }}</text>
						</view>
					</view>
				</view>

				<!-- 扣款明细 -->
				<view class="warpboxss"
					v-if="currentSalaryType === 'healthCoach' || currentSalaryType === 'techTeacher' || currentSalaryType === 'majorProjectTeacher' || currentSalaryType === 'businessUnitManager' || currentSalaryType === 'techGeneralManager' || currentSalaryType === 'majorProjectDirector'">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>扣款明细</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">缺卡扣款：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.MissingCard) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">迟到扣款：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.LateArrival) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">请假扣款：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.LeaveDeduction) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">扣社保：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.SocialInsuranceDeduction) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">扣除奖励：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.RewardDeduction) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">扣住宿费：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.AccommodationDeduction) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">扣学习期费用：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.StudyPeriodDeduction) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">扣工作服费用：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.WorkClothesDeduction) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">扣款合计：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.TotalDeduction) }}</text>
						</view>
					</view>
				</view>

				<!-- 其他信息 -->
				<view class="warpboxss">
					<view class="warpboxs-small-title" style="margin-bottom: 30rpx;">
						<view><text class="warpboxs-small-title-line"></text>其他信息</view>
					</view>
					<view class="info-card">
						<view class="info-row">
							<text class="info-label">发奖金：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.Bonus) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">退手机押金：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.ReturnPhoneDeposit) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">退住宿押金：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.ReturnAccommodationDeposit) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">当月是否发放：</text>
							<text class="info-value">{{ salaryData.MonthlyPaymentStatus || '无' }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">支付金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.PaidAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">待支付金额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.PendingAmount) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">补发上月：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.LastMonthSupplement) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">当月支付总额：</text>
							<text class="info-value">￥{{ formatMoney(salaryData.MonthlyTotalPayment) }}</text>
						</view>
					</view>
				</view>

			</view>

			<!-- 确认按钮/状态 - 固定在底部 -->
			<view class="confirm-bottom-wrapper" v-if="salaryData">
				<view class="warpboxss confirm-bottom"
					v-if="salaryData.IsLocked === 1 && salaryData.EmployeeConfirmStatus !== 1">
					<view class="confirm-section">
						<view class="confirm-btn" @click="showConfirmDialog = true">
							<u-icon name="checkmark-circle" size="18" color="#fff"></u-icon>
							<text>确认工资</text>
						</view>
					</view>
				</view>
				<view class="warpboxss confirm-bottom" v-else-if="salaryData.EmployeeConfirmStatus === 1">
					<view class="confirm-status">
						<u-icon name="checkmark-circle-fill" size="24" color="#67C23A"></u-icon>
						<text class="confirmed-text">工资已确认</text>
					</view>
				</view>
				<view class="warpboxss confirm-bottom" v-else-if="salaryData.IsLocked !== 1">
					<view class="confirm-status waiting-status">
						<u-icon name="clock" size="24" color="#E6A23C"></u-icon>
						<text class="waiting-text">等待锁定中，锁定后可确认</text>
					</view>
				</view>
			</view>

			<!-- 无数据提示 -->
			<view class="no-data" v-if="!loading && !salaryData">
				<u-icon name="file-text" size="60" color="#ccc"></u-icon>
				<text>暂无工资数据</text>
			</view>

			<!-- 加载中 -->
			<view class="loading" v-if="loading">
				<u-loading-icon mode="spinner" color="#409EFF"></u-loading-icon>
				<text>查询中...</text>
			</view>
		</view>

		<!-- 确认对话框 -->
		<u-popup :show="showConfirmDialog" @close="showConfirmDialog = false" mode="center" border-radius="20"
			:close-on-click-overlay="true">
			<view class="confirm-dialog">
				<view class="dialog-title">确认工资</view>
				<view class="dialog-content">
					<view class="dialog-text">确认后工资数据将不可再修改，是否确认？</view>
					<view class="dialog-input">
						<text class="input-label">备注（可选）：</text>
						<textarea v-model="confirmRemark" placeholder="请输入备注信息" class="textarea"></textarea>
					</view>
				</view>
				<view class="dialog-footer">
					<view class="dialog-btn cancel-btn" @click="showConfirmDialog = false">取消</view>
					<view class="dialog-btn confirm-btn" @click="handleConfirm">确定</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import CustomNavbar from '@/components/custom-navbar/custom-navbar.vue'
	import request from '@/service/request.js'
	import config from '@/common/config.js'

	export default {
		components: {
			CustomNavbar
		},
		data() {
			return {
				navbarHeightRpx: 0,
				queryMonth: '',
				currentSalaryType: '', // 根据用户角色自动判断
				salaryData: null,
				loading: false,
				showConfirmDialog: false,
				confirmRemark: '',
				employeeId: '', // 从用户信息获取
				userRole: '' // 用户角色
			}
		},
		computed: {
			contentTopMargin() {
				if (this.navbarHeightRpx > 0) {
					return (this.navbarHeightRpx + 20) + 'rpx'
				}
				return '100rpx'
			},
			queryMonthText() {
				if (!this.queryMonth) return ''
				const [year, month] = this.queryMonth.split('-')
				return `${year}年${parseInt(month)}月`
			}
		},
		onLoad() {
			// 获取当前用户信息
			this.getUserInfo()
			// 初始化日期为当前年月
			const now = new Date()
			this.queryMonth = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`
			this.handleQuery()
		},
		methods: {
			handleNavbarHeightChange(heightInfo) {
				this.navbarHeightRpx = heightInfo.rpx || 0
			},
			onMonthChange(e) {
				this.queryMonth = e.detail.value
			},
			async getUserInfo() {
				try {
					const userInfo = uni.getStorageSync('userInfo')
					const newuserInfo = uni.getStorageSync('newuserInfo') || {}

					if (userInfo && userInfo.userId) {
						this.employeeId = userInfo.userId
					}

					// 根据用户角色判断工资类型
					const role = newuserInfo.gw || ''
					this.userRole = role

					if (role === '健康师') {
						this.currentSalaryType = 'healthCoach'
					} else if (role === '店助' || role === '店助主任') {
						this.currentSalaryType = 'assistant'
					} else if (role === '科技老师') {
						this.currentSalaryType = 'techTeacher'
					} else if (role === '主任') {
						this.currentSalaryType = 'director'
					} else if (role === '店长') {
						this.currentSalaryType = 'storeManager'
					} else if (role === '大项目部老师') {
						this.currentSalaryType = 'majorProjectTeacher'
					} else if (role === '事业部总经理' || role === '事业部经理') {
						this.currentSalaryType = 'businessUnitManager'
					} else if (role === '科技部总经理') {
						this.currentSalaryType = 'techGeneralManager'
					} else if (role === '主管') {
						this.currentSalaryType = 'majorProjectDirector'
					} else {
						// 默认健康师
						this.currentSalaryType = 'healthCoach'
					}
				} catch (e) {
					console.error('获取用户信息失败', e)
				}
			},
			async handleQuery() {
				if (!this.queryMonth) {
					uni.showToast({
						icon: 'none',
						title: '请选择月份'
					})
					return
				}
				if (!this.employeeId) {
					uni.showToast({
						icon: 'none',
						title: '未获取到员工信息'
					})
					return
				}
				if (!this.currentSalaryType) {
					uni.showToast({
						icon: 'none',
						title: '无法识别您的岗位类型，请联系管理员'
					})
					return
				}

				this.loading = true
				this.salaryData = null

				try {
					const [year, month] = this.queryMonth.split('-').map(v => parseInt(v))

					let url = ''
					if (this.currentSalaryType === 'healthCoach') {
						url = `/api/Extend/lqsalary/query-by-employee`
					} else if (this.currentSalaryType === 'assistant') {
						url = `/api/Extend/lqassistantsalary/query-by-employee`
					} else if (this.currentSalaryType === 'techTeacher') {
						url = `/api/Extend/lqtechteachersalary/query-by-employee`
					} else if (this.currentSalaryType === 'director') {
						url = `/api/Extend/lqdirectorsalary/query-by-employee`
					} else if (this.currentSalaryType === 'storeManager') {
						url = `/api/Extend/lqstoremanagersalary/query-by-employee`
					} else if (this.currentSalaryType === 'majorProjectTeacher') {
						url = `/api/Extend/lqmajorprojectteachersalary/query-by-employee`
					} else if (this.currentSalaryType === 'businessUnitManager') {
						url = `/api/Extend/lqbusinessunitmanagersalary/query-by-employee`
					} else if (this.currentSalaryType === 'techGeneralManager') {
						url = `/api/Extend/lqtechgeneralmanagersalary/query-by-employee`
					} else if (this.currentSalaryType === 'majorProjectDirector') {
						url = `/api/Extend/lqmajorprojectdirectorsalary/query-by-employee`
					}

					const params = {
						Year: year,
						Month: month,
						EmployeeId: this.employeeId
					}

					const res = await request.get(url, params)

					if (res.code === 200 && res.data) {
						this.salaryData = res.data
					} else {
						uni.showToast({
							icon: 'none',
							title: res.msg || '查询失败'
						})
					}
				} catch (error) {
					console.error('查询工资失败', error)
					uni.showToast({
						icon: 'none',
						title: '查询失败，请稍后重试'
					})
				} finally {
					this.loading = false
				}
			},
			async handleConfirm() {
				if (!this.salaryData || !this.salaryData.Id) {
					uni.showToast({
						icon: 'none',
						title: '工资数据异常'
					})
					return
				}

				try {
					let url = ''
					if (this.currentSalaryType === 'healthCoach') {
						url = `/api/Extend/lqsalary/confirm`
					} else if (this.currentSalaryType === 'assistant') {
						url = `/api/Extend/lqassistantsalary/confirm`
					} else if (this.currentSalaryType === 'techTeacher') {
						url = `/api/Extend/lqtechteachersalary/confirm`
					} else if (this.currentSalaryType === 'director') {
						url = `/api/Extend/lqdirectorsalary/confirm`
					} else if (this.currentSalaryType === 'storeManager') {
						url = `/api/Extend/lqstoremanagersalary/confirm`
					} else if (this.currentSalaryType === 'majorProjectTeacher') {
						url = `/api/Extend/lqmajorprojectteachersalary/confirm`
					} else if (this.currentSalaryType === 'businessUnitManager') {
						url = `/api/Extend/lqbusinessunitmanagersalary/confirm`
					} else if (this.currentSalaryType === 'techGeneralManager') {
						url = `/api/Extend/lqtechgeneralmanagersalary/confirm`
					} else if (this.currentSalaryType === 'majorProjectDirector') {
						url = `/api/Extend/lqmajorprojectdirectorsalary/confirm`
					}

					const params = {
						id: this.salaryData.Id,
						employeeId: this.employeeId,
						remark: this.confirmRemark || ''
					}

					const res = await request.post(url, params)

					if (res.code === 200 || res === '确认成功') {
						uni.showToast({
							icon: 'success',
							title: '确认成功'
						})
						this.showConfirmDialog = false
						this.confirmRemark = ''
						// 重新查询数据
						this.handleQuery()
					} else {
						uni.showToast({
							icon: 'none',
							title: res.msg || '确认失败'
						})
					}
				} catch (error) {
					console.error('确认工资失败', error)
					uni.showToast({
						icon: 'none',
						title: '确认失败，请稍后重试'
					})
				}
			},
			formatMoney(value) {
				if (value === null || value === undefined) return '0.00'
				return parseFloat(value).toFixed(2)
			},
			formatPercent(value) {
				if (value === null || value === undefined || value === '') return '0.00%'
				const numValue = parseFloat(value)
				if (isNaN(numValue)) return '0.00%'
				return (numValue * 100).toFixed(2) + '%'
			},
			formatNumber(value) {
				if (value === null || value === undefined) return '0'
				return parseFloat(value).toString()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		min-height: 100vh;
		background: #f5f7fa;
		display: flex;
		flex-direction: column;
	}

	.content-wrapper {
		flex: 1;
		padding: 20rpx;
		padding-bottom: 160rpx;
		display: flex;
		flex-direction: column;
		overflow-y: auto;
	}

	.warpboxss {
		margin-bottom: 30rpx;
		background: rgba(255, 255, 255, 0.7);
		backdrop-filter: blur(20px) saturate(180%);
		-webkit-backdrop-filter: blur(20px) saturate(180%);
		padding: 30rpx;
		border-radius: 24rpx;
		box-shadow:
			0 8rpx 32rpx rgba(0, 0, 0, 0.08),
			0 2rpx 8rpx rgba(0, 0, 0, 0.04);
	}

	.warpboxs-small-title {
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 30rpx;
		font-weight: 600;
		color: #1f2937;

		.warpboxs-small-title-line {
			display: inline-block;
			background: linear-gradient(180deg, #43a047 0%, #66bb6a 100%);
			height: 26rpx;
			width: 10rpx;
			margin-right: 12rpx;
			border-radius: 18rpx;
			box-shadow:
				0 2rpx 8rpx rgba(67, 160, 71, 0.4),
				0 0 12rpx rgba(67, 160, 71, 0.3),
				inset 0 1rpx 2rpx rgba(255, 255, 255, 0.3);
			position: relative;

			&::after {
				content: '';
				position: absolute;
				top: 0;
				left: 0;
				right: 0;
				bottom: 0;
				border-radius: 3rpx;
				background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
				pointer-events: none;
			}
		}
	}

	.query-section {
		background: transparent;
		padding: 0;
		margin-bottom: 0;

		.form-item {
			width: 100%;
			display: flex;
			align-items: center;
			margin-bottom: 30rpx;

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

			.label {
				width: 140rpx;
				font-size: 28rpx;
				color: #333;
				font-weight: 500;
			}

			.picker-view {
				flex: 1;
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 20rpx 24rpx;
				background: #f5f7fa;
				border-radius: 8rpx;
				font-size: 28rpx;
				color: #333;
			}
		}

		.query-btn {
			margin-top: 30rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			padding: 24rpx;
			background: linear-gradient(135deg, #409EFF 0%, #67C23A 100%);
			border-radius: 8rpx;
			color: #fff;
			font-size: 30rpx;
			font-weight: 500;

			text {
				margin-left: 10rpx;
			}
		}
	}

	.salary-detail {
		.info-card {
			background: transparent;
			border-radius: 12rpx;
			padding: 0;
			margin-bottom: 0;

			.info-row {
				display: flex;
				align-items: center;
				padding: 24rpx 0;
				border-bottom: 1rpx solid rgba(0, 0, 0, 0.05);

				&:last-child {
					border-bottom: none;
				}

				&.highlight-row {
					background: linear-gradient(135deg, rgba(255, 243, 224, 0.5) 0%, rgba(255, 224, 178, 0.5) 100%);
					margin: 0 -30rpx;
					padding: 24rpx 30rpx;
					border-radius: 12rpx;
					border-bottom: none;
				}

				.info-label {
					// width: 180rpx;
					font-size: 28rpx;
					color: #666;
					font-weight: 500;
				}

				.info-value {
					flex: 1;
					font-size: 28rpx;
					color: #333;
					text-align: right;
					font-weight: 500;

					&.highlight {
						color: #F56C6C;
						font-size: 36rpx;
						font-weight: 700;
					}
				}
			}
		}




	}

	.confirm-section {
		.confirm-btn {
			display: flex;
			align-items: center;
			justify-content: center;
			padding: 28rpx;
			background: linear-gradient(135deg, #67C23A 0%, #409EFF 100%);
			border-radius: 12rpx;
			color: #fff;
			font-size: 30rpx;
			font-weight: 600;
			box-shadow: 0 4rpx 16rpx rgba(64, 158, 255, 0.3);

			text {
				margin-left: 10rpx;
			}
		}
	}

	.confirm-bottom-wrapper {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		z-index: 10;
		// padding: 20rpx 20rpx 20rpx 20rpx;
		// background: #f5f7fa;
		box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
		/* iOS安全区域适配 - 先写constant兼容旧版iOS */
		padding-bottom: 20rpx;
		padding-bottom: calc(20rpx + constant(safe-area-inset-bottom));
		padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
	}

	.confirm-bottom {
		margin-bottom: 0;
	}

	.confirm-status {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 12rpx;
		text-align: center;
		padding:20rpx 30rpx;
		background: linear-gradient(135deg, rgba(232, 245, 233, 0.7) 0%, rgba(200, 230, 201, 0.7) 100%);
		border-radius: 12rpx;

		.confirmed-text {
			font-size: 30rpx;
			color: #43a047;
			font-weight: 600;
		}

		&.waiting-status {
			background: linear-gradient(135deg, rgba(255, 243, 224, 0.7) 0%, rgba(255, 224, 178, 0.7) 100%);

			.waiting-text {
				font-size: 28rpx;
				color: #E6A23C;
				font-weight: 500;
			}
		}
	}

	.confirmed-status {
		color: #67C23A;
		font-weight: 600;
	}

	.unconfirmed-status {
		color: #E6A23C;
		font-weight: 500;
	}

	.no-data {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 100rpx 0;
		color: #999;
		font-size: 28rpx;

		text {
			margin-top: 20rpx;
		}
	}

	.loading {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 100rpx 0;
		color: #999;
		font-size: 28rpx;

		text {
			margin-top: 20rpx;
		}
	}

	.confirm-dialog {
		padding: 40rpx;
		background: #fff;
		border-radius: 20rpx;
		min-width: 600rpx;
		max-width: 90vw;

		.dialog-title {
			font-size: 32rpx;
			font-weight: 600;
			color: #303133;
			text-align: center;
			margin-bottom: 30rpx;
			position: relative;
			padding-bottom: 20rpx;

			&::after {
				content: '';
				position: absolute;
				bottom: 0;
				left: 50%;
				transform: translateX(-50%);
				width: 60rpx;
				height: 4rpx;
				background: linear-gradient(90deg, #409EFF 0%, #67C23A 100%);
				border-radius: 2rpx;
			}
		}

		.dialog-content {
			margin-bottom: 30rpx;

			.dialog-text {
				font-size: 28rpx;
				color: #333;
				margin-bottom: 30rpx;
				line-height: 1.6;
				text-align: center;
			}

			.dialog-input {
				.input-label {
					font-size: 26rpx;
					color: #666;
					margin-bottom: 10rpx;
					display: block;
				}

				.textarea {
					width: 100%;
					min-height: 120rpx;
					padding: 20rpx;
					background: #f5f7fa;
					border-radius: 8rpx;
					font-size: 26rpx;
					color: #333;
					box-sizing: border-box;
				}
			}
		}

		.dialog-footer {
			display: flex;
			justify-content: space-between;
			gap: 20rpx;
			margin-top: 30rpx;

			.dialog-btn {
				flex: 1;
				padding: 24rpx;
				text-align: center;
				border-radius: 8rpx;
				font-size: 28rpx;
				font-weight: 500;

				&.cancel-btn {
					background: #f5f7fa;
					color: #606266;
				}

				&.confirm-btn {
					background: linear-gradient(135deg, #409EFF 0%, #67C23A 100%);
					color: #fff;
				}
			}
		}
	}
</style>