1 |
- import{_ as R,d as Z,x as f,Z as N,bC as q,ah as G,a0 as z,bL as M,r as i,o as d,G as v,D as t,l as a,m as p,aQ as O,c as S,F as H,E as T,a as x,h as P,M as Q,aZ as B,cY as J,ae as W}from"./index.js";import{i as X}from"./status.4c13d767.js";const ee={class:"flex justify-end"},ue=Z({__name:"back-modal",emits:["refresh"],setup(le,{expose:j,emit:I}){const $={10:"electronic",20:"special_electronic","01":"special","04":"normal",32:"fully_digitalized_normal_electronic",31:"fully_digitalized_special_electronic"},E=f(""),A=f(""),V=f(!1),U=f(null),Y=N({inv_code:[{required:!0,message:"\u53D1\u7968\u4EE3\u7801\u683C\u5F0F\u4E0D\u6B63\u786E",trigger:"blur",validator(r,e){return e?q(e):new Error("\u53D1\u7968\u4EE3\u7801\u4E0D\u80FD\u4E3A\u7A7A")}}],inv_number:[{required:!0,message:"\u53D1\u7968\u53F7\u7801\u683C\u5F0F\u4E0D\u6B63\u786E",trigger:"blur",validator(r,e){return e?q(e):new Error("\u53D1\u7968\u53F7\u7801\u4E0D\u80FD\u4E3A\u7A7A")}}],open_date:[{required:!0,message:"\u8BF7\u9009\u62E9\u5F00\u7968\u65E5\u671F",trigger:"change"}],inv_total:[{required:!0,message:"\u8BF7\u8F93\u5165\u7A0E\u540E\u91D1\u989D",trigger:"blur"}],inv_subtotal:[{required:!0,message:"\u8BF7\u8F93\u5165\u7A0E\u524D\u91D1\u989D",trigger:"blur"}],check_code:[{required:!1,message:"\u8BF7\u8F93\u5165\u6821\u9A8C\u7801",trigger:"change"}]}),n=f(""),b=G(()=>l.input_type==="1"),k=f(!1),y=f(""),l=N({input_type:"1",remark:"",inv_code:"",inv_number:"",open_date:null,inv_subtotal:0,inv_total:0,check_code:""});function K(){U.value.validate(async r=>{if(!r)return;const{input_type:e,inv_subtotal:s,inv_total:g,check_code:o,...D}=l;let c=null;const _=$[n.value];if(n.value&&String(E.value)!==String(_))return B.error("\u626B\u63CF\u8BC6\u522B\u7684\u53D1\u7968\u7C7B\u578B\u4E0E\u5F00\u7968\u7C7B\u578B\u4E0D\u4E00\u81F4");c={invNo:A.value,inv_subtotal:_==="fully_digitalized_normal_electronic"||_==="fully_digitalized_special_electronic"?"":s.toFixed(2),inv_total:_==="fully_digitalized_normal_electronic"||_==="fully_digitalized_special_electronic"?g.toFixed(2):"",...o?{check_code:o}:{},...D},k.value=!0;const{code:F,message:m}=await J(c);switch(k.value=!1,F){case 0:V.value=!1,I("refresh");break;default:B.warning(m);break}})}function L(r){const{keyCode:e}=r;if(e!==13)return;if(y.value.indexOf("\uFF0C")>=0)return B.error("\u4E0D\u80FD\u5305\u542B\u4E2D\u6587\u9017\u53F7"),y.value="";const s=y.value.split(",");if(s.length!==9&&s.length!==8){B.error("\u626B\u7801\u67AA\u8BC6\u522B\u6570\u636E\u683C\u5F0F\u4E0D\u6B63\u786E,\u8BF7\u91CD\u65B0\u626B\u63CF\u3002");return}const[g,o,...D]=s,[c,_,F,m,C]=D;n.value=o;const h=m.slice(0,4),u=m.slice(4,6),w=m.slice(6);l.inv_code=c,l.check_code=C,l.inv_number=_,o==="31"||o==="32"?l.inv_total=Number(F):l.inv_subtotal=Number(F),l.open_date=W(`${h}-${u}-${w}`).format("YYYY-MM-DD HH:mm:ss"),y.value=""}return z(()=>{Y.check_code[0].required=E.value==="normal"||E.value==="electronic"}),z(()=>{const{input_type:r}=l;if(r==="2"){const e=M.find(({value:s})=>s===E.value);e&&(n.value=e.scanValue)}}),j({onDisplay:(r,e)=>{V.value=!0,E.value=r,A.value=e}}),(r,e)=>{const s=i("el-option"),g=i("el-select"),o=i("el-form-item"),D=i("el-col"),c=i("el-input"),_=i("el-row"),F=i("el-date-picker"),m=i("el-input-number"),C=i("el-button"),h=i("el-dialog");return d(),v(h,{modelValue:V.value,"onUpdate:modelValue":e[9]||(e[9]=u=>V.value=u),"close-on-click-modal":!1,"close-on-press-escape":!1},{default:t(()=>[a(p(O),{ref_key:"formRef",ref:U,model:l,rules:Y,"label-width":"90px",class:"demo-ruleForm",size:"small","status-icon":""},{default:t(()=>[a(_,null,{default:t(()=>[a(D,{span:12},{default:t(()=>[a(o,{label:"\u8F93\u5165\u7C7B\u578B",prop:"input_type"},{default:t(()=>[a(g,{modelValue:l.input_type,"onUpdate:modelValue":e[0]||(e[0]=u=>l.input_type=u),style:{width:"100%"},placeholder:"\u83DC\u5355\u7C7B\u578B"},{default:t(()=>[(d(!0),S(H,null,T(p(X),(u,w)=>(d(),v(s,{key:"type"+u.value+w,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.input_type==="1"?(d(),v(D,{key:0,span:24,style:{padding:"12px 12px 12px 16px"}},{default:t(()=>[a(c,{clearable:"",modelValue:y.value,"onUpdate:modelValue":e[1]||(e[1]=u=>y.value=u),rows:3,type:"textarea",placeholder:"\u626B\u7801\u67AA\u8F93\u5165\u5904",onKeydown:L},null,8,["modelValue"])]),_:1})):x("v-if",!0)]),_:1}),a(o,{label:"\u53D1\u7968\u7C7B\u578B"},{default:t(()=>[a(g,{style:{width:"100%"},modelValue:n.value,"onUpdate:modelValue":e[2]||(e[2]=u=>n.value=u),disabled:""},{default:t(()=>[(d(!0),S(H,null,T(p(M),u=>(d(),v(s,{key:u.scanValue,value:u.scanValue,label:u.label},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(o,{label:"\u53D1\u7968\u53F7\u7801",prop:"inv_number"},{default:t(()=>[a(c,{modelValue:l.inv_number,"onUpdate:modelValue":e[3]||(e[3]=u=>l.inv_number=u),placeholder:"\u53D1\u7968\u53F7\u7801",disabled:p(b)},null,8,["modelValue","disabled"])]),_:1}),n.value!=="32"&&n.value!=="31"?(d(),v(o,{key:0,label:"\u53D1\u7968\u4EE3\u7801",prop:"inv_code"},{default:t(()=>[a(c,{modelValue:l.inv_code,"onUpdate:modelValue":e[4]||(e[4]=u=>l.inv_code=u),placeholder:"\u53D1\u7968\u4EE3\u7801",disabled:p(b)},null,8,["modelValue","disabled"])]),_:1})):x("v-if",!0),a(o,{label:"\u5F00\u7968\u65E5\u671F",prop:"open_date"},{default:t(()=>[a(F,{style:{width:"100%"},"value-format":"YYYY-MM-DD HH:mm:ss",modelValue:l.open_date,"onUpdate:modelValue":e[5]||(e[5]=u=>l.open_date=u),disabled:p(b)},null,8,["modelValue","disabled"])]),_:1}),n.value!=="32"&&n.value!=="31"?(d(),v(o,{key:1,label:"\u7A0E\u524D\u91D1\u989D",prop:"inv_subtotal"},{default:t(()=>[a(m,{modelValue:l.inv_subtotal,"onUpdate:modelValue":e[6]||(e[6]=u=>l.inv_subtotal=u),precision:2,style:{width:"100%"},min:0,max:999999,disabled:p(b)},null,8,["modelValue","disabled"])]),_:1})):(d(),v(o,{key:2,label:"\u7A0E\u540E\u91D1\u989D",prop:"inv_total"},{default:t(()=>[a(m,{modelValue:l.inv_total,"onUpdate:modelValue":e[7]||(e[7]=u=>l.inv_total=u),precision:2,style:{width:"100%"},min:0,max:999999,disabled:p(b)},null,8,["modelValue","disabled"])]),_:1})),n.value!=="32"&&n.value!=="31"?(d(),v(o,{key:3,label:"\u6821\u9A8C\u7801",prop:"check_code"},{default:t(()=>[a(c,{placeholde:"\u8BF7\u8F93\u5165\u6821\u9A8C\u7801",modelValue:l.check_code,"onUpdate:modelValue":e[8]||(e[8]=u=>l.check_code=u),disabled:p(b)},null,8,["modelValue","disabled"])]),_:1})):x("v-if",!0),P("div",ee,[a(C,{type:"primary",loading:k.value,onClick:K},{default:t(()=>[Q("\u4FDD\u5B58")]),_:1},8,["loading"])])]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}});var oe=R(ue,[["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/InvoiceSales/invoiceApply/components/back-modal.vue"]]);export{oe as default};
|