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