2025-06-27 08:56:14 +08:00
|
|
|
"use strict";
|
|
|
|
|
const common_vendor = require("../../common/vendor.js");
|
2025-09-15 17:23:33 +08:00
|
|
|
const pages_addoldman_api_api = require("./api/api.js");
|
|
|
|
|
const api_loginApi = require("../../api/loginApi.js");
|
2025-06-27 08:56:14 +08:00
|
|
|
const _sfc_main = {
|
|
|
|
|
__name: "IDcard",
|
|
|
|
|
setup(__props) {
|
2025-09-15 17:23:33 +08:00
|
|
|
const form = common_vendor.reactive({
|
|
|
|
|
name: "",
|
|
|
|
|
tel: "",
|
|
|
|
|
advisoryType: 1,
|
|
|
|
|
status: 2,
|
|
|
|
|
idCard: "",
|
|
|
|
|
homeAddress: "",
|
|
|
|
|
workUnit: "",
|
|
|
|
|
izJs: 1,
|
|
|
|
|
openId: common_vendor.index.getStorageSync("openid")
|
|
|
|
|
});
|
|
|
|
|
function isValid11DigitNumber(val) {
|
|
|
|
|
return /^(\d{11})$/.test(val);
|
|
|
|
|
}
|
|
|
|
|
function isValid18DigitNumber(val) {
|
|
|
|
|
return /^(\d{18})$/.test(val);
|
2025-06-27 08:56:14 +08:00
|
|
|
}
|
2025-09-15 17:23:33 +08:00
|
|
|
const next = () => {
|
|
|
|
|
if (!form.name) {
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
title: "请填写姓名",
|
|
|
|
|
icon: "error"
|
|
|
|
|
});
|
|
|
|
|
} else if (!form.tel) {
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
title: "请填写电话",
|
|
|
|
|
icon: "error"
|
|
|
|
|
});
|
|
|
|
|
} else if (!isValid11DigitNumber(form.tel)) {
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
title: "电话格式错误",
|
|
|
|
|
icon: "none"
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
} else if (!form.idCard) {
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
title: "请填写身份证号",
|
|
|
|
|
icon: "error"
|
|
|
|
|
});
|
|
|
|
|
} else if (!isValid18DigitNumber(form.idCard)) {
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
title: "身份证号格式错误",
|
|
|
|
|
icon: "none"
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
} else if (!form.homeAddress) {
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
title: "请填写家庭住址",
|
|
|
|
|
icon: "error"
|
|
|
|
|
});
|
|
|
|
|
} else if (!form.workUnit) {
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
title: "请填写工作单位",
|
|
|
|
|
icon: "error"
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
if (common_vendor.index.getStorageSync("allinfo").name) {
|
2025-09-25 17:30:11 +08:00
|
|
|
form.id = common_vendor.index.getStorageSync("allinfo").id;
|
2025-09-15 17:23:33 +08:00
|
|
|
pages_addoldman_api_api.changePayer(form).then((res) => {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
api_loginApi.getMessage(common_vendor.index.getStorageSync("openid")).then((res2) => {
|
|
|
|
|
common_vendor.index.setStorageSync("allinfo", res2.result);
|
2025-09-19 17:12:59 +08:00
|
|
|
common_vendor.index.reLaunch({
|
2025-09-15 17:23:33 +08:00
|
|
|
url: "/pages/oldmanindex/index"
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
pages_addoldman_api_api.savePayer(form).then((res) => {
|
2025-09-19 17:12:59 +08:00
|
|
|
if (res.code == 401) {
|
|
|
|
|
pages_addoldman_api_api.savePayer(form).then((res2) => {
|
|
|
|
|
if (res2.success) {
|
|
|
|
|
api_loginApi.getMessage(common_vendor.index.getStorageSync("openid")).then((res3) => {
|
|
|
|
|
common_vendor.index.setStorageSync("allinfo", res3.result);
|
|
|
|
|
common_vendor.index.reLaunch({
|
|
|
|
|
url: "/pages/login/callback"
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-09-15 17:23:33 +08:00
|
|
|
if (res.success) {
|
|
|
|
|
api_loginApi.getMessage(common_vendor.index.getStorageSync("openid")).then((res2) => {
|
|
|
|
|
common_vendor.index.setStorageSync("allinfo", res2.result);
|
2025-09-19 17:12:59 +08:00
|
|
|
common_vendor.index.reLaunch({
|
|
|
|
|
url: "/pages/login/callback"
|
2025-09-15 17:23:33 +08:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-06-27 08:56:14 +08:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-09-15 17:23:33 +08:00
|
|
|
const goBack = () => {
|
|
|
|
|
common_vendor.index.navigateBack();
|
2025-06-27 08:56:14 +08:00
|
|
|
};
|
2025-09-15 17:23:33 +08:00
|
|
|
common_vendor.onLoad(() => {
|
|
|
|
|
if (common_vendor.index.getStorageSync("allinfo").name) {
|
|
|
|
|
let data = common_vendor.index.getStorageSync("allinfo");
|
|
|
|
|
const keys = [
|
|
|
|
|
"openId",
|
|
|
|
|
"name",
|
|
|
|
|
"tel",
|
|
|
|
|
"advisoryType",
|
|
|
|
|
"status",
|
|
|
|
|
"idCard",
|
|
|
|
|
"homeAddress",
|
|
|
|
|
"workUnit",
|
|
|
|
|
"izJs"
|
|
|
|
|
];
|
|
|
|
|
keys.forEach((key) => {
|
|
|
|
|
form[key] = data[key] || "";
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-06-27 08:56:14 +08:00
|
|
|
return (_ctx, _cache) => {
|
2025-09-15 17:23:33 +08:00
|
|
|
return {
|
|
|
|
|
a: common_vendor.o(goBack),
|
|
|
|
|
b: form.name,
|
|
|
|
|
c: common_vendor.o(($event) => form.name = $event.detail.value),
|
|
|
|
|
d: form.tel,
|
|
|
|
|
e: common_vendor.o(($event) => form.tel = $event.detail.value),
|
|
|
|
|
f: form.idCard,
|
|
|
|
|
g: common_vendor.o(($event) => form.idCard = $event.detail.value),
|
|
|
|
|
h: form.homeAddress,
|
|
|
|
|
i: common_vendor.o(($event) => form.homeAddress = $event.detail.value),
|
|
|
|
|
j: form.workUnit,
|
|
|
|
|
k: common_vendor.o(($event) => form.workUnit = $event.detail.value),
|
|
|
|
|
l: common_vendor.o(next)
|
|
|
|
|
};
|
2025-06-27 08:56:14 +08:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-5fcb8e22"]]);
|
|
|
|
|
wx.createPage(MiniProgramPage);
|
|
|
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/addoldman/IDcard.js.map
|