import{b as z,c as F}from"./category.ff26ab29.js";import{d as D,r as p,p as B,c as a,e as i,k as b,i as r,g as d,h as n,f as m,j as G,F as k,H as E,t as U,m as f,_ as N}from"./index.0308b213.js";const j={style:{display:"flex"}},P=f("\u67E5\u8BE2"),q={class:"goodsLists"},H=["onClick"],O=["src"],R={style:{padding:"5px"}},T={class:"pagination"},$=f("\u53D6\u6D88"),J=f("\u786E\u8BA4"),K=D({props:{selectBrand:Number,showAddGoods:Boolean,selectedGoods:{type:[Object,String],default:()=>({})}},emits:["closeAddGoods","handleSelectGoods","goodsInfosList"],setup(C,{emit:u}){const c=C,s=p({keyword:"",page:1,limit:10,storeItem:null}),y=p([]);(async()=>{var t=await z({brand_id:c.selectBrand});y.value=t})();const _=p([]),h=async()=>{const t=await F(s.value);_.value=t},l=p([]),w=t=>{const o=l.value.findIndex(g=>g===t.id);o>-1?l.value.splice(o,1):l.value.push(t.id)};B(s,(t,o)=>{h()},{deep:!0}),B(c,(t,o)=>{Array.isArray(t.selectedGoods)&&t.selectedGoods.length>0?l.value=t.selectedGoods:l.value=[],u("goodsInfosList")},{deep:!0});const x=()=>{u("closeAddGoods")},V=()=>{u("closeAddGoods"),l.value.length!==0&&(u("handleSelectGoods",l.value),u("goodsInfosList"))};return(t,o)=>{const g=a("el-input"),A=a("el-option"),L=a("el-select"),v=a("el-button"),I=a("el-pagination"),S=a("el-dialog");return i(),b(S,{modelValue:c.showAddGoods,"onUpdate:modelValue":o[4]||(o[4]=e=>c.showAddGoods=e),title:"\u6DFB\u52A0\u5546\u54C1",width:"1000px","before-close":x},{default:r(()=>[d("div",j,[n(g,{modelValue:s.value.keyword,"onUpdate:modelValue":o[0]||(o[0]=e=>s.value.keyword=e),style:{width:"240px","margin-right":"20px"},placeholder:"\u7B5B\u9009\u5546\u54C1\u540D\u79F0"},null,8,["modelValue"]),n(L,{modelValue:s.value.storeItem,"onUpdate:modelValue":o[1]||(o[1]=e=>s.value.storeItem=e),placeholder:"\u8BF7\u9009\u62E9\u5546\u5BB6",clearable:"",filterable:""},{default:r(()=>[(i(!0),m(k,null,G(y.value,e=>(i(),b(A,{key:e.id,label:e.title,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),n(v,{onClick:h,type:"primary",style:{"margin-left":"20px"}},{default:r(()=>[P]),_:1})]),d("div",q,[(i(!0),m(k,null,G(_.value.goods,(e,Q)=>(i(),m("div",{key:e.id,class:E(["goods",{selected:l.value.includes(e.id)}]),onClick:W=>w(e)},[d("img",{src:e.thumb,alt:"",style:{width:"50px",height:"50px","border-radius":"5px"}},null,8,O),d("div",R,U(e.title),1)],10,H))),128))]),d("div",T,[n(I,{currentPage:s.value.page,"onUpdate:currentPage":o[2]||(o[2]=e=>s.value.page=e),"page-size":s.value.limit,"onUpdate:page-size":o[3]||(o[3]=e=>s.value.limit=e),"page-sizes":[10,20,30,40],layout:"total, sizes, prev, pager, next, jumper",total:_.value.total},null,8,["currentPage","page-size","total"]),d("div",null,[n(v,{onClick:x},{default:r(()=>[$]),_:1}),n(v,{type:"primary",onClick:V},{default:r(()=>[J]),_:1})])])]),_:1},8,["modelValue"])}}});const Z=N(K,[["__scopeId","data-v-2525b351"]]);export{Z as default};
