import{a as R}from"./install.524ae6f2.js";import{g as T,c as J,s as K}from"./index.2cc74cc5.js";import{u as Q,P as W}from"./index.9e8820cd.js";import{g as X,c as Y,s as Z}from"./diy.a6ea004c.js";import{d as ee,a6 as te,r as v,p as A,c as r,e as g,k as D,i as d,g as n,h as p,f as E,j as I,m as _,t as h,F as G,A as le,H as ae,u as w,q as se,E as oe,_ as ne}from"./index.0308b213.js";const ue={modelValue:{type:Boolean,default:!1},cid:{type:[Number,String]},agentid:{type:[Number,String]},chooseGoods:{type:Array},sids:{type:Array},canSelectCount:{type:Number,default:10},is_diy:{type:[Number,String],default:0}},ie={"update:modelValue":y=>typeof y=="boolean",change:y=>!0},de={class:"flex"},ce=_("\u540D\u79F0"),re=_("\u641C\u7D22"),ge={class:"flex flex-wrap box"},pe=["onClick"],_e={style:{width:"100px"},class:"flex flex-col"},fe={class:"dialog-footer"},me=_("\u53D6\u6D88"),ve=_("\u786E\u5B9A"),he=ee({props:ue,emits:ie,setup(y,{emit:S}){var P;const e=y,{OpPlatform:B}=te(),f=v(e.modelValue),m=v([]),u=v([]),L=t=>{const{id:a}=t,i=u.value.findIndex(c=>+c.id===a);if(i>-1)u.value.splice(i,1);else if(u.value.length>=e.canSelectCount){oe.warning(`\u4E00\u4E2A\u5206\u7C7B\u6700\u5927\u8BBE\u7F6E\u4E3A${e.canSelectCount}\u4E2A\u5546\u54C1`);return}else u.value.push(t)},N=e.is_diy||0,U=()=>{S("change",u),b()},$=t=>{f.value&&(f.value=!1,b(),t())},b=()=>{S("update:modelValue",!1)};v(!1);const o=v({uniacid:1,page_size:20,audit_status:0,status:1,type:0,mold:0,order_by_type:"displayorder",scid:e.cid||0,sid:(P=e==null?void 0:e.sids)==null?void 0:P.join(","),keyword:""}),{pager:x,requestApi:j,resetPage:q}=Q({callback:B.value==="agent"?X:T,params:o.value}),M=()=>{o.value.sid?o.value.scid=0:o.value.scid=e.cid||0,q()},F=(t=!0)=>{var a,i,c,C;j(),B.value==="agent"?N?t&&Y({lat:"23.031335",lng:"113.185222",page:1,psize:50,cid:e.cid,sid:(a=e==null?void 0:e.sids)==null?void 0:a.join(","),agentid:e.agentid||""}).then(s=>{m.value=s}):t&&Z({lat:"23.031335",lng:"113.185222",page:1,psize:50,cid:e.cid,sid:(i=e==null?void 0:e.sids)==null?void 0:i.join(","),agentid:e.agentid||""}).then(s=>{m.value=s.stores}):N?t&&J({lat:"23.031335",lng:"113.185222",page:1,psize:50,cid:e.cid,sid:(c=e==null?void 0:e.sids)==null?void 0:c.join(","),agentid:e.agentid||""}).then(s=>{console.log("res",s),m.value=s}):t&&K({lat:"23.031335",lng:"113.185222",page:1,psize:50,cid:e.cid,sid:(C=e==null?void 0:e.sids)==null?void 0:C.join(","),agentid:e.agentid||""}).then(s=>{console.log("res",s),m.value=s.stores})};return A(()=>e.sids,()=>{var t,a;!((t=e==null?void 0:e.sids)!=null&&t.length)||(o.value.sid=(a=e==null?void 0:e.sids)==null?void 0:a.join(","),F(!1))},{immediate:!0}),A(()=>e.cid,t=>{!t||(o.value.scid=t,F())}),A(()=>e.chooseGoods,()=>{u.value=e.chooseGoods||[]},{deep:!0}),A(()=>e.modelValue,t=>{f.value=t,t&&F()}),(t,a)=>{const i=r("el-input"),c=r("el-option"),C=r("el-select"),s=r("el-button"),H=r("el-image"),O=r("el-dialog");return g(),D(O,{modelValue:f.value,"onUpdate:modelValue":a[3]||(a[3]=V=>f.value=V),width:"660px",title:"\u9009\u62E9\u5546\u54C1","destroy-on-close":!0,"append-to-body":"","before-close":$},{default:d(()=>{var V;return[n("div",de,[p(i,{modelValue:o.value.keyword,"onUpdate:modelValue":a[0]||(a[0]=l=>o.value.keyword=l),placeholder:"\u8F93\u5165\u5546\u54C1\u540D\u79F0"},{prepend:d(()=>[ce]),_:1},8,["modelValue"]),(V=e==null?void 0:e.sids)!=null&&V.length?le("",!0):(g(),D(C,{key:0,modelValue:o.value.sid,"onUpdate:modelValue":a[1]||(a[1]=l=>o.value.sid=l),placeholder:"\u8BF7\u9009\u62E9\u5546\u6237",filterable:"",clearable:"",style:{"margin-left":"10px"}},{default:d(()=>[(g(!0),E(G,null,I(m.value,(l,k)=>(g(),D(c,{key:`merchant-categorys-${k}`,value:l.id,label:l.title},{default:d(()=>[_(h(l.title),1)]),_:2},1032,["value","label"]))),128))]),_:1},8,["modelValue"])),p(s,{type:"primary",onClick:M},{default:d(()=>[re]),_:1})]),n("div",ge,[(g(!0),E(G,null,I(w(x).lists,(l,k)=>(g(),E("div",{class:ae(["item flex flex-center flex-col row-between",{selected:u.value.findIndex(z=>z.id===l.id)>-1}]),key:k,onClick:z=>L(l)},[p(H,{style:{width:"100px",height:"100px"},src:l.thumb,fit:"cover"},null,8,["src"]),n("div",_e,[n("span",null,"\u5546\u54C1\uFF1A"+h(l.title),1),n("span",null,"\u5546\u6237\uFF1A"+h(l.s_title),1),n("span",null,[_("\u539F\u4EF7\uFF1A"+h(l.old_price)+" ",1),n("span",null,"\u4EF7\u683C\uFF1A"+h(l.price),1)])])],10,pe))),128))]),p(W,{modelValue:w(x),"onUpdate:modelValue":a[2]||(a[2]=l=>se(x)?x.value=l:null),layout:"total, prev, pager, next, jumper",onChange:w(j)},null,8,["modelValue","onChange"]),n("div",fe,[p(s,{onClick:b},{default:d(()=>[me]),_:1}),p(s,{type:"primary",onClick:U},{default:d(()=>[ve]),_:1})])]}),_:1},8,["modelValue"])}}});const ye=ne(he,[["__scopeId","data-v-c9c9c778"]]),Fe=R(ye);export{Fe as G};
