1 |
- import{_ as M,d as P,w as y,m as Q,aO as J,ag as v,Z as K,aP as W,z as A,y as X,r as f,o as c,c as T,l as n,C as o,b as E,u as i,aQ as Y,F as C,D as V,G as h,aR as $,M as ee}from"./index.42bf163d.js";import{c as R,i as D}from"./configs.79885403.js";import{h as ae,a as te}from"./index.a3e78a40.js";import"./tootip.bb80052f.js";import"./verification.611d3025.js";const le={flex:"",gap:"1"},ue={flex:"","gap-3":""},ne={flex:"","justify-end":""},oe=P({__name:"finance-setting",props:{columns:{type:Array,required:!0},backRoute:{type:String,required:!0},name:{type:String,required:!1},detail:{type:null,required:!0}},emits:["refresh"],setup(q,{emit:U}){const F=q,p=y(null),Z={cat_code:"",cat_name:"",inv_good_name:"",tax:"",inv_tag:"",is_discount:"",addTax:""},g=y([]),{query:I}=Q(),N=J(),w=y(null),j=v(()=>I.id),e=K({...Z}),S=W(!1),x=v(()=>({isDiscount:e.is_discount==="1",isZeroTaxRate:e.tax==="0%"})),b=v(()=>{const u=!e.cat_code,{isDiscount:a,isZeroTaxRate:l}=x.value;return{tax:u,is_discount:u,addTax:u||!l||!a,inv_tag:u||!l||a&&l}}),H=v(()=>{const{isDiscount:u,isZeroTaxRate:a}=x.value;return{...R,inv_tag:[{...R.inv_tag,required:a}],addTax:[{...R.addTax,required:u&&a}]}}),k=v(()=>{const{isDiscount:u,isZeroTaxRate:a}=x.value;let l=[],r=[];return u&&a&&(r=l=[D[0],D[1]]),a&&!u&&(r=[D[2]]),{addTax:l,invTag:r}});function O(){w.value.validate(async u=>{if(!u)return;const{addTax:a,is_discount:l,inv_tag:r,cat_code:d,inv_good_name:_,tax:m}=e,t=[{addTax:a,is_discount:l,inv_tag:r||"0",cat_code:d,inv_good_name:_,tax:m,spuCode:j.value}];S.value=!0;const{code:s,message:B}=await te({list:t,status:"2"});S.value=!1,N({code:s,message:B,handler:()=>U("refresh")})})}function z(u){if(!u)return e.tax="",e.cat_name="",g.value=[];const{tax:a,cat_name:l}=u;e.cat_name=l,g.value=[...a,"0%"],e.tax="",e.addTax="",e.inv_tag="",e.is_discount=""}const G=()=>{e.addTax="",e.inv_tag=""},L=()=>{e.is_discount="",e.addTax="",e.inv_tag=""};return A(()=>e.addTax,u=>{if(!u)return;const{isZeroTaxRate:a,isDiscount:l}=x.value;a&&l&&(e.inv_tag=e.addTax)},{immediate:!0}),A(()=>[F.detail,p.value],async()=>{if(!F.detail||!p.value)return;const{cgd_inv_good_name:u,cgd_inv_cat_code:a,is_discount:l,good_name:r,cgd_inv_tax:d,inv_tag:_,addTax:m}=F.detail;if(e.inv_good_name=u||r,e.tax=d||"",e.is_discount=String(l),e.inv_good_name.length>70&&(e.inv_good_name=e.inv_good_name.slice(0,70)),X(()=>{e.inv_tag=String(_)!=="0"?String(_):"",e.addTax=m}),a&&p.value){const t={cat_code:a},s=await p.value.initalData(t);if(!s||!Array.isArray(s))return;const{tax:B}=s[0];g.value=B}},{immediate:!0}),(u,a)=>{const l=f("el-form-item"),r=f("el-input"),d=f("el-option"),_=f("el-select"),m=f("el-button");return c(),T(C,null,[n(i($),{"label-position":"left",ref_key:"formRef",ref:w,rules:i(H),model:e},{default:o(()=>[E("div",le,[n(l,{label:"\u5546\u54C1\u7C7B\u76EE\u8BBE\u7F6E",prop:"cat_code","flex-1":""},{default:o(()=>[n(i(Y),{ref_key:"remoteSelectRef",ref:p,"w-full":"","is-root":"",api:i(ae),modelValue:e.cat_code,"onUpdate:modelValue":a[0]||(a[0]=t=>e.cat_code=t),placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u7C7B\u76EE","response-label-prop":"cat_name","response-val-prop":"merge_code","request-prop":"cat_name","sub-label-prop":"short_name",onItemChange:z,onInital:a[1]||(a[1]=t=>e.cat_code=t)},null,8,["api","modelValue"])]),_:1}),n(l,{label:"\u5F00\u7968\u5546\u54C1\u540D\u79F0",prop:"inv_good_name","flex-1":""},{default:o(()=>[n(r,{"w-full":"",modelValue:e.inv_good_name,"onUpdate:modelValue":a[2]||(a[2]=t=>e.inv_good_name=t),placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",maxlength:"70"},null,8,["modelValue"])]),_:1})]),E("div",ue,[n(l,{label:"\u7A0E\u7387",prop:"tax"},{default:o(()=>[n(_,{"w-180px":"",modelValue:e.tax,"onUpdate:modelValue":a[3]||(a[3]=t=>e.tax=t),disabled:i(b).tax,placeholder:"\u8BF7\u8F93\u5165\u7A0E\u7387",onChange:L},{default:o(()=>[(c(!0),T(C,null,V(g.value,(t,s)=>(c(),h(d,{key:s,label:t,value:t},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),n(l,{label:"\u662F\u5426\u6709\u4F18\u60E0\u653F\u7B56",prop:"is_discount"},{default:o(()=>[n(_,{disabled:i(b).is_discount,"w-150px":"",modelValue:e.is_discount,"onUpdate:modelValue":a[4]||(a[4]=t=>e.is_discount=t),placeholder:"\u8BF7\u9009\u62E9\u662F\u5426\u5305\u542B\u4F18\u60E0\u653F\u7B56",onChange:G},{default:o(()=>[n(d,{label:"\u5426",value:"0"}),n(d,{label:"\u662F",value:"1"})]),_:1},8,["disabled","modelValue"])]),_:1}),n(l,{label:"\u589E\u503C\u7A0E\u7BA1\u7406\u5185\u5BB9",prop:"addTax"},{default:o(()=>[n(_,{disabled:i(b).addTax,"w-230px":"",modelValue:e.addTax,"onUpdate:modelValue":a[5]||(a[5]=t=>e.addTax=t),placeholder:"\u8BF7\u9009\u62E9\u589E\u503C\u7A0E\u7BA1\u7406\u7A0E\u5185\u5BB9"},{default:o(()=>[(c(!0),T(C,null,V(i(k).addTax,(t,s)=>(c(),h(d,{key:s,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["disabled","modelValue"])]),_:1}),n(l,{label:"\u6C47\u7387\u6807\u8BC6",prop:"inv_tag"},{default:o(()=>[n(_,{"w-180px":"",disabled:i(b).inv_tag,modelValue:e.inv_tag,"onUpdate:modelValue":a[6]||(a[6]=t=>e.inv_tag=t),placeholder:"\u8BF7\u9009\u62E9\u6C47\u7387\u6807\u8BC6"},{default:o(()=>[(c(!0),T(C,null,V(i(k).invTag,(t,s)=>(c(),h(d,{key:s,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["disabled","modelValue"])]),_:1})])]),_:1},8,["rules","model"]),E("div",ne,[n(m,{type:"primary",onClick:O},{default:o(()=>[ee("\u4FDD\u5B58")]),_:1})])],64)}}});var ce=M(oe,[["__scopeId","data-v-685dbaed"],["__file","C:/Users/63107/Desktop/projects/accout-vue3-ui/src/views/supplyInvoiceSaleSettings/_component/finance-setting.vue"]]);export{ce as default};
|