1 |
- import{_ as J,d as M,E as V,A as W,z as P,aI as Q,af as f,a7 as X,H as A,G as Y,x,aA as $,o as s,c as p,b as h,T as ee,N as g,u as i,O as ae,K as n,y as o,aJ as te,L as D,M as k,aK as le,a as q,W as U}from"./index.743f0c80.js";import{c as R,i as y}from"./configs.5457d001.js";import{h as ue,a as oe}from"./index.86c5ab98.js";import{B as ne}from"./basic-descriptions.e56bd542.js";import"./configs.da7a34da.js";const se={class:"settings__content","bg-white":""},ie={"mb-2":"","font-bold":""},de={key:1,"h-100px":""},re=U("\u8BE6\u60C5\u52A0\u8F7D\u4E2D..."),ce=[re],_e={"mt-5":""},me={flex:"",gap:"1"},pe={flex:"","gap-3":""},ve={key:1,flex:"","justify-end":""},fe=U("\u4FDD\u5B58"),xe=M({__name:"basic-settings",props:{title:{type:String,required:!0},detail:{type:null,required:!0},columns:{type:Array,required:!0},backRoute:{type:String,required:!0},name:{type:String,required:!1},canChange:{type:Boolean,required:!1}},setup(_){const b=_,F=V(null),I={cat_code:"",cat_name:"",inv_good_name:"",tax:"",inv_tag:"",is_discount:"",addTax:""},{push:N}=W(),{query:Z}=P(),w=V(null),H=Q(),B=V([]),K=f(()=>Z.id),e=X({...I}),C=f(()=>({isDiscount:e.is_discount==="1",isZeroTaxRate:e.tax==="0%"})),T=f(()=>{const{isDiscount:u,isZeroTaxRate:a}=C.value,l=!e.cat_code;return{tax:l,is_discount:l,addTax:l||!a||!u,inv_tag:l||!a||u&&a}}),L=f(()=>{const{isDiscount:u,isZeroTaxRate:a}=C.value;return{...R,inv_tag:[{...R.inv_tag[0],required:a}],addTax:[{...R.addTax[0],required:u&&a}]}}),S=f(()=>{const{isDiscount:u,isZeroTaxRate:a}=C.value;let l=[],d=[];return u&&a&&(d=l=[y[0],y[1]]),a&&!u&&(d=[y[2]]),{addTax:l,invTag:d}});function O(){w.value.validate(async u=>{var r;if(!u)return;const a={spuCode:K.value,...e},{addTax:l}=a;l&&(a.addTax=((r=y.find(({value:v})=>l===v))==null?void 0:r.label)||"");const{code:d,message:c}=await oe(a);H({code:d,message:c,handler:()=>N(b.backRoute)})})}function j(u){if(!u)return e.tax="",e.cat_name="",B.value=[];const{tax:a,cat_name:l}=u;B.value=[...a],e.cat_name=l,e.tax="",e.addTax="",e.inv_tag="",e.is_discount=""}const z=()=>{e.addTax="",e.inv_tag=""},G=()=>{e.is_discount="",e.addTax="",e.inv_tag=""};return A(()=>e.addTax,u=>{if(!u)return;const{isZeroTaxRate:a,isDiscount:l}=C.value;a&&l&&(e.inv_tag=e.addTax)}),A(()=>b.detail,async()=>{if(!b.detail)return;const{good_name:u,inv_good_name:a,inv_tax:l,inv_cat_code:d,is_discount:c,inv_tag:r,addTax:v}=b.detail;if(e.inv_good_name=a||u,e.tax=l?l*100+"%":"",e.is_discount=String(c),e.inv_good_name.length>70&&(e.inv_good_name=e.inv_good_name.slice(0,70)),Y(()=>{e.inv_tag=String(r)!=="0"?String(r):"",e.addTax=v}),d&&F.value){const E={cat_code:d},t=await F.value.initalData(E);if(!t||!Array.isArray(t))return;const{tax:m}=t[0];B.value=m}}),(u,a)=>{const l=x("el-form-item"),d=x("el-input"),c=x("el-option"),r=x("el-select"),v=x("el-button"),E=$("loading");return s(),p("div",se,[h("h1",ie,ee(_.title),1),_.detail?(s(),g(i(ne),{key:0,data:_.detail,columns:_.columns,"label-width":"130px","col-number":2},null,8,["data","columns"])):ae((s(),p("div",de,ce)),[[E,!0]]),h("div",_e,[_.canChange?(s(),g(i(le),{key:0,"label-position":"left",ref_key:"formRef",ref:w,rules:i(L),model:e},{default:n(()=>[h("div",me,[o(l,{label:"\u5546\u54C1\u7C7B\u76EE\u8BBE\u7F6E",prop:"cat_code","flex-1":""},{default:n(()=>[o(i(te),{ref_key:"remoteSelectRef",ref:F,"w-full":"","is-root":"",api:i(ue),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","sub-label-prop":"short_name",onItemChange:j,onInital:a[1]||(a[1]=t=>e.cat_code=t)},null,8,["api","modelValue"])]),_:1}),o(l,{label:"\u5F00\u7968\u5546\u54C1\u540D\u79F0",prop:"inv_good_name","flex-1":""},{default:n(()=>[o(d,{"w-full":"",modelValue:e.inv_good_name,"onUpdate:modelValue":a[2]||(a[2]=t=>e.inv_good_name=t),placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",maxlength:"70"},null,8,["modelValue"])]),_:1})]),h("div",pe,[o(l,{label:"\u7A0E\u7387",prop:"tax"},{default:n(()=>[o(r,{"w-180px":"",modelValue:e.tax,"onUpdate:modelValue":a[3]||(a[3]=t=>e.tax=t),disabled:i(T).tax,placeholder:"\u8BF7\u8F93\u5165\u7A0E\u7387",onChange:G},{default:n(()=>[(s(!0),p(D,null,k(B.value,(t,m)=>(s(),g(c,{key:m,label:t,value:t},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),o(l,{label:"\u662F\u5426\u6709\u4F18\u60E0\u653F\u7B56",prop:"is_discount"},{default:n(()=>[o(r,{disabled:i(T).is_discount,"w-150px":"",modelValue:e.is_discount,"onUpdate:modelValue":a[4]||(a[4]=t=>e.is_discount=t),placeholder:"\u8BF7\u9009\u62E9\u662F\u5426\u5305\u542B\u4F18\u60E0\u653F\u7B56",onChange:z},{default:n(()=>[o(c,{label:"\u5426",value:"0"}),o(c,{label:"\u662F",value:"1"})]),_:1},8,["disabled","modelValue"])]),_:1}),o(l,{label:"\u589E\u503C\u7A0E\u7BA1\u7406\u5185\u5BB9",prop:"addTax"},{default:n(()=>[o(r,{disabled:i(T).addTax,"w-230px":"",modelValue:e.addTax,"onUpdate:modelValue":a[5]||(a[5]=t=>e.addTax=t),placeholder:"\u8BF7\u9009\u62E9\u589E\u503C\u7A0E\u7BA1\u7406\u7A0E\u5185\u5BB9"},{default:n(()=>[(s(!0),p(D,null,k(i(S).addTax,(t,m)=>(s(),g(c,{key:m,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["disabled","modelValue"])]),_:1}),o(l,{label:"\u6C47\u7387\u6807\u8BC6",prop:"inv_tag"},{default:n(()=>[o(r,{disabled:i(T).inv_tag,"w-180px":"",modelValue:e.inv_tag,"onUpdate:modelValue":a[6]||(a[6]=t=>e.inv_tag=t),placeholder:"\u8BF7\u9009\u62E9\u6C47\u7387\u6807\u8BC6"},{default:n(()=>[(s(!0),p(D,null,k(i(S).invTag,(t,m)=>(s(),g(c,{key:m,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["disabled","modelValue"])]),_:1})])]),_:1},8,["rules","model"])):q("v-if",!0),_.canChange?(s(),p("div",ve,[o(v,{type:"primary",onClick:O},{default:n(()=>[fe]),_:1})])):q("v-if",!0)])])}}});var he=J(xe,[["__scopeId","data-v-a5cd9d58"],["__file","D:/work/accout-vue3-ui/src/views/InvoiceSaleSettings/basic-settings.vue"]]);export{he as default};
|