59e51671
“wangming”
1
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import type { UsAppBoundLocationDto } from '../types/usAppBound'
import { getBoundLocations } from './authSession'
export type StoreInfo = UsAppBoundLocationDto
export { getBoundLocations } from './authSession'
export function getCurrentStoreId(): string {
return uni.getStorageSync('storeId') || ''
}
export function switchStore(id: string, storeName: string, locationCode?: string) {
uni.setStorageSync('storeId', id)
uni.setStorageSync('storeName', storeName)
if (locationCode != null && locationCode !== '') {
uni.setStorageSync('storeLocationCode', locationCode)
}
}
/** 顶部药丸展示用,如 LOC-1 */
export function getCurrentLocationCode(): string {
const saved = uni.getStorageSync('storeLocationCode')
if (saved) return saved
const id = getCurrentStoreId()
if (!id) return ''
const row = getBoundLocations().find((l) => l.id === id)
return row?.locationCode || ''
}
|