import useModel from './model'
import { showToast } from '@/common/libraries/naviHelper'
import { Apis } from '@/gen/Apis'
import { getApiLoading } from '@/common/libraries/apiLoading'
import getUserLogin from '@/common/libraries/userUserLogin'
export default {
  getList() {
    getApiLoading(Apis.Customer.CustomerHouses.List, useModel?.formData?.value).then(res => {
      useModel.showData.value = res?.data
      if (!res?.data) {
        uni.reLaunch({
          url: '/CUSTOMER/bind_house/index'
        })
      } else {
        useModel.loading.value = true
      }
      console.log(res)
    })
  },
  handleBindHouse() {
    if (getUserLogin?.toPageLogin()) return
    uni.navigateTo({
      url: `/CUSTOMER/bind_house/index?phone=${useModel?.showData?.value?.customer?.customer_phone}&name=${useModel?.showData?.value?.customer?.customer_name}`
    })
  }
}
