Blame view

美国版/Food Labeling Management App UniApp/src/utils/stores.ts 913 Bytes
3af4878d   杨鑫   产品 标签 关联
1
  import type { UsAppBoundLocationDto } from '../types/usAppBound'
6faaf539   杨鑫   APP 登录门店对接
2
3
4
  import { getBoundLocations } from './authSession'
  
  export type StoreInfo = UsAppBoundLocationDto
940fb6ea   “wangming”   又改了一个版本,这泰额太纠结了,一...
5
  
6faaf539   杨鑫   APP 登录门店对接
6
  export { getBoundLocations } from './authSession'
940fb6ea   “wangming”   又改了一个版本,这泰额太纠结了,一...
7
8
  
  export function getCurrentStoreId(): string {
6faaf539   杨鑫   APP 登录门店对接
9
    return uni.getStorageSync('storeId') || ''
940fb6ea   “wangming”   又改了一个版本,这泰额太纠结了,一...
10
11
  }
  
6faaf539   杨鑫   APP 登录门店对接
12
  export function switchStore(id: string, storeName: string, locationCode?: string) {
940fb6ea   “wangming”   又改了一个版本,这泰额太纠结了,一...
13
14
    uni.setStorageSync('storeId', id)
    uni.setStorageSync('storeName', storeName)
6faaf539   杨鑫   APP 登录门店对接
15
16
17
18
19
20
21
22
23
24
25
26
27
    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 || ''
940fb6ea   “wangming”   又改了一个版本,这泰额太纠结了,一...
28
  }