diff --git a/pagesOrder/settle/settle.vue b/pagesOrder/settle/settle.vue
index 7f88f92..451f4fc 100644
--- a/pagesOrder/settle/settle.vue
+++ b/pagesOrder/settle/settle.vue
@@ -209,6 +209,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -249,6 +263,7 @@
const cartStore = useCartStore();
const reservation_time = ref('')
const is_storage = ref(0)
+ const LocationShow = ref(false)
const formData = ref({
remark: ""
@@ -561,21 +576,76 @@
})
const getLocation = () => {
- uni.getLocation({
- type: "gcj02",
+ uni.getSetting({
success(res) {
- location.lat = res.latitude;
- location.long = res.longitude;
- uni.setStorageSync('location', JSON.stringify(location))
- checkOrder();
- },
- fail() {
- uni.$u.toast('获取位置当前失败,为你推荐当前门店')
- checkOrder(STORE_INFO.id);
- },
- complete() {}
+ if (res.authSetting["scope.userLocation"] == false) {
+ LocationShowOpen()
+ } else {
+ opensettings(true)
+ }
+ }
})
}
+ const LocationShowOpen = () => {
+ LocationShow.value = true;
+ }
+ const userLocationfalse = () => {
+ LocationShow.value = false;
+ uni.$u.toast('获取位置当前失败,为你推荐当前门店')
+ checkOrder(STORE_INFO.id);
+ }
+ const opensettings = (a = false) => {
+ if (a == false) {
+ uni.openSetting({
+ success(res) {
+ LocationShow.value = false;
+ if (res.authSetting["scope.userLocation"] == true) {
+ uni.authorize({
+ scope: 'scope.userLocation',
+ success() {
+ uni.getLocation({
+ type: "gcj02",
+ success(res) {
+ location.lat = res.latitude;
+ location.long = res.longitude;
+ uni.setStorageSync('location', JSON.stringify(
+ location))
+ checkOrder();
+ },
+ })
+ },
+ fail(e) {
+ userLocationfalse()
+ },
+ })
+ }
+ },
+ fail(e) {
+ userLocationfalse()
+ }
+ });
+ } else {
+ uni.authorize({
+ scope: 'scope.userLocation',
+ success() {
+ uni.getLocation({
+ type: "gcj02",
+ success(res) {
+ location.lat = res.latitude;
+ location.long = res.longitude;
+ uni.setStorageSync('location', JSON.stringify(location))
+ checkOrder();
+ },
+ })
+ },
+ fail(e) {
+ userLocationfalse()
+ },
+ })
+
+ }
+
+ }
onShow(() => {
getAddressList();
})