import{a2 as Y,H as ee,J as oe,K as te,D as le,C as ae,w as ue,F as se,L as ne,M as re,b as ie,t as pe,N as me,O as de}from"./element-plus.7b9d0c0d.js";import{_ as ce}from"./index.vue_vue_type_script_setup_true_lang.8b9de773.js";import{d as U,s as _e,r as c,Z as fe,ap as D,o as i,c as x,U as e,L as t,u as l,T as he,a9 as ve,K as _,aa as S,R as r,M as B,j as L,a as P,Q as we,n as be}from"./@vue.18505fe0.js";import{u as Ee}from"./usePaging.6a6670f9.js";import{u as Ce}from"./useDictOptions.1a1b606d.js";import{d as ge,b as Fe,e as Be}from"./store_branch_product.11217e35.js";import"./lodash.9dc701ad.js";import{a as ke}from"./system_store.9d67bd1c.js";import{f as Ve}from"./index.c56b65b4.js";import{_ as ye}from"./edit.vue_vue_type_script_setup_true_name_storeBranchProductEdit_lang.e725b552.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.fbc6a400.js";import"./@element-plus.edbd5a83.js";import"./dayjs.7347fedc.js";import"./axios.4607972f.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./vue-router.101084e3.js";import"./pinia.a969beab.js";import"./css-color-function.bb8c34b2.js";import"./color.fbd63fe8.js";import"./clone.31a3aa2c.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./ms.564e106c.js";import"./nprogress.0d2736b7.js";import"./vue-clipboard3.7d5a7a5d.js";import"./clipboard.860a1cea.js";import"./echarts.5016c48c.js";import"./zrender.58d022a1.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.b0c09b66.js";import"./picker.217bd9de.js";import"./index.75fd8450.js";import"./index.vue_vue_type_style_index_0_scoped_d380c88d_lang.d9a16ced.js";import"./index.eb1580c5.js";import"./index.283ad693.js";import"./vuedraggable.1648e3a8.js";import"./vue.393dceb0.js";import"./sortablejs.382fadba.js";import"./store_product_unit.694efc37.js";const De={class:"mt-4"},xe={class:"flex mt-4 justify-end"},Se=U({name:"storeBranchProductLists"}),ko=U({...Se,setup(Le){const C=_e(),g=c(!1),s=fe({store_id:"",store_name:"",bar_code:"",exchange:0,status:null,stock:null}),K=c([]),R=a=>{K.value=a.map(({id:u})=>u)},{dictData:T}=Ce(""),{pager:p,getLists:m,resetParams:A,resetPage:f}=Ee({fetchFun:Be,params:s}),$=async a=>{var u,v;g.value=!0,await be(),(u=C.value)==null||u.open("edit"),(v=C.value)==null||v.setFormData(a)},N=async a=>{await Ve.confirm("\u786E\u5B9A\u8981\u5220\u9664\uFF1F"),await ge({id:a}),m()};m();const h=c(!1),k=c([]),I=(a="")=>{h.value=!0,ke({name:a,page_size:50}).then(u=>{k.value=u.lists,setTimeout(()=>{h.value=!1},300)}).catch(u=>{setTimeout(()=>{h.value=!1},300)})},M=a=>{Fe({id:a.id,store_name:a.store_name,image:a.image,price:a.price,unit:a.unit,status:a.status})},F=c("0"),j=a=>{a==0?(s.status=null,s.stock=null):a==1?(s.status=1,s.stock=null):a==2?(s.status=0,s.stock=null):a==3?(s.status=null,s.stock=10):a==4&&(s.status=null,s.stock=0),m()};return(a,u)=>{const v=oe,z=te,w=le,V=ae,b=ue,O=se,y=ne,d=Y,q=ee,n=re,G=ie,H=pe,J=me,Q=ce,Z=D("prems"),W=D("perms"),X=de;return i(),x("div",null,[e(y,{class:"!border-none mb-4",shadow:"never"},{default:t(()=>[e(O,{class:"mb-[-16px]",model:l(s),inline:""},{default:t(()=>[e(w,{label:"\u95E8\u5E97",prop:"store_id"},{default:t(()=>[e(z,{modelValue:l(s).store_id,"onUpdate:modelValue":u[0]||(u[0]=o=>l(s).store_id=o),filterable:"",remote:"","reserve-keyword":"",placeholder:"\u8F93\u5165\u95E8\u5E97\u540D\u79F0\u641C\u7D22","remote-show-suffix":"","remote-method":I,loading:l(h),style:{width:"240px"},onChange:l(f)},{default:t(()=>[(i(!0),x(he,null,ve(l(k),o=>(i(),_(v,{key:o.id,label:o.name,value:o.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading","onChange"])]),_:1}),e(w,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:t(()=>[e(V,{class:"w-[280px]",modelValue:l(s).store_name,"onUpdate:modelValue":u[1]||(u[1]=o=>l(s).store_name=o),onKeydown:S(l(f),["enter"]),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0"},null,8,["modelValue","onKeydown"])]),_:1}),e(w,{label:"\u5546\u54C1\u6761\u7801",prop:"bar_code"},{default:t(()=>[e(V,{class:"w-[280px]",modelValue:l(s).bar_code,"onUpdate:modelValue":u[2]||(u[2]=o=>l(s).bar_code=o),onKeydown:S(l(f),["enter"]),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u6761\u7801"},null,8,["modelValue","onKeydown"])]),_:1}),e(w,null,{default:t(()=>[e(b,{type:"primary",onClick:l(f)},{default:t(()=>[r("\u67E5\u8BE2")]),_:1},8,["onClick"]),e(b,{onClick:l(A)},{default:t(()=>[r("\u91CD\u7F6E")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"])]),_:1}),B((i(),_(y,{class:"!border-none",shadow:"never"},{default:t(()=>[e(q,{modelValue:l(F),"onUpdate:modelValue":u[3]||(u[3]=o=>L(F)?F.value=o:null),onChange:j},{default:t(()=>[e(d,{label:"0"},{default:t(()=>[r("\u5168\u90E8")]),_:1}),e(d,{label:"1"},{default:t(()=>[r("\u4E0A\u67B6")]),_:1}),e(d,{label:"2"},{default:t(()=>[r("\u4E0B\u67B6")]),_:1}),e(d,{label:"3"},{default:t(()=>[r("\u5E93\u5B58\u8B66\u544A")]),_:1}),e(d,{label:"4"},{default:t(()=>[r("\u5DF2\u552E\u7F44")]),_:1})]),_:1},8,["modelValue"]),P("div",De,[e(J,{data:l(p).lists,onSelectionChange:R},{default:t(()=>[e(n,{label:"ID",prop:"id","show-overflow-tooltip":""}),e(n,{label:"\u95E8\u5E97",prop:"system_store_name","show-overflow-tooltip":""}),e(n,{label:"\u5206\u7C7B",prop:"cate_name","show-overflow-tooltip":""}),e(n,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name","show-overflow-tooltip":""}),e(n,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","show-overflow-tooltip":""},{default:t(({row:o})=>[e(G,{class:"w-[40px] h-[40px]",src:o.image,"preview-teleported":!0},null,8,["src"])]),_:1}),e(n,{label:"\u4F9B\u8D27\u4EF7",prop:"purchase","min-width":"100","show-overflow-tooltip":""}),e(n,{label:"\u5546\u6237\u4EF7",prop:"cost","min-width":"120","show-overflow-tooltip":""}),e(n,{label:"\u4F1A\u5458\u4EF7",prop:"vip_price","min-width":"120","show-overflow-tooltip":""}),e(n,{label:"\u7EC8\u7AEF\u96F6\u552E\u4EF7",prop:"price","min-width":"120","show-overflow-tooltip":""}),e(n,{label:"\u5546\u54C1\u6761\u7801",prop:"bar_code","show-overflow-tooltip":""}),e(n,{label:"\u9500\u91CF",prop:"sales","show-overflow-tooltip":""}),e(n,{label:"\u552E\u5356\u5E93\u5B58",prop:"stock","show-overflow-tooltip":""}),e(n,{label:"\u5151\u6362\u5E93\u5B58",prop:"swap","show-overflow-tooltip":""}),e(n,{label:"\u5355\u4F4D",prop:"unit_name","show-overflow-tooltip":""}),e(n,{label:"\u72B6\u6001",prop:"status"},{default:t(({row:o})=>[e(H,{size:"large",onChange:E=>M(o),modelValue:o.status,"onUpdate:modelValue":E=>o.status=E,"active-value":1,"inactive-value":0,"active-text":"\u4E0A\u67B6","inactive-text":"\u4E0B\u67B6","inline-prompt":""},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1}),e(n,{label:"\u64CD\u4F5C","min-width":"140",fixed:"right",align:"center","show-overflow-tooltip":""},{default:t(({row:o})=>[B((i(),_(b,{type:"primary",link:"",onClick:E=>$(o)},{default:t(()=>[r("\u7F16\u8F91")]),_:2},1032,["onClick"])),[[Z,["store_branch_product.store_branch_product/deit"]]]),B((i(),_(b,{type:"danger",link:"",onClick:E=>N(o.id)},{default:t(()=>[r("\u5220\u9664")]),_:2},1032,["onClick"])),[[W,["store_branch_product.store_branch_product/delete"]]])]),_:1})]),_:1},8,["data"])]),P("div",xe,[e(Q,{modelValue:l(p),"onUpdate:modelValue":u[4]||(u[4]=o=>L(p)?p.value=o:null),onChange:l(m)},null,8,["modelValue","onChange"])])]),_:1})),[[X,l(p).loading]]),l(g)?(i(),_(ye,{key:0,ref_key:"editRef",ref:C,"dict-data":l(T),onSuccess:l(m),onClose:u[5]||(u[5]=o=>g.value=!1)},null,8,["dict-data","onSuccess"])):we("",!0)])}}});export{ko as default};