"use strict";
const common_vendor = require("../../common/vendor.js");
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
require("../../common/libraries/day.js");
const gen_Apis = require("../../gen/Apis.js");
require("../../common/libraries/request.js");
require("../../common/store/useWeAppAuthStore.js");
require("../../common/libraries/setTabBar.js");
require("../../common/store/useWorkStore.js");
if (!Array) {
  const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  const _easycom_hs_popup2 = common_vendor.resolveComponent("hs-popup");
  (_easycom_uni_icons2 + _easycom_hs_popup2)();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_hs_popup = () => "../hs-popup/hs-popup.js";
if (!Math) {
  (_easycom_uni_icons + _easycom_hs_popup)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "hs-popup-house",
  props: ["Apis", "baseStyle"],
  emits: ["close", "change"],
  setup(__props, { emit }) {
    const props = __props;
    const selectEd = common_vendor.ref({ name: "全部房屋", id: 0 });
    const pickerList = common_vendor.ref([]);
    const popupShow = common_vendor.ref(false);
    const onPopupShow = () => {
      popupShow.value = !popupShow.value;
      if (popupShow.value) {
        getPickerList();
      }
    };
    const getPickerList = () => {
      var _a, _b, _c;
      common_libraries_apiLoading.getApiLoading((_c = (_b = (_a = gen_Apis.Apis) == null ? void 0 : _a.Archive) == null ? void 0 : _b.HouseOccupants) == null ? void 0 : _c.List, {}).then((res) => {
        pickerList.value = res == null ? void 0 : res.data;
        console.log(res);
      });
    };
    const onSelectMerchant = (i) => {
      var _a;
      selectEd.value = { name: (_a = i == null ? void 0 : i.asset_house) == null ? void 0 : _a.full_name, id: i == null ? void 0 : i.asset_houses_id };
      emit("change", (i == null ? void 0 : i.asset_houses_id) || "");
      onPopupShow();
    };
    const handleClose = () => {
      selectEd.value = { name: "全部房屋", id: 0 };
      emit("change", void 0);
    };
    return (_ctx, _cache) => {
      var _a, _b, _c, _d, _e;
      return common_vendor.e({
        a: common_vendor.t((_a = selectEd.value) == null ? void 0 : _a.name),
        b: common_vendor.s((props == null ? void 0 : props.baseStyle) || {}),
        c: ((_b = selectEd.value) == null ? void 0 : _b.name) === "全部房屋"
      }, ((_c = selectEd.value) == null ? void 0 : _c.name) === "全部房屋" ? {
        d: common_vendor.p({
          type: "down",
          color: "#333",
          size: "12"
        })
      } : {}, {
        e: common_vendor.o(onPopupShow),
        f: ((_d = selectEd.value) == null ? void 0 : _d.name) !== "全部房屋"
      }, ((_e = selectEd.value) == null ? void 0 : _e.name) !== "全部房屋" ? {
        g: common_vendor.p({
          type: "close",
          color: "#666",
          size: "18"
        }),
        h: common_vendor.o(handleClose)
      } : {}, {
        i: common_vendor.f(pickerList.value, (i, index, i0) => {
          var _a2, _b2, _c2;
          return common_vendor.e({
            a: common_vendor.t((_a2 = i == null ? void 0 : i.asset_house) == null ? void 0 : _a2.full_name),
            b: ((_b2 = selectEd.value) == null ? void 0 : _b2.id) === (i == null ? void 0 : i.asset_houses_id)
          }, ((_c2 = selectEd.value) == null ? void 0 : _c2.id) === (i == null ? void 0 : i.asset_houses_id) ? {
            c: "cc8caa34-3-" + i0 + ",cc8caa34-2",
            d: common_vendor.p({
              type: "checkmarkempty",
              size: "20",
              color: "#2A7EFB"
            })
          } : {}, {
            e: `key_${index}`,
            f: common_vendor.o(($event) => onSelectMerchant(i), `key_${index}`)
          });
        }),
        j: common_vendor.o(onPopupShow),
        k: common_vendor.p({
          show: popupShow.value,
          mode: "bottom",
          closeable: true,
          round: 20
        })
      });
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-cc8caa34"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-customer/src/components/hs-popup-house/hs-popup-house.vue"]]);
wx.createComponent(Component);
