index.vue 5.2 KB

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