<template>
	<view class="setting-page">
		<uni-nav-bar
			left-icon="left"
			title="常用设置"
			@clickLeft="goBack"
			fixed
			color="#8B2316"
			height="140rpx"
			:border="false"
			backgroundColor="#eee"
		>
		
		</uni-nav-bar>

		<view class="list-block">
			<view class="cell" @click="goRemark">
				<text class="cell-left">设置备注</text>
				<view class="cell-right">
					<text class="cell-desc">给患者添加备注名</text>
					<uni-icons type="right" size="20" color="#999"></uni-icons>
				</view>
			</view>

			<view class="cell" @click="goRemark">
				<text class="cell-left">设置分组</text>
				<view class="cell-right">
					<text class="cell-desc">通过分组给患者分类</text>
					<uni-icons type="right" size="20" color="#999"></uni-icons>
				</view>
			</view>

			<view class="cell" @click="goRemark">
				<text class="cell-left">患者描述</text>
				<view class="cell-right">
					<text class="cell-desc">补充患者关键信息，方便随访患者</text>
					<uni-icons type="right" size="20" color="#999"></uni-icons>
				</view>
			</view>

			<view class="cell" @click="setNextFollow">
				<text class="cell-left">下次随访时间</text>
				<view class="cell-right">
					<text class="cell-desc">添加随访提醒</text>
					<uni-icons type="right" size="20" color="#999"></uni-icons>
				</view>
			</view>

			<view class="cell" @click="goFeedback">
				<text class="cell-left">投诉反馈</text>
				<view class="cell-right">
					<uni-icons type="right" size="20" color="#999"></uni-icons>
				</view>
			</view>
		</view>

		<view class="danger-block">
			<text class="danger-text" @click="unbindPatient">解除随访</text>
		</view>
	</view>
</template>

<script setup>
	import navTo from '@/utils/navTo.js'
	import { onLoad } from '@dcloudio/uni-app'

	const goBack = () => {
		uni.navigateBack();
	}
	const goRemark = () => {
		navTo({ url: '/pages_app/patientRemark/patientRemark' })
	}
	
	const setNextFollow = () => {
		navTo({ url: '/pages_app/visit/visit' })
	}
	const goFeedback = () => {
		navTo({ url: '/pages_app/feedback/feedback' })
	}
	const unbindPatient = () => {
		uni.showModal({
			title: '确认解除',
			content: '确定要解除随访关系吗？',
			success: (res) => {
				if (res.confirm) {
					uni.showToast({ title: '已提交解除', icon: 'success' })
					// TODO: 调用解除随访接口
				}
			}
		})
	}
</script>

<style lang="scss" scoped>
	.setting-page{
		min-height: 100vh;
		background:#f7f7f7;
	}
	.list-block{
		margin-top: 20rpx;
		background: #fff;
		.cell{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 30rpx;
			border-bottom: 1rpx solid #f0f0f0;
			&:last-child{ border-bottom: none; }
			.cell-left{
				font-size: 32rpx;
				color: #333;
			}
			.cell-right{
				display: flex;
				align-items: center;
				gap: 16rpx;
				.cell-desc{
					font-size: 26rpx;
					color: #999;
				}
			}
		}
	}
	.danger-block{
		margin-top: 30rpx;
		background: #fff;
		padding: 40rpx 0;
		display: flex;
		justify-content: center;
		.align-center{ align-items: center; }
		.danger-text{
			color: #8B2316;
			font-size: 32rpx;
		}
	}
</style>
