import{d as D,h as E,W as T,l as r,o as c,a as B,x as u,y as a,p as b,b as F,K as y,e as _,f as h,q as H,n as x,E as s,_ as w}from"./index.ecaf1036.js";import{C as N}from"./api.dc5a7f55.js";const q={class:"invoice-form"},U=D({__name:"invoiceForm",props:{invoiceProps:{type:Object,required:!0},type:{type:String,required:!0},page:{type:String,required:!0},showAddInvoiceHeaderDialog:{type:Boolean,required:!0}},emits:["closeDialog"],setup(g,{emit:p}){const i=g,e=E({invoiceInfo:{titleType:0,fapiaoType:0,title:"",taxNo:"",address:"",bankAccount:"",bankName:"",phone:""},invoiceHeaderList:[],limit:10,page:1,total:0,totalPage:null});e.invoiceInfo={...e.invoiceInfo,...i.invoiceProps},T(()=>i.showAddInvoiceHeaderDialog,()=>{i.type==="edit"?e.invoiceInfo={...e.invoiceInfo,...i.invoiceProps}:e.invoiceInfo={titleType:0,fapiaoType:0,title:"",taxNo:"",address:"",bankAccount:"",bankName:"",phone:""}});const m=()=>{p("closeDialog")},d=n=>{if(!n.title)return s({message:"\u8BF7\u8F93\u5165\u53D1\u7968\u62AC\u5934",type:"warning",showClose:!0}),!1;if(n.titleType===1){if(!n.taxNo)return s({message:"\u8BF7\u8F93\u5165\u7EB3\u7A0E\u8BC6\u522B\u53F7",type:"warning",showClose:!0}),!1;if(n.fapiaoType===1){if(!n.bankName)return s({message:"\u8BF7\u8F93\u5165\u5F00\u6237\u94F6\u884C",type:"warning",showClose:!0}),!1;if(!n.bankAccount)return s({message:"\u8BF7\u8F93\u5165\u94F6\u884C\u8D26\u53F7",type:"warning",showClose:!0}),!1;if(!n.address)return s({message:"\u8BF7\u8F93\u5165\u4F01\u4E1A\u5730\u5740",type:"warning",showClose:!0}),!1;if(!n.phone)return s({message:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7",type:"warning",showClose:!0}),!1;const o=/^400-[0-9]{3}-[0-9]{4}|^1[34578]\d{9}$|^800-[0-9]{3}-[0-9]{4}/;if(console.log(o.test(n.phone)),!o.test(n.phone))return s({message:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7",type:"warning",showClose:!0}),!1}}return!0},f=()=>{console.info("submit",i.type),d(e.invoiceInfo)&&N().addInvoiceHeaderApi(e.invoiceInfo,i.type).then(n=>{let{code:o,message:I}=n;if(o!==200){s.error(I);return}s({message:i.type==="edit"?"\u4FEE\u6539\u6210\u529F":"\u6DFB\u52A0\u6210\u529F",type:"success",showClose:!0}),e.invoiceInfo={titleType:0,fapiaoType:0,title:"",taxNo:"",address:"",bankAccount:"",bankName:"",phone:""},p("closeDialog",{type:i.type,invoiceInfo:e.invoiceInfo})})};return(n,o)=>{const I=r("el-radio"),C=r("el-radio-group"),t=r("el-form-item"),A=r("el-option"),V=r("el-select"),v=r("el-input"),k=r("el-form");return c(),B("div",q,[u(k,{"label-width":"120px"},{default:a(()=>[u(t,{label:"\u62AC\u5934\u7C7B\u578B\uFF1A",rules:{required:!0}},{default:a(()=>[u(C,{modelValue:e.invoiceInfo.titleType,"onUpdate:modelValue":o[0]||(o[0]=l=>e.invoiceInfo.titleType=l),class:"ml-4"},{default:a(()=>[u(I,{label:0,size:"small"},{default:a(()=>[b("\u4E2A\u4EBA")]),_:1}),u(I,{label:1,size:"small"},{default:a(()=>[b("\u4F01\u4E1A")]),_:1})]),_:1},8,["modelValue"])]),_:1}),u(t,{label:"\u53D1\u7968\u7C7B\u578B\uFF1A",rules:{required:!0}},{default:a(()=>[u(V,{modelValue:e.invoiceInfo.fapiaoType,"onUpdate:modelValue":o[1]||(o[1]=l=>e.invoiceInfo.fapiaoType=l),class:"w468"},{default:a(()=>[u(A,{label:"\u666E\u901A\u53D1\u7968",value:0}),u(A,{label:"\u4E13\u7528\u53D1\u7968",value:1,disabled:e.invoiceInfo.titleType===0},null,8,["disabled"])]),_:1},8,["modelValue"])]),_:1}),e.invoiceInfo.titleType===1?(c(),F(t,{key:0,label:"\u7A0E\u53F7\uFF1A",rules:{required:!0}},{default:a(()=>[u(v,{placeholder:"\u8BF7\u8F93\u5165\u7EB3\u7A0E\u8BC6\u522B\u53F7",class:"w468",modelValue:e.invoiceInfo.taxNo,"onUpdate:modelValue":o[2]||(o[2]=l=>e.invoiceInfo.taxNo=l)},null,8,["modelValue"])]),_:1})):y("v-if",!0),u(t,{label:"\u53D1\u7968\u62AC\u5934\uFF1A",rules:{required:!0}},{default:a(()=>[u(v,{placeholder:"\u8BF7\u8F93\u5165\u53D1\u7968\u62AC\u5934",class:"w468",modelValue:e.invoiceInfo.title,"onUpdate:modelValue":o[3]||(o[3]=l=>e.invoiceInfo.title=l)},null,8,["modelValue"])]),_:1}),e.invoiceInfo.titleType===1&&e.invoiceInfo.fapiaoType===1?(c(),F(t,{key:1,label:"\u5F00\u6237\u94F6\u884C\uFF1A",rules:{required:!0}},{default:a(()=>[u(v,{placeholder:"\u8BF7\u8F93\u5165\u5F00\u6237\u94F6\u884C",class:"w468",modelValue:e.invoiceInfo.bankName,"onUpdate:modelValue":o[4]||(o[4]=l=>e.invoiceInfo.bankName=l)},null,8,["modelValue"])]),_:1})):y("v-if",!0),e.invoiceInfo.titleType===1&&e.invoiceInfo.fapiaoType===1?(c(),F(t,{key:2,label:"\u94F6\u884C\u8D26\u53F7\uFF1A",rules:{required:!0}},{default:a(()=>[u(v,{placeholder:"\u8BF7\u8F93\u5165\u94F6\u884C\u8D26\u53F7",class:"w468",modelValue:e.invoiceInfo.bankAccount,"onUpdate:modelValue":o[5]||(o[5]=l=>e.invoiceInfo.bankAccount=l)},null,8,["modelValue"])]),_:1})):y("v-if",!0),e.invoiceInfo.titleType===1&&e.invoiceInfo.fapiaoType===1?(c(),F(t,{key:3,label:"\u4F01\u4E1A\u5730\u5740\uFF1A",rules:{required:!0}},{default:a(()=>[u(v,{placeholder:"\u8BF7\u8F93\u5165\u4F01\u4E1A\u5730\u5740",class:"w468",modelValue:e.invoiceInfo.address,"onUpdate:modelValue":o[6]||(o[6]=l=>e.invoiceInfo.address=l)},null,8,["modelValue"])]),_:1})):y("v-if",!0),e.invoiceInfo.titleType===1&&e.invoiceInfo.fapiaoType===1?(c(),F(t,{key:4,label:"\u4F01\u4E1A\u7535\u8BDD\uFF1A",rules:{required:!0}},{default:a(()=>[u(v,{placeholder:"\u8BF7\u8F93\u5165\u4F01\u4E1A\u7535\u8BDD",class:"w468",modelValue:e.invoiceInfo.phone,"onUpdate:modelValue":o[7]||(o[7]=l=>e.invoiceInfo.phone=l)},null,8,["modelValue"])]),_:1})):y("v-if",!0),u(t,null,{default:a(()=>[_("div",{class:"btns",style:x({justifyContent:i.page==="dialog"?"flex-end":""})},[_("div",{class:"cancel-btn",onClick:m},"\u53D6\u6D88"),_("div",{class:h([i.page==="dialog"?"confirm-btn":"submit-btn"]),onClick:f},H(i.page==="dialog"?"\u786E\u5B9A":"\u63D0\u4EA4"),3)],4)]),_:1})]),_:1})])}}});const P=w(U,[["__scopeId","data-v-93b2c0e5"],["__file","/data/jenkins/workspace/pay.ws.baibaodun.com.cn/src/components/invoiceForm.vue"]]),j=D({__name:"invoiceHeaderDialog",props:{showAddInvoiceHeaderDialog:{type:Boolean,required:!0},type:{type:String,required:!0},invoiceInfo:{type:Object,required:!0}},emits:["closeAddInvoiceHeaderDialog","updateInvoiceHeader"],setup(g,{emit:p}){const i=g,e=m=>{if(!m){p("closeAddInvoiceHeaderDialog");return}let{type:d,invoiceInfo:f}=m;d=="edit"?p("updateInvoiceHeader",{invoice:f,type:d}):p("updateInvoiceHeader",{invoice:f,type:"add"})};return(m,d)=>{const f=r("el-dialog");return c(),B("div",null,[u(f,{title:g.type==="edit"?"\u7F16\u8F91\u53D1\u7968\u62AC\u5934":"\u6DFB\u52A0\u53D1\u7968\u62AC\u5934",modelValue:i.showAddInvoiceHeaderDialog,"onUpdate:modelValue":d[0]||(d[0]=n=>i.showAddInvoiceHeaderDialog=n),onClose:e},{default:a(()=>[u(P,{onCloseDialog:e,invoiceProps:i.invoiceInfo,type:i.type,page:"dialog",showAddInvoiceHeaderDialog:i.showAddInvoiceHeaderDialog},null,8,["invoiceProps","type","showAddInvoiceHeaderDialog"])]),_:1},8,["title","modelValue"])])}}}),O=w(j,[["__file","/data/jenkins/workspace/pay.ws.baibaodun.com.cn/src/components/invoiceHeaderDialog.vue"]]);export{O as i};