高敬炎 пре 2 година
родитељ
комит
89b8bbb9d3
2 измењених фајлова са 63 додато и 19 уклоњено
  1. 60 16
      uni_applet/pages/find/find.vue
  2. 3 3
      uni_applet/pages/food/food.vue

+ 60 - 16
uni_applet/pages/find/find.vue

@@ -39,7 +39,7 @@
 		</view>
 		<view>
 			<mescroll-uni :up="upOption" :down="downOption" ref="mescrollRef" @init="mescrollInit"
-				@up="upCallback" @down="downCallback" height="660">
+				@up="upCallback" @down="downCallback" height="730">
 				<view class='findItem' v-for='item in findList'>
 					<view style='align-items: flex-start;' class='flex'>
 						<view class="left">
@@ -170,6 +170,50 @@
 					}
 				});
 			},
+			isdingwei() {
+				authorizedLocation().then(res => {
+					let _obj = {}
+					if (res == '取消授权') {
+						//获取上一次,无上一次山海广场
+						let _place = uni.getStorageSync("LocationPlace")
+						if (_place && _place.latitude) {
+							_obj = {
+								latitude: _place.latitude,
+								longitude: _place.longitude
+							}
+						} else {
+							_obj = {
+								latitude: 40.22086204872,
+								longitude: 122.08338497727
+							}
+						}
+			
+					} else {
+						_obj = {
+							latitude: res.latitude,
+							longitude: res.longitude
+						}
+					}
+					this.longitude = _obj.longitude
+					this.latitude = _obj.latitude
+					qqmapsdk.reverseGeocoder({
+						location: _obj,
+						success: function(res) {
+							console.log(res)
+							that.detailedAddress = res.result.formatted_addresses.recommend
+							that.mescroll.resetUpScroll()
+						},
+						fail: function(error) {
+							console.error(error);
+						},
+						complete: function(res) {
+							// console.log(res);
+						}
+			
+					})
+			
+				})
+			},
 			mescrollInit(mescroll) {
 				this.mescroll = mescroll;
 			},
@@ -226,23 +270,21 @@
 						that.curPageLen = finddata.data.items.length;
 						that.handleList = finddata.data.items
 						that.totalPage = finddata.data.total;
-						for(var i=0;i<that.handleList.length;i++){
-							that.handleList[i].latitude=that.handleList[i].location.split(',')[0]
-							that.handleList[i].longitude=that.handleList[i].location.split(',')[1]
-							// var data=await that.getDistance(that.handleList[i].latitude,that.handleList[i].longitude) 
-							that.handleList[i].distance=(that.handleList[i].distance/1000).toFixed(2)
-							if(i==that.handleList.length-1){
-								setTimeout(()=>{
-									console.log(that.handleList)
-									that.findList = that.handleList
-									that.loading = false
-									that.$nextTick(() => {
-										that.mescroll.endBySize(that.curPageLen, that.totalPage)
-									});	
-									uni.hideLoading()
-								},100)
+						if(that.handleList.length > 0){
+							for(var i=0;i<that.handleList.length;i++){
+								that.handleList[i].latitude=that.handleList[i].location.split(',')[0]
+								that.handleList[i].longitude=that.handleList[i].location.split(',')[1]
+								// var data=await that.getDistance(that.handleList[i].latitude,that.handleList[i].longitude) 
+								that.handleList[i].distance=(that.handleList[i].distance/1000).toFixed(2)
+								console.log(that.handleList)
+								that.findList = that.handleList
+								that.loading = false
 							}
 						}
+						uni.hideLoading()
+						that.$nextTick(() => {
+							that.mescroll.endBySize(that.curPageLen, that.totalPage)
+						});	
 			
 					// }
 			},
@@ -271,6 +313,8 @@
 		 		that.$request.baseRequest('admin.tourism.productManagement', 'list', {
 		 			page: page.num,
 		 			limit: page.size,
+					latitude: that.latitude,
+					longitude: that.longitude
 		 			// searchContent: this.searchVal,
 		 			// classify: this.typeName
 		 		}, failres => {

+ 3 - 3
uni_applet/pages/food/food.vue

@@ -170,10 +170,10 @@
 					page: {
 						size: 10 // 每页数据的数量,默认10
 					},
-					auto: false,
-					noMoreSize: 1,
+					// auto: false,
+					noMoreSize: 10,
 					textNoMore: '没有更多了~',
-					textColor: '#bbb'
+					// textColor: '#bbb'
 				},
 			};
 		},