1 |
- import{_ as ee,d as ue,w as p,ag as q,bP as le,X as ae,z as oe,r as m,o as n,G as v,C as t,l as s,u as c,aR as re,a as w,cc as x,bw as T,c as A,F as N,D as R,b as te,M as j,aY as B,ae as ne,bQ as se,bR as pe}from"./index.fd765376.js";import{t as ie}from"./_details.f90e1169.js";import{B as de}from"./status.0f05917e.js";import{I as M}from"./global.9ad647c8.js";const be={payNo:{trigger:"change",required:!0,message:"\u8BF7\u9009\u62E9\u8BA2\u5355"},invArr:{required:!0,message:"\u8BF7\u4E0A\u4F20\u53D1\u7968",validator(Y,V){return V.length!==0}}},ce={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\u4EE3\u7801",required:!0}],invCode:[{trigger:"blur",message:"\u8BF7\u9009\u62E9\u53D1\u7968\u7F16\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}],gold:[{trigger:"blur",message:"\u8BF7\u9009\u62E9\u91D1\u989D",required:!0}]};const me={"w-full":""},ve=ue({__name:"invoice-form",emits:["change"],setup(Y,{expose:V,emit:H}){const D=p(!1),E=p([]),f=p([]),i=p("1"),S=p(!1),L=["png","jpg","bmp","jpeg"].map(l=>"image/"+l),U=q(()=>ie[i.value]||[]),P=p({...ce}),I=p(null),z=q(()=>i.value==="1"),_=p(""),a=p({currentValue:""}),O=le(),$=ae(),G=({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 K(){f.value=[],E.value=[],a.value={}}function Q(){I.value.validate(async l=>{if(!!l){if(!i.value)return B.error("\u8BF7\u9009\u62E9\u7533\u8BF7\u7C7B\u578B");if(i.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")}H("change",i.value==="2"?f.value:{...a.value,invType:i.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[r,F,...d]=_.value.split(","),[g,b,h,y,u]=d,C=y.slice(0,4),o=y.slice(4,6),k=y.slice(6);a.value={invoiceType:F,invCode:g,subtotal_amount:h,open_time:ne(`${C}-${o}-${k}`).format("YYYY-MM-DD HH:mm:ss"),invNumber:b,checkNumber:u},_.value=""}const J=async({file:l})=>{const e=new FormData;e.append("img",l),e.append("token",O.token);const{message:r,code:F,data:d}=await se(e);$({message:r,code:F,handler:()=>{d.forEach(({url:g,name:b})=>{f.value.push({inv_img:pe+"/"+g,invName:b,invType:"2"})})}})},W=l=>{const e=E.value.findIndex(({uid:r})=>r===l.uid);return f.value.splice(e,1),!0};oe(()=>U.value,l=>{const e={};e.payNo=a.value.payNo,l.forEach(r=>{r.prop!=="payNo"&&(e[r.prop]="")}),a.value=e});const Z=l=>l.getTime()>Date.now();return V({onDisplay:()=>D.value=!0}),(l,e)=>{const r=m("el-option"),F=m("el-select"),d=m("el-form-item"),g=m("el-button"),b=m("el-upload"),h=m("el-date-picker"),y=m("el-dialog");return n(),v(y,{modelValue:D.value,"onUpdate:modelValue":e[3]||(e[3]=u=>D.value=u),onClose:K,"close-on-click-modal":!1},{default:t(()=>[s(c(re),{"label-width":"100px",model:a.value,rules:P.value,ref_key:"formRef",ref:I,size:"small"},{default:t(()=>[s(d,{label:"\u53D1\u7968\u4E0A\u4F20\u65B9\u5F0F"},{default:t(()=>[s(F,{modelValue:i.value,"onUpdate:modelValue":e[0]||(e[0]=u=>i.value=u)},{default:t(()=>[s(r,{label:"\u624B\u5DE5\u6DFB\u52A0",value:"1"}),s(r,{label:"ocr\u8BC6\u522B",value:"2"})]),_:1},8,["modelValue"])]),_:1}),w(" \u626B\u7801\u67AA\u8BC6\u522B "),c(z)?(n(),v(d,{key:0,label:"\u626B\u7801\u67AA"},{default:t(()=>[s(c(x),T({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})):w("v-if",!0),(n(!0),A(N,null,R(c(U),(u,C)=>(n(),v(d,{label:u.label,prop:u.prop,key:C},{default:t(()=>[u.prop==="invoiceType"?(n(),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:t(()=>[(n(!0),A(N,null,R(c(de),(o,k)=>(n(),v(r,{label:o.label,value:o.hwy_value,key:k},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):u.prop==="inv_img"?(n(),A(N,{key:1},[w(' list-type="picture" '),te("div",me,[s(b,{class:"upload-demo","file-list":E.value,"onUpdate:fileList":e[2]||(e[2]=o=>E.value=o),"before-upload":G,"before-remove":W,"http-request":J,multiple:""},{default:t(()=>[s(g,{type:"primary"},{default:t(()=>[j("\u4E0A\u4F20\u56FE\u7247")]),_:1})]),_:1},8,["file-list"])])],64)):u.prop==="open_time"?(n(),v(h,{key:2,modelValue:a.value[u.prop],"onUpdate:modelValue":o=>a.value[u.prop]=o,"disabled-date":Z,"value-format":"YYYY-MM-DD HH:mm:ss",placeholder:"\u8BF7\u8F93\u5165\u5F00\u7968\u65E5\u671F"},null,8,["modelValue","onUpdate:modelValue"])):(n(),v(c(x),T({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(d,{class:"justify-end flex w-full"},{default:t(()=>[s(g,{type:"primary",loading:S.value,onClick:Q},{default:t(()=>[j("\u4FDD\u5B58")]),_:1},8,["loading"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}});var fe=ee(ve,[["__scopeId","data-v-7eb37d0a"],["__file","C:/Users/63107/Desktop/projects/accout-vue3-ui/src/views/purchase/buyInvoiceQuery/components/invoice-form.vue"]]),ye=Object.freeze(Object.defineProperty({__proto__:null,default:fe},Symbol.toStringTag,{value:"Module"}));export{fe as I,be as c,ye as i};
|