"use strict";const e=require("../../common/vendor.js");require("../../common/libraries/request.js"),require("../../common/store/useWatermarkStore.js"),require("../../common/store/useWeAppAuthStore.js");const o=require("../../common/store/useWorkStore.js"),l=require("../../common/libraries/apiLoading.js"),s=require("../../common/libraries/naviHelper.js"),r=require("../../gen/Apis.js"),i=require("./model.js"),u=o.useWorkStore(),n={init(){var e,o,l;console.log("init",null==u?void 0:u.selectWorkHouse),i.useModel.formData.value={...i.useModel.formData.value},(null==(e=null==u?void 0:u.selectWorkHouse)?void 0:e.id)&&(i.useModel.formData.value={...i.useModel.formData.value,asset_houses_id:null==(o=null==u?void 0:u.selectWorkHouse)?void 0:o.id,full_name:null==(l=null==u?void 0:u.selectWorkHouse)?void 0:l.full_name})},handleSelectProject(e){var o,l;let s=e[3];i.useModel.formData.value={...null==(l=null==(o=i.useModel)?void 0:o.formData)?void 0:l.value,asset_houses_id:null==s?void 0:s.id,full_name:null==s?void 0:s.full_name},console.log(e,"data")},handleSubmit(){var o,u,n,a,t;let d=null==(u=null==(o=i.useModel)?void 0:o.formData)?void 0:u.value;return(null==d?void 0:d.asset_houses_id)?(null==d?void 0:d.type)?("AddOwner"===d.type?(d.house_relation="Owner",d.residential_relation="PropertyOwner"):d.house_relation="Owner",(null==d?void 0:d.residential_relation)?(null==d?void 0:d.name)?(null==d?void 0:d.phone)?(null==d?void 0:d.id_card)?(null==(n=null==d?void 0:d.card_front_image)?void 0:n.length)&&(null==(a=null==d?void 0:d.card_back_image)?void 0:a.length)?"AddOwner"!==d.type||(null==(t=null==d?void 0:d.ownership_info)?void 0:t.length)?void l.getApiLoading(r.Apis.Archive.HouseRegisters.RegisterHouse,{...d,customer_info:[d]}).then(o=>{e.index.redirectTo({url:"/CUSTOMER/bind_house_form/success"}),console.log(o)}):s.showToast("请上传房产证"):s.showToast("请上传身份证正反面"):s.showToast("请填写身份证号"):s.showToast("请填写手机号"):s.showToast("请填写姓名"):s.showToast("请选择居住关系")):s.showToast("请选择类型"):s.showToast("请选择房屋")},handleToSelectHouse(){e.index.navigateTo({url:"/pages/public/asset_houses/index?type=work_add"})}};exports.method=n;
