invoice-form.b518db57.js 4.8 KB

1
  1. import{_ as W,d as ee,w as p,ag as A,bZ as ue,X as le,z as ae,r as m,o as r,G as v,C as n,l as s,u as c,aR as oe,a as C,bP as N,bw as R,c as w,F as I,D as T,b as te,M as Y,aY as B,ae as ne,b_ as re,b$ as se}from"./index.88f7d256.js";import{t as pe}from"./_details.7c6ddbaa.js";import{i as de}from"./_rules.1ebcf188.js";import{I as ie}from"./status.2df4810d.js";import{I as M}from"./global.9ad647c8.js";const ce={"w-full":""},me=ee({__name:"invoice-form",emits:["change"],setup(ve,{expose:H,emit:j}){const D=p(!1),E=p([]),f=p([]),d=p("1"),S=p(!1),L=["png","jpg","bmp","jpeg"].map(l=>"image/"+l),U=A(()=>pe[d.value]||[]),$=p({...de}),x=p(null),O=A(()=>d.value==="1"),_=p(""),a=p({currentValue:""}),P=ue(),q=le(),z=({type:l,size:e})=>{if(!L.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 G(){f.value=[],E.value=[],a.value={}}function K(){x.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}),D.value=!1}})}function X(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,V,g,u]=i,k=g.slice(0,4),o=g.slice(4,6),h=g.slice(6);a.value={invoiceType:F,invCode:y,subtotal_amount:V,open_time:ne(`${k}-${o}-${h}`).format("YYYY-MM-DD HH:mm:ss"),invNumber:b,checkNumber:u},_.value=""}const Z=async({file:l})=>{const e=new FormData;e.append("img",l),e.append("token",P.token);const{message:t,code:F,data:i}=await re(e);q({message:t,code:F,handler:()=>{i.forEach(({url:y,name:b})=>{f.value.push({inv_img:se+"/"+y,invName:b,invType:"2"})})}})},J=l=>{const e=E.value.findIndex(({uid:t})=>t===l.uid);return f.value.splice(e,1),!0};ae(()=>U.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 H({onDisplay:()=>D.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"),V=m("el-date-picker"),g=m("el-dialog");return r(),v(g,{modelValue:D.value,"onUpdate:modelValue":e[3]||(e[3]=u=>D.value=u),onClose:G,"close-on-click-modal":!1},{default:n(()=>[s(c(oe),{"label-width":"100px",model:a.value,rules:$.value,ref_key:"formRef",ref:x,size:"small"},{default:n(()=>[s(i,{label:"\u53D1\u7968\u4E0A\u4F20\u65B9\u5F0F"},{default:n(()=>[s(F,{modelValue:d.value,"onUpdate:modelValue":e[0]||(e[0]=u=>d.value=u)},{default:n(()=>[s(t,{label:"\u624B\u5DE5\u6DFB\u52A0",value:"1"}),s(t,{label:"ocr\u8BC6\u522B",value:"2"})]),_:1},8,["modelValue"])]),_:1}),C(" \u626B\u7801\u67AA\u8BC6\u522B "),c(O)?(r(),v(i,{key:0,label:"\u626B\u7801\u67AA"},{default:n(()=>[s(c(N),R({type:"textarea",placeholder:"\u8BF7\u5728\u626B\u7801\u5B8C\u6210\u540E\u624B\u52A8\u56DE\u8F66",onKeydown:X,modelValue:_.value,"onUpdate:modelValue":e[1]||(e[1]=u=>_.value=u)},c(M)),null,16,["modelValue"])]),_:1})):C("v-if",!0),(r(!0),w(I,null,T(c(U),(u,k)=>(r(),v(i,{label:u.label,prop:u.prop,key:k},{default:n(()=>[u.prop==="invoiceType"?(r(),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(()=>[(r(!0),w(I,null,T(c(ie),(o,h)=>(r(),v(t,{label:o.label,value:o.hwy_value,key:h},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):u.prop==="inv_img"?(r(),w(I,{key:1},[C(' list-type="picture" '),te("div",ce,[s(b,{class:"upload-demo","file-list":E.value,"onUpdate:fileList":e[2]||(e[2]=o=>E.value=o),"before-upload":z,"before-remove":J,"http-request":Z,multiple:""},{default:n(()=>[s(y,{type:"primary"},{default:n(()=>[Y("\u4E0A\u4F20\u56FE\u7247")]),_:1})]),_:1},8,["file-list"])])],64)):u.prop==="open_time"?(r(),v(V,{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"])):(r(),v(c(N),R({key:3,modelValue:a.value[u.prop],"onUpdate:modelValue":o=>a.value[u.prop]=o},c(M)),null,16,["modelValue","onUpdate:modelValue"]))]),_:2},1032,["label","prop"]))),128)),s(i,{class:"justify-end flex w-full"},{default:n(()=>[s(y,{type:"primary",loading:S.value,onClick:K},{default:n(()=>[Y("\u4FDD\u5B58")]),_:1},8,["loading"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}});var be=W(me,[["__scopeId","data-v-9ebdc78a"],["__file","D:/work/accout-vue3-ui2/settle-vue3/src/views/supplierOrder/sendOrderInvoiceRelive/components/invoice-form.vue"]]);export{be as default};