"use strict";
const common_vendor = require("../../common/vendor.js");
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
const pages_me_model = require("./model.js");
const gen_Apis = require("../../gen/Apis.js");
require("../../common/libraries/request.js");
const common_store_useWeAppAuthStore = require("../../common/store/useWeAppAuthStore.js");
require("../../common/store/useWorkStore.js");
const auth = common_store_useWeAppAuthStore.useWeAppAuthStore();
const getOwnerAuditList = () => {
  var _a, _b;
  common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Archive.HouseRegisters.OwnerAuditList, (_b = (_a = pages_me_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value).then((res) => {
    pages_me_model.useModel.dataList.value = [...pages_me_model.useModel.dataList.value, ...res == null ? void 0 : res.data];
    pages_me_model.useModel.meta.value = res == null ? void 0 : res.meta;
    console.log(res);
  });
};
const handleSrarch = () => {
  pages_me_model.useModel.dataList.value = [];
  pages_me_model.useModel.formData.value.page = 1;
  getOwnerAuditList();
};
const method = {
  getOwnerAuditList,
  handleSrarch,
  handleLoadMore(page) {
    pages_me_model.useModel.formData.value.page = page;
    getOwnerAuditList();
  },
  getHouseKeeper() {
    var _a, _b, _c, _d;
    if ((_b = (_a = auth == null ? void 0 : auth.data) == null ? void 0 : _a.selected_house) == null ? void 0 : _b.id) {
      common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Grid.Grids.GetHousekeeper, {
        asset_houses_id: (_d = (_c = auth == null ? void 0 : auth.data) == null ? void 0 : _c.selected_house) == null ? void 0 : _d.id
      }).then((res) => {
        pages_me_model.useModel.houseKeeperData.value = res == null ? void 0 : res.data;
        console.log(res);
      });
    }
  },
  getCountHouse() {
    common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Customer.Customers.GetCountHouse, {}).then((res) => {
      pages_me_model.useModel.countHouseData.value = res == null ? void 0 : res.data;
      console.log(res);
    });
  },
  handleAudit(e) {
    common_vendor.index.showModal({
      title: "提示",
      content: "请仔细确认好注册用户信息！",
      confirmText: "通过",
      confirmColor: "#2A7EFB",
      success: function(res) {
        if (res.confirm) {
          common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Archive.HouseRegisters.Audit, {
            status: "Approved",
            id: e == null ? void 0 : e.id
          }).then((res2) => {
            handleSrarch();
            console.log(res2);
          });
          console.log("用户点击确定");
        } else if (res.cancel) {
          console.log("用户点击取消");
        }
      }
    });
  }
};
exports.method = method;
