1 |
- import{_ as Z,d as ee,E as p,af as N,bE as ue,a6 as le,H as ae,x as m,o as s,N as v,K as n,y as r,a as C,u as c,c1 as A,bs as R,c as w,M as T,L as U,aK as oe,W as M,aS as B,ah as te,b as ne,bF as se,bG as re}from"./index.743f0c80.js";import{b as pe}from"./_details.7ed0eccb.js";import{i as de}from"./_rules.1a544eb3.js";import{h as ie}from"./status.868e86c0.js";import{I as H}from"./global.9ad647c8.js";import"./_opitons.90d80463.js";const ce={"w-full":""},me=M("\u4E0A\u4F20\u56FE\u7247"),ve=M("\u4FDD\u5B58"),fe=ee({__name:"invoice-form",emits:["change"],setup(_e,{expose:Y,emit:j}){const g=p(!1),V=p([]),f=p([]),d=p("1"),S=p(!1),K=["png","jpg","bmp","jpeg"].map(l=>"image/"+l),x=N(()=>pe[d.value]||[]),L=p({...de}),I=p(null),$=N(()=>d.value==="1"),_=p(""),a=p({currentValue:""}),q=ue(),G=le(),P=({type:l,size:e})=>{if(!K.includes(l))return B.error("\u8BF7\u4E0A\u4F20jpg.png.bmp.jpeg\u7C7B\u578B\u56FE\u7247"),!1;if(e/1024/1024>1)return B.error("\u56FE\u7247\u5927\u5C0F\u8D85\u8FC71M"),!1};function z(){f.value=[],V.value=[],a.value={}}function O(){I.value.validate(async l=>{if(!!l){if(!d.value)return B.error("\u8BF7\u9009\u62E9\u7533\u8BF7\u7C7B\u578B");if(d.value==="2"){if(!f.value.length)return B.error("\u8BF7\u9009\u62E9\u4E0A\u4F20\u7684\u56FE\u7247");if(f.value.length>100)return B.error("\u4E0A\u4F20\u56FE\u7247\u4E0D\u80FD\u8D85\u8FC7100\u5F20")}j("change",d.value==="2"?f.value:{...a.value,invType:d.value}),g.value=!1}})}function W(l){const{keyCode:e}=l;if(e!==13)return;if(_.value.indexOf("\uFF0C")>=0)return B.error("\u4E0D\u80FD\u5305\u542B\u4E2D\u6587\u9017\u53F7"),_.value="";const[t,F,...i]=_.value.split(","),[y,b,D,E,u]=i,h=E.slice(0,4),o=E.slice(4,6),k=E.slice(6);a.value={invoiceType:F,invCode:y,subtotal_amount:D,open_time:te(`${h}-${o}-${k}`).format("YYYY-MM-DD HH:mm:ss"),invNumber:b,checkNumber:u},_.value=""}const X=async({file:l})=>{const e=new FormData;e.append("img",l),e.append("token",q.token);const{message:t,code:F,data:i}=await se(e);G({message:t,code:F,handler:()=>{i.forEach(({url:y,name:b})=>{f.value.push({inv_img:re+"/"+y,invName:b,invType:"2"})})}})},J=l=>{const e=V.value.findIndex(({uid:t})=>t===l.uid);return f.value.splice(e,1),!0};ae(()=>x.value,l=>{const e={};e.payNo=a.value.payNo,l.forEach(t=>{t.prop!=="payNo"&&(e[t.prop]="")}),a.value=e});const Q=l=>l.getTime()>Date.now();return Y({onDisplay:()=>g.value=!0}),(l,e)=>{const t=m("el-option"),F=m("el-select"),i=m("el-form-item"),y=m("el-button"),b=m("el-upload"),D=m("el-date-picker"),E=m("el-dialog");return s(),v(E,{modelValue:g.value,"onUpdate:modelValue":e[3]||(e[3]=u=>g.value=u),onClose:z},{default:n(()=>[r(c(oe),{"label-width":"100px",model:a.value,rules:L.value,ref_key:"formRef",ref:I,size:"small"},{default:n(()=>[r(i,{label:"\u53D1\u7968\u4E0A\u4F20\u65B9\u5F0F"},{default:n(()=>[r(F,{modelValue:d.value,"onUpdate:modelValue":e[0]||(e[0]=u=>d.value=u)},{default:n(()=>[r(t,{label:"\u624B\u5DE5\u6DFB\u52A0",value:"1"}),r(t,{label:"ocr\u8BC6\u522B",value:"2"})]),_:1},8,["modelValue"])]),_:1}),C(" \u626B\u7801\u67AA\u8BC6\u522B "),c($)?(s(),v(i,{key:0,label:"\u626B\u7801\u67AA"},{default:n(()=>[r(c(A),R({type:"textarea",placeholder:"\u8BF7\u5728\u626B\u7801\u5B8C\u6210\u540E\u624B\u52A8\u56DE\u8F66",onKeydown:W,modelValue:_.value,"onUpdate:modelValue":e[1]||(e[1]=u=>_.value=u)},c(H)),null,16,["modelValue"])]),_:1})):C("v-if",!0),(s(!0),w(U,null,T(c(x),(u,h)=>(s(),v(i,{label:u.label,prop:u.prop,key:h},{default:n(()=>[u.prop==="invoiceType"?(s(),v(F,{key:0,modelValue:a.value[u.prop],"onUpdate:modelValue":o=>a.value[u.prop]=o,placeholder:"\u8BF7\u9009\u62E9\u53D1\u7968\u7C7B\u578B","w-750px":""},{default:n(()=>[(s(!0),w(U,null,T(c(ie),(o,k)=>(s(),v(t,{label:o.label,value:o.hwy_value,key:k},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):u.prop==="inv_img"?(s(),w(U,{key:1},[C(' list-type="picture" '),ne("div",ce,[r(b,{class:"upload-demo","file-list":V.value,"onUpdate:file-list":e[2]||(e[2]=o=>V.value=o),"before-upload":P,"before-remove":J,"http-request":X,multiple:""},{default:n(()=>[r(y,{type:"primary"},{default:n(()=>[me]),_:1})]),_:1},8,["file-list"])])],64)):u.prop==="open_time"?(s(),v(D,{key:2,modelValue:a.value[u.prop],"onUpdate:modelValue":o=>a.value[u.prop]=o,"disabled-date":Q,"value-format":"YYYY-MM-DD HH:mm:ss",placeholder:"\u8BF7\u8F93\u5165\u5F00\u7968\u65E5\u671F"},null,8,["modelValue","onUpdate:modelValue"])):(s(),v(c(A),R({key:3,modelValue:a.value[u.prop],"onUpdate:modelValue":o=>a.value[u.prop]=o},c(H)),null,16,["modelValue","onUpdate:modelValue"]))]),_:2},1032,["label","prop"]))),128)),r(i,{class:"justify-end flex w-full"},{default:n(()=>[r(y,{type:"primary",loading:S.value,onClick:O},{default:n(()=>[ve]),_:1},8,["loading"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}});var Ve=Z(fe,[["__scopeId","data-v-b7f94826"],["__file","D:/work/accout-vue3-ui/src/views/purchase/ticketReturnRelive/components/invoice-form.vue"]]);export{Ve as default};
|