"use strict"; var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const common_vendor = require("../../common/vendor.js"); require("../../store/index.js"); const utils_http = require("../../utils/http.js"); const utils_commUtils = require("../../utils/commUtils.js"); const service_userService = require("../../service/userService.js"); const store_user = require("../../store/user.js"); if (!Array) { const _easycom_wd_popup2 = common_vendor.resolveComponent("wd-popup"); const _component_layout_default_uni = common_vendor.resolveComponent("layout-default-uni"); (_easycom_wd_popup2 + _component_layout_default_uni)(); } const _easycom_wd_popup = () => "../../node-modules/wot-design-uni/components/wd-popup/wd-popup.js"; if (!Math) { (TopBar + CertPopup + _easycom_wd_popup)(); } const TopBar = () => "../../components/TopBar.js"; const CertPopup = () => "./components/certPopup.js"; const _sfc_main = { __name: "index", setup(__props) { const user = store_user.useUserStore(); const certificate = common_vendor.ref({}); const show = common_vendor.ref(!user.userInfo.isPetNursery && false); const applyState = common_vendor.ref(false); const applyStateData = common_vendor.ref(""); const handleReturn = () => { show.value = false; common_vendor.index.navigateBack(); }; const handleJoin = () => { show.value = false; }; const getCertificationStatus = () => __async(this, null, function* () { const res = yield utils_http.httpGet("/petInfo/getExpertInfo"); if (res.code == 200) { certificate.value = res.data; if (!user.userInfo.isPetNursery) { yield service_userService.getUserInfo(); } } else { const stateRes = yield utils_http.httpGet("/petInfo/getApplyState"); if (stateRes.code == 200) { applyState.value = true; applyStateData.value = stateRes.data; if (stateRes.data == "已通过") { const userInfo = yield service_userService.getUserInfo(); if (userInfo.isPetNursery) { const epRes = yield utils_http.httpGet("/petInfo/getExpertInfo"); if (epRes.code == 200) { certificate.value = epRes.data; } } } } } }); const formatDate = (dateStr) => { const date = new Date(dateStr); return date.toLocaleDateString(); }; common_vendor.onLoad(() => __async(this, null, function* () { yield getCertificationStatus(); })); const goToApplication = () => { common_vendor.index.navigateTo({ url: "/pages/certification/pet-sitter" }); }; return (_ctx, _cache) => { return common_vendor.e({ a: !applyState.value || common_vendor.unref(user).userInfo.isPetNursery }, !applyState.value || common_vendor.unref(user).userInfo.isPetNursery ? common_vendor.e({ b: !common_vendor.unref(user).userInfo.isPetNursery }, !common_vendor.unref(user).userInfo.isPetNursery ? { c: common_vendor.unref(utils_commUtils.imgUrl)("@/static/certification/wy.png"), d: common_vendor.o(goToApplication), e: common_vendor.unref(utils_commUtils.imgUrl)("@/static/certification/wyl.png"), f: common_vendor.o(goToApplication), g: common_vendor.unref(utils_commUtils.imgUrl)("@/static/certification/mr.png"), h: common_vendor.o(goToApplication) } : { i: common_vendor.unref(utils_commUtils.imgUrl)("@/static/certification/cert.png"), j: common_vendor.t(certificate.value.cardId), k: common_vendor.t(certificate.value.type || "宠托师"), l: common_vendor.t(certificate.value.serviceNumber), m: common_vendor.t(formatDate(certificate.value.createTime)), n: common_vendor.t(formatDate(certificate.value.expiredTime)), o: common_vendor.t(formatDate(certificate.value.updateTime)) }) : { p: common_vendor.t(applyStateData.value) }, { q: common_vendor.o(handleJoin), r: common_vendor.o(handleReturn), s: common_vendor.o(($event) => show.value = $event), t: common_vendor.p({ ["close-on-click-modal"]: false, position: "center", modelValue: show.value }) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6b94bbdd"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=index.js.map