<script setup lang="ts">
import HomeTabs from "./components/HomeTabs.vue";
import HomeList from "./components/HomeList.vue";
import { ref, reactive, onMounted } from "vue";
import { login } from "@/hooks/useIsLogin";
import { onShow } from "@dcloudio/uni-app";
import ShuiWuSH from "@/components/ShuiWuSH.vue";
const companyName = ref<string>("");

const phoneGet = ref<any>();

onMounted(() => {
  //我来了
});
onShow(() => {
  console.log("onshow");
  login().then((res) => {
    //登录调用成功后
    //判断是否授权了
    //如果授权了则开始查询列表数据
    //列表查出来后判断是都可以查看报告
  });
});
//调用子组件---获取手机号授权
const phoneGetFun = () => {
  phoneGet.value.open();
};
const validFun = () => {
  //判断用户授权登录没有
  phoneGetFun();
  //跳转到邀请用户页面
  // uni.navigateTo({ url: "/pages/index/inviteUser" });
};

//点击税务风险检测--弹出输入税务号的信息
const swGet = ref<any>();
const openSW = () => {
  swGet.value.openSH();
};
</script>
<template>
  <!-- 引入头部安全区域组件 -->
  <view class="home_padding">
    <ShuiWuTop />
    <HomeTabs @jumpInvite="validFun" @jumpSW="openSW" />
    <view class="list_search">
      <uni-easyinput type="text" v-model="companyName" placeholder="请输入公司名称" />
    </view>
    <HomeList class="home_list_com" />
    <ShuiWuGetPhone ref="phoneGet" />
    <ShuiWuSH ref="swGet" />
  </view>
</template>
<style>
.list_search >>> .is-input-border {
  display: flex;
  box-sizing: border-box;
  flex-direction: row;
  align-items: center;
  border: 1px solid #dcdfe6;
  border-radius: 400px !important;
}
</style>
<style lang="scss">
page {
  height: 100%;
  background-color: rgb(243, 250, 248);
}
.home_padding {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0rpx 20rpx;
  .home_list_com {
    flex: 1;
    overflow: scroll;
  }
  .list_search {
    margin-top: 40rpx;
  }
}
</style>
