<template>
	<view class="app">
		<view class="forlist">
			<view class="item" @tap='gofamilymemberdetail(item)' v-for="item in familyList">
				<view class="namesigning">
					<span class="name">
						{{item.patientName}}
					</span>
					<view class="signing">
						{{item.signNo==null ?"未签约":'已签约'}}
					</view>
				</view>
				<view class="card">
					{{item.cardNo}}
				</view>
				<view class="border"></view>
				<view class="identityname" v-if="item.householdRelationship">
					{{item.householdRelationship=='1'?"户主本人":''}}
					{{item.householdRelationship=='2'?"配偶":''}}
					{{item.householdRelationship=='3'?"子女":''}}
					{{item.householdRelationship=='4'?"(外)孙子女":''}}
					{{item.householdRelationship=='5'?"父母":''}}
					{{item.householdRelationship=='6'?"(外)祖父母":''}}
					{{item.householdRelationship=='7'?"兄弟姐妹":''}}
					{{item.householdRelationship=='8'?"儿媳":''}}
					{{item.householdRelationship=='9'?"女婿":''}}
					{{item.householdRelationship=='10'?"孙子女":''}}
					{{item.householdRelationship=='11'?"侄子女":''}}
					{{item.householdRelationship=='12'?"曾孙子女":''}}
					{{item.householdRelationship=='13'?"祖父母":''}}
					{{item.householdRelationship=='99'?"其他":''}}
				</view>
			</view>
		</view>
		<view class="bottom">
			<view class="text">
				每位微信用户最多可以绑定8名家庭成员
			</view>
			<view class="btn" @tap="add">
				添加家庭成员
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getCurrentUser,

	} from '@/api/pages/myinformation/myinformation.js';
	export default {
		data() {
			return {
				familyList:{},
				valueopenid:'',

			};
		},
		onShow(){
			this.valueopenid = uni.getStorageSync('openid');
			this.getpersnoal()

		},
		methods: {
			// 获取成员
			getpersnoal(){
				getCurrentUser(this.valueopenid).then(res => {
					console.log(res)
					this.familyList = res.data

				})
			},
			// 添加家庭成员
			add(){
				uni.navigateTo({
					url:'/pagesB/AddMembers/AddMembers'
				})

			},

			gofamilymemberdetail(item) {
				console.log((item))
				uni.navigateTo({
					url: `/pagesB/familymemberdetail/familymemberdetail?patientCode=${item.patientCode}`
				})
			}
		},
		// onReachBottom() { //下滑加载
		// 	if (this.couponlist.length >= this.total) {} else {
		// 		this.pageNum++;
		// 		selectCoupon(this.pageNum, this.pageSize, this.patientId, this.couponstatus).then(res => {
		// 			res.rows.forEach(e => {
		// 				this.couponlist.push(e)
		// 			})
		// 		})
		// 	}
		// },
		onPullDownRefresh() { //下拉刷新
			this.pageNum = 1;
			this.getlist();
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
	}
</script>

<style lang="scss">
	@import './managefamily.scss';
</style>
