<template>
	<view class="agreement-list-page">
		<nav-bar title="协议列表"></nav-bar>
		<view class="list-container">
			<view class="agreement-item" v-for="item in agreements" :key="item.id" @click="goToDetail(item)">
				<view class="item-info">
					<text class="item-title">{{ item.title }}</text>
				</view>
				<uni-icons type="right" size="14" color="#ccc"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script setup>
// @Author: Antigravity
import { ref } from 'vue'
import navBar from '@/components/nav-bar/index.vue'

// 协议列表，ID 参考 admin web 配置及后端 SysAgreementController
const agreements = ref([
	{ id: 2, title: '隐私政策' },
	{ id: 1, title: '用户服务协议' },
	{ id: 4, title: '商家托运协议' },
	{ id: 5, title: '宠物洗护服务规范' } // 根据需求预留 ID:5
])

const goToDetail = (item) => {
	uni.navigateTo({ 
		url: `/pages/my/agreement/detail/index?id=${item.id}&title=${encodeURIComponent(item.title)}` 
	})
}
</script>

<style lang="scss" scoped>
.agreement-list-page {
	min-height: 100vh;
	background: #f7f8fa;
}

.list-container {
	padding: 24rpx;
}

.agreement-item {
	display: flex;
	align-items: center;
	background: #fff;
	border-radius: 20rpx;
	padding: 32rpx;
	margin-bottom: 20rpx;
	box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.03);
}

.item-info {
	flex: 1;
}

.item-title {
	display: block;
	font-size: 30rpx;
	color: #333;
	font-weight: 500;
}
</style>
