"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: "/modules/pet/certification/pet-sitter" }); }; return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.unref(utils_commUtils.imgUrl)("@/static/certification/certification_bg.png"), b: !applyState.value || common_vendor.unref(user).userInfo.isPetNursery }, !applyState.value || common_vendor.unref(user).userInfo.isPetNursery ? common_vendor.e({ c: !common_vendor.unref(user).userInfo.isPetNursery }, !common_vendor.unref(user).userInfo.isPetNursery ? { d: common_vendor.unref(utils_commUtils.imgUrl)("@/static/certification/wy.png"), e: common_vendor.o(goToApplication), f: common_vendor.unref(utils_commUtils.imgUrl)("@/static/certification/wyl.png"), g: common_vendor.o(goToApplication), h: common_vendor.unref(utils_commUtils.imgUrl)("@/static/certification/mr.png"), i: common_vendor.o(goToApplication) } : { j: common_vendor.unref(utils_commUtils.imgUrl)("@/static/certification/cert.png"), k: common_vendor.t(certificate.value.cardId), l: common_vendor.t(certificate.value.type || "宠托师"), m: common_vendor.t(certificate.value.serviceNumber), n: common_vendor.t(formatDate(certificate.value.createTime)), o: common_vendor.t(formatDate(certificate.value.expiredTime)), p: common_vendor.t(formatDate(certificate.value.updateTime)) }) : { q: common_vendor.t(applyStateData.value) }, { r: common_vendor.o(handleJoin), s: common_vendor.o(handleReturn), t: common_vendor.o(($event) => show.value = $event), v: 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-b98da6f1"]]); wx.createPage(MiniProgramPage);