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