import{C as y}from"./api.7608f319.js";import{d as x,a as A,c as C,f as d,g as r,P as F,Q as P,l as h,h as a,k,i as D,m as b,U as N,y as L,z as B,o as S,E as H,M,K as T}from"./index.2c7321ca.js";import{_ as U}from"./invoiceHeaderDialog.vue_vue_type_script_setup_true_lang.cec105a1.js";import{_ as $}from"./_plugin-vue_export-helper.cdc0426e.js";const V="/assets/no_invoice_img.38fa28ab.png",z=i=>(L("data-v-598efa0e"),i=i(),B(),i),J={class:"invoice-header-list-comp"},K=["onClick"],O={key:0,class:"has-invoice"},Q={class:"title"},j={class:"invoice-type"},q={class:"btns"},G=["onClick"],R=["onClick"],W=z(()=>a("span",{class:"add-tip"},"\u6DFB\u52A0\u65B0\u53D1\u7968\u5730\u5740",-1)),X=x({__name:"invoiceHeaderListComp",props:{invoiceHeaderList:null},emits:["updateInvoiceHeader","delInvoice","chooseInvoiceItem"],setup(i,{emit:e}){const l=i,s=A({showAddInvoiceHeaderDialog:!1,type:"add",invoiceInfo:{}}),m=o=>{e("chooseInvoiceItem",{index:o})},g=(o,t)=>{console.info("type invoice",t,o),s.type=t,t==="edit"&&(s.invoiceInfo=o),s.showAddInvoiceHeaderDialog=!0},I=()=>{s.showAddInvoiceHeaderDialog=!1},f=o=>{e("updateInvoiceHeader",o),s.showAddInvoiceHeaderDialog=!1},c=(o,t)=>{N.confirm("\u786E\u8BA4\u8981\u5220\u9664\u5417\uFF1F","\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88"}).then(()=>{e("delInvoice",{invoice:o,index:t})}).catch(()=>{})};return(o,t)=>{const _=C("Plus"),p=C("el-icon");return d(),r("div",J,[(d(!0),r(F,null,P(l.invoiceHeaderList,(n,u)=>(d(),r("div",{class:"invoice-header-item",key:u,onClick:v=>m(u)},[JSON.stringify(n)!=="{}"?(d(),r("div",O,[a("div",Q,k(n.title),1),a("div",j,"\u53D1\u7968\u7C7B\u578B\uFF1A"+k(n.fapiaoType===0?"\u589E\u503C\u7A0E\u7535\u5B50\u666E\u901A\u53D1\u7968":"\u589E\u503C\u7A0E\u7535\u5B50\u4E13\u7528\u53D1\u7968"),1),a("div",q,[a("div",{class:"edit-btn",onClick:D(v=>g(n,"edit"),["stop"])},"\u7F16\u8F91",8,G),a("div",{class:"del-btn",onClick:D(v=>c(n,u),["stop"])},"\u5220\u9664",8,R)])])):(d(),r("div",{key:1,class:"no-invoice",onClick:g},[h(p,{size:"32",color:"#909399"},{default:b(()=>[h(_)]),_:1}),W]))],8,K))),128)),h(U,{showAddInvoiceHeaderDialog:s.showAddInvoiceHeaderDialog,type:s.type,invoiceInfo:s.invoiceInfo,onUpdateInvoiceHeader:f,onCloseAddInvoiceHeaderDialog:I},null,8,["showAddInvoiceHeaderDialog","type","invoiceInfo"])])}}});const Y=$(X,[["__scopeId","data-v-598efa0e"]]),Z=i=>(L("data-v-374fa4b8"),i=i(),B(),i),ee={class:"invoice-manage"},oe={class:"right"},te={class:"content"},ie={style:{width:"100%",padding:"20px 35px"}},se={key:1,class:"empty-container"},ne=Z(()=>a("img",{src:V,class:"no-invoice-img"},null,-1)),ae=[ne],ce={key:0,class:"page-container"},de=x({__name:"index",setup(i){const e=A({invoiceHeaderList:[],limit:10,page:1,total:0,totalPage:0});S(()=>{l()});const l=()=>{let c={limit:e.limit,page:e.page};y().getInvoiceHeaderListApi(c).then(o=>{let{code:t,message:_,data:p}=o;if(t!==200){H.error(_);return}let{list:n,limit:u,page:v,totalPage:w,total:E}=p;e.invoiceHeaderList=v===1?[{},...n]:n,e.limit=u,e.page=v,e.totalPage=w,e.total=E})},s=c=>{l()},m=c=>{let{invoice:o,index:t}=c,_={id:o.id};y().delInvoiceHeaderApi(_).then(p=>{let{code:n,message:u}=p;if(n!==200){H.error(u);return}e.invoiceHeaderList.splice(t,1),H({message:"\u5220\u9664\u6210\u529F",type:"success",showClose:!0}),l()})},g=c=>{e.page=c,l()},I=()=>{e.page-=1,l()},f=()=>{e.page+=1,l()};return(c,o)=>{const t=C("el-pagination");return d(),r("div",ee,[a("div",oe,[a("div",te,[a("div",ie,[e.invoiceHeaderList.length?(d(),M(Y,{key:0,invoiceHeaderList:e.invoiceHeaderList,onUpdateInvoiceHeader:s,onDelInvoice:m},null,8,["invoiceHeaderList"])):(d(),r("div",se,ae))]),e.invoiceHeaderList.length>0?(d(),r("div",ce,[h(t,{background:"",layout:"prev, pager, next",total:e.total,onCurrentChange:g,onPrevClick:I,onNextClick:f},null,8,["total"])])):T("",!0)])])])}}});const pe=$(de,[["__scopeId","data-v-374fa4b8"]]);export{pe as default};
