<template>
  <view class="customer_assets_page">
    <view
      class="customer_item"
      v-for="(i, index) in useModel?.userHouse?.value"
      :key="`item_${index}`"
    >
      <view class="customer_item_head">
        <view
          class="name"
          @click="toPage(`/BILL/outstanding_fee/show/index?id=${i?.asset_houses_id}`)"
        >
          {{ i?.asset_project?.name }}{{ i?.asset_building?.name }}{{ i?.asset_unit?.name
          }}{{ i?.asset_house?.name }} <uni-icons type="right" size="13" color="#999"></uni-icons>
        </view>
        <view class="identity">
          身份：<view class="status_tab" v-if="i?.house_relation === 'Owner'"> 产权人 </view>
          <view class="status_tab" v-if="i?.is_contact">常用联系人</view>
          <view class="status_tab" v-if="i?.residential_relation">
            <hs-enum-tag
              :Enums="HouseOccupantsResidentialRelationEnum"
              :value="i?.residential_relation"
            />
          </view>
        </view>
      </view>
      <view class="unbind" v-if="i?.house_relation !== 'Owner'" @click="method.handleUnbind(i)">
        解绑
      </view>
    </view>

    <view class="customer_item_add_btn" @click="method?.handleBindHouse">
      <uni-icons type="plus" size="20"></uni-icons> <text>新增入户登记</text>
    </view>
  </view>
</template>

<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'
import { HouseOccupantsHouseRelationEnum, HouseOccupantsResidentialRelationEnum } from '@/gen/Enums'
import method from './method'
import useModel from './model'
const toPage = (url: string) => {
  uni.navigateTo({
    url: url
  })
}
onLoad(e => {
  useModel.formData.value = e
  method?.getUserHoueInfo(e?.phone)
  console.log(e)
})
</script>
<style lang="scss">
@import './style.scss';
</style>
