<!--
 * @Title: 
 * @Description: 家庭成员清单
 * @Author: swp
 * @Date: 2022-08-24 10:49:21
 * @LastEditors: 
 * @LastEditTime: 2022-08-24 10:49:21
-->
<template>
	<view class="wrap">
		<uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
			@clickLeft="toBack">
			<view class="nav-title">
				<text>{{title}}</text>
			</view>
		</uni-nav-bar>
		<view class="container">
			<uni-list>
				<uni-list-item v-for="item in list" :key="item.id">
					<template v-slot:body>
						<view class="list-item-block">
							<view v-if="item.isHouseholder ===1" class="line">
								<text class="text" style="color: blue;">户主</text>
							</view>
							<view v-else class="line">
								<text class="text" style="color: blue;">家庭成员</text>
							</view>
							<view class="line">
								<text class="text text-ellipsis">姓名：{{item.personName}}</text>
							</view>
							<view class="line">
								<text class="text text-ellipsis">手机号：{{item.personId}}</text>
							</view>
						</view>
					</template>
				</uni-list-item>
			</uni-list>
		</view>
	</view>
</template>

<script>
	import http from '@/http/api.js';
	export default {
		components: {},
		onLoad(option) {
			this.query = {};
			this.query['personId'] = option.personId;
			this.getList();
		},
		data() {
			return {
				title: '家庭成员表',
				list: [],
				query: {},
			}
		},
		computed: {},
		onShow() {},
		methods: {
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			getList(params = {}) {
				let postData = Object.assign(params, this.query);
				let that = this;
				http.request({
					url: '/galaxy-business/yj/resident/family/list',
					method: 'GET',
					data: postData,
				}).then(res => {
					if (res.data != null) {
						that.list = res.data;
						// that.list = res.data.map(item => {
						// 	let id = item.personId.replace(/^(\d{6})\d+(\d{4})$/, '$1******$2')
						// 	return {
						// 		'id': item.id,
						// 		'isHouseholder':item.isHouseholder,
						// 		'personName':item.personName,
						// 		'personId':id
						// 	}
						// })
					}
				}).catch(err => {
					console.log(err)
				})
			},
		}
	}
</script>

<style lang="scss" scoped>

</style>