<template>
  <div class="sevice_detail">
    <div class="sevice_breadcrumb">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item to="/shop">服务超市</el-breadcrumb-item>
        <el-breadcrumb-item to="/shop/space_time_service_list"
          >时空服务</el-breadcrumb-item
        >
        <el-breadcrumb-item>服务详情信息</el-breadcrumb-item>
      </el-breadcrumb>
    </div>

    <service-info :data="baseInfo"></service-info>

    <service-tabs
      detail-url="skfw"
      specification-url="skfw"
      provider-url="skfw"
      comments-url="skfw"
    ></service-tabs>
  </div>
</template>

<script>
import serviceInfo from "@/components/service-info";
import serviceTabs from "@/components/service-tabs";

export default {
  components: {
    serviceInfo,
    serviceTabs,
  },
  data: () => ({
    baseInfo: null,
  }),
  computed: {
    id() {
      return this.$route.params.id;
    },
  },
  methods: {
    getDataFromApi(_url) {
      return new Promise((resolve, reject) => {
        this.$http
          .get(_url)
          .then((response) => {
            resolve(response.body);
          })
          .catch(function(error) {
            reject(error);
          });
      });
    },
    init() {
      this.getDataFromApi(`/static/serviceBaseInfo.json`).then(
        ({ skfw }) => {
          this.baseInfo = skfw;
        },
        (error) => {
          console.log(error);
        }
      );
    },
  },
  mounted() {
    this.init();
  },
};
</script>
