File: /var/www/html/public/static/js/hookPay-7b120d42.js
import{getPayHistoriesWeb as Qe,getPayDetailWeb as Je,prePaidWeb as Ze,AddUsedFormModelWeb as $e,AddUsedFormWeb as et,getPreviouInvoiceListWeb as tt,submitPreviouInvoiceWeb as at,UsedFormDetail as it,returnPayBalanceWeb as nt,getClinicsDetailWeb as ot,DeletePaidWeb as st}from"./po-bf9ba69d.js";import{d as B,u as ct}from"./vue-router-a383d220.js";import{o as R}from"./index-81e4a901.js";import{b7 as c}from"./message-2472a54a.js";import{r as i,A as n,o as lt}from"./runtime-core.esm-bundler-6128546f.js";import"./index-479458b8.js";import"./preload-helper-78dc9057.js";import"./vue-i18n.runtime.esm-bundler-6949bcab.js";import"./index-b7f916e1.js";import"./_commonjsHelpers-87174ba5.js";import"./utils-2ab4f76a.js";import"./focus-trap-53f1c6ab.js";import"./error-78e43d3e.js";function Dt(h){B(),ct(),B();const L=i(),g=i({}),I=i(""),v=i(!1),w=i(!1),b=i(!1),S=i(!1),l=i(!1),Y=i(!1),W=i(!1),A=i(!1);i("");const F=i(!1),z=i(!1),V=i(!1),D=i(!1),M=i(!1),N=i(!1),U=i(!1),G=i(""),f=i(""),O=i([]),j=i([]),x=i([]),u=i([]),K=i([]),H=i([]),p=i([]),_=i([]),P=i([]),k=i([]),X=n({}),o=n({name:"",id:"",sum:"",pay_amount:"",time:"",pay_method:"",files:[],content:"",pay_id:""}),Q=n({tableIndex:0,note:""}),J=i([{value:"Y",text:"Y"},{value:"N",text:"N"}]),y=n({name:"",id:"",clinic_id:""}),C=n({name:"",id:""}),E=n({}),Z=n({}),$=n({}),ee=n({}),te=n({}),ae=n({});n({});const ie=n({}),ne=n({}),oe=n({}),se=n({}),ce=n({}),s=n({name:"",customer_id:"",pay_amount:"",pay_method:"",cheque_number:"",content:"",service_name:"",duration:"",invoice_price:"",time:"",other:"",account_id:""}),m=n({total:0,pageSize:10,currentPage:1,background:!0,pageSizes:[10,25,50,100]}),le=i([{id:1,text:"Paypal",value:"Paypal"},{id:2,text:"VISA",value:"VISA"},{id:3,text:"MasterCard",value:"MasterCard"},{id:4,text:"AMERICAN_EXPRESS",value:"AMERICAN_EXPRESS"},{id:5,text:"Cheque",value:"Cheque"},{id:6,text:"BankTransfer",value:"BankTransfer"},{id:7,text:"Cash",value:"Cash"},{id:8,text:"Other",value:"Other"}]),t=n({order_key:"",material_key:"",truck_key:"",truck_id:"",comment:"",show:"",searchKey:"",clinic_id:"",type:"",role:"",pay_id:"",amount:"",begin_date:"",end_date:"",therapists:"",therapistsArr:[],invoiceTime:[],Total_Amount:"",show_number:!0,is_tax1:!0,is_tax:"Y",include_tax:"Y",hstValue:"",total:"",company_id:"",loacation_name:"",Account:"",location:"",name:"",pkg:"",tel:""}),de=[{type:"selection",width:55,align:"left",hide:({checkList:e})=>!e.includes("勾选列")},{label:"序号列",type:"index",width:70,hide:({checkList:e})=>!e.includes("序号列")},{label:"PayId",prop:"pay_id",minWidth:50,hide:({checkList:e})=>!e.includes("PayId")},{label:"Files",prop:"file",minWidth:50,slot:"files",hide:({checkList:e})=>!e.includes("Files")},{label:"CustomerId",prop:"customer_id",minWidth:100,hide:({checkList:e})=>!e.includes("CustomerId")},{label:"CustomerName",prop:"customername",minWidth:100,hide:({checkList:e})=>!e.includes("CustomerName")},{label:"Pay Amount",prop:"pay_amount",minWidth:100,hide:({checkList:e})=>!e.includes("Pay Amount")},{label:"Account Name",prop:"account_name",minWidth:100,hide:({checkList:e})=>!e.includes("Account Name")},{label:"Invoiced Amount",prop:"balanceInfo",minWidth:120,slot:"balanceInfo",hide:({checkList:e})=>!e.includes("Invoiced Amount")},{label:"Remain Amount",prop:"remain_amount",minWidth:120,hide:({checkList:e})=>!e.includes("Remain Amount")},{label:"Pay Method",prop:"pay_method",minWidth:150,hide:({checkList:e})=>!e.includes("Pay Method")},{label:"Pay Data",prop:"create_time",minWidth:120,hide:({checkList:e})=>!e.includes("Pay Data")},{label:"Collection Time",prop:"collection_time",minWidth:120,hide:({checkList:e})=>!e.includes("Collection Time")},{label:"Action",fixed:"right",width:200,slot:"operation",align:"left",hide:({checkList:e})=>!e.includes("Action")}],re=["PayId","Files","CustomerId","CustomerName","Pay Amount","Account Name","Invoiced Amount","Remain Amount","Pay Method","Pay Data","Collection Time","Action"];function ue(){r()}function me(e){m.pageSize=e,r()}function fe(e){m.currentPage=e,r()}async function r(){t.clinic_id=localStorage.getItem("clinicIdOverall"),l.value=!0;const{data:e}=await Qe(Object.assign(X,{clinic_id:t.clinic_id,searchKey:t.searchKey,options:I,customer_id:h.customer_id,pageSize:m.pageSize,page:m.currentPage}));e.code==1&&(O.value=e.data,m.total=e.total),l.value=!1}const pe=(e,a)=>{};function _e(e){Object.keys(e).map(a=>{E[a]=e[a]})}async function ye(e){const{data:a}=await nt(Object.assign($,{used_id:e.id}));a.code==1?(q(f.value),c({type:"success",message:a.msg})):c({type:"error",message:a.msg})}const he=e=>{R.confirm("Are you sure you want to return this location",{confirmButtonText:"confirm",cancelButtonText:"cancel",type:"warning"}).then(()=>{ye(e)}).catch(()=>{c({type:"info",message:"Canceled"})})};async function q(e){f.value=e;const{data:a}=await Je(Object.assign(ee,{pay_id:f.value.id}));a.code==1?(f.value=a.data,N.value=!0):c({type:"error",message:a.msg})}function ge(){y.clinic_id=t.clinic_id,F.value=!0}function ve(){s.customer_id=y.id,s.name=y.name}async function be(){if(l.value=!0,s.pay_method!="Cheque"&&(s.cheque_number=""),s.pay_method=="Cheque"&&s.cheque_number==""){c({type:"error",message:"Please enter cheque number"}),l.value=!1;return}let e="";if(s.pay_method=="Other"){if(s.other==""){c({type:"error",message:"Please enter pay method"}),l.value=!1;return}e=s.other}else e=s.pay_method;const{data:a}=await Ze(Object.assign(te,{customer_id:s.customer_id,pay_amount:s.pay_amount,pay_method:e,cheque_number:s.cheque_number,content:s.content,collection_time:s.time,account_id:s.account_id}));a.code==1?(r(),c({type:"success",message:a.msg}),M.value=!1):c({type:"error",message:a.msg}),l.value=!1}function Ae(e){e==null&&(s.pay_method="")}async function De(e){t.pay_id=e.id;const{data:a}=await $e(Object.assign(Z,{pay_id:t.pay_id,role:t.role,clinic_id:t.clinic_id}));a.code==1?(P.value=a.data.service,p.value=a.data.Deduction_type,t.amount=a.data.amount,u.value=[a.data.date_period.begin,a.data.date_period.end],D.value=!0):c({type:"error",message:a.msg})}function xe(e){e.is_selected==!0?e.is_selected=!1:e.is_selected=!0}function Pe(e){p.value.forEach((a,d)=>{a.is_selected=!1}),e.is_selected=!0}function Ce(e){const a=new Date;return a.setHours(0,0,0,0),e.getTime()<a.getTime()}function Te(e){const a=new Date;return a.setHours(0,0,0,0),e.getTime()>a.getTime()}async function Ie(){l.value=!0,u.value==null&&(u.value=[]);let e={begin:u.value.length>0?u.value[0]:"",end:u.value.length>0?u.value[1]:""},a={Deduction_type:p.value,amount:t.amount,date_period:e,service:P.value};const{data:d}=await et(Object.assign(ae,{pay_id:t.pay_id,model_data:a,clinic_id:t.clinic_id}));d.code==1?(r(),c({type:"success",message:d.msg}),D.value=!1):c({type:"error",message:d.msg}),l.value=!1}function we(e){e==null&&(u.value=[])}function Se(e){e==null&&(t.invoiceTime=[])}async function We(){const{data:e}=await ot(Object.assign(ie,{searchKey:"",clinic_id:t.clinic_id}));e.code==1&&(x.value=e.data.therapists_user)}function Fe(e){t.pay_id=e.id,t.therapists="",t.therapistsArr=[],t.invoiceTime=[],_.value=[],t.Total_Amount=e.remain_amount,x.value=[],t.company_id="",t.loacation_name="",t.type==2&&We(),A.value=!0}function Me(e){if(t.therapists.includes(e.id)){let a=t.therapistsArr.findIndex(d=>d===e.id);a!==-1&&t.therapistsArr.splice(a,1)}else t.therapistsArr.push(e.id);t.therapists=t.therapistsArr.toString()}async function Ne(){let e="",a="";t.invoiceTime!=null&&t.invoiceTime.length>0&&(e=t.invoiceTime[0],a=t.invoiceTime[1]);const{data:d}=await tt(Object.assign(ne,{clinic_id:t.clinic_id,role:t.role,begin_date:e,end_date:a,therapists:t.therapists,pay_id:t.pay_id}));d.code==1?(d.data.length==0&&c({type:"info",message:"No data"}),_.value=d.data,t.is_tax1=!0,t.is_tax="Y",T()):c({type:"error",message:d.msg})}async function Oe(){l.value=!0;const{data:e}=await at(Object.assign(oe,{clinic_id:t.clinic_id,role:t.role,pay_id:t.pay_id,rows:_.value,is_tax:t.is_tax1,include_tax:t.include_tax,company_id:t.company_id}));e.code==1?(H.value=e.InvoiceArr,A.value=!1,r()):c({type:"error",message:e.msg}),l.value=!1}function je(e){e?t.is_tax="Y":t.is_tax="N",T()}function ke(e){e==null&&(t.include_tax="N"),T()}function T(){let e=t.Total_Amount;t.is_tax1?t.include_tax=="N"?(t.hstValue=Math.round(parseFloat(e)*.13*100)/100,t.total=Math.round(parseFloat(e)*1.13*100)/100):t.include_tax=="Y"&&(t.hstValue=Math.round(parseFloat(e)/1.13*.13*100)/100,t.total=Math.round(parseFloat(e)*100)/100):(t.hstValue=0,t.total=Math.round(parseFloat(e)*100)/100)}function Ee(){W.value=!0}function qe(){t.loacation_name=C.name,t.company_id=C.id}function Be(){v.value=!v.value}function Re(){g.value&&(I.value=g.value.value,r())}function Le(e){Ye(e.deducation_info.id)}async function Ye(e){const{data:a}=await it(Object.assign(se,{used_id:e}));a.code==1?(t.pkg=a.date.info.pkg,t.tel=a.date.info.tel,t.location=a.date.info.location,t.name=a.date.info.name,t.Account=a.date.info.Account,j.value=a.date.detail,S.value=!0):c({type:"error",message:a.msg})}function ze(){r()}function Ve(e){e.length&&(k.value=e,w.value=!0)}function Ue(e){window.open(e)}async function Ge(e){const{data:a}=await st(Object.assign(ce,{pay_id:e.id}));a.code==1?(r(),c({type:"success",message:a.msg})):c({type:"error",message:a.msg})}const Ke=e=>{R.confirm("Are you sure you want to delete this item",{confirmButtonText:"confirm",cancelButtonText:"cancel",type:"warning"}).then(()=>{Ge(e)}).catch(()=>{c({type:"info",message:"Canceled"})})};function He(){o.pay_id="",o.content="",o.pay_amount="",o.time="",o.pay_method="",o.files=[],o.name=h.customer_name,o.id=h.customer_id,o.sum="",b.value=!0}function Xe(e){o.pay_id=e.id,o.content=e.content,o.pay_amount=e.pay_amount,o.time=e.collection_time,o.pay_method=e.pay_method,o.files=e.file,o.name=e.customername,o.id=e.customer_id,o.sum="",b.value=!0}return lt(()=>{t.type=localStorage.getItem("type"),t.type==2&&(t.role="clinic"),t.type==1&&(t.role="therapists"),r()}),{searchDetail:t,btnSearchPart:ue,loading:l,small:U,selectList:re,columns:de,pagination:m,handleSizeChange:me,handleCurrentChange:fe,PartList:O,order_date:G,deliverDialog:Y,selectClick:pe,itemArr:Q,addLocationDialog:z,locationArr:E,EditLocation:_e,btnDellocation:he,singleTableRef:L,infoDialog:N,btnInfo:q,infoArr:f,btnCollection:He,CollectionDialog:M,collectionArr:s,onSelClient:ge,ClientData:y,ClientDialog:F,eventIsNum:ve,btncollectionConfirm:be,payMethodData:le,onPayMethod:Ae,GenerateDialog:D,btnGenerate:De,ServiceData:P,btnService:xe,DeductionType:p,selectedTr:Pe,datePeriod:u,disabledBeforeToday:Ce,btnDatePeriod:we,btnGenerateConfirm:Ie,btnDeducationShow:Le,AccountData:K,btnGenerateInvoice:Fe,invoiceDialog:A,Therapists:x,disabledBeforeToday1:Te,onTherapists:Me,btnInvoiceTime:Se,btnFind:Ne,FindData:_,InvoiceDetailDialog:V,btnSubmitConfirm:Oe,taxData:J,IncludeTax:ke,onIs_tax:je,onSelectLocation:Ee,locationDialog:W,eventIsNumlocation:qe,locationData:C,eventFilter:Re,optionsFilter:g,isShowFilter:v,btnFilterQuery:Be,UsedLogDialog:S,logData:j,addCollectionDialog:b,paymentArr:o,eventPrePay:ze,btnFile:Ve,onFile:Ue,fileDialog:w,fileArr:k,btnDelete:Ke,btnEidt:Xe}}export{Dt as useEqu};