import{i as y,c as j,h as J,a as K,b as O}from"./index.b1f9698b.js";import{R as z}from"./remote-select.0c28bf23.js";import{u as G}from"./use-response-handle.e6cae34f.js";import{_ as M,q as P,B,x as Q,w as W,a4 as k,a2 as X,aC as D,r as _,as as Y,o as s,n as r,p as g,O as Z,K as f,v as m,L as $,t as l,H as o,I as E,J as C,aD as ee,S as A}from"./index.d8ce26ef.js";import{B as ae}from"./basic-descriptions.43c3a1ff.js";import"./configs.a7e7e50a.js";const te={class:"settings__content","bg-white":""},le={"mb-2":"","font-bold":""},ue={key:1,"h-100px":""},oe=A("\u8BE6\u60C5\u52A0\u8F7D\u4E2D..."),ne=[oe],se={"w-500px":"","m-auto":"","mt-5":""},de={flex:"","justify-center":""},ie=A("\u4FDD\u5B58"),ce=P({__name:"basic-settings",props:{title:null,detail:null,columns:null,backRoute:null,name:null},setup(d){const b=d;let R="",F=!0;const h=B(null),S=G(),V=B([...y]),{push:T}=Q(),{query:U}=W(),w=k({...j}),q=X(()=>U.id),p=B([]),e=k({cat_code:"",cat_name:"",inv_good_name:"",tax:"",inv_tag:"0",is_discount:"0",addTax:""});function H(){h.value.validate(async n=>{if(!n)return;const{code:a,message:u}=await O({spuCode:q.value,...e,cat_code:e.cat_name?e.cat_code:R});S({code:a,message:u,handler:()=>T(b.backRoute)})})}function I(n){if(!n)return e.tax="",e.cat_name="",p.value=[];const{tax:a,cat_name:u}=n;p.value=a,e.tax=a[0],e.cat_name=u}return D(()=>{const{is_discount:n}=e;let a=[];e.inv_tag="",n==="0"||!n?(a=["0","3"],e.addTax=""):a=["0","1","2"],w.addTax[0].required=!!n,F&&(e.inv_tag="0",F=!1),V.value=y.filter(u=>a.includes(u.value))}),D(()=>{if(!b.detail)return;const{good_name:n,inv_good_name:a,inv_cat_name:u,inv_tax:x}=b.detail;e.cat_code=u||"",e.inv_good_name=a||n,e.tax=x||""}),(n,a)=>{const u=_("el-form-item"),x=_("el-input"),i=_("el-option"),v=_("el-select"),N=_("el-button"),L=Y("loading");return s(),r("div",te,[g("h1",le,Z(d.title),1),d.detail?(s(),f(m(ae),{key:0,data:d.detail,columns:d.columns,"label-width":"130px","col-number":2},null,8,["data","columns"])):$((s(),r("div",ue,ne)),[[L,!0]]),g("div",se,[l(m(ee),{"label-width":"120px","label-position":"left",ref_key:"formRef",ref:h,rules:w,model:e},{default:o(()=>[l(u,{label:"\u5546\u54C1\u7C7B\u76EE\u8BBE\u7F6E",prop:"cat_code"},{default:o(()=>[l(m(z),{"w-100":"","is-root":"",api:m(J),modelValue:e.cat_code,"onUpdate:modelValue":a[0]||(a[0]=t=>e.cat_code=t),placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u7C7B\u76EE","response-label-prop":"cat_name","response-val-prop":"cat_code","request-prop":"cat_name",onItemChange:I},null,8,["api","modelValue"])]),_:1}),l(u,{label:"\u5546\u54C1\u540D\u79F0",prop:"inv_good_name"},{default:o(()=>[l(x,{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"},null,8,["modelValue"])]),_:1}),l(u,{label:"\u662F\u5426\u6709\u4F18\u60E0\u653F\u7B56",prop:"is_discount"},{default:o(()=>[l(v,{"w-390px":"",modelValue:e.is_discount,"onUpdate:modelValue":a[2]||(a[2]=t=>e.is_discount=t),placeholder:"\u8BF7\u9009\u62E9\u662F\u5426\u5305\u542B\u4F18\u60E0\u653F\u7B56"},{default:o(()=>[l(i,{label:"\u5426",value:"0"}),l(i,{label:"\u662F",value:"1"})]),_:1},8,["modelValue"])]),_:1}),l(u,{label:"\u6C47\u7387\u6807\u8BC6",prop:"inv_tag"},{default:o(()=>[l(v,{"w-390px":"",modelValue:e.inv_tag,"onUpdate:modelValue":a[3]||(a[3]=t=>e.inv_tag=t),placeholder:"\u8BF7\u9009\u62E9\u6C47\u7387\u6807\u8BC6"},{default:o(()=>[(s(!0),r(E,null,C(V.value,(t,c)=>(s(),f(i,{key:c,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(u,{label:"\u7A0E\u7387",prop:"tax"},{default:o(()=>[l(v,{"w-390px":"",modelValue:e.tax,"onUpdate:modelValue":a[4]||(a[4]=t=>e.tax=t),disabled:p.value.length===0,placeholder:"\u8BF7\u8F93\u5165\u7A0E\u7387"},{default:o(()=>[(s(!0),r(E,null,C(p.value,(t,c)=>(s(),f(i,{key:c,label:t,value:t},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),l(u,{label:"\u589E\u503C\u7A0E\u7BA1\u7406\u5185\u5BB9",prop:"addTax"},{default:o(()=>[l(v,{"w-390px":"",modelValue:e.addTax,"onUpdate:modelValue":a[5]||(a[5]=t=>e.addTax=t),disabled:e.is_discount==="0",placeholder:"\u8BF7\u9009\u62E9\u589E\u503C\u7A0E\u7BA1\u7406\u7A0E\u5185\u5BB9"},{default:o(()=>[(s(!0),r(E,null,C(m(K),(t,c)=>(s(),f(i,{key:c,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1},8,["rules","model"]),g("div",de,[l(N,{type:"primary",onClick:H},{default:o(()=>[ie]),_:1})])])])}}});var be=M(ce,[["__scopeId","data-v-56b2b5b6"]]);export{be as default};
