Browse Source

门店bug修改

twt 1 year ago
parent
commit
6aa99c6bca
2 changed files with 36 additions and 18 deletions
  1. 2 1
      manifest.json
  2. 34 17
      pages/index/shopList.vue

+ 2 - 1
manifest.json

@@ -52,7 +52,8 @@
     "mp-weixin" : {
         "appid" : "wx33053a645546ec31",
         "setting" : {
-            "urlCheck" : false
+            "urlCheck" : false,
+            "minified" : true
         },
         "usingComponents" : true,
         "permission" : {

+ 34 - 17
pages/index/shopList.vue

@@ -68,7 +68,7 @@
 		<!-- 上拉 加载更多 -->
 		<view class="noMore" v-if="noMoreShow && (queryShopList.length!=0)">没有更多数据</view>
 		<!-- 无数据空白页 -->
-		<nodata v-if="queryShopList.length==0"></nodata>
+		<nodata v-if="queryShopList.length==0&&loading"></nodata>
         <uni-popup ref="popup" type="right" :mask-click="true">
 			<view class="popup-content">
 				<scroll-view class="brandList" scroll-y="true">
@@ -109,30 +109,44 @@
 				areaList:'',
 				index:'',
 				areaName:'区域',
+				loading:false,
 			}
 		},
 
 		onLoad() {
 			var that = this;
 			uni.removeStorageSync('selectCity');
-			uni.getLocation({
-				type: 'gcj02',
-				success: function(res) {
-					console.log(res)
-					that.location.lat = res.latitude
-					that.location.lng = res.longitude
-                    that.getAdress();
-					//that.getqueryShopList() //获取全部门店列表
-
-				},
-				fail(err) {
-
-				}
-			});
+			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.getAdress();
+							//that.getqueryShopList() //获取全部门店列表
+					
+						},
+						fail(err) {
+							console.log("定位失败")
+					        that.getqueryShopList();
+						}
+					});
+				},
+				fail: (err) => {
+					 that.getqueryShopList();
+					 
+				}})
+			
+			// that.getqueryShopList();
 			
 		},
 		onShow() {
 			const selectCity = uni.getStorageSync('selectCity');
+			//console.log("onShow")
+			//console.log(selectCity)
 			if(selectCity){
 				this.cityName=selectCity.city
 				this.cityCode=selectCity.code
@@ -207,6 +221,7 @@
 			getAdress(){
 				var that=this;
 				var location = this.location.lng + ',' + this.location.lat
+				console.log('location'+location)
 				uni.request({
 					url: 'https://restapi.amap.com/v3/geocode/regeo',
 					data: {
@@ -248,6 +263,7 @@
 				uni.showLoading({
 					title: '加载中'
 				})
+				this.loading=false;
 				this.$http('opencarOwnerHome/queryShopInfoList', {
 
 					lat: this.location.lat ? this.location.lat : '',
@@ -256,8 +272,9 @@
                     area:this.area
 				}, 'GET').then(res => {
 					uni.hideLoading();
-					this.queryShopList = res.data.shop
-					console.log('list+=', this.queryShopList);
+					this.queryShopList = res.data.shop;
+					this.loading=true;
+					//console.log('list+=', this.queryShopList);
 
 				})
 			},