Commit 5450d32677975d9b504f263a3bef9f342a5d7881
1 parent
aa4ffa02
首页门店选择显示距离
Showing
2 changed files
with
15 additions
and
9 deletions
components/diy_store_select/diy_store_select.js
... | ... | @@ -44,10 +44,6 @@ Component({ |
44 | 44 | |
45 | 45 | //获取顶部的门店 |
46 | 46 | getApp().get_user_store(function(){ |
47 | - var top_store=getApp().globalData.pk_store; | |
48 | - if(top_store){ | |
49 | - th.setData({top_store:top_store}); | |
50 | - }else{ | |
51 | 47 | wx.getLocation({ |
52 | 48 | type: 'gcj02', |
53 | 49 | success: function(res) { |
... | ... | @@ -61,9 +57,12 @@ Component({ |
61 | 57 | } |
62 | 58 | } |
63 | 59 | }) |
64 | - } | |
60 | + | |
65 | 61 | }) |
66 | 62 | }, |
63 | + | |
64 | + | |
65 | + | |
67 | 66 | //-- 设置最近的店为默认的店,一开始加载的时候 -- |
68 | 67 | set_fir_store_to_def(){ |
69 | 68 | var th=this; |
... | ... | @@ -74,7 +73,13 @@ Component({ |
74 | 73 | page:1, |
75 | 74 | }; |
76 | 75 | dd.lat = th.data.lat; |
77 | - dd.lon = th.data.lon; | |
76 | + dd.lon = th.data.lon; | |
77 | + | |
78 | + var top_store=getApp().globalData.pk_store; | |
79 | + if(top_store){ | |
80 | + dd.pickup_id=top_store.pickup_id; | |
81 | + } | |
82 | + | |
78 | 83 | //----------获取门店,最近的门店---------------- |
79 | 84 | getApp().request.promiseGet("/api/weshop/pickup/list", { |
80 | 85 | data: dd, |
... | ... | @@ -173,8 +178,7 @@ Component({ |
173 | 178 | this.deal_pickup(this.data.all_pick_list,func) |
174 | 179 | return false; |
175 | 180 | } |
176 | - var th = this,that=this; | |
177 | - var i = getApp().request; | |
181 | + var th = this,that=this; | |
178 | 182 | var dd = { |
179 | 183 | store_id: o.stoid, |
180 | 184 | isstop: 0, | ... | ... |
components/diy_store_select/diy_store_select.wxml
1 | +<wxs module="filters" src="../../utils/filter.wxs"></wxs> | |
2 | + | |
1 | 3 | <!-- 如果是自定义模板的时候 --> |
2 | 4 | <block wx:if="{{object}}"> |
3 | 5 | <view class="store_sele1 flex ai_c" bindtap="sele_top_store" style="background-color:{{object.bgcolor}};color: {{object.word_color}};"> |
... | ... | @@ -51,7 +53,7 @@ |
51 | 53 | </view> |
52 | 54 | <view> |
53 | 55 | <view class="distance fs24 address-val"wx:if="{{item.distance!=null}}"> |
54 | - 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+'km':filters.toFix(item.distance,0)+"m"}}</view> | |
56 | + 距离: {{item.distance>1000?filters.toFix(item.distance/1000,2)+'km':filters.toFix(item.distance,0)+"m"}}</view> | |
55 | 57 | </view> |
56 | 58 | </view> |
57 | 59 | <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view> | ... | ... |