123456 |
- import{_ as te,d as ne,x as v,ah as M,c_ as se,X as ie,A as Y,r as f,o as i,G as g,D as d,l as F,m as o,aQ as de,a as k,co as $,bJ as O,c as w,F as H,E as L,df as pe,M as N,h as ce,aZ as c,ae as me,c$ as ve,d0 as fe}from"./index.js";import{t as Fe}from"./_details.7e8f00e4.js";import{I as P}from"./global.9ad647c8.js";const he={payNo:{trigger:"change",required:!0,message:"\u8BF7\u9009\u62E9\u8BA2\u5355"},invArr:{required:!0,message:"\u8BF7\u4E0A\u4F20\u53D1\u7968",validator(b,n){return n.length!==0}}},_e={payNo:[{trigger:"blur",message:"\u8BF7\u9009\u62E9\u8BA2\u5355",required:!0}],invoiceType:[{trigger:"blur",message:"\u8BF7\u9009\u62E9\u53D1\u7968\u7C7B\u578B",required:!0}],invType:[{trigger:"blur",message:"\u8BF7\u9009\u62E9\u7533\u8BF7\u65B9\u5F0F",required:!0}],invNumber:[{trigger:"blur",required:!0,validator(b,n,a){n===""?a(new Error("\u53D1\u7968\u53F7\u7801\u4E0D\u80FD\u4E3A\u7A7A!")):/^\d+(\.\d+)?$/.test(n)?a():a(new Error("\u53D1\u7968\u53F7\u7801\u5FC5\u987B\u4E3A\u6570\u5B57"))}}],invCode:[{required:!0,validator(b,n,a){n===""?a(new Error("\u53D1\u7968\u4EE3\u7801\u4E0D\u80FD\u4E3A\u7A7A!")):/^\d+(\.\d+)?$/.test(n)?a():a(new Error("\u53D1\u7968\u4EE3\u7801\u5FC5\u987B\u4E3A\u6570\u5B57"))}}],open_time:[{trigger:"blur",message:"\u8BF7\u9009\u62E9\u5F00\u7968\u65F6\u95F4",required:!0}],subtotal_amount:[{trigger:"blur",required:!0,validator(b,n,a){n===""?a(new Error("\u7A0E\u524D\u91D1\u989D\u4E0D\u80FD\u4E3A\u7A7A!")):/^\d+(\.\d+)?$/.test(n)?a():a(new Error("\u7A0E\u524D\u91D1\u989D\u5FC5\u987B\u4E3A\u6570\u5B57\u4E14\u4E0D\u80FD\u4E3A\u8D1F\u6570!"))}}],invName:[{trigger:"blur",message:"\u8BF7\u8F93\u5165\u53D1\u7968\u540D\u79F0",required:!0}],checkNumber:[{trigger:"blur",message:"\u8BF7\u8F93\u5165\u6821\u9A8C\u7801",required:!0}]};const Ee={key:1,"w-full":""},ge={class:"justify-end flex w-full"},De=ne({__name:"invoice-form",emits:["change"],setup(b,{expose:n,emit:a}){const _=v(!1),h=v([]),m=v([]),p=v("1"),R=v(!1),z=["png","jpg","bmp","jpeg"].map(e=>"image/"+e),T=v({..._e}),x=v(null),G=M(()=>p.value==="1"),D=v(""),l=v({currentValue:""}),K=se(),X=ie(),J=["invCode","checkNumber"],S=M(()=>Fe[p.value]||[]),Q=({type:e,size:u})=>{if(!z.includes(e))return c.error("\u8BF7\u4E0A\u4F20jpg.png.bmp.jpeg\u7C7B\u578B\u56FE\u7247"),!1;if(u/1024/1024>1)return c.error("\u56FE\u7247\u5927\u5C0F\u8D85\u8FC71M"),!1};function Z(){m.value=[],h.value=[],l.value={}}function W(){x.value.validate(async e=>{if(!!e){if(!p.value)return c.error("\u8BF7\u9009\u62E9\u7533\u8BF7\u7C7B\u578B");if(p.value==="2"){if(!m.value.length)return c.error("\u8BF7\u9009\u62E9\u4E0A\u4F20\u7684\u56FE\u7247");if(m.value.length>100)return c.error("\u4E0A\u4F20\u56FE\u7247\u4E0D\u80FD\u8D85\u8FC7100\u5F20")}a("change",p.value==="2"?m.value:{...o(l),invType:o(p)}),_.value=!1}})}function ee(){x.value.validate(async e=>{if(!!e){if(!p.value)return c.error("\u8BF7\u9009\u62E9\u7533\u8BF7\u7C7B\u578B");if(p.value==="2"){if(!m.value.length)return c.error("\u8BF7\u9009\u62E9\u4E0A\u4F20\u7684\u56FE\u7247");if(m.value.length>100)return c.error("\u4E0A\u4F20\u56FE\u7247\u4E0D\u80FD\u8D85\u8FC7100\u5F20")}a("change",p.value==="2"?m.value:{...o(l),invType:o(p)}),l.value={}}})}function ue(e){const{keyCode:u}=e;if(u!==13)return;if(D.value.indexOf("\uFF0C")>=0)return c.error("\u4E0D\u80FD\u5305\u542B\u4E2D\u6587\u9017\u53F7"),D.value="";const t=D.value.split(",");if(t.length!==8&&t.length!==9){c.error("\u626B\u7801\u67AA\u8BC6\u522B\u6570\u636E\u683C\u5F0F\u4E0D\u6B63\u786E,\u8BF7\u91CD\u65B0\u626B\u63CF\u3002");return}let[C,y,...E]=t;const[A,U,q,B,r]=E;let V="";if(B){const s=B.slice(0,4),j=B.slice(4,6),ae=B.slice(6);V=me(`${s}-${j}-${ae}`).format("YYYY-MM-DD HH:mm:ss")}l.value={invoiceType:y,invCode:A,subtotal_amount:q,open_time:V,invNumber:U,checkNumber:r},D.value=""}const I=M(()=>{const{invoiceType:e}=l.value;return e==="32"||e==="31"}),re=async({file:e})=>{const u=new FormData;u.append("img",e),u.append("token",K.token);const{message:t,code:C,data:y}=await ve(u);X({message:t,code:C,handler:()=>{y.forEach(({url:E,name:A})=>{m.value.push({inv_img:fe+"/"+E,invName:A,invType:"2"})})}})},le=e=>{const u=h.value.findIndex(({uid:t})=>t===e.uid);return m.value.splice(u,1),!0};Y(()=>S.value,e=>{const u={};u.payNo=l.value.payNo,e.forEach(t=>{t.prop!=="payNo"&&(u[t.prop]="")}),l.value=u}),Y(()=>l.value.invoiceType,()=>{T.value.checkNumber&&(T.value.checkNumber[0].required=["04","10"].includes(l.value.invoiceType))});const oe=e=>e.getTime()>Date.now();return n({onDisplay:()=>_.value=!0}),(e,u)=>{const t=f("el-form-item"),C=f("el-option"),y=f("el-select"),E=f("el-button"),A=f("el-upload"),U=f("el-date-picker"),q=f("ElTag"),B=f("el-dialog");return i(),g(B,{modelValue:_.value,"onUpdate:modelValue":u[2]||(u[2]=r=>_.value=r),onClose:Z,title:"\u4E0A\u4F20\u53D1\u7968",center:"","close-on-click-modal":!1,"close-on-press-escape":!1},{default:d(()=>[F(o(de),{"label-width":"100px",model:l.value,rules:T.value,ref_key:"formRef",ref:x,size:"small"},{default:d(()=>[k(` <el-form-item label="\u53D1\u7968\u4E0A\u4F20\u65B9\u5F0F">\r
- <el-select v-model="invType" disabled>\r
- <el-option label="\u624B\u5DE5\u6DFB\u52A0" value="1" />\r
- <el-option label="ocr\u8BC6\u522B" value="2" />\r
- </el-select>\r
- </el-form-item> `),k(" \u626B\u7801\u67AA\u8BC6\u522B "),o(G)?(i(),g(t,{key:0,label:"\u626B\u7801\u67AA"},{default:d(()=>[F(o($),O({type:"textarea",placeholder:"\u8BF7\u5728\u626B\u7801\u5B8C\u6210\u540E\u624B\u52A8\u56DE\u8F66",onKeydown:ue,modelValue:D.value,"onUpdate:modelValue":u[0]||(u[0]=r=>D.value=r)},o(P)),null,16,["modelValue"])]),_:1})):k("v-if",!0),(i(!0),w(H,null,L(o(S),(r,V)=>(i(),w(H,{key:V},[!o(I)||o(I)&&!J.includes(r.prop)?(i(),g(t,{key:0,label:o(I)&&r.prop==="subtotal_amount"?"\u7A0E\u540E\u91D1\u989D":r.label,prop:r.prop},{default:d(()=>[r.prop==="invoiceType"?(i(),g(y,{key:0,modelValue:l.value[r.prop],"onUpdate:modelValue":s=>l.value[r.prop]=s,placeholder:"\u8BF7\u9009\u62E9\u53D1\u7968\u7C7B\u578B","w-750px":""},{default:d(()=>[(i(!0),w(H,null,L(o(pe),(s,j)=>(i(),g(C,{label:s.label,value:s.scanValue,key:j},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):r.prop==="inv_img"?(i(),w("div",Ee,[F(A,{class:"upload-demo","file-list":h.value,"onUpdate:fileList":u[1]||(u[1]=s=>h.value=s),"before-upload":Q,"before-remove":le,"http-request":re,multiple:""},{default:d(()=>[F(E,{type:"primary"},{default:d(()=>[N("\u4E0A\u4F20\u56FE\u7247")]),_:1})]),_:1},8,["file-list"])])):r.prop==="open_time"?(i(),g(U,{key:2,modelValue:l.value[r.prop],"onUpdate:modelValue":s=>l.value[r.prop]=s,"disabled-date":oe,"value-format":"YYYY-MM-DD HH:mm:ss",placeholder:"\u8BF7\u8F93\u5165\u5F00\u7968\u65E5\u671F"},null,8,["modelValue","onUpdate:modelValue"])):(i(),g(o($),O({key:3,modelValue:l.value[r.prop],"onUpdate:modelValue":s=>l.value[r.prop]=s},o(P)),null,16,["modelValue","onUpdate:modelValue"]))]),_:2},1032,["label","prop"])):k("v-if",!0)],64))),128)),F(t,null,{default:d(()=>[F(q,{type:"warning",style:{"margin-left":"30px"}},{default:d(()=>[N("\u6682\u4E0D\u652F\u6301\u4E0A\u4F20\u8D1F\u6570\u53D1\u7968")]),_:1}),ce("div",ge,[F(E,{type:"primary",loading:R.value,onClick:ee},{default:d(()=>[N("\u4FDD\u5B58\u5F53\u524D\u53D1\u7968")]),_:1},8,["loading"]),F(E,{type:"primary",loading:R.value,onClick:W},{default:d(()=>[N("\u4FDD\u5B58\u5E76\u5173\u95ED")]),_:1},8,["loading"])])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}});var Be=te(De,[["__scopeId","data-v-7d8ef108"],["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/supplierOrder/sendOrderInvoice/components/invoice-form.vue"]]),Ce=Object.freeze(Object.defineProperty({__proto__:null,default:Be},Symbol.toStringTag,{value:"Module"}));export{Be as I,he as c,Ce as i};
|