Showing
5 changed files
with
22 additions
and
9 deletions
| @@ -25,6 +25,7 @@ Component({ | @@ -25,6 +25,7 @@ Component({ | ||
| 25 | wx.getLocation({ | 25 | wx.getLocation({ |
| 26 | type: 'gcj02', | 26 | type: 'gcj02', |
| 27 | success: (res) => { | 27 | success: (res) => { |
| 28 | + getApp().location=res | ||
| 28 | success(res) | 29 | success(res) |
| 29 | }, | 30 | }, |
| 30 | fail: (res) => { | 31 | fail: (res) => { |
| @@ -57,6 +58,13 @@ Component({ | @@ -57,6 +58,13 @@ Component({ | ||
| 57 | }); | 58 | }); |
| 58 | } | 59 | } |
| 59 | }else{// | 60 | }else{// |
| 61 | + console.log('getApp().location',getApp().location) | ||
| 62 | + if(getApp().location && getApp().location.latitude){ | ||
| 63 | + return this.triggerEvent("pos",{ | ||
| 64 | + latitude: getApp().location.latitude, | ||
| 65 | + longitude: getApp().location.longitude, | ||
| 66 | + }); | ||
| 67 | + } | ||
| 60 | this.getPosDo(timeout).then(res=>{ | 68 | this.getPosDo(timeout).then(res=>{ |
| 61 | console.log('getPos.then',res) | 69 | console.log('getPos.then',res) |
| 62 | this.triggerEvent("pos",{ | 70 | this.triggerEvent("pos",{ |
| @@ -32,6 +32,12 @@ Component({ | @@ -32,6 +32,12 @@ Component({ | ||
| 32 | methods: { | 32 | methods: { |
| 33 | getPos(fouce=false){ | 33 | getPos(fouce=false){ |
| 34 | console.log('getPos') | 34 | console.log('getPos') |
| 35 | + if(getApp().location && getApp().location.latitude){ | ||
| 36 | + return this.triggerEvent("pos",{ | ||
| 37 | + latitude: getApp().location.latitude, | ||
| 38 | + longitude: getApp().location.longitude, | ||
| 39 | + }); | ||
| 40 | + } | ||
| 35 | this._getPos().then(res => { | 41 | this._getPos().then(res => { |
| 36 | console.log('wx.getLocation.then', res); | 42 | console.log('wx.getLocation.then', res); |
| 37 | failCount=0; | 43 | failCount=0; |
| @@ -17,7 +17,7 @@ Page({ | @@ -17,7 +17,7 @@ Page({ | ||
| 17 | {id:2,name:'菜品有特色'}, | 17 | {id:2,name:'菜品有特色'}, |
| 18 | {id:3,name:'超大包间'}, | 18 | {id:3,name:'超大包间'}, |
| 19 | ], | 19 | ], |
| 20 | - markers:[], | 20 | + sellers:[], |
| 21 | hasMore:true, | 21 | hasMore:true, |
| 22 | hasDisabled:true, | 22 | hasDisabled:true, |
| 23 | hasSuggestion:false, | 23 | hasSuggestion:false, |
| @@ -282,11 +282,11 @@ Page({ | @@ -282,11 +282,11 @@ Page({ | ||
| 282 | }, | 282 | }, |
| 283 | getListMore(){ | 283 | getListMore(){ |
| 284 | this.param.offset+=1; | 284 | this.param.offset+=1; |
| 285 | - let markers=this.data.markers; | 285 | + let sellers=this.data.sellers; |
| 286 | App.Customer.SellerLists(this.param).then(res=>{ | 286 | App.Customer.SellerLists(this.param).then(res=>{ |
| 287 | this.setData({ | 287 | this.setData({ |
| 288 | hasMore:res.data.length==this.size, | 288 | hasMore:res.data.length==this.size, |
| 289 | - markers:markers.concat(this.sellerFormat(res.data)), | 289 | + sellers:sellers.concat(this.sellerFormat(res.data)), |
| 290 | }) | 290 | }) |
| 291 | }) | 291 | }) |
| 292 | }, | 292 | }, |
| @@ -389,9 +389,9 @@ Page({ | @@ -389,9 +389,9 @@ Page({ | ||
| 389 | this.onpos(e) | 389 | this.onpos(e) |
| 390 | },500) | 390 | },500) |
| 391 | } | 391 | } |
| 392 | - if(this.data.markers.length<1){ | ||
| 393 | - this.GetRecommendSellerList() | ||
| 394 | - } | 392 | + // if(this.data.sellers.length<1){ |
| 393 | + // this.GetRecommendSellerList() | ||
| 394 | + // } | ||
| 395 | }, | 395 | }, |
| 396 | GetRecommendSellerList(){ | 396 | GetRecommendSellerList(){ |
| 397 | let param={sid:'sid'} | 397 | let param={sid:'sid'} |
| @@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
| 32 | <scroll-view class="view scroll-view" scroll-y="true" | 32 | <scroll-view class="view scroll-view" scroll-y="true" |
| 33 | scroll-into-view="seller-{{scrollSellerID}}" | 33 | scroll-into-view="seller-{{scrollSellerID}}" |
| 34 | scroll-with-animation | 34 | scroll-with-animation |
| 35 | - bindscroll="scrollEvent" | 35 | + bindscrolltolower="getListMore" |
| 36 | style="width:100%;height: calc(100vh - 150px);"> | 36 | style="width:100%;height: calc(100vh - 150px);"> |
| 37 | <block wx:for="{{sellers}}" wx:key="sellers" > | 37 | <block wx:for="{{sellers}}" wx:key="sellers" > |
| 38 | <navigator url="/pages/reserve/detail?id={{item.id}}" hover-class="navigator-hover"> | 38 | <navigator url="/pages/reserve/detail?id={{item.id}}" hover-class="navigator-hover"> |
| @@ -466,10 +466,9 @@ | @@ -466,10 +466,9 @@ | ||
| 466 | "scene": null | 466 | "scene": null |
| 467 | }, | 467 | }, |
| 468 | { | 468 | { |
| 469 | - "id": 52, | ||
| 470 | "name": "pages/reserve/indexList", | 469 | "name": "pages/reserve/indexList", |
| 471 | "pathName": "pages/reserve/indexList", | 470 | "pathName": "pages/reserve/indexList", |
| 472 | - "query": "lat=34.216529&lng=108.891677&map={\"errMsg\":\"getMapRegion:ok\",\"southwest\":{\"longitude\":108.85949049182128,\"latitude\":34.18927020234597},\"northeast\":{\"longitude\":108.9238635081787,\"latitude\":34.24377898163213},\"scale\":14}&multiIndex=0&tags=1,2", | 471 | + "query": "lat=39.65157&lng=118.15044&keyword=西安&multiIndex=0", |
| 473 | "scene": null | 472 | "scene": null |
| 474 | }, | 473 | }, |
| 475 | { | 474 | { |
-
Please register or login to post a comment