157 lines
7.5 KiB
JavaScript

"use strict";
const common_vendor = require("../../../common/vendor.js");
const common_libraries_naviHelper = require("../../../common/libraries/naviHelper.js");
const common_libraries_userUserLogin = require("../../../common/libraries/userUserLogin.js");
const common_libraries_IsHouseExist = require("../../../common/libraries/IsHouseExist.js");
require("../../../common/libraries/request.js");
const common_store_useWeAppAuthStore = require("../../../common/store/useWeAppAuthStore.js");
require("../../../common/store/useWorkStore.js");
const common_libraries_apiLoading = require("../../../common/libraries/apiLoading.js");
const gen_Apis = require("../../../gen/Apis.js");
const pages_index_model = require("../model.js");
const gen_Enums = require("../../../gen/Enums.js");
require("../method.js");
if (!Array) {
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
const _easycom_hs_enum_tag2 = common_vendor.resolveComponent("hs-enum-tag");
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
const _easycom_hs_popup2 = common_vendor.resolveComponent("hs-popup");
(_easycom_up_icon2 + _easycom_hs_enum_tag2 + _easycom_uni_icons2 + _easycom_hs_popup2)();
}
const _easycom_up_icon = () => "../../../node-modules/uview-plus/components/u-icon/u-icon.js";
const _easycom_hs_enum_tag = () => "../../../components/hs-enum-tag/hs-enum-tag.js";
const _easycom_uni_icons = () => "../../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_hs_popup = () => "../../../components/hs-popup/hs-popup.js";
if (!Math) {
(_easycom_up_icon + _easycom_hs_enum_tag + _easycom_uni_icons + _easycom_hs_popup)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "PageHeadTitle",
props: ["title", "objStyle", "data"],
setup(__props) {
const props = __props;
const show = common_vendor.ref(false);
const titleValue = common_vendor.ref("标题");
const capsuleRect = common_vendor.ref({});
const userData = common_vendor.ref({});
const auth = common_store_useWeAppAuthStore.useWeAppAuthStore();
const dataList = common_vendor.ref([]);
const formData = common_vendor.ref({ page: 1 });
const metaData = common_vendor.ref({});
const handlePopupSwitchHouse = () => {
if (!common_libraries_IsHouseExist.getIsHouseExist())
return;
show.value = true;
formData.value.page = 1;
dataList.value = [];
getHouseList();
};
const getHouseList = () => {
var _a;
if (!((_a = common_libraries_userUserLogin.getUserLogin) == null ? void 0 : _a.getLoginStatus()))
return;
common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Archive.HouseOccupants.List, formData == null ? void 0 : formData.value).then((res) => {
dataList.value = [...dataList.value, ...res == null ? void 0 : res.data];
metaData.value = res == null ? void 0 : res.meta;
console.log(res);
});
};
const handleSelectedHouse = (e) => {
var _a, _b;
if ((e == null ? void 0 : e.asset_houses_id) === ((_b = (_a = auth == null ? void 0 : auth.data) == null ? void 0 : _a.selected_house) == null ? void 0 : _b.id)) {
common_libraries_naviHelper.showToast("已是该房屋!");
return;
}
common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Archive.HouseOccupants.UpdateSelectedHouse, {
asset_houses_id: e == null ? void 0 : e.asset_houses_id
}).then((res) => {
auth == null ? void 0 : auth.me(() => {
show.value = false;
});
console.log(res);
});
};
const hadnleNewBindingHouse = () => {
var _a;
common_vendor.index.navigateTo({
url: ((_a = userData == null ? void 0 : userData.value) == null ? void 0 : _a.user) ? "/INDEX/binding/index" : "/pages/login"
});
};
common_vendor.onShow(() => {
userData.value = auth == null ? void 0 : auth.data;
console.log("2k2k", userData.value);
});
common_vendor.onMounted(() => {
titleValue.value = props.title;
capsuleRect.value = common_vendor.index.getMenuButtonBoundingClientRect();
console.log(capsuleRect.value, "capsuleRect");
});
common_vendor.onHide(() => {
show.value = false;
});
return (_ctx, _cache) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
return common_vendor.e({
a: !((_a = userData.value) == null ? void 0 : _a.user)
}, !((_b = userData.value) == null ? void 0 : _b.user) ? {} : !((_c = userData.value) == null ? void 0 : _c.selected_house) ? {} : {
c: common_vendor.t(((_e = (_d = userData.value) == null ? void 0 : _d.selected_house) == null ? void 0 : _e.full_name) || "-")
}, {
b: !((_f = userData.value) == null ? void 0 : _f.selected_house),
d: common_vendor.p({
name: "arrow-down-fill",
size: "12",
color: "#333"
}),
e: common_vendor.o(handlePopupSwitchHouse),
f: common_vendor.f(dataList.value, (i, index, i0) => {
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
return common_vendor.e({
a: common_vendor.t((_a2 = i == null ? void 0 : i.asset_house) == null ? void 0 : _a2.full_name),
b: "f5a8911c-2-" + i0 + ",f5a8911c-1",
c: common_vendor.p({
value: i == null ? void 0 : i.house_relation,
Enums: common_vendor.unref(gen_Enums.HouseOccupantsHouseRelationEnum)
}),
d: (i == null ? void 0 : i.asset_houses_id) === ((_d2 = (_c2 = (_b2 = common_vendor.unref(auth)) == null ? void 0 : _b2.data) == null ? void 0 : _c2.selected_house) == null ? void 0 : _d2.id)
}, (i == null ? void 0 : i.asset_houses_id) === ((_g2 = (_f2 = (_e2 = common_vendor.unref(auth)) == null ? void 0 : _e2.data) == null ? void 0 : _f2.selected_house) == null ? void 0 : _g2.id) ? {
e: "f5a8911c-3-" + i0 + ",f5a8911c-1",
f: common_vendor.p({
type: "checkbox-filled",
size: "20",
color: "#2A7EFB"
})
} : {
g: "f5a8911c-4-" + i0 + ",f5a8911c-1",
h: common_vendor.p({
type: "circle",
size: "20",
color: "#999"
})
}, {
i: index,
j: common_vendor.o(($event) => handleSelectedHouse(i), index)
});
}),
g: common_vendor.n(`popup_list ${((_g = dataList.value) == null ? void 0 : _g.length) > 2 ? "popup_list_max" : "popup_list_min"}`),
h: common_vendor.p({
name: "plus-circle",
size: "25",
color: "#3D3D3D"
}),
i: common_vendor.o(hadnleNewBindingHouse),
j: common_vendor.o(($event) => show.value = false),
k: common_vendor.p({
show: show.value,
mode: "bottom",
closeable: true,
round: 20
}),
l: common_vendor.n(`custom-title ${((_i = (_h = common_vendor.unref(pages_index_model.useModel)) == null ? void 0 : _h.scrollTop) == null ? void 0 : _i.value) > 10 ? "custom_title_scroll_bg" : ""}`),
m: common_vendor.s(`padding-top:${capsuleRect.value.top}px;height:${capsuleRect.value.height}px;line-height:${capsuleRect.value.height}px;${props == null ? void 0 : props.objStyle}`)
});
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f5a8911c"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-customer/src/pages/index/components/PageHeadTitle.vue"]]);
wx.createComponent(Component);