2025-12-15 18:19:04 +08:00

120 lines
5.5 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const INDEX_binding_model = require("./model.js");
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
const gen_Apis = require("../../gen/Apis.js");
require("../../common/libraries/request.js");
const common_store_useWeAppAuthStore = require("../../common/store/useWeAppAuthStore.js");
require("../../common/store/useWorkStore.js");
const common_libraries_naviHelper = require("../../common/libraries/naviHelper.js");
const common_libraries_userUserLogin = require("../../common/libraries/userUserLogin.js");
const auth = common_store_useWeAppAuthStore.useWeAppAuthStore();
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.loading.value = false;
INDEX_binding_model.useModel.show.value = false;
common_vendor.index.redirectTo({ url: "/INDEX/binding/success" });
auth == null ? void 0 : auth.getIsHouseExist();
console.log(res);
});
};
const method = {
handleSubmitStore,
handleSelectProject: (e) => {
var _a;
if (e[3]) {
INDEX_binding_model.useModel.formData.value.asset_houses_id = (_a = e[3]) == null ? void 0 : _a.id;
} else {
INDEX_binding_model.useModel.formData.value.asset_houses_id = "";
}
console.log(e, "e");
},
init(e) {
var _a, _b;
INDEX_binding_model.useModel.defaultHouseValueName.value = (e == null ? void 0 : e.houseName) || "";
INDEX_binding_model.useModel.formData.value = {
asset_houses_id: (e == null ? void 0 : e.id) || "",
type: "",
customer_info: [],
name: "",
phone: ((_b = (_a = auth == null ? void 0 : auth.data) == null ? void 0 : _a.user) == null ? void 0 : _b.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
};
},
handleIsLiveIn(e) {
var _a;
INDEX_binding_model.useModel.formData.value.is_live_in = (_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.value;
console.log(e, "e");
},
handleSubmit: (e) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
if (!((_a = common_libraries_userUserLogin.getUserLogin) == null ? void 0 : _a.onBindPhone())) {
return false;
}
if (!INDEX_binding_model.useModel.formData.value.asset_houses_id) {
return common_libraries_naviHelper.showToast("请先选择房屋!");
}
if (!INDEX_binding_model.useModel.formData.value.type) {
return common_libraries_naviHelper.showToast("请先选择身份!");
}
if (!INDEX_binding_model.useModel.formData.value.name || !INDEX_binding_model.useModel.formData.value.phone) {
return common_libraries_naviHelper.showToast("请设置姓名和手机号!");
}
if (!((_b = INDEX_binding_model.useModel.formData.value.card_front_image) == null ? void 0 : _b.length) || !((_c = INDEX_binding_model.useModel.formData.value.card_back_image) == null ? void 0 : _c.length)) {
return common_libraries_naviHelper.showToast("请先上传身份证正反面!");
}
if (INDEX_binding_model.useModel.formData.value.type === "AddOwner" && !((_e = (_d = INDEX_binding_model.useModel.formData.value) == null ? void 0 : _d.ownership_info) == null ? void 0 : _e.length)) {
return common_libraries_naviHelper.showToast("请先上传房产证!");
}
if (INDEX_binding_model.useModel.formData.value.type === "AddOwner" && ((_h = (_g = (_f = INDEX_binding_model.useModel) == null ? void 0 : _f.ownerList) == null ? void 0 : _g.value) == null ? void 0 : _h.length)) {
INDEX_binding_model.useModel.show.value = true;
return;
}
INDEX_binding_model.useModel.loading.value = true;
console.log((_i = INDEX_binding_model.useModel) == null ? void 0 : _i.formData.value, "formData");
common_vendor.index.requestSubscribeMessage({
tmplIds: ["0nIVHQNvIco7zeTWv-W3_MbZFR9ibIXejLxh2OFo5mg"],
success(res) {
console.log(res);
handleSubmitStore();
},
fail(res) {
handleSubmitStore();
console.log(res, "res定远失败");
}
});
},
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);
});
}
}
};
exports.method = method;