twt 1 рік тому
батько
коміт
6d79281071
1 змінених файлів з 24 додано та 13 видалено
  1. 24 13
      pages/shop/ckshopList.vue

+ 24 - 13
pages/shop/ckshopList.vue

@@ -56,20 +56,31 @@
 		onLoad(opt) {
 			var that = this;
 			this.goodsId=opt.goodsId;
-			uni.getLocation({
-				type: 'gcj02',
-				success: function(res) {
-					console.log(res)
-					that.location.lat = res.latitude
-					that.location.lng = res.longitude
-
-					that.getqueryShopList() //获取全部门店列表
-
+			var that = this;
+			this.goodsId=opt.goodsId;
+			uni.authorize({
+				scope: 'scope.userLocation',
+				success() {
+					uni.getLocation({
+						type: 'gcj02',
+						success: function(res) {
+							console.log(res)
+							that.location.lat = res.latitude
+							that.location.lng = res.longitude
+					
+							that.getqueryShopList() //获取全部门店列表
+					
+						},
+						fail(err) {
+					      console.log(err)
+						  that.getqueryShopList() //获取全部门店列表
+						}
+					});
 				},
-				fail(err) {
-
-				}
-			});
+				fail: (err) => {
+					 that.getqueryShopList();
+					 
+				}})
 		},
 		methods: {