acdr-ui/dist/dev/mp-weixin/modules/pet/certification/index.js

128 lines
5.0 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"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());
});
};
2024-10-01 09:15:35 +08:00
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");
2024-09-19 07:20:14 +08:00
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)();
}
2024-10-01 09:15:35 +08:00
const _easycom_wd_popup = () => "../../../node-modules/wot-design-uni/components/wd-popup/wd-popup.js";
2024-09-19 07:20:14 +08:00
if (!Math) {
(TopBar + CertPopup + _easycom_wd_popup)();
}
2024-10-01 09:15:35 +08:00
const TopBar = () => "../../../components/TopBar.js";
2024-09-19 07:20:14 +08:00
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({
2024-10-01 09:15:35 +08:00
url: "/modules/pet/certification/pet-sitter"
2024-09-19 07:20:14 +08:00
});
};
return (_ctx, _cache) => {
return common_vendor.e({
2024-10-01 09:15:35 +08:00
a: common_vendor.unref(utils_commUtils.imgUrl)("@/static/certification/certification_bg.png"),
b: !applyState.value || common_vendor.unref(user).userInfo.isPetNursery
2024-09-19 07:20:14 +08:00
}, !applyState.value || common_vendor.unref(user).userInfo.isPetNursery ? common_vendor.e({
2024-10-01 09:15:35 +08:00
c: !common_vendor.unref(user).userInfo.isPetNursery
2024-09-19 07:20:14 +08:00
}, !common_vendor.unref(user).userInfo.isPetNursery ? {
2024-10-01 09:15:35 +08:00
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)
2024-09-19 07:20:14 +08:00
} : {
2024-10-01 09:15:35 +08:00
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))
2024-09-19 07:20:14 +08:00
}) : {
2024-10-01 09:15:35 +08:00
q: common_vendor.t(applyStateData.value)
2024-09-19 07:20:14 +08:00
}, {
2024-10-01 09:15:35 +08:00
r: common_vendor.o(handleJoin),
s: common_vendor.o(handleReturn),
t: common_vendor.o(($event) => show.value = $event),
v: common_vendor.p({
2024-09-19 07:20:14 +08:00
["close-on-click-modal"]: false,
position: "center",
modelValue: show.value
})
});
};
}
};
2024-10-01 09:15:35 +08:00
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b98da6f1"]]);
2024-09-19 07:20:14 +08:00
wx.createPage(MiniProgramPage);