import{d as p}from"./index-CnvVVgGn.js";import{r as c,X as g}from"./element-plus-D8cTx5ZJ.js";import{s as a}from"./http-BeIBo5P3.js";const y=p("user",()=>{const t=c(""),o=c(!1),r=n=>{t.value=n,o.value=!0;const h=Date.now()+31536e3*1e3;localStorage.setItem("token",n),localStorage.setItem("tokenExpiry",h.toString())},e=n=>{localStorage.setItem("mobilePhone",n)},i=()=>{localStorage.removeItem("mobilePhone")},s=()=>{try{t.value="",o.value=!1,localStorage.removeItem("token"),localStorage.removeItem("tokenExpiry")}catch(n){console.error("Error clearing token from localStorage:",n)}},l=()=>{try{const n=localStorage.getItem("tokenExpiry");return n?Date.now()>parseInt(n,10):!0}catch(n){return console.error("Error checking token expiry:",n),!0}},m=n=>{localStorage.setItem("Identity",n)},u=()=>{localStorage.removeItem("Identity")};return g(()=>{try{const n=localStorage.getItem("token");n&&!l()?(t.value=n,o.value=!0):s()}catch(n){console.error("Error retrieving token from localStorage:",n)}}),{token:t,isLoggedIn:o,setToken:r,clearToken:s,setMobilePhone:e,removeMobilePhone:i,setIdentity:m,removeIdentity:u}});function w(t){return t.isFilter=!0,new Promise((o,r)=>{a({url:"/api/mobile/account/login/doMerchSmsRegisterAndLogin",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function v(t){return t.isFilter=!0,new Promise((o,r)=>{a({url:"/api/mobile/account/login/sendVerifyCode",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function S(){return new Promise((t,o)=>{a({url:"/api/mobile/shop/shop-base-store-category/list",method:"post"}).then(r=>{t(r)}).catch(r=>o(console.warn(r)))})}function k(t){return t.map(o=>({value:o.store_category_id,label:o.store_category_name,children:o.children?[{value:o.store_category_id,label:`${o.store_category_name} 分割比例(${o.split_ratio}%)`},...o.children.map(r=>({value:r.store_category_id,label:`${r.store_category_name} 分割比例(${r.split_ratio}%)`}))]:[]}))}function I(t){return t.isFilter=!0,new Promise((o,r)=>{a({url:"/api/mobile/shop/merch/baidu/place/v2/suggestion",method:"get",params:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function P(t){return new Promise((o,r)=>{a({url:"/api/mobile/shop/lakala/tk/bank/search",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function _(t){return new Promise((o,r)=>{a({url:"/api/mobile/shop/merch/apply",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function G(){const t={mobile:localStorage.getItem("mobilePhone")};return new Promise((o,r)=>{a({url:"/api/mobile/shop/merch/fresh/approval/status",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function x(t){return new Promise((o,r)=>{a({url:"/api/mobile/shop/merch/re-apply",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function E(t){return new Promise((o,r)=>{a({url:"/api/mobile/shop/merch/detail",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function A(t){return new Promise((o,r)=>{a({url:"/api/admin/account/account-user-base/doLogin",method:"post",params:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function T(t){return new Promise((o,r)=>{a({url:"/api/admin/shop/shop-base-config/image",method:"GET",params:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function C(){return new Promise((t,o)=>{a({url:"/api/mobile/shop/shop-base-district/getAppDistrict",method:"get"}).then(r=>{t(r)}).catch(r=>o(console.warn(r)))})}export{S as G,C as a,P as b,I as c,E as d,A as e,T as f,G as g,w as h,v as i,_ as m,x as r,k as t,y as u};
