import{d as N,V as x,a4 as A,a3 as L,X as I,r,o as D,c as l,e as d,f as h,h as n,i as a,F as y,j as F,k as J,A as M,m as O,E as q}from"./index.0308b213.js";import R from"./LoginPage.ad2bcaa4.js";const U=O("\u786E\u8BA4"),j={key:0,style:{position:"fixed",top:"0",left:"0",width:"100vw",height:"100vh","background-color":"rgba(0, 0, 0, 0.5)","z-index":"9999"}},G=N({setup(z){const{router:b,route:P}=x(),S=A(),{login:V}=L(),{getConfig:T,updateInfo:k}=I(),m=r({}),i=r([]),o=r(""),p=r(!1),_=r(!1),c=s=>{_.value=!0,m.value=s,V({...s,sid:o.value}).then(e=>{if(console.log(e,"res1231"),e.stores){if(i.value=e.stores,i.value.length==1){o.value=i.value[0].id,c(m.value);return}p.value=!0;return}let f=localStorage.getItem("shangpu_pinia-website-info")||"",u=JSON.parse(f);u.config.web_logo=e.logo,u.config.web_name=e.name;const g=JSON.stringify(u);localStorage.setItem("shangpu_pinia-website-info",g),k(e.name,e.logo,"","");const v="/store/checkstand";uni.postMessage({data:{type:"login_res",login_res:{...s,sid:o.value}}}),b.replace(v)}).catch(e=>{console.log(e)}).finally(()=>{_.value=!1})},w=()=>{if(!o.value){q.error("\u8BF7\u9009\u62E9\u5E73\u53F0");return}c(m.value)};return D(()=>{S.query.login_res&&c(JSON.parse(S.query.login_res))}),(s,e)=>{const f=l("el-option"),u=l("el-select"),g=l("el-form-item"),v=l("el-form"),C=l("el-button"),B=l("el-dialog");return d(),h(y,null,[n(R,{"login-title":"\u5546\u6237\u6536\u94F6",onLogin:c}),n(B,{modelValue:p.value,"onUpdate:modelValue":e[1]||(e[1]=t=>p.value=t),title:"\u9009\u62E9\u5546\u5BB6",width:"30%","destroy-on-close":"",onClose:s.handleSelectStoreDialogClose},{footer:a(()=>[n(C,{type:"primary",onClick:w},{default:a(()=>[U]),_:1})]),default:a(()=>[n(v,null,{default:a(()=>[n(g,null,{default:a(()=>[n(u,{modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=t=>o.value=t),style:{width:"100%"}},{default:a(()=>[(d(!0),h(y,null,F(i.value,(t,E)=>(d(),J(f,{key:`select_platform_${E}`,value:t.id,label:t.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["modelValue","onClose"]),_.value?(d(),h("div",j)):M("",!0)],64)}}});export{G as default};
