 <template>
 	<view class="contentStyle" style="">
 		<view class="status-bar"></view>
 		<uni-nav-bar :title="'新增'+paymentType+'缴费'" left-icon="left" @clickLeft="goBack" backgroundColor="transparent"
 			:border="false">
 		</uni-nav-bar>


 		<!-- 表单区域 -->
 		<scroll-view class="page" scroll-y="true">
 			<view class="container">
 				<!-- 顶部蓝色标题栏 -->
 				<view class="header-card">
 					<view class="header-icon">
 						<image class="iconStyle"
 							:src="paymentType=='燃气'?'https://wuye.ckdzkj.com/images/propertyImgs/gas.png':'https://wuye.ckdzkj.com/images/propertyImgs/heating.png'">
 							></image>
 					</view>
 					<text class="header-title">{{paymentType+'费'}}</text>
 				</view>

 				<!-- 缴费信息卡片 -->
 				<view class="info-card">
 					<view class="form-item" @click="goToChange()">
 						<text class="label">缴费单位</text>
 						<text class="company-name">XXXXXXXX有限公司</text>
 					</view>

 					<view class="form-item">
 						<text class="label">缴费单位</text>
 						<view class="input-wrapper">
 							<input type="number" placeholder="请输入户号" class="input-field" v-model="userNo" />
 							<text class="help-link" @click="showPopup = true">如何获取户号?</text>
 						</view>
 					</view>
 				</view>


 			</view>



 			<!-- 快速获取户号 底部弹窗 -->
 			<view v-if="showPopup" class="popup-mask" @click="showPopup = false">
 				<view class="popup-content" @click.stop>
 					<view class="popup-header">
 						<text class="popup-title">快速获取户号</text>
 						<text class="popup-close" @click="showPopup = false">×</text>
 					</view>
 					<view class="popup-list">
 						<view class="popup-item">
 							<view class="item-number">1</view>
 							<view class="item-content">
 								<text class="item-title">查看缴费通知单</text>
 								<text class="item-desc">在纸质缴费/催费通知单上查找户号。</text>
 							</view>
 						</view>
 						<view class="popup-item">
 							<view class="item-number">2</view>
 							<view class="item-content">
 								<text class="item-title">查询通知短信</text>
 								<text class="item-desc">搜索手机由缴费单位发送的催缴短信，短信中包含户号</text>
 							</view>
 						</view>
 					</view>
 				</view>
 			</view>


 		</scroll-view>
 		<!-- 底部协议和立即缴费按钮 -->
 		<view class="bottom-area">
 			<view class="agreement">
 				<checkbox-group @change="handleAgreeChange">
 					<checkbox :checked="isAgree" />
 				</checkbox-group>
 				<text class="agreement-text">我已阅并同意</text>
 				<text class="agreement-link" @click="handleProtocol">《协议链接》</text>
 			</view>
 			<button class="submit-btn" @click="handleSubmit">
 				立即缴费
 			</button>
 		</view>
 	</view>



 </template>

 <script setup>
 	import {
 		ref,
 		onMounted,
 		computed

 	} from 'vue'
 	import {
 		onShow,
 		onReady,
 		onReachBottom,
 		onLoad,
 		onUnload,
 		onPullDownRefresh
 	} from '@dcloudio/uni-app'
 	// 响应式数据
 	const statusBarHeight = ref(20)
 	const paymentType = ref(uni.getStorageSync('addPaymentType'))
 	const userNo = ref('')
 	const isAgree = ref(false)
 	const showPopup = ref(false)

 	// 生命周期
 	onShow(() => {})
 	onMounted(() => {})
 	onReady(() => {
 		// nextTick 用法
 		// nextTick(() => {})
 	})

 	// 勾选协议
 	const handleAgreeChange = (e) => {
 		isAgree.value = e.detail.value.length > 0
 	}

 	// 协议链接点击
 	const handleProtocol = () => {
 		uni.navigateTo({})
 	}

 	// 提交
 	const handleSubmit = () => {
 		if (!userNo.value) {
 			uni.showToast({
 				title: '请输入户号',
 				icon: 'none'
 			})
 			return
 		}

 		if (!isAgree.value) {
 			uni.showToast({
 				title: '请先同意协议',
 				icon: 'none'
 			})
 			return
 		}

 		uni.showModal({
 			title: '确认提交',
 			content: '确认要提交吗?',
 			success: (res) => {
 				if (res.confirm) {
 					uni.showLoading({
 						title: '提交中...',
 						mask: true
 					})

 					setTimeout(() => {
 						uni.showToast({
 							title: '提交成功',
 							icon: 'success'
 						})
 					}, 1000)

 					setTimeout(() => {
 						uni.hideLoading()
 						goNext()
 					}, 2500)
 				}
 			}
 		})
 	}

 	// 跳转成功页
 	const goNext = () => {
 		uni.navigateTo({
 			url: '/pageSubPack/payment-list/addPaymentSuccess'
 		})
 	}

 	// 切换（注释保留）
 	const goToChange = () => {
 		// uni.navigateTo({
 		//   url: '/pageSubPack/payment-list/selectPaymentEntity'
 		// })
 	}

 	// 返回
	const goBack = () => {
		uni.navigateBack();
	}
 </script>
 <style lang="scss">
 	page {
 		background: #f9f9f9;
 	}
 </style>

 <style scoped>
 	.contentStyle {
 		display: flex;
 		flex-direction: column;
 		height: 100vh;
 		/* 关键：占满屏幕高度 */
 		background-color: #f9f9f9;
 	}

 	.page {
 		flex: 1;
 		overflow-y: auto;
 		padding: 0px 40rpx;
 		box-sizing: border-box;
 	}

 	.container {
 		border-radius: 10rpx;
 	}

 	/* 顶部标题栏 */
 	.header-card {
 		background: #fff;
 		padding: 30rpx;
 		display: flex;
 		align-items: center;
 		border-bottom: 2rpx solid #ededed;

 	}

 	.header-icon {
 		width: 56rpx;
 		height: 56rpx;
 		background-color: #fff;
 		border-radius: 50%;
 		display: flex;
 		align-items: center;
 		justify-content: center;
 		margin-right: 20rpx;

 	}

 	.iconStyle {
 		width: 100%;
 		height: 100%;
 	}

 	.icon-fire {
 		font-size: 32rpx;
 		color: #4080ff;
 	}

 	.header-title {
 		font-size: 32rpx;
 		font-weight: bold;
 	}

 	/* 信息卡片 */
 	.info-card {
 		background-color: #fff;
 		border-radius: 10rpx;
 		/* padding: 30rpx; */
 		margin-bottom: 40rpx;
 	}

 	.form-item {
 		/* margin-bottom: 40rpx; */
 		border-bottom: 2rpx solid #ededed;
 		padding: 30rpx;
 	}

 	.form-item:last-child {
 		margin-bottom: 0;
 	}

 	.label {
 		display: block;
 		font-size: 28rpx;
 		color: #222;
 		margin-bottom: 20rpx;
 	}

 	.company-name {
 		display: block;
 		font-size: 32rpx;
 		color: #333;
 		font-weight: 600;
 	}

 	.input-wrapper {
 		display: flex;
 		align-items: center;
 		justify-content: space-between;
 	}

 	.input-field {
 		flex: 1;
 		font-size: 32rpx;
 		color: #333;
 		padding: 10rpx 0;
 		border: none;
 		outline: none;
 	}

 	.input-field::placeholder {
 		color: #ccc;
 	}

 	.help-link {
 		font-size: 28rpx;
 		color: #4080ff;
 		white-space: nowrap;
 		margin-left: 20rpx;
 	}

 	/* 底部区域 */
 	.bottom-area {
 		position: fixed;
 		bottom: 0;
 		left: 0;
 		right: 0;
 		padding: 30rpx;
 		box-sizing: border-box;
 	}

 	.agreement {
 		display: flex;
 		align-items: center;
 		margin-bottom: 20rpx;
 	}

 	.agreement checkbox {
 		transform: scale(0.8);
 		margin-right: 10rpx;
 	}

 	.agreement-text {
 		font-size: 24rpx;
 		color: #333;
 	}

 	.agreement-link {
 		font-size: 28rpx;
 		color: #4080ff;
 		margin-left: 10rpx;
 	}

 	.submit-btn {
 		width: 100%;
 		height: 90rpx;
 		line-height: 90rpx;
 		background-color: #4080ff;
 		color: #fff;
 		border-radius: 10rpx;
 		font-size: 36rpx;
 		font-weight: 500;
 		border: none;
 		outline: none;
 	}

 	.submit-btn[disabled] {
 		background-color: #a0c4ff;
 		color: #fff;
 		opacity: 0.7;
 	}

 	/* 弹窗遮罩层 */
 	.popup-mask {
 		position: fixed;
 		top: 0;
 		left: 0;
 		right: 0;
 		bottom: 0;
 		background-color: rgba(0, 0, 0, 0.5);
 		z-index: 999;
 		display: flex;
 		align-items: flex-end;
 	}

 	/* 弹窗内容 */
 	.popup-content {
 		width: 100%;
 		background-color: #fff;
 		border-radius: 20rpx 20rpx 0 0;
 		padding: 30rpx 40rpx 60rpx;
 		box-sizing: border-box;
 		animation: slideUp 0.3s ease-out;
 	}

 	/* 弹窗标题栏 */
 	.popup-header {
 		display: flex;
 		align-items: center;
 		justify-content: space-between;
 		margin-bottom: 40rpx;
 	}

 	.popup-title {
 		font-size: 32rpx;
 		line-height: 60rpx;
 		font-weight: bold;
 		color: #333;
 		width: 100%;
 		display: flex;
 		/* align-items: center; */
 		justify-content: space-evenly;
 		border-bottom: 2rpx solid #ebebeb;
 	}

 	.popup-close {
 		font-size: 48rpx;
 		color: #999;
 		line-height: 1;
 	}

 	/* 弹窗列表 */
 	.popup-list {
 		padding: 0 10rpx;

 	}

 	.popup-item {
 		display: flex;
 		align-items: flex-start;
 		margin-bottom: 40rpx;
 	}

 	.popup-item:last-child {
 		margin-bottom: 0;
 	}

 	.item-number {
 		width: 40rpx;
 		height: 40rpx;
 		line-height: 40rpx;
 		text-align: center;
 		border: 2rpx solid #4080ff;
 		border-radius: 6rpx;
 		font-size: 28rpx;
 		font-weight: bold;
 		color: #4080ff;
 		margin-right: 20rpx;
 		flex-shrink: 0;
 	}

 	.item-content {
 		flex: 1;
 		display: flex;
 		flex-direction: column;
 	}

 	.item-title {
 		font-size: 32rpx;
 		font-weight: bold;
 		color: #333;
 		margin-bottom: 16rpx;
 	}

 	.item-desc {
 		font-size: 28rpx;
 		color: #666;
 		line-height: 1.5;
 	}

 	/* 弹窗动画 */
 	/* @keyframes slideUp {
 		from {
 			transform: translateY(100%);
 		}

 		to {
 			transform: translateY(0);
 		}
 	} */

 	/* 成功提示弹窗 */
 	.toast-mask {
 		position: fixed;
 		top: 0;
 		left: 0;
 		right: 0;
 		bottom: 0;
 		display: flex;
 		align-items: center;
 		justify-content: center;
 		background-color: transparent;
 		z-index: 9999;
 	}

 	.toast-content {
 		background-color: rgba(0, 0, 0, 0.8);
 		padding: 40rpx 60rpx;
 		border-radius: 8rpx;
 		display: flex;
 		flex-direction: column;
 		align-items: center;
 		justify-content: center;
 	}

 	.toast-icon {
 		width: 60rpx;
 		height: 60rpx;
 		line-height: 60rpx;
 		border-radius: 50%;
 		background-color: #fff;
 		color: #1677ff;
 		font-size: 40rpx;
 		font-weight: bold;
 		margin-bottom: 20rpx;
 		display: flex;
 		align-items: center;
 		justify-content: center;
 	}

 	.toast-text {
 		color: #fff;
 		font-size: 28rpx;
 	}

 	.status-bar {
 		width: 100vw;
 		height: 46px;
 	}
 </style>