import{_ as T,d as j,n as x,j as H,cb as L,aa as y,Q as U,cc as Z,w as I,q as Q,r as p,o as b,c as C,h as r,y as d,e as v,a as z,F,z as P,A as G,i as J,cd as K,H as M}from"./index.js";import{c as O}from"./configs.daaaa261.js";import{h as W}from"./index.49bb9470.js";import X from"./query-category.dcce26.js";import"./verification.611d3025.js";const Y={flex:"",gap:"1"},$={flex:"","gap-3":""},ee={flex:"","justify-end":""},te=j({__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:D}){const c=x(null),V=D,f=B,w={inv_good_name:"",cat_name:"",cat_code:"",tax:""},_=x([]),{query:E}=H(),R=L(),h=x(null),S=y(()=>E.id),e=U({...w}),g=Z(!1),k=y(()=>({tax:!e.cat_code})),A=y(()=>({...O}));function q(){h.value.validate(async o=>{if(!o)return;const{cat_code:t,inv_good_name:l,tax:n}=e,i=[{cat_code:t,inv_good_name:l,tax:n,spuCode:S.value}];g.value=!0;const{code:s,message:u}=await W({list:i,status:"1",isZx:f.isZx?"1":"0"});g.value=!1,R({code:s,message:u,handler:()=>V("refresh")})})}function N(o,t){if(!o)return e.tax="",e.cat_name="",_.value=[];const{tax:l,label:n}=o;_.value=[...l,"0%","1%","3%"],t||(e.cat_name=n,e.tax="")}return I(()=>f.detail,async()=>{if(!f.detail)return;const{inv_good_name:o,inv_cat_code:t,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),Q(async()=>{if(t&&c.value&&t.trim().length!==0){const u={cat_code:t},a=await c.value.initalData(u);if(!a||!Array.isArray(a))return;const{tax:m}=a[0];_.value=[...m,"0%","1%","3%"]}else if(s&&c.value&&s.trim().length!==0){const u={cat_code:s},a=await c.value.initalData(u);if(!a||!Array.isArray(a))return;const{tax:m}=a[0];_.value=[...m,"0%","1%","3%"]}})},{immediate:!0}),(o,t)=>{const l=p("el-form-item"),n=p("el-input"),i=p("el-option"),s=p("el-select"),u=p("el-button");return b(),C(F,null,[r(J(K),{"label-position":"left",ref_key:"formRef",ref:h,rules:A.value,model:e},{default:d(()=>[v("div",Y,[r(l,{label:"\u5546\u54C1\u7C7B\u76EE\u8BBE\u7F6E",prop:"cat_code","flex-1":""},{default:d(()=>[z(` <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(X,{ref_key:"remoteSelectRef",ref:c,modelValue:e.cat_code,"onUpdate:modelValue":t[0]||(t[0]=a=>e.cat_code=a),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":t[1]||(t[1]=a=>e.inv_good_name=a),placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",maxlength:"70"},null,8,["modelValue"])]),_:1})]),v("div",$,[r(l,{label:"\u7A0E\u7387",prop:"tax"},{default:d(()=>[r(s,{"w-180px":"",modelValue:e.tax,"onUpdate:modelValue":t[2]||(t[2]=a=>e.tax=a),disabled:k.value.tax,placeholder:"\u8BF7\u8F93\u5165\u7A0E\u7387"},{default:d(()=>[(b(!0),C(F,null,P(_.value,(a,m)=>(b(),G(i,{key:m,label:a,value:a},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})])]),_:1},8,["rules","model"]),v("div",ee,[r(u,{type:"primary",onClick:q,loading:g.value},{default:d(()=>t[3]||(t[3]=[M("\u4FDD\u5B58")])),_:1},8,["loading"])])],64)}}});var se=T(te,[["__scopeId","data-v-09a86bb6"],["__file","D:/work/jiesuan/settle-vue3/src/views/InvoiceSaleSettings/_component/procure-setting.vue"]]);export{se as default};
