1 |
- import{_ as M,d as P,E as D,A as W,z as J,aC 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 T,T as ee,N as g,u as i,O as ae,K as n,y as u,aD as te,L as V,M as k,aE as le,a as q,W as U}from"./index.1417328f.js";import{c as R,i as h}from"./configs.87b335b0.js";import{h as oe,a as ue}from"./index.57ad1f95.js";import{B as ne}from"./basic-descriptions.cadaf928.js";import"./configs.a6760415.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=P({__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=D(null),N={cat_code:"",cat_name:"",inv_good_name:"",tax:"",inv_tag:"",is_discount:"",addTax:""},{push:Z}=W(),{query:I}=J(),S=D(null),H=Q(),C=D([]),j=f(()=>I.id),e=X({...N}),y=f(()=>({isDiscount:e.is_discount==="1",isZeroTaxRate:e.tax==="0%"})),B=f(()=>{const{isDiscount:o,isZeroTaxRate:a}=y.value,l=!e.cat_code;return{tax:l,is_discount:l,addTax:l||!a||!o,inv_tag:l||!a||o&&a}}),L=f(()=>{const{isDiscount:o,isZeroTaxRate:a}=y.value;return{...R,inv_tag:[{...R.inv_tag[0],required:a}],addTax:[{...R.addTax[0],required:o&&a}]}}),w=f(()=>{const{isDiscount:o,isZeroTaxRate:a}=y.value;let l=[],d=[];return o&&a&&(d=l=[h[0],h[1]]),a&&!o&&(d=[h[2]]),{addTax:l,invTag:d}});function O(){S.value.validate(async o=>{var r;if(!o)return;const a={spuCode:j.value,...e},{addTax:l}=a;l&&(a.addTax=((r=h.find(({value:v})=>l===v))==null?void 0:r.label)||"");const{code:d,message:c}=await ue(a);H({code:d,message:c,handler:()=>Z(b.backRoute)})})}function z(o){if(!o)return e.tax="",e.cat_name="",C.value=[];const{tax:a,cat_name:l}=o;C.value=[...a],e.cat_name=l,e.tax="",e.addTax="",e.inv_tag="",e.is_discount=""}const G=()=>{e.addTax="",e.inv_tag=""},K=()=>{e.is_discount="",e.addTax="",e.inv_tag=""};return A(()=>e.addTax,o=>{if(!o)return;const{isZeroTaxRate:a,isDiscount:l}=y.value;a&&l&&(e.inv_tag=e.addTax)}),A(()=>b.detail,async()=>{if(!b.detail)return;const{good_name:o,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||o,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];C.value=m}}),(o,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,[T("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]]),T("div",_e,[_.canChange?(s(),g(i(le),{key:0,"label-position":"left",ref_key:"formRef",ref:S,rules:i(L),model:e},{default:n(()=>[T("div",me,[u(l,{label:"\u5546\u54C1\u7C7B\u76EE\u8BBE\u7F6E",prop:"cat_code","flex-1":""},{default:n(()=>[u(i(te),{ref_key:"remoteSelectRef",ref:F,"w-full":"","is-root":"",api:i(oe),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:z,onInital:a[1]||(a[1]=t=>e.cat_code=t)},null,8,["api","modelValue"])]),_:1}),u(l,{label:"\u5F00\u7968\u5546\u54C1\u540D\u79F0",prop:"inv_good_name","flex-1":""},{default:n(()=>[u(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})]),T("div",pe,[u(l,{label:"\u7A0E\u7387",prop:"tax"},{default:n(()=>[u(r,{"w-180px":"",modelValue:e.tax,"onUpdate:modelValue":a[3]||(a[3]=t=>e.tax=t),disabled:i(B).tax,placeholder:"\u8BF7\u8F93\u5165\u7A0E\u7387",onChange:K},{default:n(()=>[(s(!0),p(V,null,k(C.value,(t,m)=>(s(),g(c,{key:m,label:t,value:t},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),u(l,{label:"\u662F\u5426\u6709\u4F18\u60E0\u653F\u7B56",prop:"is_discount"},{default:n(()=>[u(r,{disabled:i(B).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:G},{default:n(()=>[u(c,{label:"\u5426",value:"0"}),u(c,{label:"\u662F",value:"1"})]),_:1},8,["disabled","modelValue"])]),_:1}),u(l,{label:"\u589E\u503C\u7A0E\u7BA1\u7406\u5185\u5BB9",prop:"addTax"},{default:n(()=>[u(r,{disabled:i(B).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(V,null,k(i(w).addTax,(t,m)=>(s(),g(c,{key:m,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["disabled","modelValue"])]),_:1}),u(l,{label:"\u6C47\u7387\u6807\u8BC6",prop:"inv_tag"},{default:n(()=>[u(r,{disabled:i(B).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(V,null,k(i(w).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,[u(v,{type:"primary",onClick:O},{default:n(()=>[fe]),_:1})])):q("v-if",!0)])])}}});var Te=M(xe,[["__scopeId","data-v-a5cd9d58"],["__file","/Users/apple/Desktop/Company Projects/accout-vue3-ui/src/views/InvoiceSaleSettings/basic-settings.vue"]]);export{Te as default};
|