98 lines
4.3 KiB
JavaScript
Raw Normal View History

2025-07-15 16:18:34 +08:00
"use strict";
require("../../common/vendor.js");
const INDEX_binding_model = require("./model.js");
2025-07-15 18:34:34 +08:00
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
const gen_Apis = require("../../gen/Apis.js");
const common_libraries_naviHelper = require("../../common/libraries/naviHelper.js");
2025-08-29 09:51:02 +08:00
const handleSubmitStore = () => {
var _a, _b, _c;
common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Archive.HouseRegisters.Store, {
...INDEX_binding_model.useModel.formData.value,
is_live_in: ((_c = (_b = (_a = INDEX_binding_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value) == null ? void 0 : _c.is_live_in) ? 1 : 0,
customer_info: [INDEX_binding_model.useModel.formData.value]
}).then((res) => {
INDEX_binding_model.useModel.show.value = false;
common_libraries_naviHelper.showToastBack("提交成功,等待审核!", 1, true);
console.log(res);
});
};
2025-07-15 16:18:34 +08:00
const method = {
2025-08-29 09:51:02 +08:00
handleSubmitStore,
2025-07-15 16:18:34 +08:00
handleSelectProject: (e) => {
2025-07-15 18:34:34 +08:00
var _a;
if (e[3]) {
2025-08-29 09:51:02 +08:00
INDEX_binding_model.useModel.formData.value.asset_houses_id = (_a = e[3]) == null ? void 0 : _a.id;
2025-07-16 09:35:59 +08:00
} else {
2025-08-29 09:51:02 +08:00
INDEX_binding_model.useModel.formData.value.asset_houses_id = "";
2025-07-15 18:34:34 +08:00
}
console.log(e, "e");
2025-07-15 16:18:34 +08:00
},
2025-08-29 09:51:02 +08:00
init() {
INDEX_binding_model.useModel.formData.value = {
asset_project_id: "",
asset_houses_id: "",
type: "",
customer_info: [],
name: "",
phone: "",
card_front_image: [],
card_back_image: [],
house_relation: "",
card_type: "MainlandID",
relation_with_owner: "",
ownership_info: [],
id_card: "",
move_in_date: "",
is_live_in: true
};
},
2025-07-15 18:34:34 +08:00
handleIsLiveIn(e) {
var _a;
2025-08-29 09:51:02 +08:00
INDEX_binding_model.useModel.formData.value.is_live_in = (_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.value;
2025-07-15 18:34:34 +08:00
console.log(e, "e");
},
handleSubmit: (e) => {
2025-08-29 09:51:02 +08:00
var _a, _b, _c, _d, _e, _f, _g, _h;
if (!INDEX_binding_model.useModel.formData.value.asset_houses_id) {
return common_libraries_naviHelper.showToast("请先选择房屋!");
2025-07-16 09:35:59 +08:00
}
2025-08-29 09:51:02 +08:00
if (!INDEX_binding_model.useModel.formData.value.type) {
2025-07-16 09:35:59 +08:00
return common_libraries_naviHelper.showToast("请先选择身份!");
}
2025-08-29 09:51:02 +08:00
if (!INDEX_binding_model.useModel.formData.value.name || !INDEX_binding_model.useModel.formData.value.phone) {
return common_libraries_naviHelper.showToast("请设置姓名和手机号!");
2025-07-16 09:35:59 +08:00
}
2025-08-29 09:51:02 +08:00
if (!((_a = INDEX_binding_model.useModel.formData.value.card_front_image) == null ? void 0 : _a.length) || !((_b = INDEX_binding_model.useModel.formData.value.card_back_image) == null ? void 0 : _b.length)) {
2025-07-16 09:35:59 +08:00
return common_libraries_naviHelper.showToast("请先上传身份证正反面!");
}
2025-08-29 09:51:02 +08:00
if (INDEX_binding_model.useModel.formData.value.type === "AddOwner" && !((_d = (_c = INDEX_binding_model.useModel.formData.value) == null ? void 0 : _c.ownership_info) == null ? void 0 : _d.length)) {
2025-07-16 09:35:59 +08:00
return common_libraries_naviHelper.showToast("请先上传房产证!");
}
2025-08-29 09:51:02 +08:00
if (INDEX_binding_model.useModel.formData.value.type === "AddOwner" && ((_g = (_f = (_e = INDEX_binding_model.useModel) == null ? void 0 : _e.ownerList) == null ? void 0 : _f.value) == null ? void 0 : _g.length)) {
INDEX_binding_model.useModel.show.value = true;
return;
}
console.log((_h = INDEX_binding_model.useModel) == null ? void 0 : _h.formData.value, "formData");
handleSubmitStore();
},
handleClose() {
INDEX_binding_model.useModel.show.value = false;
},
handleSelectType(e) {
INDEX_binding_model.useModel.formData.value.house_relation = (e == null ? void 0 : e.value) === "AddOwner" ? "Owner" : "NonOwner";
console.log(e);
},
handleSelectResidentialRelation() {
var _a, _b, _c, _d, _e, _f;
if ((_c = (_b = (_a = INDEX_binding_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value) == null ? void 0 : _c.asset_houses_id) {
common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Archive.HouseOccupants.GetOwner, {
asset_houses_id: (_f = (_e = (_d = INDEX_binding_model.useModel) == null ? void 0 : _d.formData) == null ? void 0 : _e.value) == null ? void 0 : _f.asset_houses_id
}).then((res) => {
INDEX_binding_model.useModel.ownerList.value = (res == null ? void 0 : res.data) || [];
console.log(res);
});
2025-07-16 09:35:59 +08:00
}
2025-07-15 16:18:34 +08:00
}
};
exports.method = method;