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