77 lines
3.3 KiB
JavaScript
77 lines
3.3 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const common_libraries_naviHelper = require("../../common/libraries/naviHelper.js");
|
|
const CUSTOMER_bind_house_form_model = require("./model.js");
|
|
const gen_Apis = require("../../gen/Apis.js");
|
|
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
|
|
require("../../common/libraries/request.js");
|
|
require("../../common/store/useWatermarkStore.js");
|
|
require("../../common/store/useWeAppAuthStore.js");
|
|
const common_store_useWorkStore = require("../../common/store/useWorkStore.js");
|
|
const work = common_store_useWorkStore.useWorkStore();
|
|
const method = {
|
|
init() {
|
|
var _a, _b, _c;
|
|
console.log("init", work == null ? void 0 : work.selectWorkHouse);
|
|
CUSTOMER_bind_house_form_model.useModel.formData.value = {
|
|
...CUSTOMER_bind_house_form_model.useModel.formData.value
|
|
};
|
|
if ((_a = work == null ? void 0 : work.selectWorkHouse) == null ? void 0 : _a.value) {
|
|
CUSTOMER_bind_house_form_model.useModel.formData.value = {
|
|
...CUSTOMER_bind_house_form_model.useModel.formData.value,
|
|
asset_houses_id: (_b = work == null ? void 0 : work.selectWorkHouse) == null ? void 0 : _b.value,
|
|
full_name: (_c = work == null ? void 0 : work.selectWorkHouse) == null ? void 0 : _c.label
|
|
};
|
|
}
|
|
},
|
|
handleSubmit() {
|
|
var _a, _b, _c, _d, _e;
|
|
let data = (_b = (_a = CUSTOMER_bind_house_form_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value;
|
|
if (!(data == null ? void 0 : data.asset_houses_id)) {
|
|
return common_libraries_naviHelper.showToast("请选择房屋");
|
|
}
|
|
if (!(data == null ? void 0 : data.type)) {
|
|
return common_libraries_naviHelper.showToast("请选择类型");
|
|
}
|
|
if (data.type === "AddOwner") {
|
|
data.house_relation = "Owner";
|
|
data.residential_relation = "PropertyOwner";
|
|
} else {
|
|
data.house_relation = "Owner";
|
|
}
|
|
if (!(data == null ? void 0 : data.residential_relation)) {
|
|
return common_libraries_naviHelper.showToast("请选择居住关系");
|
|
}
|
|
if (!(data == null ? void 0 : data.name)) {
|
|
return common_libraries_naviHelper.showToast("请填写姓名");
|
|
}
|
|
if (!(data == null ? void 0 : data.phone)) {
|
|
return common_libraries_naviHelper.showToast("请填写手机号");
|
|
}
|
|
if (!(data == null ? void 0 : data.id_card)) {
|
|
return common_libraries_naviHelper.showToast("请填写身份证号");
|
|
}
|
|
if (!((_c = data == null ? void 0 : data.card_front_image) == null ? void 0 : _c.length) || !((_d = data == null ? void 0 : data.card_back_image) == null ? void 0 : _d.length)) {
|
|
return common_libraries_naviHelper.showToast("请上传身份证正反面");
|
|
}
|
|
if (data.type === "AddOwner" && !((_e = data == null ? void 0 : data.ownership_info) == null ? void 0 : _e.length)) {
|
|
return common_libraries_naviHelper.showToast("请上传房产证");
|
|
}
|
|
common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Archive.HouseRegisters.RegisterHouse, {
|
|
...data,
|
|
customer_info: [data]
|
|
}).then((res) => {
|
|
common_vendor.index.redirectTo({
|
|
url: "/CUSTOMER/bind_house_form/success"
|
|
});
|
|
console.log(res);
|
|
});
|
|
},
|
|
handleToSelectHouse() {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/public/asset_houses/index?type=work_add"
|
|
});
|
|
}
|
|
};
|
|
exports.method = method;
|