"use strict";const e=require("../../gen/Apis.js"),o=require("./model.js");require("../../common/libraries/request.js");const l=require("../../common/store/useWeAppAuthStore.js");require("../../common/store/useWorkStore.js");const i=require("../../common/libraries/apiLoading.js"),u=require("../../common/libraries/day.js");l.useWeAppAuthStore();const t=()=>{i.getApiLoading(e.Apis.Visitor.VisitorApplies.Codes,{}).then((e=>{var l,i,u,t,r,n,d;let a=null==(l=null==e?void 0:e.data)?void 0:l.map((e=>{var o,l,i,u,t;return{asset_house_id:null==(o=null==e?void 0:e.asset_house)?void 0:o.id,full_name:null==(l=null==e?void 0:e.asset_house)?void 0:l.full_name,id:null==e?void 0:e.id,renovation_workers:(null==(i=null==e?void 0:e.renovation_workers)?void 0:i.length)?null==(t=null==(u=null==e?void 0:e.renovation_workers[0])?void 0:u.worker_photo)?void 0:t[0]:{},remark:null==e?void 0:e.remark,visit_start_time:null==e?void 0:e.visit_start_time,code_expired_at:null==e?void 0:e.code_expired_at,type:2}}));o.useModel.listData.value=[...o.useModel.listData.value,...a],(null==(i=o.useModel.listData.value)?void 0:i.length)&&(o.useModel.currentHouse.value=null==(t=null==(u=o.useModel)?void 0:u.listData)?void 0:t.value[0],2===(null==(d=null==(n=null==(r=o.useModel)?void 0:r.currentHouse)?void 0:n.value)?void 0:d.type)&&s())}))},s=()=>{var l,u,t;i.getApiLoading(e.Apis.Visitor.VisitorApplies.VisitorQrCode,{id:null==(t=null==(u=null==(l=o.useModel)?void 0:l.currentHouse)?void 0:u.value)?void 0:t.id}).then((e=>{var l;o.useModel.qrCode.value=null==(l=null==e?void 0:e.data)?void 0:l.qr_code,console.log(e)}))},r=()=>{o.useModel.showCurrentTime.value=u.showCurrentTime(),o.useModel.timeoutObj.value=setTimeout((()=>{r()}),1e3)},n={getList:t,getHouseList:()=>{i.getApiLoading(e.Apis.Archive.HouseOccupants.List,{}).then((e=>{var l;let i=null==(l=null==e?void 0:e.data)?void 0:l.map((e=>({...null==e?void 0:e.asset_house,house_relation:null==e?void 0:e.house_relation,type:1})));o.useModel.listData.value=i||[],t()}))},getQrCode:s,getShowCurrentTime:r};exports.method=n;
