<template>
  <view class="collection">
    <view class="collection_title"> 请选择需要开通托收的房屋 </view>

    <view class="collection_tabs">
      <hs-tabs
        :list="useModel?.tablData"
        :no_space_between="true"
        :current="useModel?.current?.value"
        @onChange="method?.handleTableChange"
      />
    </view>
    <view class="collection_list">
      <hs-empty v-if="!useModel?.dataList?.value?.length" />
      <view
        class="collection_item"
        v-for="i in useModel?.dataList?.value"
        :key="i"
        @click="method?.handleSelect(i)"
      >
        {{ i?.asset_house?.full_name || '' }}
        <uni-icons
          v-if="i?.asset_houses_id === useModel?.formData?.value?.asset_houses_id"
          type="checkbox-filled"
          size="20"
          color="#2A7EFB"
        ></uni-icons>
        <uni-icons v-else type="circle" size="20" color="#888"></uni-icons>
      </view>
    </view>
    <hs-footer btnParimaryName="下一步" @handleParmaryClick="method?.toNext" />
  </view>
</template>

<script setup lang="ts">
import useModel from './model'
import { getApiLoading } from '@/common/libraries/apiLoading'
import { Apis } from '@/gen/Apis'
import method from './method'
import { onMounted } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
onLoad(() => {
  method?.getHouseList()
})
</script>

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