Browse Source

首页门店逻辑修改

xiaohaizhao 1 year ago
parent
commit
cf7ba1c06b
2 changed files with 27 additions and 15 deletions
  1. 0 3
      packageA/shop/history.vue
  2. 27 12
      pages/index/index/index.vue

+ 0 - 3
packageA/shop/history.vue

@@ -81,9 +81,6 @@ export default {
             this.$Http.changeShop && this.$Http.changeShop(this.list[index]);
         }
     },
-    onUnload() {
-        delete this.$Http.changeShop
-    }
 }
 </script>
 

+ 27 - 12
pages/index/index/index.vue

@@ -65,12 +65,18 @@
                 <view class="popup-row" style="color: #666666;font-size: 14px;">
                     门店定位
                 </view>
-                <view class="popup-row" @click="showShopOtions = false" hover-class="navigator-hover"
-                    style="color: #C30D23;">
-                    {{ shopDetail.storename }}
-                </view>
-                <navigator @click="changeShop" class="popup-row" url="/packageA/shop/history" hover-class="navigator-hover"
-                    open-type="navigate">
+
+                <scroll-view :style="{ maxHeight: tovw(200) }" class="scroll-view" scroll-y>
+                    <view class="popup-row" v-for="item in  storeList " :key="item.sa_storeid" hover-class="navigator-hover"
+                        :style="{
+                            color: item.sa_storeid == shopDetail.sa_storeid ? '#C30D23' : ''
+                        }" @click="changeStore(item)">
+                        {{ item.storename }}
+                    </view>
+                </scroll-view>
+
+                <navigator @click="showShopOtions = false" class="popup-row" url="/packageA/shop/history"
+                    hover-class="navigator-hover" open-type="navigate">
                     历史足迹
                 </navigator>
                 <view class="popup-row" hover-class="navigator-hover" @click="getLocaT">
@@ -98,6 +104,7 @@ export default {
             },
             showShopOtions: false,
             getLocationLoading: true,
+            storeList: [],
         }
     },
     watch: {
@@ -129,6 +136,10 @@ export default {
                 callBack()
             }, 5000);
         },
+        changeStore(item) {
+            this.shopDetail = item;
+            this.showShopOtions = false;
+        },
         getLocaT() {
             return new Promise((resolve, reject) => {
                 this.getLocationLoading = true;
@@ -147,9 +158,16 @@ export default {
                         this.showShopOtions = false;
                         console.log("获取最近门店信息", res)
                         if (this.cutoff(res.msg)) return;
-                        res.data.cover = res.data.attinfos.length ? this.getSpecifiedImage(res.data.attinfos[0]) : uni.getStorageSync('site').logo || ''
-                        res.data.distance = res.data.distance > 1000 ? ((res.data.distance / 1000).toFixed(2) - 0) + 'km' : ((res.data.distance).toFixed(2) - 0) + 'm'
-                        this.shopDetail = res.data;
+                        if (res.data.length) {
+                            let list = res.data.map(v => {
+                                v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos[0]) : uni.getStorageSync('site').logo || '';
+                                v.distance = v.distance > 1000 ? ((v.distance / 1000).toFixed(2) - 0) + 'km' : ((v.distance).toFixed(2) - 0) + 'm';
+                                return v
+                            })
+                            this.shopDetail = list[0];
+                            console.log("shopDetail", this.shopDetail)
+                            this.storeList = list;
+                        }
                     })
                 })
             })
@@ -167,9 +185,6 @@ export default {
                     console.log('fail', fail)
                 },
             });
-        },
-        changeShop() {
-            this.showShopOtions = false;
         }
     },
 }