upload-invoice.a6a0b6.js 5.5 KB

1
  1. import{_ as L,d as P,x as h,Z as S,ah as Y,a0 as U,bL as A,r as i,o as c,G as v,D as a,l as t,c as T,F as M,E as q,m as d,a as w,h as R,M as Z,aQ as G,ae as y,aZ as V}from"./index.js";import{i as O}from"./status.4c13d767.js";import{u as Q}from"./configs.55e4fd8d.js";const J={class:"flex justify-end"},W=P({__name:"upload-invoice",props:{isElectronic:{type:Boolean,required:!0},isSupport:{type:Boolean,required:!0},isSpecialTicket:{type:Boolean,required:!0},isPlain:{type:Boolean,required:!0},invType:{type:String,required:!0}},emits:["changeStatus"],setup(H,{emit:I}){const B=H,j={10:"electronic",20:"special_electronic","01":"special","04":"normal",31:"fully_digitalized_special_electronic",32:"fully_digitalized_normal_electronic"},N=h(null),g=S({...Q}),p=h(""),b=Y(()=>e.input_type==="1"),m=h(""),e=S({input_type:"1",remark:"",invCode:"",invNum:"",open_date:null,subtotal_fee:0,checkCode:""}),F=Y(()=>Number(p.value)===31||Number(p.value)===32);function z(){N.value.validate(_=>{if(!_)return;const{input_type:l,subtotal_fee:n,checkCode:f,...s}=e,o=y(new Date).format("YYYY-MM-DD");if(e.open_date&&!y(e.open_date).isSame(y(o))&&!y(e.open_date).isBefore(y(o)))return V.error("\u5F00\u7968\u65E5\u671F\u4E0D\u80FD\u8D85\u8FC7\u5F53\u524D\u65E5\u671F");let r=null;const C=j[p.value];if(p.value&&String(B.invType)!==String(C))return V.error("\u626B\u63CF\u8BC6\u522B\u7684\u53D1\u7968\u7C7B\u578B\u4E0E\u5F00\u7968\u7C7B\u578B\u4E0D\u4E00\u81F4");r={status:"3",...F.value?{total_fee:n.toFixed(2)}:{subtotal_fee:n.toFixed(2)},...f?{checkCode:f}:{},...s},I("changeStatus",r)})}function $(_){const{keyCode:l}=_;if(l!==13)return;if(m.value.indexOf("\uFF0C")>=0)return V.error("\u4E0D\u80FD\u5305\u542B\u4E2D\u6587\u9017\u53F7"),m.value="";const n=m.value.split(",");if(n.length!==9&&n.length!==8){V.error("\u626B\u7801\u67AA\u8BC6\u522B\u6570\u636E\u683C\u5F0F\u4E0D\u6B63\u786E,\u8BF7\u91CD\u65B0\u626B\u63CF\u3002");return}const[f,s,...o]=n,[r,C,E,D,k]=o;p.value=s;const u=D.slice(0,4),x=D.slice(4,6),K=D.slice(6);e.invCode=r,e.checkCode=k,e.invNum=C,e.subtotal_fee=Number(E),e.open_date=y(`${u}-${x}-${K}`).format("YYYY-MM-DD HH:mm:ss"),m.value=""}return U(()=>{g.checkCode[0].required=B.invType==="normal"||B.invType==="electronic"}),U(()=>{const{input_type:_}=e;if(_==="2"){const l=A.find(({value:n})=>n===B.invType);l&&(p.value=l.scanValue)}}),(_,l)=>{const n=i("el-option"),f=i("el-select"),s=i("el-form-item"),o=i("el-col"),r=i("el-input"),C=i("el-date-picker"),E=i("el-input-number"),D=i("el-row"),k=i("el-button");return c(),v(d(G),{ref_key:"formRef",ref:N,model:e,rules:g,"label-width":"90px",class:"demo-ruleForm",size:"small","status-icon":""},{default:a(()=>[t(D,null,{default:a(()=>[t(o,{span:12},{default:a(()=>[t(s,{label:"\u8F93\u5165\u7C7B\u578B",prop:"input_type"},{default:a(()=>[t(f,{modelValue:e.input_type,"onUpdate:modelValue":l[0]||(l[0]=u=>e.input_type=u),style:{width:"100%"},placeholder:"\u83DC\u5355\u7C7B\u578B"},{default:a(()=>[(c(!0),T(M,null,q(d(O),(u,x)=>(c(),v(n,{key:"type"+u.value+x,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e.input_type==="1"?(c(),v(o,{key:0,span:24,style:{padding:"12px 12px 12px 16px"}},{default:a(()=>[t(r,{clearable:"",modelValue:m.value,"onUpdate:modelValue":l[1]||(l[1]=u=>m.value=u),rows:3,type:"textarea",placeholder:"\u626B\u7801\u67AA\u8F93\u5165\u5904",onKeydown:$},null,8,["modelValue"])]),_:1})):w("v-if",!0),t(o,{span:8},{default:a(()=>[t(s,{label:"\u53D1\u7968\u7C7B\u578B"},{default:a(()=>[t(f,{style:{width:"100%"},modelValue:p.value,"onUpdate:modelValue":l[2]||(l[2]=u=>p.value=u),disabled:""},{default:a(()=>[(c(!0),T(M,null,q(d(A),u=>(c(),v(n,{key:u.scanValue,value:u.scanValue,label:u.label},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),t(o,{span:8},{default:a(()=>[t(s,{label:"\u53D1\u7968\u53F7\u7801",prop:"invNum"},{default:a(()=>[t(r,{modelValue:e.invNum,"onUpdate:modelValue":l[3]||(l[3]=u=>e.invNum=u),placeholder:"\u53D1\u7968\u53F7\u7801",disabled:d(b)},null,8,["modelValue","disabled"])]),_:1})]),_:1}),d(F)?w("v-if",!0):(c(),v(o,{key:1,span:8},{default:a(()=>[t(s,{label:"\u53D1\u7968\u4EE3\u7801",prop:"invCode"},{default:a(()=>[t(r,{modelValue:e.invCode,"onUpdate:modelValue":l[4]||(l[4]=u=>e.invCode=u),placeholder:"\u53D1\u7968\u4EE3\u7801",disabled:d(b)},null,8,["modelValue","disabled"])]),_:1})]),_:1})),t(o,{span:8},{default:a(()=>[t(s,{label:"\u5F00\u7968\u65E5\u671F",prop:"open_date"},{default:a(()=>[t(C,{style:{width:"100%"},"value-format":"YYYY-MM-DD HH:mm:ss",modelValue:e.open_date,"onUpdate:modelValue":l[5]||(l[5]=u=>e.open_date=u),disabled:d(b)},null,8,["modelValue","disabled"])]),_:1})]),_:1}),t(o,{span:8},{default:a(()=>[t(s,{label:d(F)?"\u7A0E\u540E\u91D1\u989D":"\u7A0E\u524D\u91D1\u989D",prop:"subtotal_fee"},{default:a(()=>[t(E,{modelValue:e.subtotal_fee,"onUpdate:modelValue":l[6]||(l[6]=u=>e.subtotal_fee=u),precision:2,style:{width:"100%"},max:1e8,min:0,disabled:d(b)},null,8,["modelValue","disabled"])]),_:1},8,["label"])]),_:1}),d(F)?w("v-if",!0):(c(),v(o,{key:2,span:8},{default:a(()=>[t(s,{label:"\u6821\u9A8C\u7801",prop:"checkCode"},{default:a(()=>[t(r,{placeholde:"\u8BF7\u8F93\u5165\u6821\u9A8C\u7801",modelValue:e.checkCode,"onUpdate:modelValue":l[7]||(l[7]=u=>e.checkCode=u),disabled:d(b)},null,8,["modelValue","disabled"])]),_:1})]),_:1}))]),_:1}),R("div",J,[t(k,{type:"primary",onClick:z},{default:a(()=>[Z("\u4FDD\u5B58")]),_:1})])]),_:1},8,["model","rules"])}}});var le=L(W,[["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/InvoiceSales/invoiceApply/components/approval-process/src/upload-invoice.vue"]]);export{le as default};