import{k as eo,C as to,D as M,w as O,F as j,M as G,b as q,N as H,O as lo,G as uo,H as ao,v as so,I as no,L as io}from"./element-plus.ea2cdc63.js";import{_ as ro}from"./index.vue_vue_type_script_setup_true_lang.9926caf5.js";import{d as F,Z,r as w,o as C,c as K,U as o,L as e,u as s,aa as po,R as p,M as A,a as h,j as y,s as mo,ap as _o,K as U,S as co}from"./@vue.18505fe0.js";import{u as fo}from"./usePaging.6a6670f9.js";import{u as wo}from"./useDictOptions.6e911004.js";import{d as ho,e as vo,_ as Eo}from"./store_product.1c85fc6d.js";import"./lodash.60201f64.js";import{w as bo}from"./index.af73db67.js";import{a as Co}from"./vue-router.101084e3.js";import{a as go}from"./store_product_unit.df39f0b6.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.86d5d3c7.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 Bo={class:"mt-4"},Do={class:"flex mt-4 justify-end"},yo=F({name:"systemStoreLists"}),Fo=F({...yo,emits:["onBindStore"],setup(z,{emit:$}){const b=Z({store_name:""}),g=w([]),k=E=>{g.value=E.map(({id:d})=>d)};wo("");const{pager:r,getLists:m,resetParams:x,resetPage:B}=fo({fetchFun:ho,params:b});m();const v=$,_=()=>{let E=r.lists.filter(d=>g.value.includes(d.id));if(!E.length)return eo.error("\u8BF7\u5148\u9009\u62E9\u95E8\u5E97");v("onBindStore",E)};return(E,d)=>{const V=to,S=M,c=O,L=j,i=G,n=q,t=H,u=ro,a=lo;return C(),K("div",null,[o(L,{class:"mb-[-16px]",model:s(b),inline:""},{default:e(()=>[o(S,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:e(()=>[o(V,{class:"w-[200px]",modelValue:s(b).store_name,"onUpdate:modelValue":d[0]||(d[0]=f=>s(b).store_name=f),onKeydown:po(s(B),["enter"]),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0"},null,8,["modelValue","onKeydown"])]),_:1}),o(S,null,{default:e(()=>[o(c,{type:"primary",onClick:s(B)},{default:e(()=>[p("\u67E5\u8BE2")]),_:1},8,["onClick"]),o(c,{onClick:s(x)},{default:e(()=>[p("\u91CD\u7F6E")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"]),A((C(),K("div",Bo,[o(t,{data:s(r).lists,onSelectionChange:k,height:300},{default:e(()=>[o(i,{type:"selection",width:"55"}),o(i,{label:"\u5546\u54C1ID",prop:"id","show-overflow-tooltip":""}),o(i,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:e(({row:f})=>[o(n,{style:{width:"50px",height:"50px"},src:f.image},null,8,["src"])]),_:1}),o(i,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name","min-width":"200","show-overflow-tooltip":""}),o(i,{label:"\u5206\u7C7B",prop:"cate_name","min-width":"120","show-overflow-tooltip":""}),o(i,{label:"\u5355\u4F4D",prop:"unit_name","min-width":"80","show-overflow-tooltip":""}),o(i,{label:"\u5546\u54C1\u4EF7\u683C",prop:"price","min-width":"100","show-overflow-tooltip":""}),o(i,{label:"\u6210\u672C\u4EF7",prop:"cost","min-width":"100","show-overflow-tooltip":""}),o(i,{label:"\u4F9B\u8D27\u4EF7",prop:"purchase","min-width":"100","show-overflow-tooltip":""}),o(i,{label:"\u552E\u5356\u5E93\u5B58",prop:"stock","min-width":"100","show-overflow-tooltip":""}),o(i,{label:"\u5151\u6362\u5E93\u5B58",prop:"swap","min-width":"100","show-overflow-tooltip":""}),o(i,{label:"\u9500\u91CF",prop:"sales","min-width":"100","show-overflow-tooltip":""})]),_:1},8,["data"])])),[[a,s(r).loading]]),h("div",Do,[o(u,{modelValue:s(r),"onUpdate:modelValue":d[1]||(d[1]=f=>y(r)?r.value=f:null),onChange:s(m)},null,8,["modelValue","onChange"])]),o(c,{class:"w-full mt-4",type:"primary",onClick:_},{default:e(()=>[p("\u6DFB\u52A0\u5546\u54C1")]),_:1})])}}}),ko=h("div",{class:"mb-4 text-lg font-bold"}," \u5BFC\u5165\u5546\u54C1\u5230\u95E8\u5E97 ",-1),xo={class:"flex-1 w-full"},Vo={class:"mb-2"},So={class:"flex-1 w-full"},Lo={class:"mb-2"},Po=h("span",{class:"text-info text-xs ml-6"},"\u9ED8\u8BA4\u4E3A\u5206\u914D\u552E\u5356\u5E93\u5B58, \u5982\u9700\u5206\u914D\u5151\u6362\u5E93\u5B58\u8BF7\u9009\u62E9\u5206\u914D\u5151\u6362\u5E93\u5B58",-1),Uo=F({name:"storeProductEdit"}),he=F({...Uo,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(z,{emit:$}){const b=mo(),{removeTab:g}=bo();w("add");const k=Z({store_id:""}),r=w(!1),m=w([]),x=n=>{m.value=m.value.filter(t=>t.id!==n)},B=n=>{n.forEach(t=>{m.value.find(u=>u.id==t.id)||m.value.push(t)}),r.value=!1},v=w(!1),_=w([]),E=n=>{_.value=_.value.filter(t=>t.id!==n)},d=n=>{n.forEach(t=>{_.value.find(u=>u.id==t.id)||_.value.push(t)}),v.value=!1},V=w([]);(()=>{go({}).then(n=>{V.value=n.lists})})();const c=w(1),L=Co(),i=async()=>{const n=_.value.map(u=>({id:u.id,stock:u.new_stock||0})),t=m.value.map(u=>u.id);console.log(n,t),vo({product_arr:n,store_arr:t,stock_type:c.value}).then(u=>{g(),L.push({path:"/store/store_product"})})};return(n,t)=>{const u=O,a=G,f=q,I=H,D=M,J=so,R=uo,Q=ao,W=j,X=Eo,N=no,Y=Fo,oo=io,T=_o("perms");return C(),U(oo,null,{default:e(()=>[ko,h("div",null,[o(W,{ref_key:"formRef",ref:b,model:s(k),"label-width":"90px"},{default:e(()=>[o(D,{label:"\u95E8\u5E97",prop:"store_id"},{default:e(()=>[h("div",xo,[h("div",Vo,[o(u,{type:"primary",onClick:t[0]||(t[0]=l=>r.value=!0)},{default:e(()=>[p("\u6DFB\u52A0\u95E8\u5E97")]),_:1})]),o(I,{data:s(m)},{default:e(()=>[o(a,{label:"ID",prop:"id","show-overflow-tooltip":""}),o(a,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),o(a,{label:"\u624B\u673A\u53F7\u7801",prop:"phone","show-overflow-tooltip":""}),o(a,{label:"\u8BE6\u7EC6\u5730\u5740",prop:"detailed_address","show-overflow-tooltip":""}),o(a,{label:"\u95E8\u5E97logo",prop:"image","show-overflow-tooltip":""},{default:e(({row:l})=>[o(f,{src:l.image,class:"w-[40px] h-[40px]"},null,8,["src"])]),_:1}),o(a,{label:"\u8425\u4E1A\u72B6\u6001",prop:"is_show","show-overflow-tooltip":""},{default:e(({row:l})=>[p(co(l.is_show?"\u8425\u4E1A":"\u6253\u70CA"),1)]),_:1}),o(a,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:e(({row:l})=>[A((C(),U(u,{type:"danger",link:"",onClick:P=>x(l.id)},{default:e(()=>[p(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[T,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])])]),_:1}),o(D,{label:"\u5546\u54C1",prop:"store_id"},{default:e(()=>[h("div",So,[h("div",Lo,[o(u,{type:"primary",onClick:t[1]||(t[1]=l=>v.value=!0)},{default:e(()=>[p("\u6DFB\u52A0\u5546\u54C1")]),_:1})]),o(I,{data:s(_)},{default:e(()=>[o(a,{label:"\u5546\u54C1ID",prop:"id","show-overflow-tooltip":""}),o(a,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:e(({row:l})=>[o(f,{style:{width:"50px",height:"50px"},src:l.image},null,8,["src"])]),_:1}),o(a,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name","min-width":"200","show-overflow-tooltip":""}),o(a,{label:"\u5206\u7C7B",prop:"cate_name","min-width":"120","show-overflow-tooltip":""}),o(a,{label:"\u5355\u4F4D",prop:"unit_name","min-width":"80","show-overflow-tooltip":""}),o(a,{label:"\u5546\u54C1\u4EF7\u683C",prop:"price","min-width":"100","show-overflow-tooltip":""}),o(a,{label:"\u5206\u914D\u5E93\u5B58","min-width":"150"},{default:e(({row:l})=>[o(J,{modelValue:l.new_stock,"onUpdate:modelValue":P=>l.new_stock=P,min:1},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),o(a,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:e(({row:l})=>[A((C(),U(u,{type:"danger",link:"",onClick:P=>E(l.id)},{default:e(()=>[p(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[T,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])])]),_:1}),o(D,{label:"\u5E93\u5B58\u7C7B\u578B",prop:"stock_type"},{default:e(()=>[o(Q,{modelValue:s(c),"onUpdate:modelValue":t[2]||(t[2]=l=>y(c)?c.value=l:null),class:"ml-6"},{default:e(()=>[o(R,{value:1,label:1},{default:e(()=>[p("\u5206\u914D\u552E\u5356\u5E93\u5B58")]),_:1}),o(R,{value:2,label:2},{default:e(()=>[p("\u5206\u914D\u5151\u6362\u5E93\u5B58")]),_:1})]),_:1},8,["modelValue"]),Po]),_:1}),o(D,{label:""},{default:e(()=>[o(u,{onClick:i,type:"primary",class:"w-40"},{default:e(()=>[p("\u63D0\u4EA4")]),_:1})]),_:1})]),_:1},8,["model"])]),o(N,{modelValue:s(r),"onUpdate:modelValue":t[3]||(t[3]=l=>y(r)?r.value=l:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:e(()=>[o(X,{onOnBindStore:B})]),_:1},8,["modelValue"]),o(N,{modelValue:s(v),"onUpdate:modelValue":t[4]||(t[4]=l=>y(v)?v.value=l:null),title:"\u9009\u62E9\u5546\u54C1",width:"70%"},{default:e(()=>[o(Y,{onOnBindStore:d})]),_:1},8,["modelValue"])]),_:1})}}});export{he as default};