import{k as X,C as Y,D as T,w as M,F as O,M as j,b as q,N as K,O as ee,v as oe,I as te,L as le}from"./element-plus.78e68aed.js";import{_ as ue}from"./index.vue_vue_type_script_setup_true_lang.3c4454b7.js";import{u as ae}from"./usePaging.6a6670f9.js";import{u as se}from"./useDictOptions.d3b8fa80.js";import{d as ie,e as ne,_ as re}from"./store_product.8addd707.js";import"./lodash.60201f64.js";import{v as pe}from"./index.49b211ae.js";import{d as B,Z,r as w,o as E,c as N,U as e,L as o,u as i,R as m,M as U,a as v,j as A,s as de,ap as me,K as P,S as ce}from"./@vue.18505fe0.js";import{a as _e}from"./vue-router.101084e3.js";import{a as fe}from"./store_product_unit.d3ab9be7.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.fbc6a400.js";import"./@element-plus.edbd5a83.js";import"./dayjs.8ae0c638.js";import"./axios.2b8d80bd.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./system_store.09c222e2.js";import"./pinia.a969beab.js";import"./css-color-function.b82a2ce7.js";import"./color.b905eb26.js";import"./clone.e1fb2883.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.495afef3.js";import"./vue-clipboard3.cb649e18.js";import"./clipboard.4592e390.js";import"./echarts.5016c48c.js";import"./zrender.58d022a1.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.b0c09b66.js";const he={class:"mt-4"},we={class:"flex mt-4 justify-end"},ve=B({name:"systemStoreLists"}),be=B({...ve,emits:["onBindStore"],setup(z,{emit:$}){const c=Z({name:"",phone:""}),C=w([]),y=h=>{C.value=h.map(({id:r})=>r)};se("");const{pager:n,getLists:d,resetParams:k,resetPage:x}=ae({fetchFun:ie,params:c});d();const f=$,_=()=>{let h=n.lists.filter(r=>C.value.includes(r.id));if(!h.length)return X.error("\u8BF7\u5148\u9009\u62E9\u95E8\u5E97");f("onBindStore",h)};return(h,r)=>{const g=Y,F=T,b=M,V=O,t=j,l=q,a=K,s=ue,D=ee;return E(),N("div",null,[e(V,{class:"mb-[-16px]",model:i(c),inline:""},{default:o(()=>[e(F,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name"},{default:o(()=>[e(g,{class:"w-[200px]",modelValue:i(c).name,"onUpdate:modelValue":r[0]||(r[0]=p=>i(c).name=p),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u95E8\u5E97\u540D\u79F0"},null,8,["modelValue"])]),_:1}),e(F,{label:"\u624B\u673A\u53F7\u7801",prop:"phone"},{default:o(()=>[e(g,{class:"w-[200px]",modelValue:i(c).phone,"onUpdate:modelValue":r[1]||(r[1]=p=>i(c).phone=p),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7\u7801"},null,8,["modelValue"])]),_:1}),e(F,null,{default:o(()=>[e(b,{type:"primary",onClick:i(x)},{default:o(()=>[m("\u67E5\u8BE2")]),_:1},8,["onClick"]),e(b,{onClick:i(k)},{default:o(()=>[m("\u91CD\u7F6E")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"]),U((E(),N("div",he,[e(a,{data:i(n).lists,onSelectionChange:y,height:300},{default:o(()=>[e(t,{type:"selection",width:"55"}),e(t,{label:"\u5546\u54C1ID",prop:"id","show-overflow-tooltip":""}),e(t,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:o(({row:p})=>[e(l,{style:{width:"50px",height:"50px"},src:p.image},null,8,["src"])]),_:1}),e(t,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name","min-width":"200","show-overflow-tooltip":""}),e(t,{label:"\u5206\u7C7B",prop:"cate_name","min-width":"120","show-overflow-tooltip":""}),e(t,{label:"\u5355\u4F4D",prop:"unit_name","min-width":"80","show-overflow-tooltip":""}),e(t,{label:"\u5546\u54C1\u4EF7\u683C",prop:"price","min-width":"100","show-overflow-tooltip":""}),e(t,{label:"\u6210\u672C\u4EF7",prop:"cost","min-width":"100","show-overflow-tooltip":""}),e(t,{label:"\u91C7\u8D2D\u4EF7",prop:"purchase","min-width":"100","show-overflow-tooltip":""}),e(t,{label:"\u5E93\u5B58",prop:"stock","min-width":"100","show-overflow-tooltip":""}),e(t,{label:"\u9500\u91CF",prop:"sales","min-width":"100","show-overflow-tooltip":""})]),_:1},8,["data"])])),[[D,i(n).loading]]),v("div",we,[e(s,{modelValue:i(n),"onUpdate:modelValue":r[2]||(r[2]=p=>A(n)?n.value=p:null),onChange:i(d)},null,8,["modelValue","onChange"])]),e(b,{class:"w-full mt-4",type:"primary",onClick:_},{default:o(()=>[m("\u6DFB\u52A0\u5546\u54C1")]),_:1})])}}}),Ee=v("div",{class:"mb-4 text-lg font-bold"}," \u5BFC\u5165\u5546\u54C1\u5230\u95E8\u5E97 ",-1),Ce={class:"flex-1 w-full"},ge={class:"mb-2"},Fe={class:"flex-1 w-full"},De={class:"mb-2"},Be=B({name:"storeProductEdit"}),ro=B({...Be,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(z,{emit:$}){const c=de(),{removeTab:C}=pe();w("add");const y=Z({store_id:""}),n=w(!1),d=w([]),k=t=>{d.value=d.value.filter(l=>l.id!==t)},x=t=>{t.forEach(l=>{d.value.find(a=>a.id==l.id)||d.value.push(l)}),n.value=!1},f=w(!1),_=w([]),h=t=>{_.value=_.value.filter(l=>l.id!==t)},r=t=>{t.forEach(l=>{_.value.find(a=>a.id==l.id)||_.value.push(l)}),f.value=!1},g=w([]);(()=>{fe({}).then(t=>{g.value=t.lists})})();const b=_e(),V=async()=>{const t=_.value.map(a=>({id:a.id,stock:a.new_stock||0})),l=d.value.map(a=>a.id);console.log(t,l),ne({product_arr:t,store_arr:l}).then(a=>{C(),b.push({path:"/store/store_product"})})};return(t,l)=>{const a=M,s=j,D=q,p=K,S=T,G=oe,H=O,J=re,I=te,Q=be,W=le,R=me("perms");return E(),P(W,null,{default:o(()=>[Ee,v("div",null,[e(H,{ref_key:"formRef",ref:c,model:i(y),"label-width":"90px"},{default:o(()=>[e(S,{label:"\u95E8\u5E97",prop:"store_id"},{default:o(()=>[v("div",Ce,[v("div",ge,[e(a,{type:"primary",onClick:l[0]||(l[0]=u=>n.value=!0)},{default:o(()=>[m("\u6DFB\u52A0\u95E8\u5E97")]),_:1})]),e(p,{data:i(d)},{default:o(()=>[e(s,{label:"ID",prop:"id","show-overflow-tooltip":""}),e(s,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),e(s,{label:"\u624B\u673A\u53F7\u7801",prop:"phone","show-overflow-tooltip":""}),e(s,{label:"\u8BE6\u7EC6\u5730\u5740",prop:"detailed_address","show-overflow-tooltip":""}),e(s,{label:"\u95E8\u5E97logo",prop:"image","show-overflow-tooltip":""},{default:o(({row:u})=>[e(D,{src:u.image,class:"w-[40px] h-[40px]"},null,8,["src"])]),_:1}),e(s,{label:"\u8425\u4E1A\u72B6\u6001",prop:"is_show","show-overflow-tooltip":""},{default:o(({row:u})=>[m(ce(u.is_show?"\u8425\u4E1A":"\u6253\u70CA"),1)]),_:1}),e(s,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:o(({row:u})=>[U((E(),P(a,{type:"danger",link:"",onClick:L=>k(u.id)},{default:o(()=>[m(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[R,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])])]),_:1}),e(S,{label:"\u5546\u54C1",prop:"store_id"},{default:o(()=>[v("div",Fe,[v("div",De,[e(a,{type:"primary",onClick:l[1]||(l[1]=u=>f.value=!0)},{default:o(()=>[m("\u6DFB\u52A0\u5546\u54C1")]),_:1})]),e(p,{data:i(_)},{default:o(()=>[e(s,{label:"\u5546\u54C1ID",prop:"id","show-overflow-tooltip":""}),e(s,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:o(({row:u})=>[e(D,{style:{width:"50px",height:"50px"},src:u.image},null,8,["src"])]),_:1}),e(s,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name","min-width":"200","show-overflow-tooltip":""}),e(s,{label:"\u5206\u7C7B",prop:"cate_name","min-width":"120","show-overflow-tooltip":""}),e(s,{label:"\u5355\u4F4D",prop:"unit_name","min-width":"80","show-overflow-tooltip":""}),e(s,{label:"\u5546\u54C1\u4EF7\u683C",prop:"price","min-width":"100","show-overflow-tooltip":""}),e(s,{label:"\u5206\u914D\u5E93\u5B58",fixed:"right","min-width":"150"},{default:o(({row:u})=>[e(G,{modelValue:u.new_stock,"onUpdate:modelValue":L=>u.new_stock=L,min:1},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(s,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:o(({row:u})=>[U((E(),P(a,{type:"danger",link:"",onClick:L=>h(u.id)},{default:o(()=>[m(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[R,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])])]),_:1}),e(S,{label:""},{default:o(()=>[e(a,{onClick:V,type:"primary",class:"w-40"},{default:o(()=>[m("\u63D0\u4EA4")]),_:1})]),_:1})]),_:1},8,["model"])]),e(I,{modelValue:i(n),"onUpdate:modelValue":l[2]||(l[2]=u=>A(n)?n.value=u:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:o(()=>[e(J,{onOnBindStore:x})]),_:1},8,["modelValue"]),e(I,{modelValue:i(f),"onUpdate:modelValue":l[3]||(l[3]=u=>A(f)?f.value=u:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:o(()=>[e(Q,{onOnBindStore:r})]),_:1},8,["modelValue"])]),_:1})}}});export{ro as default};