<!-- 无用组件，待废弃 -->
<template>
  <!-- 掉期订单 -->
  <section class="spot_warran">
    <component :is="componentId" v-if="componentId"></component>
    <thirdMenu :list="tabList" @selectMenu="changeTab" :value="'title'">
      <!-- 议价单 -->
      <div class="goods-apply" v-if="componentId === BARGIN">
        <a-radio-group class="conditionCommonRadioGroup" v-model:value="bargainValue">
          <a-radio @focus="changeBargain(ApplyType.my)" :value="ApplyType.my">我的申请</a-radio>
          <a-radio @focus="changeBargain(ApplyType.counterpart)" :value="ApplyType.counterpart">对方申请</a-radio>
        </a-radio-group>
      </div>
    </thirdMenu>
  </section>
</template>

<script lang="ts">
import { defineAsyncComponent, defineComponent, ref } from 'vue';
import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
import thirdMenu from '@/common/components/thirdMenu/index.vue';
import { handleOrderDetailList } from '@/common/setup/order/orderData';
import Bus from '@/utils/eventBus/index';
import { ApplyType } from '@/common/constants/enumCommon';

const BARGIN = 'swap_commodity_contract_bargain';

export default defineComponent({
  components: {
    thirdMenu,
    swap_commodity_contract_summary: defineAsyncComponent(() => import('./components/swap_commodity_contract_summary/index.vue')), // 合约汇总
    swap_commodity_contract_commission: defineAsyncComponent(() => import('./components/swap_commodity_contract_commission/index.vue')), // 委托
    swap_commodity_contract_make_deal: defineAsyncComponent(() => import('./components/swap_commodity_contract_make_deal/index.vue')), // 成交
    [BARGIN]: defineAsyncComponent(() => import('./components/swap_commodity_contract_bargain/index.vue')), // 议价单
  },
  setup() {
    // 切换 我的
    function changeBargain(value: ApplyType) {
      Bus.$emit('bargain', value);
    }
    const bargainValue = ref<ApplyType>(ApplyType.my);
    return { ...handleOrderDetailList('swap_the_order'), changeBargain, BARGIN, ApplyType, bargainValue };
  },
});
</script>
