"use strict"; const common_vendor = require("../../common/vendor.js"); const utils_globalState = require("../../utils/globalState.js"); const api_index = require("../../api/index.js"); const utils_session = require("../../utils/session.js"); if (!Math) { AppIcon(); } const AppIcon = () => "../../components/AppIcon.js"; const _sfc_main = { __name: "MyReports", emits: ["change-page"], setup(__props, { emit: __emit }) { const userInfo = utils_session.getUserSession(); const storeInfo = utils_session.getStoreSession(); const navSafeStyle = (() => { var _a, _b, _c, _d; const statusBarHeight = ((_b = (_a = common_vendor.index).getSystemInfoSync) == null ? void 0 : _b.call(_a).statusBarHeight) || 20; let navHeight = statusBarHeight + 44; const menuRect = (_d = (_c = common_vendor.index).getMenuButtonBoundingClientRect) == null ? void 0 : _d.call(_c); if (menuRect && menuRect.top && menuRect.height) { const verticalGap = Math.max(menuRect.top - statusBarHeight, 4); navHeight = statusBarHeight + verticalGap * 2 + menuRect.height; } return `padding-top:${statusBarHeight}px;height:${navHeight}px;`; })(); const loading = common_vendor.ref(false); const reportList = common_vendor.ref([]); const loadReports = async () => { loading.value = true; const params = userInfo.role === "boss" ? { storeId: storeInfo.id } : { userId: userInfo.id }; const res = await api_index.getReportList(params); loading.value = false; if (res.code === 200) reportList.value = res.data; }; const goHome = () => { utils_globalState.navigateTo("home"); }; const viewReport = (r) => { let origin = api_index.API_ORIGIN; `${origin}/report.html?token=${r.reportToken}`; common_vendor.index.navigateTo({ url: `/pages/report-view/reportView?token=${r.reportToken}` }); }; common_vendor.onMounted(() => loadReports()); return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.p({ name: "home", size: 16, color: "#ffffff" }), b: common_vendor.o(goHome), c: common_vendor.s(common_vendor.unref(navSafeStyle)), d: common_vendor.t(reportList.value.length), e: reportList.value.length > 0 }, reportList.value.length > 0 ? { f: common_vendor.f(reportList.value, (r, k0, i0) => { return common_vendor.e({ a: r.beforePhoto }, r.beforePhoto ? { b: common_vendor.unref(api_index.imgUrl)(r.beforePhoto) } : { c: "8b3def6b-1-" + i0, d: common_vendor.p({ name: "camera", size: 18, color: "#94a3b8" }) }, { e: common_vendor.t(r.petName), f: common_vendor.t(r.serviceType), g: "8b3def6b-2-" + i0, h: r.id, i: common_vendor.o(($event) => viewReport(r), r.id) }); }), g: common_vendor.p({ name: "report", size: 11, color: "#64748b" }) } : {}, { h: !loading.value && reportList.value.length === 0 }, !loading.value && reportList.value.length === 0 ? {} : {}); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-8b3def6b"]]); wx.createPage(MiniProgramPage);