【新增】(地址模块):根据后台开关按钮,是否需要定位功能

This commit is contained in:
15093570141
2024-10-18 10:01:17 +08:00
parent 9c8493b881
commit 7bbcbd7fee
3 changed files with 17 additions and 5 deletions

View File

@@ -69,6 +69,12 @@ export enum ShowVasEnum {
no = 2,
}
/** 是否使用地图定位功能 */
export enum ShowAllowAddressToUseMap {
yes = 1,
no = 2,
}
/** 是否显示门店列表*/
export enum ShowStoresSwitchEnum {
yes = 1,

View File

@@ -66,4 +66,5 @@ export interface ShopConfigType {
toCashMoneyLow ?: string;
toCashMoneyRate ?: string;
userAgreementId ?: number;
allowAddressToUseMap ?: number;
}

View File

@@ -20,14 +20,14 @@
<view class="lab">省市县</view>
<view class="val" @click="handleShowCityPicker">
<uv-input placeholder="请选择省市县" border="surround" v-model="state.city"
:readonly="true"></uv-input>
:readonly="true" suffixIcon="arrow-down" suffixIconStyle="color: #909399"></uv-input>
</view>
</view>
<view class="item">
<view class="lab">街道社区</view>
<view class="val" @click="handleGoToMap">
<uv-input placeholder="请选择街道社区" border="surround" v-model="state.form.street"
:readonly="true"></uv-input>
:readonly="shopConfigStore.config?.allowAddressToUseMap == ShowAllowAddressToUseMap.yes" suffixIcon="map-fill" suffixIconStyle="color: #5ac725"></uv-input>
</view>
</view>
<view class="item">
@@ -56,7 +56,7 @@
<script setup lang="ts">
import { reactive } from 'vue';
import { onLoad, onShow, onUnload } from '@dcloudio/uni-app';
import { AddressPageTitltEnum } from '@/core/enum';
import { AddressPageTitltEnum ,ShowAllowAddressToUseMap} from '@/core/enum';
import { queryAreaId, querySaveUserShip, queryShipDetail } from '@/core/api';
import type { Response, ShopConfigStoreType, AddressType } from '@/core/models';
import { useShopConfigStore } from '@/core/store';
@@ -141,7 +141,10 @@
state.shipId = query.id;
getShipInfo();
}
getMyLocation();
/** 开启定位 */
if(shopConfigStore.config?.allowAddressToUseMap == ShowAllowAddressToUseMap.yes){
getMyLocation();
}
});
onUnload(() => {
@@ -233,7 +236,9 @@
/** 去定位 */
const handleGoToMap = () => {
if(shopConfigStore.config?.allowAddressToUseMap != ShowAllowAddressToUseMap.yes){
return;
}
// #ifdef MP-WEIXIN
const txMapkey = shopConfigStore?.config?.qqMapKey; //使用在腾讯位置服务申请的key
const referer = shopConfigStore?.config?.shopName; //调用插件的app的名称