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