import{_ as T,d as U,x as y,n as Z,aO as L,ah as b,Z as j,aP as H,A as I,z as P,r as p,o as h,c as F,l as r,D as d,h as v,a as Q,m as g,F as D,E as z,G,aQ as M,M as O}from"./index.js";import{c as J}from"./configs.f31ce718.js";import{h as K}from"./index.ab253282.js";import W from"./query-category.748471.js";import"./verification.611d3025.js";const X={flex:"",gap:"1"},Y={flex:"","gap-3":""},$={flex:"","justify-end":""},ee=U({__name:"procure-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(B,{emit:V}){const f=B,c=y(null),E={inv_good_name:"",cat_name:"",cat_code:"",tax:""},_=y([]),{query:R}=Z(),S=L(),C=y(null),k=b(()=>R.id),e=j({...E}),x=H(!1),w=b(()=>({tax:!e.cat_code})),A=b(()=>({...J}));function q(){C.value.validate(async o=>{if(!o)return;const{cat_code:a,inv_good_name:l,tax:n}=e,i=[{cat_code:a,inv_good_name:l,tax:n,spuCode:k.value}];x.value=!0;const{code:s,message:u}=await K({list:i,status:"1",isZx:f.isZx?"1":"0"});x.value=!1,S({code:s,message:u,handler:()=>V("refresh")})})}function N(o,a){if(!o)return e.tax="",e.cat_name="",_.value=[];const{tax:l,label:n}=o;_.value=[...l,"0%","1%","3%"],a||(e.cat_name=n,e.tax="")}return I(()=>f.detail,async()=>{if(!f.detail)return;const{inv_good_name:o,inv_cat_code:a,good_name:l,inv_tax:n,cgd_inv_tax:i,cgd_inv_cat_code:s}=f.detail;e.inv_good_name=o||l,e.tax=n?n*100+"%":"",e.inv_good_name.length>70&&(e.inv_good_name=e.inv_good_name.slice(0,70)),i&&(e.tax=i),P(async()=>{if(a&&c.value&&a.trim().length!==0){const u={cat_code:a},t=await c.value.initalData(u);if(!t||!Array.isArray(t))return;const{tax:m}=t[0];_.value=[...m,"0%","1%","3%"]}else if(s&&c.value&&s.trim().length!==0){const u={cat_code:s},t=await c.value.initalData(u);if(!t||!Array.isArray(t))return;const{tax:m}=t[0];_.value=[...m,"0%","1%","3%"]}})},{immediate:!0}),(o,a)=>{const l=p("el-form-item"),n=p("el-input"),i=p("el-option"),s=p("el-select"),u=p("el-button");return h(),F(D,null,[r(g(M),{"label-position":"left",ref_key:"formRef",ref:C,rules:g(A),model:e},{default:d(()=>[v("div",X,[r(l,{label:"\u5546\u54C1\u7C7B\u76EE\u8BBE\u7F6E",prop:"cat_code","flex-1":""},{default:d(()=>[Q(` <RemoteSelect w-full :getLabel="handleLabel" :api="httpCatlist"\r
          v-model="formData.cat_code" placeholder="\u8BF7\u9009\u62E9\u5546\u54C1\u7C7B\u76EE" response-label-prop="cat_name"\r
          response-val-prop="merge_code" request-prop="cat_name" sub-label-prop="short_name"\r
          @item-change="handleSelectCategory"\r
          @inital="(_, { code, merge_code }) => (formData.cat_code = Number(detail.status) >= 1 ? merge_code : code)" /> `),r(W,{ref_key:"remoteSelectRef",ref:c,modelValue:e.cat_code,"onUpdate:modelValue":a[0]||(a[0]=t=>e.cat_code=t),onChange:N},null,8,["modelValue"])]),_:1})]),v("div",null,[r(l,{label:"\u5F00\u7968\u5546\u54C1\u540D\u79F0",prop:"inv_good_name","flex-1":""},{default:d(()=>[r(n,{"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})]),v("div",Y,[r(l,{label:"\u7A0E\u7387",prop:"tax"},{default:d(()=>[r(s,{"w-180px":"",modelValue:e.tax,"onUpdate:modelValue":a[2]||(a[2]=t=>e.tax=t),disabled:g(w).tax,placeholder:"\u8BF7\u8F93\u5165\u7A0E\u7387"},{default:d(()=>[(h(!0),F(D,null,z(_.value,(t,m)=>(h(),G(i,{key:m,label:t,value:t},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})])]),_:1},8,["rules","model"]),v("div",$,[r(u,{type:"primary",onClick:q,loading:g(x)},{default:d(()=>[O("\u4FDD\u5B58")]),_:1},8,["loading"])])],64)}}});var re=T(ee,[["__scopeId","data-v-09a86bb6"],["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/InvoiceSaleSettings/_component/procure-setting.vue"]]);export{re as default};
