<template>
  <section class="AppFinanceProduct">
    <component :is="currentComponent" :instance="instance" :dict="dict" :permissions="permissions"/>
  </section>
</template>

<script>

import ProductDetail from "./productDetail";
import ProductList from "./productList";
import ProductAdd from "./productAdd";
import ProductRecommend from "./productRecommend";

export default {
  name: "AppFinanceProduct",
  components: {ProductRecommend, ProductAdd, ProductList, ProductDetail},
  label: "产品发布",
  props: {
    instance: Function,
    dict: Object,
    permissions: Function
  },
  computed: {
    currentComponent() {
      return this.$route.hash == "#add" ? ProductAdd :
          this.$route.hash == "#productRecommend" ? ProductRecommend :
              !!this.$route.query.id ? ProductDetail : ProductList
    }
  },
  created() {
    this.dict.load("productGuaranteeMode", "productRepaymentMethod", "productRepaymentTimeline", "productStatus", "productFaceUser",
        "enterpriseAuditStatus", "yesOrNo", "financialOrganizationType")
  }
}
</script>

<style lang="scss" scoped>
.AppFinanceProduct {
  height: 100%;
}
</style>
