finance-setting.38c3be.js 6.1 KB

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