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