<template>
    <div class="store">
      <nearStoreCom :storeList="storeList" v-if="storeList.length>0"></nearStoreCom>
      <jxEmpty v-else></jxEmpty>	
    </div>
  </template>
  
<script>
import {store} from "@/store";
import apiStore from '@/apis/apiStore';
import { mapGetters, mapActions } from "vuex";
import nearStoreCom from '@/components/nearlyStoreCom/index.vue'
import jxEmpty from '@/components/jxEmpty/index.vue'
export default {
  components:{
    nearStoreCom,
    jxEmpty
  },
  data(){
    return {
      storeList:[],
      // brandID:[]
    }
  },
  computed:{
    ...mapGetters({
			myLocation:"indexPage/myLocation",
			reLocation: "indexPage/reLocation"
		})
  },
  async onLoad(query){
    let obj = {
      lat: this.reLocation && this.reLocation.lat? this.reLocation.lat : this.myLocation.lat,
      lng: this.reLocation && this.reLocation.lng? this.reLocation.lng : this.myLocation.lng,
      needWalkDistance:false,
    }
    // console.log('query!----',query.type)
   
    // if(!query.type) {
    //   store.commit('indexPage/changeDNS',query.type)
    //   obj.brandID = JSON.parse( query.brandID)
    // }
    // console.log(query,'域名信息',query.type)
    if(query && query.type) store.commit('indexPage/changeDNS',query.type)
    if(query && query.brandID)  obj.brandID = JSON.parse( query.brandID)
      
    this.storeList = await apiStore.getNearlyStore(obj)
   
    this.storeList = this.storeList.filter(item => item.storeInfo.storeID !== 102919 )  // 过滤掉商城模板店
    this.storeList = this.storeList.map(item => ({...item,dnsType:query.type}))
  }
}
</script>
  
<style lang="scss" scoped>
  @import './index.scss'
</style>