<template>
  <div class="bi-settlement-rule-adjust-form">
    <settlement-rule-adjust-price
      v-if="currentClass === '01'"
      :title="pageTitle"
      :type="pageTitle"
      :get-settle-rule-car-config-method="getSettleRuleCarConfigMethod"
    ></settlement-rule-adjust-price>
    <settlement-rule-adjust-guarantee
      v-if="currentClass === '02'"
      :title="pageTitle"
    ></settlement-rule-adjust-guarantee>
    <settlement-rule-adjust-hurry
      v-if="currentClass === '03'"
      :title="pageTitle"
    ></settlement-rule-adjust-hurry>
    <settlement-rule-adjust-taxrate
      v-if="currentClass === '04'"
      :title="pageTitle"
    ></settlement-rule-adjust-taxrate>
  </div>
</template>
<script>
import SettlementRuleAdjustPrice from './settlement-rule-adjust-price.vue'
import SettlementRuleAdjustGuarantee from './settlement-rule-adjust-guarantee.vue'
import SettlementRuleAdjustHurry from './settlement-rule-adjust-hurry.vue'
import SettlementRuleAdjustTaxrate from './settlement-rule-adjust-taxrate.vue'

export default {
  name: 'BiSettlementRuleAdjustForm',
  props: {
    ruleMenuData: {
      type: Array,
      required: true
    },
    getSettleRuleCarConfigMethod: {
      type: Function
    }
  },
  components: {
    SettlementRuleAdjustPrice,
    SettlementRuleAdjustHurry,
    SettlementRuleAdjustGuarantee,
    SettlementRuleAdjustTaxrate
  },
  computed: {
    currentClass() {
      return this.$route.params.class
    },
    currentType() {
      return this.$route.params.type
    },
    pageTitle() {
      if (!this.currentMenuItem) {
        return
      }
      return this.currentMenuItem.menuName
    },
    currentMenuItem() {
      const group = this.ruleMenuData.find(v => v.id === this.currentClass)
      if (!group) {
        return
      }
      return group.menuList.find(v => v.id === this.currentType)
    }
  }
}
</script>
<style lang="less">
.bi-settlement-rule-adjust-form{
  height: 100%;
}
</style>
