CustomerDetailsHeader.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div v-loading="loading">
  3. <div class="flex items-start justify-between">
  4. <div>
  5. <!-- 左上:客户基本信息 -->
  6. <el-col>
  7. <el-row>
  8. <span class="text-xl font-bold">{{ customer.name }}</span>
  9. </el-row>
  10. </el-col>
  11. </div>
  12. <div>
  13. <!-- 右上:按钮 -->
  14. <el-button
  15. type="primary"
  16. v-hasPermi="['crm:customer:update']"
  17. @click="openForm(customer.id)"
  18. >
  19. 编辑
  20. </el-button>
  21. <!-- TODO @puhui999:转移的操作接入 -->
  22. <el-button type="primary" @click="transfer">转移</el-button>
  23. <!-- TODO @puhui999:修改成交状态的接入 -->
  24. <el-button>更改成交状态</el-button>
  25. <el-button v-if="customer.lockStatus" @click="handleUnlock(customer.id!)">解锁</el-button>
  26. <el-button v-else @click="handleLock(customer.id!)">锁定</el-button>
  27. </div>
  28. </div>
  29. </div>
  30. <ContentWrap class="mt-10px">
  31. <el-descriptions :column="5" direction="vertical">
  32. <el-descriptions-item label="客户级别">
  33. <dict-tag :type="DICT_TYPE.CRM_CUSTOMER_LEVEL" :value="customer.level" />
  34. </el-descriptions-item>
  35. <el-descriptions-item label="成交状态">
  36. {{ customer.dealStatus ? '已成交' : '未成交' }}
  37. </el-descriptions-item>
  38. <el-descriptions-item label="负责人">{{ customer.ownerUserName }}</el-descriptions-item>
  39. <!-- TODO wanwan 首要联系人? -->
  40. <el-descriptions-item label="首要联系人" />
  41. <!-- TODO wanwan 首要联系人电话? -->
  42. <el-descriptions-item label="首要联系人电话">{{ customer.mobile }}</el-descriptions-item>
  43. </el-descriptions>
  44. </ContentWrap>
  45. <!-- 表单弹窗:添加/修改 -->
  46. <CustomerForm ref="formRef" @success="emit('refresh')" />
  47. </template>
  48. <script lang="ts" setup>
  49. import { DICT_TYPE } from '@/utils/dict'
  50. import * as CustomerApi from '@/api/crm/customer'
  51. import CustomerForm from '../CustomerForm.vue'
  52. defineOptions({ name: 'CustomerDetailsHeader' })
  53. const { customer, loading } = defineProps<{
  54. customer: CustomerApi.CustomerVO // 客户信息
  55. loading: boolean // 加载中
  56. }>()
  57. const message = useMessage() // 消息弹窗
  58. /** 修改操作 */
  59. const formRef = ref()
  60. const openForm = (id?: number) => {
  61. formRef.value.open('update', id)
  62. }
  63. /** 锁定操作 */
  64. const handleLock = async (id: number) => {
  65. await CustomerApi.lockCustomer(id, true)
  66. message.success('锁定成功')
  67. emit('refresh')
  68. }
  69. /** 解锁操作 */
  70. const handleUnlock = async (id: number) => {
  71. console.log(customer, '=======')
  72. await CustomerApi.lockCustomer(id, false)
  73. message.success('解锁成功')
  74. emit('refresh')
  75. }
  76. const emit = defineEmits(['refresh']) // 定义 success 事件,用于操作成功后的回调
  77. </script>