<template>
  <view class="recommend-hot">
    <page-navbar :hasBack="true" bgColor="#fff" :title="getTitle"></page-navbar>
    <base-list :list="listData" @click="handlerRouterSkip"></base-list>
    <!-- <load-more :status="loadmoreStatus" color="#ccc"></load-more> -->
  </view>
</template>

<script>
import { indexMerchantPaging } from '@/api/client/home';
import ListMixin from '@/mixin/list.js';

export default {
  mixins: [ListMixin],
  data() {
    return {
      queryData: {
        region: null, //地区编码
        longitude: null, //经度
        latitude: null, //纬度
        queryType: 1, //查询类型 0-附近商家 1- 推荐商家
      },
      listApiName: indexMerchantPaging,
    };
  },
  onLoad(option) {
    let { queryType } = option;
    this.queryData.queryType = queryType;
  },
  computed: {
    getTitle() {
      return this.queryData.queryType == 1 ? '热门推荐' : '附近商家';
    },
  },
  created() {
    this.getInitData();
  },
  mounted() {
    this.initDataList(this.queryData, true);
  },
  methods: {
    getInitData() {
      let { latitude, longitude, region } = this.location;
      this.queryData.latitude = latitude;
      this.queryData.longitude = longitude;
      this.queryData.region = region;
    },
    handlerRouterSkip(item) {
      console.log(item, 'item');
      uni.navigateTo({
        url: `/pagesHome/marketer/index?id=${item.id}`,
      });
    },
  },
};
</script>

<style scoped lang="scss">
.recommend-hot {
  padding: 32rpx;
  box-sizing: border-box;
}
</style>