import{t as P,a as W}from"./configs.e055d2d5.js";import{c as z}from"./index.bebfbdc5.js";import{u as G}from"./use-response-handle.f995d678.js";import{h as Q,b as X}from"./index.76b641e9.js";import{_ as Z,q as ee,B as d,a2 as A,bg as ae,E as le,aY as oe,r as m,o as u,K as i,H as s,t as r,v as f,bp as S,P as ue,n as F,J as Y,I as j,bd as te,S as ne,aF as E,aM as se,V as re,W as pe,p as de}from"./index.7a111e62.js";import{i as ce}from"./status.8b8d6c88.js";const me=k=>(re("data-v-426b8982"),k=k(),pe(),k),ie={key:1},_e=["src"],ve={key:1,class:"text"},fe=me(()=>de("span",null,"\u5927\u5C0F:\u5C0F\u4E8E1M; \u5C3A\u5BF8:100*100; \u7C7B\u578B:jpg.png.bmp.jpeg",-1)),ye=ne("\u4FDD\u5B58"),ge=ee({__name:"create-ticket-dialog",setup(k,{expose:M}){const B=d(!1),T=["png","jpg","bmp","jpeg"].map(o=>"image/"+o),w=d(""),_=d(""),V=d(!1),l=d({}),U=d(null),I=A(()=>P[_.value]||[]),H=A(()=>_.value==="1"),c=d(""),x=d({...W}),R=ae(),N=G(),q=({type:o,size:a})=>{if(!T.includes(o))return E.error("\u8BF7\u4E0A\u4F20jpg.png.bmp.jpeg\u7C7B\u578B\u56FE\u7247"),!1;if(a/1024/1024>1)return E.error("\u56FE\u7247\u5927\u5C0F\u8D85\u8FC71M"),!1};function K(){U.value.validate(async o=>{if(!o)return;V.value=!0;const{code:a,message:t}=await z({payNo:w.value,invType:_.value,...l.value});N({code:a,message:t,handler:()=>B.value=!1}),V.value=!1})}function $(){l.value={},_.value="",c.value=""}function J(o){const{keyCode:a}=o;if(a!==13)return;if(c.value.indexOf("\uFF0C")>=0)return E.error("\u4E0D\u80FD\u5305\u542B\u4E2D\u6587\u9017\u53F7"),c.value="";const[t,v,...p]=c.value.split(","),[y,g,h,b,e]=p,D=b.slice(0,4),n=b.slice(4,6),C=b.slice(6);l.value={invoiceType:v,invCode:y,subtotal_amount:h,open_time:se(`${D}-${n}-${C}`).format("YYYY-MM-DD HH:mm:ss"),invNumber:g,checkNumber:e},c.value=""}const L=async({file:o})=>{const a=new FormData;a.append("img",o),a.append("token",R.token);const{message:t,code:v,data:p}=await Q(a);N({message:t,code:v,handler:()=>{const{url:y,name:g}=p[0];l.value.inv_img=X+"/"+y,l.value.invName=g}})};le(()=>I.value,o=>{const a={};o.forEach(t=>a[t.prop]=""),l.value=a}),oe(()=>x.value.checkNumber[0].required=l.value.invoiceType!=="01");const O=o=>o.getTime()>Date.now();return M({onDisplay:o=>{B.value=!0,w.value=o}}),(o,a)=>{const t=m("el-option"),v=m("el-select"),p=m("el-form-item"),y=m("el-upload"),g=m("el-date-picker"),h=m("el-button"),b=m("el-dialog");return u(),i(b,{modelValue:B.value,"onUpdate:modelValue":a[2]||(a[2]=e=>B.value=e),"custom-class":"ticket__dialog",title:"\u6DFB\u52A0\u53D1\u7968",center:"","destroy-on-close":"",onClose:$},{default:s(()=>[r(f(te),{"label-width":"100px",model:l.value,rules:x.value,ref_key:"formRef",ref:U},{default:s(()=>[r(p,{label:"\u7533\u8BF7\u7C7B\u578B"},{default:s(()=>[r(v,{modelValue:_.value,"onUpdate:modelValue":a[0]||(a[0]=e=>_.value=e)},{default:s(()=>[r(t,{label:"\u624B\u5DE5\u6DFB\u52A0",value:"1"}),r(t,{label:"ocr\u8BC6\u522B",value:"2"})]),_:1},8,["modelValue"])]),_:1}),f(H)?(u(),i(p,{key:0,label:"\u626B\u7801\u67AA"},{default:s(()=>[r(f(S),{type:"textarea",onKeydown:J,modelValue:c.value,"onUpdate:modelValue":a[1]||(a[1]=e=>c.value=e)},null,8,["modelValue"])]),_:1})):ue("",!0),(u(!0),F(j,null,Y(f(I),(e,D)=>(u(),i(p,{label:e.label,prop:e.prop,key:D},{default:s(()=>[e.prop==="invName"?(u(),i(v,{key:0,modelValue:l.value[e.prop],"onUpdate:modelValue":n=>l.value[e.prop]=n,placeholder:"\u8BF7\u9009\u62E9\u53D1\u7968\u540D\u79F0"},{default:s(()=>[(u(!0),F(j,null,Y(f(ce),(n,C)=>(u(),i(t,{label:n.label,value:n.hwy_value,key:C},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.prop==="inv_img"?(u(),F("div",ie,[r(y,{class:"upload","before-upload":q,"http-request":L,"show-file-list":!1},{default:s(()=>[l.value[e.prop]?(u(),F("img",{key:0,class:"avatar",src:l.value[e.prop]},null,8,_e)):(u(),F("div",ve,"\u70B9\u51FB\u4E0A\u4F20"))]),_:2},1024),fe])):e.prop==="open_time"?(u(),i(g,{key:2,modelValue:l.value[e.prop],"onUpdate:modelValue":n=>l.value[e.prop]=n,"disabled-date":O,"value-format":"YYYY-MM-DD HH:mm:ss",placeholder:"\u8BF7\u8F93\u5165\u5F00\u7968\u65E5\u671F"},null,8,["modelValue","onUpdate:modelValue"])):(u(),i(f(S),{key:3,modelValue:l.value[e.prop],"onUpdate:modelValue":n=>l.value[e.prop]=n},null,8,["modelValue","onUpdate:modelValue"]))]),_:2},1032,["label","prop"]))),128)),r(p,{"justify-end":"",flex:"","w-full":""},{default:s(()=>[r(h,{type:"primary",loading:V.value,onClick:K},{default:s(()=>[ye]),_:1},8,["loading"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}});var De=Z(ge,[["__scopeId","data-v-426b8982"]]);export{De as default};
