Commit 5450d32677975d9b504f263a3bef9f342a5d7881

Authored by yvan.ni
1 parent aa4ffa02

首页门店选择显示距离

components/diy_store_select/diy_store_select.js
@@ -44,10 +44,6 @@ Component({ @@ -44,10 +44,6 @@ Component({
44 44
45 //获取顶部的门店 45 //获取顶部的门店
46 getApp().get_user_store(function(){ 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 wx.getLocation({ 47 wx.getLocation({
52 type: 'gcj02', 48 type: 'gcj02',
53 success: function(res) { 49 success: function(res) {
@@ -61,9 +57,12 @@ Component({ @@ -61,9 +57,12 @@ Component({
61 } 57 }
62 } 58 }
63 }) 59 })
64 - } 60 +
65 }) 61 })
66 }, 62 },
  63 +
  64 +
  65 +
67 //-- 设置最近的店为默认的店,一开始加载的时候 -- 66 //-- 设置最近的店为默认的店,一开始加载的时候 --
68 set_fir_store_to_def(){ 67 set_fir_store_to_def(){
69 var th=this; 68 var th=this;
@@ -74,7 +73,13 @@ Component({ @@ -74,7 +73,13 @@ Component({
74 page:1, 73 page:1,
75 }; 74 };
76 dd.lat = th.data.lat; 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 getApp().request.promiseGet("/api/weshop/pickup/list", { 84 getApp().request.promiseGet("/api/weshop/pickup/list", {
80 data: dd, 85 data: dd,
@@ -173,8 +178,7 @@ Component({ @@ -173,8 +178,7 @@ Component({
173 this.deal_pickup(this.data.all_pick_list,func) 178 this.deal_pickup(this.data.all_pick_list,func)
174 return false; 179 return false;
175 } 180 }
176 - var th = this,that=this;  
177 - var i = getApp().request; 181 + var th = this,that=this;
178 var dd = { 182 var dd = {
179 store_id: o.stoid, 183 store_id: o.stoid,
180 isstop: 0, 184 isstop: 0,
components/diy_store_select/diy_store_select.wxml
  1 +<wxs module="filters" src="../../utils/filter.wxs"></wxs>
  2 +
1 <!-- 如果是自定义模板的时候 --> 3 <!-- 如果是自定义模板的时候 -->
2 <block wx:if="{{object}}"> 4 <block wx:if="{{object}}">
3 <view class="store_sele1 flex ai_c" bindtap="sele_top_store" style="background-color:{{object.bgcolor}};color: {{object.word_color}};"> 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,7 +53,7 @@
51 </view> 53 </view>
52 <view> 54 <view>
53 <view class="distance fs24 address-val"wx:if="{{item.distance!=null}}"> 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 </view> 57 </view>
56 </view> 58 </view>
57 <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view> 59 <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>