"use strict";const l=require("../../common/vendor.js"),e=require("./model.js"),i=require("../../common/libraries/naviHelper.js"),u=require("../../gen/Apis.js"),o=require("../../common/libraries/apiLoading.js");require("../../common/libraries/userUserLogin.js");const s=require("../../common/libraries/sendWxWork.js"),a=(l,i)=>{e.useModel.currentHouses.value={id:l,name:i},o.getApiLoading(u.Apis.Bill.HouseBills.List,{asset_houses_id:l,type:1}).then(l=>{var i;null==(i=null==l?void 0:l.data)||i.map(l=>{var e;l.isSelect=!0,null==(e=null==l?void 0:l.bills)||e.map(l=>{l.isSelect=!0})}),e.useModel.listData.value=(null==l?void 0:l.data)||[],console.log(l)})},n={handleChange(l){var i,u,o,s,n;let d=null==(s=null==(u=null==(i=e.useModel)?void 0:i.showData)?void 0:u.value)?void 0:s.houseList[null==(o=null==l?void 0:l.detail)?void 0:o.value];a(null==d?void 0:d.asset_houses_id,null==(n=null==d?void 0:d.asset_house)?void 0:n.full_name),console.log(l,"e")},getList(){var l,i;o.getApiLoading(u.Apis.Customer.CustomerHouses.List,null==(i=null==(l=e.useModel)?void 0:l.formData)?void 0:i.value).then(l=>{var i,u,o,s,n,d;if(null==(u=null==(i=null==l?void 0:l.data)?void 0:i.houseList)?void 0:u.length){let e=null==(o=null==l?void 0:l.data)?void 0:o.houseList[0];null==(n=null==(s=null==l?void 0:l.data)?void 0:s.houseList)||n.map(l=>{var e;l.full_name=null==(e=null==l?void 0:l.asset_house)?void 0:e.full_name}),a(null==e?void 0:e.asset_houses_id,null==(d=null==e?void 0:e.asset_house)?void 0:d.full_name)}e.useModel.showData.value=null==l?void 0:l.data,console.log(l)})},getHouseBill:a,handleSelect(l){var i,u;let o=e.useModel.listData.value[l].isSelect;e.useModel.listData.value[l].isSelect=!o,null==(u=null==(i=e.useModel.listData.value[l])?void 0:i.bills)||u.map(l=>{l.isSelect=!o})},handleFindSelect(l,i,u){var o;let s=null==l?void 0:l.isSelect;e.useModel.listData.value[i].bills[u].isSelect=!s;let a=null==(o=e.useModel.listData.value[i].bills)?void 0:o.every(l=>null==l?void 0:l.isSelect);e.useModel.listData.value[i].isSelect=a},handleParmaryClick(){var l,u,o,a,n,d,t,v,r;let m=[];if(null==(o=null==(u=null==(l=e.useModel)?void 0:l.listData)?void 0:u.value)||o.map(l=>{var e,i;(null==(e=null==l?void 0:l.bills)?void 0:e.length)&&(null==(i=null==l?void 0:l.bills)||i.map(l=>{(null==l?void 0:l.isSelect)&&(null==m||m.push(null==l?void 0:l.id))}))}),!(null==m?void 0:m.length))return i.showToast("请至少选择一个月账单！");s.sendChatMessage({page:`/INDEX/bill_order/index.html?bill_ids=${JSON.stringify(m)}&house_id=${null==(d=null==(n=null==(a=e.useModel)?void 0:a.currentHouses)?void 0:n.value)?void 0:d.id}`,title:`分享给您${null==(r=null==(v=null==(t=e.useModel)?void 0:t.currentHouses)?void 0:v.value)?void 0:r.name}物业账单`,imgUrl:"https://pay-prod-1369486729.cos.ap-guangzhou.myqcloud.com/uploads/cs-test/01K5B5RY2TQQAJ1GT2RZSK426V.jpg"})},handleQRCode(){var s,a,n;let d=[],t=0;if(null==(n=null==(a=null==(s=e.useModel)?void 0:s.listData)?void 0:a.value)||n.map(l=>{var e,i;(null==(e=null==l?void 0:l.bills)?void 0:e.length)&&(null==(i=null==l?void 0:l.bills)||i.map(l=>{(null==l?void 0:l.isSelect)&&(null==d||d.push(null==l?void 0:l.id),t+=parseFloat(null==l?void 0:l.amount))}))}),!(null==d?void 0:d.length))return i.showToast("请至少选择一个月账单！");o.getApiLoading(u.Apis.HouseOrder.HouseOrders.Store,{bill_ids:d||[],total_payable_amount:t,amount:t}).then(i=>{var u,o,s,a,n,d,v;l.index.navigateTo({url:`/BILL/poster/index?id=${null==(o=null==(u=e.useModel.currentHouses)?void 0:u.value)?void 0:o.id}&order_id=${null==(s=null==i?void 0:i.data)?void 0:s.id}&time=${null==(a=null==i?void 0:i.data)?void 0:a.created_at}&name=${null==(v=null==(d=null==(n=e.useModel)?void 0:n.currentHouses)?void 0:d.value)?void 0:v.name}&amount=${t}`})})}};exports.method=n;
