<template>
  <div class="sevice_detail">
    <div class="apass_breadcrumb">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item to="/shop">服务超市</el-breadcrumb-item>
        <el-breadcrumb-item to="/shop/app_store_list">
          应用商店
        </el-breadcrumb-item>
        <el-breadcrumb-item>应用详情信息</el-breadcrumb-item>
      </el-breadcrumb>
    </div>

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

    <service-tabs
      detail-url="yysd"
      provider-url="yysd"
      comments-url="yysd"
      detail-title="应用详情信息"
      comments-title="应用评价信息"
    ></service-tabs>
  </div>
</template>

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

export default {
  components: {
    appInfo,
    serviceTabs,
  },
  data: () => ({
    baseInfo: null,
    detailData: null,
    specification: null,
    provider: 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(
        ({ yysd }) => {
          this.baseInfo = yysd;
        },
        (error) => {
          console.log(error);
        }
      );
    },
  },
  mounted() {
    this.init();
  },
};
</script>
