import{t as W,a as z}from"./configs.a31a4c72.js";import{c as G}from"./index.81aab67e.js";import{u as Q}from"./use-response-handle.23bba72b.js";import{h as X,b as Z}from"./index.a762c091.js";import{_ as ee,q as ae,B as d,a2 as A,bl as le,E as oe,b0 as ue,r as m,o as u,K as i,H as s,t as r,v as f,bu as S,P as te,n as b,J as j,I as T,bi as ne,S as se,aF as E,aN as re,V as pe,W as de,p as ce}from"./index.10c3f8e5.js";import{i as me}from"./status.7319085b.js";const ie=k=>(pe("data-v-ed2842d2"),k=k(),de(),k),_e={key:1},ve=["src"],fe={key:1,class:"text"},ye=ie(()=>ce("span",null,"\u5927\u5C0F:\u5C0F\u4E8E1M; \u5C3A\u5BF8:100*100; \u7C7B\u578B:jpg.png.bmp.jpeg",-1)),ge=se("\u4FDD\u5B58"),Fe=ae({__name:"create-ticket-dialog",emits:["reload"],setup(k,{expose:Y,emit:H}){const B=d(!1),M=["png","jpg","bmp","jpeg"].map(o=>"image/"+o),w=d(""),_=d(""),V=d(!1),l=d({}),U=d(null),I=A(()=>W[_.value]||[]),R=A(()=>_.value==="1"),c=d(""),N=d({...z}),q=le(),x=Q(),K=({type:o,size:a})=>{if(!M.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 $(){U.value.validate(async o=>{if(!o)return;V.value=!0;const{code:a,message:t}=await G({payNo:w.value,invType:_.value,...l.value});x({code:a,message:t,handler:()=>{B.value=!1,H("reload")}}),V.value=!1})}function J(){l.value={},_.value="",c.value=""}function L(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,F,e]=p,D=F.slice(0,4),n=F.slice(4,6),C=F.slice(6);l.value={invoiceType:v,invCode:y,subtotal_amount:h,open_time:re(`${D}-${n}-${C}`).format("YYYY-MM-DD HH:mm:ss"),invNumber:g,checkNumber:e},c.value=""}const O=async({file:o})=>{const a=new FormData;a.append("img",o),a.append("token",q.token);const{message:t,code:v,data:p}=await X(a);x({message:t,code:v,handler:()=>{const{url:y,name:g}=p[0];l.value.inv_img=Z+"/"+y,l.value.invName=g}})};oe(()=>I.value,o=>{const a={};o.forEach(t=>a[t.prop]=""),l.value=a}),ue(()=>N.value.checkNumber[0].required=l.value.invoiceType!=="01");const P=o=>o.getTime()>Date.now();return Y({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"),F=m("el-dialog");return u(),i(F,{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:J},{default:s(()=>[r(f(ne),{"label-width":"100px",model:l.value,rules:N.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(R)?(u(),i(p,{key:0,label:"\u626B\u7801\u67AA"},{default:s(()=>[r(f(S),{type:"textarea",onKeydown:L,modelValue:c.value,"onUpdate:modelValue":a[1]||(a[1]=e=>c.value=e)},null,8,["modelValue"])]),_:1})):te("",!0),(u(!0),b(T,null,j(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),b(T,null,j(f(me),(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(),b("div",_e,[r(y,{class:"upload","before-upload":K,"http-request":O,"show-file-list":!1},{default:s(()=>[l.value[e.prop]?(u(),b("img",{key:0,class:"avatar",src:l.value[e.prop]},null,8,ve)):(u(),b("div",fe,"\u70B9\u51FB\u4E0A\u4F20"))]),_:2},1024),ye])):e.prop==="open_time"?(u(),i(g,{key:2,modelValue:l.value[e.prop],"onUpdate:modelValue":n=>l.value[e.prop]=n,"disabled-date":P,"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:$},{default:s(()=>[ge]),_:1},8,["loading"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}});var Ce=ee(Fe,[["__scopeId","data-v-ed2842d2"]]);export{Ce as default};
