# 定位与门店
# Api域:
const native = kreator.native;
# native.getCurrentOfflineStoreInfo(options)
获取当前线下门店信息。如果当前是在线上门店环境,返回值将为空。
| 参数名 | 类型 | 描述 |
|---|---|---|
| options | NativeApiBaseRequest | 调用入参 |
# 返回值
CurrentOfflineStoreInfoResponse 线下门店信息
# CurrentOfflineStoreInfoResponse类型:
| 参数名 | 类型 | 描述 |
|---|---|---|
| venderId | string | 商家ID |
| storeId | string | 门店ID |
| storeLogo | string | 门店logo图片url |
| storeName | string | 门店名称 |
| storeAddress | string | 门店地址 |
| distance | string | 当前距离门店的距离 |
native.getCurrentOfflineStoreInfo().then((res) => {
console.log(res);
});
# native.selectOfflineStore(options)
选择线下门店并返回门店信息。
| 参数名 | 类型 | 描述 |
|---|---|---|
| options | NativeApiBaseRequest | 调用入参 |
# 返回值
CurrentOfflineStoreInfoResponse 线下门店信息
# CurrentOfflineStoreInfoResponse类型:
| 参数名 | 类型 | 描述 |
|---|---|---|
| venderId | string | 商家ID |
| storeId | string | 门店ID |
| storeLogo | string | 门店logo图片url |
| storeName | string | 门店名称 |
| storeAddress | string | 门店地址 |
| distance | string | 当前距离门店的距离 |
native.selectOfflineStore().then((res) => {
console.log(res);
});
# native.selectOnlineStore(options)
选择线上门店。现阶段选择门店后会自动返回首页。
| 参数名 | 类型 | 描述 |
|---|---|---|
| options | NativeApiBaseRequest | 入参类型 |
native.selectOnlineStore()
# native.getLatestOfflineStoreId(options)
获取线下门店ID。
仅当当前业态为线下门店时有返回值。
| 参数名 | 类型 | 描述 |
|---|---|---|
| options | NativeApiBaseRequest | 入参类型 |
# 返回值:
string 线下门店ID
native.getLatestOfflineStoreId().then(res=>{
console.warn(res)
})
# native.getLocation(options)
通过缓存获取定位信息。
| 参数名 | 类型 | 描述 |
|---|---|---|
| options | NativeApiBaseRequest | 入参类型 |
# 返回值
# GetLocationResponseInterface 定位信息
| 参数名 | 类型 | 描述 |
|---|---|---|
| latitude | string | 入参类型 |
| longitude | string | 入参类型 |
native.getLocation().then((res) => {
console.log(res);
});