index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <div v-loading="loading">
  3. <div class="flex items-start justify-between">
  4. <div>
  5. <!-- 左上:客户基本信息 -->
  6. <CustomerBasicInfo :customer="customer" />
  7. </div>
  8. <div>
  9. <!-- 右上:按钮 -->
  10. <el-button @click="openForm('update', customer.id)" v-hasPermi="['crm:customer:update']">
  11. 编辑
  12. </el-button>
  13. <el-button>更改成交状态</el-button>
  14. </div>
  15. </div>
  16. <el-row class="mt-10px">
  17. <el-button>
  18. <Icon icon="ph:calendar-fill" class="mr-5px" />
  19. 创建任务
  20. </el-button>
  21. <el-button>
  22. <Icon icon="carbon:email" class="mr-5px" />
  23. 发送邮件
  24. </el-button>
  25. <el-button>
  26. <Icon icon="system-uicons:contacts" class="mr-5px" />
  27. 创建联系人
  28. </el-button>
  29. <el-button>
  30. <Icon icon="ep:opportunity" class="mr-5px" />
  31. 创建商机
  32. </el-button>
  33. <el-button>
  34. <Icon icon="clarity:contract-line" class="mr-5px" />
  35. 创建合同
  36. </el-button>
  37. <el-button>
  38. <Icon icon="icon-park:income-one" class="mr-5px" />
  39. 创建回款
  40. </el-button>
  41. <el-button>
  42. <Icon icon="fluent:people-team-add-20-filled" class="mr-5px" />
  43. 添加团队成员
  44. </el-button>
  45. </el-row>
  46. </div>
  47. <ContentWrap class="mt-10px">
  48. <el-descriptions :column="5" direction="vertical">
  49. <el-descriptions-item label="客户级别">
  50. <dict-tag :type="DICT_TYPE.CRM_CUSTOMER_LEVEL" :value="customer.level" />
  51. </el-descriptions-item>
  52. <el-descriptions-item label="成交状态">
  53. {{ customer.dealStatus ? '已成交' : '未成交' }}
  54. </el-descriptions-item>
  55. <el-descriptions-item label="负责人">
  56. {{ customer.ownerUserName }}
  57. </el-descriptions-item>
  58. <!-- TODO wanwan 首要联系人? -->
  59. <el-descriptions-item label="首要联系人" />
  60. <!-- TODO wanwan 首要联系人电话? -->
  61. <el-descriptions-item label="首要联系人电话">
  62. {{ customer.mobile }}
  63. </el-descriptions-item>
  64. </el-descriptions>
  65. </ContentWrap>
  66. <el-col>
  67. <el-tabs>
  68. <el-tab-pane label="详细资料">
  69. <CustomerDetails :customer="customer" />
  70. </el-tab-pane>
  71. <el-tab-pane label="活动" lazy> 活动</el-tab-pane>
  72. <el-tab-pane label="邮件" lazy> 邮件</el-tab-pane>
  73. <el-tab-pane label="工商信息" lazy> 工商信息</el-tab-pane>
  74. <el-tab-pane label="客户关系" lazy> 客户关系</el-tab-pane>
  75. <!-- TODO wanwan 以下标签上的数量需要接口统计返回 -->
  76. <el-tab-pane label="联系人" lazy>
  77. <template #label> 联系人<el-badge :value="12" class="item" type="primary" /> </template>
  78. 联系人
  79. </el-tab-pane>
  80. <el-tab-pane label="团队成员" lazy>
  81. <template #label> 团队成员<el-badge :value="2" class="item" type="primary" /> </template>
  82. 团队成员
  83. </el-tab-pane>
  84. <el-tab-pane label="商机" lazy> 商机</el-tab-pane>
  85. <el-tab-pane label="合同" lazy>
  86. <template #label> 合同<el-badge :value="3" class="item" type="primary" /> </template>
  87. 合同
  88. </el-tab-pane>
  89. <el-tab-pane label="回款" lazy>
  90. <template #label> 回款<el-badge :value="4" class="item" type="primary" /> </template>
  91. 回款
  92. </el-tab-pane>
  93. <el-tab-pane label="回访" lazy> 回访</el-tab-pane>
  94. <el-tab-pane label="发票" lazy> 发票</el-tab-pane>
  95. </el-tabs>
  96. </el-col>
  97. <!-- 表单弹窗:添加/修改 -->
  98. <CustomerForm ref="formRef" @success="getCustomerData(id)" />
  99. </template>
  100. <script setup lang="ts">
  101. import { ElMessage } from 'element-plus'
  102. import { useTagsViewStore } from '@/store/modules/tagsView'
  103. import * as CustomerApi from '@/api/crm/customer'
  104. import CustomerBasicInfo from '@/views/crm/customer/detail/CustomerBasicInfo.vue'
  105. import { DICT_TYPE } from '@/utils/dict'
  106. import CustomerDetails from '@/views/crm/customer/detail/CustomerDetails.vue'
  107. import CustomerForm from '@/views/crm/customer/CustomerForm.vue'
  108. defineOptions({ name: 'CustomerDetail' })
  109. const { delView } = useTagsViewStore() // 视图操作
  110. const route = useRoute()
  111. const { currentRoute } = useRouter() // 路由
  112. const id = Number(route.params.id)
  113. const loading = ref(true) // 加载中
  114. // 客户详情
  115. const customer = ref<CustomerApi.CustomerVO>({} as CustomerApi.CustomerVO)
  116. /**
  117. * 获取详情
  118. *
  119. * @param id
  120. */
  121. const getCustomerData = async (id: number) => {
  122. loading.value = true
  123. try {
  124. customer.value = await CustomerApi.getCustomer(id)
  125. } finally {
  126. loading.value = false
  127. }
  128. }
  129. const formRef = ref()
  130. const openForm = (type: string, id?: number) => {
  131. formRef.value.open(type, id)
  132. }
  133. /**
  134. * 初始化
  135. */
  136. onMounted(() => {
  137. if (!id) {
  138. ElMessage.warning('参数错误,客户不能为空!')
  139. delView(unref(currentRoute))
  140. return
  141. }
  142. getCustomerData(id)
  143. })
  144. </script>