<template>
  <view class="bill_order">
    <view
      class="bill_content"
      v-for="(i, index) in useModel?.listData?.value"
      :key="`items_${index}`"
    >
      <view class="bill_content_house_name">
        {{ i?.house_name }}
      </view>
      <view class="bill_content_item">
        <view class="bill_month_item" v-for="(t, idx) in i?.bills" :key="`item_${index}_${idx}`">
          <view class="bill_month_item_header" @click="t.isShow = !t.isShow">
            <view class="bill_month_item_header_left"> {{ t?.month_name }}月待缴纳费用 </view>
            <view class="price">
              ¥{{ t?.amount }}
              <uni-icons :type="t?.isShow ? 'down' : 'right'" color="#999999" size="14"></uni-icons>
            </view>
          </view>
          <view class="bill_month_item_body" v-if="t?.isShow">
            <view
              v-for="(k, indexs) in t?.details"
              :key="`item_f_${index}_${idx}_${indexs}`"
              class="item_find_select"
            >
              <view class="item_find_select_name">
                <hs-enum-tag :Enums="HouseBillsTypeEnum" :value="k?.type" />
              </view>
              <view class="price"> ¥{{ k?.amount }} </view>
            </view>
          </view>
        </view>
      </view>
    </view>
    <hs-footer btnParimaryName="立即支付" @handleParmaryClick="method?.handleSubmitOrder" />
  </view>
</template>

<script setup lang="ts">
import { HouseBillsTypeEnum } from '@/gen/Enums'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { getCurrentInstance } from 'vue'
import getUserLogin from '@/common/libraries/userUserLogin'
import useModel from './model'
import method from './method'

onLoad(async e => {
  await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched
  console.log('onLoad', e)
  if (getUserLogin?.getLoginStatus()) {
    useModel.formData.value = {
      asset_houses_id: e?.house_id,
      bill_ids: JSON.parse(e?.bill_ids)
    }
    method?.getList()
  }
})
</script>
<style setup>
@import './style.scss';
</style>
