"use strict"; const common_vendor = require("../../../common/vendor.js"); const common_libraries_apiLoading = require("../../../common/libraries/apiLoading.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 common_libraries_getPageConfig = require("../../../common/libraries/getPageConfig.js"); const common_libraries_userUserLogin = require("../../../common/libraries/userUserLogin.js"); require("../../../common/libraries/setTabBar.js"); if (!Array) { const _easycom_cc_scroll_loading2 = common_vendor.resolveComponent("cc-scroll-loading"); _easycom_cc_scroll_loading2(); } const _easycom_cc_scroll_loading = () => "../../../common/components/cc-scroll-loading/cc-scroll-loading.js"; if (!Math) { (MyEventList + MyConvenienceServices + _easycom_cc_scroll_loading)(); } const MyConvenienceServices = () => "./ConvenienceServices.js"; const MyEventList = () => "./EventList.js"; const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "Tabs", setup(__props) { const loadingStatus = common_vendor.ref(false); const formData = common_vendor.ref({ page: 1 }); const metaData = common_vendor.ref({}); const auth = common_store_useWeAppAuthStore.useWeAppAuthStore(); const tabsList = [{ label: "社区活动" }, { label: "便民服务" }]; const current = common_vendor.ref(0); const convenienceServices = common_vendor.ref([]); const handleTabClick = (index) => { current.value = index; convenienceServices.value = []; if (current.value) { getConvenienceServices("PropertyExclusive"); } else { getEventList(); } }; const getEventList = () => { var _a, _b; common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Activity.Activities.List, { ...formData.value, asset_projects_id: ((_b = (_a = auth == null ? void 0 : auth.data) == null ? void 0 : _a.selected_house) == null ? void 0 : _b.asset_projects_id) || -1 }).then((res) => { loadingStatus.value = true; convenienceServices.value = [...convenienceServices.value, ...res.data || []]; metaData.value = res.meta; console.log("res", res); }); }; const getConvenienceServices = (type) => { var _a, _b; common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Common.ConvenienceServices.List, { asset_projects_id: ((_b = (_a = auth == null ? void 0 : auth.data) == null ? void 0 : _a.selected_house) == null ? void 0 : _b.asset_projects_id) || -1, type }).then((res) => { loadingStatus.value = true; convenienceServices.value = res.data; metaData.value = res.meta; console.log(res); }); }; const handleLoadMore = (page) => { formData.value.page = page; handleTabClick(current.value); }; common_vendor.watch( () => { var _a; return (_a = auth == null ? void 0 : auth.data) == null ? void 0 : _a.selected_house; }, () => { var _a; if (((_a = common_libraries_userUserLogin.getUserLogin) == null ? void 0 : _a.getLoginStatus()) && loadingStatus.value) { handleTabClick(current.value); } }, { deep: true } ); common_vendor.onMounted(async () => { var _a; await ((_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$onLaunched); getEventList(); }); return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.f(tabsList, (i, index, i0) => { return common_vendor.e({ a: common_vendor.t(i == null ? void 0 : i.label), b: index === current.value }, index === current.value ? { c: common_vendor.s(common_vendor.unref(common_libraries_getPageConfig.getStyleBgInfo)()) } : {}, { d: `tab_${index}`, e: common_vendor.n(`tab_item ${index === current.value ? "tab_active" : ""}`), f: common_vendor.o(($event) => handleTabClick(index), `tab_${index}`) }); }), b: current.value === 0 }, current.value === 0 ? { c: common_vendor.p({ data: convenienceServices.value }) } : {}, { d: current.value === 1 }, current.value === 1 ? { e: common_vendor.o(getConvenienceServices), f: common_vendor.p({ data: convenienceServices.value }) } : {}, { g: common_vendor.o(handleLoadMore), h: common_vendor.p({ meta: metaData.value }) }); }; } }); const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-90a1bf81"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-customer/src/pages/index/components/Tabs.vue"]]); wx.createComponent(Component);