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