lilei 4 vuotta sitten
vanhempi
commit
0272a070e3
1 muutettua tiedostoa jossa 12 lisäystä ja 9 poistoa
  1. 12 9
      pages/siteInspection/siteInspection.vue

+ 12 - 9
pages/siteInspection/siteInspection.vue

@@ -2,7 +2,7 @@
 	<view class="siteInspection-wrap">
 		<!-- 搜索框 -->
 		<view class="search-con">
-			<u-search placeholder="查找全部门店" v-model="queryValue" @custom="searchHandle" @search="searchHandle" bg-color="#fff" :action-style="{background: '#2979ff',color: '#fff', borderRadius: '6upx',padding: '6upx 0', fontSize: '26upx'}"></u-search>
+			<u-search placeholder="查找全部门店" v-model="queryValue" @custom="queryHandle" @search="queryHandle" bg-color="#fff" :action-style="{background: '#2979ff',color: '#fff', borderRadius: '6upx',padding: '6upx 0', fontSize: '26upx'}"></u-search>
 		</view>
 		<!-- 定位 -->
 		<view class="location-con" ref="location">
@@ -69,12 +69,13 @@
 						_this.lat = res.latitude
 						_this.location = res.address.province + res.address.city + res.address.district + res.address.street + res.address.streetNum +'靠近' + res.address.poiName
 						setTimeout(()=>{
-							_this.searchHandle(res)
+							// 按照经纬度查询
+							_this.searchHandle({lng:this.lng,lat:this.lat})
 						}, 500)
 				    },
 					fail: function(error){
 						console.log(error)
-						_this.searchHandle()
+						_this.searchHandle({})
 						if(JSON.parse(error.errMsg.replace('getLocation:fail ','')).message){
 							uni.showToast({
 								icon: 'none',
@@ -84,14 +85,16 @@
 					}
 				})
 			},
+			// 按名称查询
+			queryHandle(){
+				this.searchHandle({
+					name: this.queryValue
+				})
+			},
 			//查询门店列表
-			searchHandle(){
+			searchHandle(params){
 				this.status = "loading"
-				findStoreList({
-					lng: this.lng,
-					lat: this.lat,
-					name: this.queryValue
-				}).then(res => {
+				findStoreList(params).then(res => {
 					console.log(res)
 					if (res.status == 200) {
 						this.listdata = res.data || []