<template>
  <el-tabs v-model="tabName">
    <el-tab-pane label="成交列表" name="list" v-if="checkPermi(['clue:order:order-list'])">
      <template v-if="tabName == 'list'">
        <OrderList v-if="appStore.getAppInfo?.instanceType == 1" />
        <MallOrderList v-else-if="appStore.getAppInfo?.instanceType == 2" />
      </template>
    </el-tab-pane>
    <el-tab-pane label="回款申请" name="commission" v-if="checkPermi(['clue:order:return-list'])">
      <Reback v-if="tabName == 'commission'" />
    </el-tab-pane>
    <el-tab-pane
      label="售后申请"
      name="aftersale"
      v-if="checkPermi(['clue:order:after-sale-list'])"
    >
      <AfterSales v-if="tabName == 'aftersale'" />
    </el-tab-pane>
    <el-tab-pane
      label="发货列表"
      name="delivery"
      v-if="appStore.getAppInfo?.instanceType == 2 && checkPermi(['clue:order:delivery-list'])"
    >
      <Delivery v-if="tabName == 'delivery'" />
    </el-tab-pane>
    <el-tab-pane label="对外结算" name="settle" v-if="checkPermi(['clue:order:settle-list'])">
      <Settle v-if="tabName == 'settle'" />
    </el-tab-pane>
    <el-tab-pane label="邀约报备" name="remark" v-if="checkPermi(['clue:order:remark'])">
      <OrderRemark v-if="tabName == 'remark'" />
    </el-tab-pane>
  </el-tabs>
</template>

<script setup name="ClueOrder">
import { useAppStore } from '@/store/modules/app'
import OrderList from './Comp/OrderList.vue'
import MallOrderList from './Comp/MallOrderList.vue'
import Reback from './Comp/Reback.vue'
import AfterSales from './Comp/AfterSales.vue'
import Delivery from './Comp/Delivery.vue'
import Settle from './Comp/Settle.vue'
import OrderRemark from './Comp/OrderRemark.vue'

import { checkPermi } from '@/utils/permission'

const appStore = useAppStore()
const tabName = ref('list')
</script>

<style lang="scss" scoped></style>
