lhl 3 anos atrás
pai
commit
7a96d3af7f
2 arquivos alterados com 72 adições e 44 exclusões
  1. 71 43
      pages/address/addressManage.vue
  2. 1 1
      pages/index/index.vue

+ 71 - 43
pages/address/addressManage.vue

@@ -127,44 +127,75 @@ export default {
 		clickMap() {
 			uni.showLoading({
 				title: '加载中'
-			});
-			let obj = this;
-			openMap().then(() => {
-				   uni.hideLoading();
-					uni.getLocation({
-						type: 'gcj02',
-						success(e) {
-							uni.chooseLocation({
-								latitude: e.latitude,
-								longitude: e.longitude,
-								success(e) {
-									obj.addressLocation = e;
-								},
-								fail(e) {
-									uni.showModal({
-										title:'地址选择错误',
-										content:JSON.parse(e)
-									})
-									console.log(e);
-								}
-							});
-						},fail(e) {
-							uni.showModal({
-								title:'定位错误',
-								content:JSON.parse(e)
-							})
-						}
-					});
-				})
+			});
+			let obj = this;
+			// #ifndef APP-PLUS
+			openMap().then(() => {
+				   uni.hideLoading();
+					uni.getLocation({
+						type: 'gcj02',
+						success(e) {
+							uni.chooseLocation({
+								latitude: e.latitude,
+								longitude: e.longitude,
+								success(e) {
+									obj.addressLocation = e;
+								},
+								fail(e) {
+									uni.showModal({
+										title:'地址选择错误',
+										content:JSON.parse(e)
+									})
+									console.log(e);
+								}
+							});
+						},fail(e) {
+							uni.showModal({
+								title:'定位错误',
+								content:JSON.parse(e)
+							})
+						}
+					});
+				})
 				.catch(e => {
-					console.log(e)
-					uni.hideLoading();
-					uni.showModal({
-						title: '提示',
-						content: '您未授权无法调用地图定位功能!',
-						showCancel: false
-					});
-				});
+					console.log(e)
+					uni.hideLoading();
+					uni.showModal({
+						title: '提示',
+						content: '您未授权无法调用地图定位功能!',
+						showCancel: false
+					});
+				});
+			// #endif
+			// #ifdef APP-PLUS
+			uni.hideLoading();
+			uni.getLocation({
+				type: 'gcj02',
+				success(e) {
+					uni.chooseLocation({
+						latitude: e.latitude,
+						longitude: e.longitude,
+						success(e) {
+							obj.addressLocation = e;
+						},
+						fail(e) {
+							uni.showModal({
+								title:'地址选择错误',
+								content:JSON.parse(e)
+							})
+							console.log(e);
+						}
+					});
+				},fail(e) {
+					uni.showModal({
+						title:'定位错误',
+						content:JSON.parse(e)
+					})
+				}
+			});
+			// uni.chooseLocation()
+			// #endif
+			
 		},
 		// 选中城市切换
 		onCityClick({ data }) {
@@ -229,14 +260,11 @@ export default {
 					city: data.address.city,
 					district: data.address.district
 				},
-				// detail: obj.addressLocation.name + ',' + data.area,
-				detail: "北京市东城区东长安街" + ',' + data.area,
+				detail: obj.addressLocation.name + ',' + data.area,
 				is_default: data.default,
 				id: data.id || '',
-				// longitude: obj.addressLocation.longitude,121.430479
-				// latitude: obj.addressLocation.latitude,28.644847
-				longitude: '116.397827',
-				latitude: '39.90374'
+				longitude: obj.addressLocation.longitude,
+				latitude: obj.addressLocation.latitude,
 			}).then(function(e) {
 				uni.showToast({
 					title: '提交成功',

+ 1 - 1
pages/index/index.vue

@@ -32,7 +32,7 @@
 					<text>全部分类</text>
 				</view>
 			</navigator>
-			<navigator :url="canChange==0 ? '/pages/shoping/list?type=5': ''">
+			<navigator :url="canChange==0 ? '/pages/shoping/list?type=5': '/pages/shoping/list'">
 				<view class="cate-item">
 					<image src="/static/icon/in1.png"></image>
 					<text>附近门店</text>