index.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <CustomerDetailsHeader :customer="customer" :loading="loading" @refresh="getCustomer(id)" />
  3. <el-col>
  4. <el-tabs>
  5. <el-tab-pane label="详细资料">
  6. <CustomerDetailsInfo :customer="customer" />
  7. </el-tab-pane>
  8. <el-tab-pane label="操作日志" lazy>TODO 待开发</el-tab-pane>
  9. <el-tab-pane label="联系人" lazy>
  10. <ContactList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
  11. </el-tab-pane>
  12. <el-tab-pane label="团队成员" lazy>
  13. <PermissionList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
  14. </el-tab-pane>
  15. <el-tab-pane label="商机" lazy>
  16. <BusinessList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
  17. </el-tab-pane>
  18. <el-tab-pane label="合同" lazy>
  19. <ContractList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
  20. </el-tab-pane>
  21. <el-tab-pane label="回款" lazy>
  22. <ReceivableList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
  23. </el-tab-pane>
  24. <el-tab-pane label="回访" lazy>TODO 待开发</el-tab-pane>
  25. </el-tabs>
  26. </el-col>
  27. </template>
  28. <script lang="ts" setup>
  29. import { useTagsViewStore } from '@/store/modules/tagsView'
  30. import * as CustomerApi from '@/api/crm/customer'
  31. import CustomerDetailsInfo from './CustomerDetailsInfo.vue' // 客户明细 - 详细信息
  32. import CustomerDetailsHeader from './CustomerDetailsHeader.vue' // 客户明细 - 头部
  33. import ContactList from '@/views/crm/contact/components/ContactList.vue' // 联系人列表
  34. import ContractList from '@/views/crm/contract/components/ContractList.vue' // 合同列表
  35. import BusinessList from '@/views/crm/business/components/BusinessList.vue' // 商机列表
  36. import ReceivableList from '@/views/crm/receivable/components/ReceivableList.vue' // 回款列表
  37. import PermissionList from '@/views/crm/permission/components/PermissionList.vue' // 团队成员列表(权限)
  38. import { BizTypeEnum } from '@/api/crm/permission'
  39. defineOptions({ name: 'CrmCustomerDetail' })
  40. const route = useRoute()
  41. const id = Number(route.params.id) // 客户编号
  42. const loading = ref(true) // 加载中
  43. /** 获取详情 */
  44. const customer = ref<CustomerApi.CustomerVO>({} as CustomerApi.CustomerVO) // 客户详情
  45. const getCustomer = async (id: number) => {
  46. loading.value = true
  47. try {
  48. customer.value = await CustomerApi.getCustomer(id)
  49. } finally {
  50. loading.value = false
  51. }
  52. }
  53. /** 初始化 */
  54. const { delView } = useTagsViewStore() // 视图操作
  55. const { currentRoute } = useRouter() // 路由
  56. onMounted(() => {
  57. if (!id) {
  58. ElMessage.warning('参数错误,客户不能为空!')
  59. delView(unref(currentRoute))
  60. return
  61. }
  62. getCustomer(id)
  63. })
  64. </script>