123456 |
- import{_ as te,d as ne,w as v,ag as j,bP as se,X as ie,z as S,r as f,o as i,G as E,C as p,l as F,u as o,aR as pe,a as w,cc as $,bw as L,c as k,F as M,D as P,M as N,b as de,aY as c,ae as ce,bQ as me,bR as ve}from"./index.fd765376.js";import{t as fe}from"./_details.70698317.js";import{I as z}from"./global.9ad647c8.js";import{v as Fe}from"./status.0f05917e.js";const he={payNo:{trigger:"change",required:!0,message:"\u8BF7\u9009\u62E9\u8BA2\u5355"},invArr:{required:!0,message:"\u8BF7\u4E0A\u4F20\u53D1\u7968",validator(A,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(A,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(A,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(A,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 ge={key:1,"w-full":""},Ee={class:"justify-end flex w-full"},De=ne({__name:"invoice-form",emits:["change"],setup(A,{expose:n,emit:a}){const _=v(!1),C=v([]),m=v([]),d=v("1"),Y=v(!1),O=["png","jpg","bmp","jpeg"].map(e=>"image/"+e),T=v({..._e}),U=v(null),G=j(()=>d.value==="1"),D=v(""),l=v({currentValue:""}),K=se(),X=ie(),Q=["invCode","checkNumber"],H=j(()=>fe[d.value]||[]),J=({type:e,size:u})=>{if(!O.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 W(){m.value=[],C.value=[],l.value={}}function Z(){U.value.validate(async e=>{if(!!e){if(!d.value)return c.error("\u8BF7\u9009\u62E9\u7533\u8BF7\u7C7B\u578B");if(d.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",d.value==="2"?m.value:{...o(l),invType:o(d)}),_.value=!1}})}function ee(){U.value.validate(async e=>{if(!!e){if(!d.value)return c.error("\u8BF7\u9009\u62E9\u7533\u8BF7\u7C7B\u578B");if(d.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",d.value==="2"?m.value:{...o(l),invType:o(d)}),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[h,y,...g]=t;const[b,x,I,B,r]=g;let V="";if(B){const s=B.slice(0,4),R=B.slice(4,6),ae=B.slice(6);V=ce(`${s}-${R}-${ae}`).format("YYYY-MM-DD HH:mm:ss")}l.value={invoiceType:y,invCode:b,subtotal_amount:I,open_time:V,invNumber:x,checkNumber:r},D.value=""}const q=j(()=>{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:h,data:y}=await me(u);X({message:t,code:h,handler:()=>{y.forEach(({url:g,name:b})=>{m.value.push({inv_img:ve+"/"+g,invName:b,invType:"2"})})}})},le=e=>{const u=C.value.findIndex(({uid:t})=>t===e.uid);return m.value.splice(u,1),!0};S(()=>H.value,e=>{const u={};u.payNo=l.value.payNo,e.forEach(t=>{t.prop!=="payNo"&&(u[t.prop]="")}),l.value=u}),S(()=>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"),h=f("el-option"),y=f("el-select"),g=f("el-button"),b=f("el-upload"),x=f("el-date-picker"),I=f("ElTag"),B=f("el-dialog");return i(),E(B,{modelValue:_.value,"onUpdate:modelValue":u[2]||(u[2]=r=>_.value=r),onClose:W,title:"\u4E0A\u4F20\u53D1\u7968",center:""},{default:p(()=>[F(o(pe),{"label-width":"100px",model:l.value,rules:T.value,ref_key:"formRef",ref:U,size:"small"},{default:p(()=>[w(` <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> `),w(" \u626B\u7801\u67AA\u8BC6\u522B "),o(G)?(i(),E(t,{key:0,label:"\u626B\u7801\u67AA"},{default:p(()=>[F(o($),L({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(z)),null,16,["modelValue"])]),_:1})):w("v-if",!0),(i(!0),k(M,null,P(o(H),(r,V)=>(i(),k(M,{key:V},[!o(q)||o(q)&&!Q.includes(r.prop)?(i(),E(t,{key:0,label:o(q)&&r.prop==="subtotal_amount"?"\u7A0E\u540E\u91D1\u989D":r.label,prop:r.prop},{default:p(()=>[r.prop==="invoiceType"?(i(),E(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:p(()=>[(i(!0),k(M,null,P(o(Fe),(s,R)=>(i(),E(h,{label:s.label,value:s.scanValue,key:R},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):r.prop==="inv_img"?(i(),k("div",ge,[F(b,{class:"upload-demo","file-list":C.value,"onUpdate:fileList":u[1]||(u[1]=s=>C.value=s),"before-upload":J,"before-remove":le,"http-request":re,multiple:""},{default:p(()=>[F(g,{type:"primary"},{default:p(()=>[N("\u4E0A\u4F20\u56FE\u7247")]),_:1})]),_:1},8,["file-list"])])):r.prop==="open_time"?(i(),E(x,{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(),E(o($),L({key:3,modelValue:l.value[r.prop],"onUpdate:modelValue":s=>l.value[r.prop]=s},o(z)),null,16,["modelValue","onUpdate:modelValue"]))]),_:2},1032,["label","prop"])):w("v-if",!0)],64))),128)),F(t,null,{default:p(()=>[F(I,{type:"warning",style:{"margin-left":"30px"}},{default:p(()=>[N("\u6682\u4E0D\u652F\u6301\u4E0A\u4F20\u8D1F\u6570\u53D1\u7968")]),_:1}),de("div",Ee,[F(g,{type:"primary",loading:Y.value,onClick:ee},{default:p(()=>[N("\u4FDD\u5B58\u5F53\u524D\u53D1\u7968")]),_:1},8,["loading"]),F(g,{type:"primary",loading:Y.value,onClick:Z},{default:p(()=>[N("\u4FDD\u5B58\u5E76\u5173\u95ED")]),_:1},8,["loading"])])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}});var Be=te(De,[["__scopeId","data-v-7c68f4ae"],["__file","C:/Users/63107/Desktop/projects/accout-vue3-ui/src/views/purchase/ticketReturn/components/invoice-form.vue"]]),Ve=Object.freeze(Object.defineProperty({__proto__:null,default:Be},Symbol.toStringTag,{value:"Module"}));export{Be as I,he as c,Ve as i};
|