| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- <template>
- <div class="data-page">
- <div class="data-header">
- <div class="data-title">📋 客户池 - 共{{ customerStats.totalCustomerCount }}家</div>
- <div style="display: flex; gap: 8px;">
- <button class="btn btn-secondary"><i class="fas fa-download"></i> 导出</button>
- <!-- <button class="btn btn-primary" @click="showAddModal = true"><i class="fas fa-plus"></i> 添加客户</button> -->
- </div>
- </div>
- <!-- Stats -->
- <div class="stat-row">
- <div class="stat-card-lg"> <!-- @click="filterTab = 'all'" -->
- <div class="stat-icon-lg blue"><i class="fas fa-users"></i></div>
- <div class="stat-content-lg"><h3>{{ customerStats.totalCustomerCount }}</h3><p>总客户数</p></div>
- </div>
- <div class="stat-card-lg"><!-- @click="filterTab = 'prospect'" -->
- <div class="stat-icon-lg purple"><i class="fas fa-user-clock"></i></div>
- <div class="stat-content-lg"><h3>{{ customerStats.keyCustomerCount }}</h3><p>重点客户</p></div>
- </div>
- <div class="stat-card-lg"><!-- @click="filterTab = 'intent'" -->
- <div class="stat-icon-lg orange"><i class="fas fa-star"></i></div>
- <div class="stat-content-lg"><h3>{{ customerStats.dealCustomerCount }}</h3><p>成交客户</p></div>
- </div>
- <div class="stat-card-lg"><!-- @click="filterTab = 'deal'" -->
- <div class="stat-icon-lg green"><img src="../assets/images/icon-gh.svg" /></div>
- <div class="stat-content-lg"><h3>{{ customerStats.publicCustomerCount }}</h3><p>公海客户</p></div>
- </div>
- <div class="stat-card-lg"><!-- @click="filterTab = 'silent'" -->
- <div class="stat-icon-lg" style="background: rgba(148, 163, 184, 0.2); color: var(--text-secondary);"><i class="fas fa-moon"></i></div>
- <div class="stat-content-lg"><h3>{{ customerStats.invalidCustomerCount }}</h3><p>无效客户</p></div>
- </div>
- </div>
- <!-- Search & Filter -->
- <div style="display: flex; gap: 16px; margin-bottom: 20px;width:100%;" class="filter-customer">
- <div class="search-box" style="flex: 1;">
- <i class="fas fa-search search-icon"></i>
- <input type="text" v-model="searchQuery" class="search-input" placeholder="搜索公司名称、联系人、邮箱..." @change="getCustomerData">
- </div>
- <div style="flex: 1;display: flex; gap: 16px;width:100%;" >
- <div class="form-select">
- <el-cascader placeholder="区域名称" :options="region"
- v-model="regionValue" clearable filterable @change="getRegion" style="width: 100%;"/>
- </div>
- <div class="form-select">
- <el-select v-model="customerClassify" clearable placeholder="客户分类" @change="getCustomerData()">
- <el-option label="公海客户" value="1" />
- <el-option label="无效客户" value="2" />
- <el-option label="重点客户" value="3" />
- <el-option label="成交客户" value="4" />
- </el-select>
- </div>
- </div>
- </div>
- <div style="display: flex; gap: 16px; margin-bottom: 20px;width:100%;" class="filter-customer">
- <div class="form-select">
- <el-select v-model="customerParams.customerSourceDictValue" clearable placeholder="客户来源" @change="getCustomerData()">
- <el-option label="搜索引擎(例:Google)" value="1" />
- <el-option label="公司网站live chat咨询" value="2" />
- <el-option label="公司网站留言" value="3" />
- <el-option label="sales信箱" value="4" />
- <el-option label="德国Embedded展会" value="5" />
- <el-option label="CES展会" value="6" />
- <el-option label="B2ClT" value="7" />
- <el-option label="CEBIT展会" value="8" />
- <el-option label="中国制造网" value="9" />
- <el-option label="Computex展会" value="10" />
- <el-option label="客户介绍" value="11" />
- <el-option label="社交媒体(例:Linkedln)" value="12" />
- <el-option label="SalesForce" value="13" />
- <el-option label="香港电子展" value="14" />
- <el-option label="官网注册用户" value="15" />
- </el-select>
- </div>
- <div class="form-select">
- <el-select v-model="customerParams.customerStatusDictValue" clearable placeholder="客户状态" @change="getCustomerData()">
- <el-option label="暂无需求" value="1" />
- <el-option label="潜在客户" value="2" />
- <el-option label="意向客户" value="3" />
- <el-option label="忠诚客户" value="4" />
- <el-option label="了解产品" value="11" />
- <el-option label="正在跟进" value="22" />
- <el-option label="寄样试用" value="33" />
- <el-option label="意向购买" value="44" />
- <el-option label="准备付款" value="55" />
- <el-option label="暂时搁置" value="66" />
- </el-select>
- </div>
- <div class="form-select">
- <el-select v-model="customerParams.customerTypeDictValue" clearable placeholder="客户类型" @change="getCustomerData()">
- <el-option label="供应厂商" value="4" />
- <el-option label="代理合作" value="5" />
- <el-option label="普通客户" value="1" />
- <el-option label="友商客户" value="3" />
- <el-option label="定制客户" value="2" />
- <el-option label="内部客户" value="6" />
- <el-option label="客户保护" value="10" />
- <el-option label="协助项目" value="11" />
- </el-select>
- </div>
- <div class="form-select">
- <el-select v-model="customerParams.customerLevelDictValue" clearable placeholder="客户等级" @change="getCustomerData()">
- <el-option label="A级" value="1" />
- <el-option label="B级" value="2" />
- <el-option label="C级" value="3" />
- <el-option label="D级" value="4" />
- </el-select>
- </div>
- <!-- <button class="btn btn-secondary"><i class="fas fa-sliders-h"></i> 高级筛选</button> -->
- </div>
-
- <!-- Tabs -->
- <div style="display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 12px;">
- <div v-for="tab in tabs" :key="tab.key"
- :style="{
- padding: '8px 16px',
- borderRadius: '8px 8px 0 0',
- cursor: 'pointer',
- fontSize: '13px',
- background: filterTab === tab.key ? 'var(--bg-hover)' : 'transparent',
- color: filterTab === tab.key ? 'var(--text-primary)' : 'var(--text-secondary)',
- fontWeight: filterTab === tab.key ? '600' : '400'
- }"
- @click="filterTab = tab.key">
- {{ tab.label }} <span style="font-size: 11px; opacity: 0.7;">({{ tab.count }})</span>
- </div>
- </div>
- <!-- Customer List -->
- <!-- <div style="flex: 1; overflow-y: auto;"> -->
- <div v-loading="dataLoading" element-loading-background="rgba(0, 0, 0, 0.8)">
- <div v-for="customer in customers" :key="customer.id"
- class="customer-card">
- <div class="customer-flag">{{ customer.flag }}</div>
- <div class="customer-info">
- <div class="customer-header">
- <span class="customer-name">{{ customer.customerName }}</span>
- <!-- 客户类型标识 -->
- <!-- <span class="customer-status" :style="{ background: getStatusBg(customer.status), color: getStatusColor(customer.status) }">
- {{ getStatusLabel(customer.status) }}
- </span> -->
- </div>
- <div class="customer-contact">
- <i class="fas fa-user"></i> {{ customer.liaison?.name }}<span v-if="customer.liaison?.departmentPosition"> · </span>{{ customer.liaison?.departmentPosition }}
- </div>
- <div class="customer-meta">
- <span><i class="fas fa-map-marker-alt"></i> {{ customer.continent }} · {{ customer.country }}</span>
- <span><i class="fas fa-industry"></i> {{ customer.customerCompany?.industry }}</span>
- <!-- <span><i class="fas fa-dollar-sign"></i> {{ customer.annualPurchase }}</span> -->
- </div>
- </div>
- <!-- <div class="customer-score">
- <div class="score-circle" :class="getScoreClass(customer.score)">{{ customer.score }}</div>
- <div class="score-label">意向分</div>
- </div> -->
- <div class="customer-actions" @click.stop>
- <button class="btn btn-secondary btn-sm" @click="showCustomerDetail(customer.id)"><i class="fas fa-eye"></i>更多详情</button>
- </div>
- </div>
- </div>
- <div class="pagination-area">
- <el-pagination
- background
- :total="customerTotal"
- style="text-align: right;"
- :current-page="params.pageIndex"
- :page-size="params.pageSize"
- layout="total, prev, pager, next"
- @current-change="pageCurrentChange">
- </el-pagination>
- </div>
-
- <!-- </div> -->
- <!-- 引入添加客户弹窗组件 -->
- <!-- <AddCustomerModal
- :show-modal="showAddModal"
- @close="showAddModal = false"
- @add="handleAddCustomer"
- /> -->
- <!-- Customer Detail Modal -->
- <CustomerDetail ref="customerDetailRef" />
- <!-- Toast -->
- <transition name="toast">
- <div v-if="showToast" class="toast" :class="toastType">
- <i :class="toastType === 'success' ? 'fas fa-check-circle' : 'fas fa-info-circle'"></i>
- {{ toastMessage }}
- </div>
- </transition>
- </div>
- </template>
- <script setup>
- import { ref, computed } from 'vue'
- import { getCustomerList,getCustomerStats } from '../api/customer'
- import {region} from '@/utils/region';
- // 引入添加客户组件
- import AddCustomerModal from '../components/addCustomer.vue'
- import CustomerDetail from '../components/customerDetail.vue';
- const showAddModal = ref(false)
- const showDetailModal = ref(false)
- const selectedCustomer = ref(null)
- const filterTab = ref('all')
- const searchQuery = ref('')
- const regionFilter = ref('')
- const industryFilter = ref('')
- const showToast = ref(false)
- const toastMessage = ref('')
- const toastType = ref('success')
- const dataLoading = ref(false)
- const aiContentLoading = ref(false)
- const formattedText = ref('')
- const detailLoading = ref(false)
- const customerClassify = ref('')
- const customerStats = ref({})
- const getStats = ()=>{
- getCustomerStats({}).then(res => {
- if(res.success){
- customerStats.value = res.result
- }
- })
- }
- getStats()
- const tabs = ref([
- { key: 'all', label: '全部客户', count: 0 },
- // { key: 'prospect', label: '潜在客户', count: 812 },
- // { key: 'intent', label: '意向客户', count: 224 },
- // { key: 'deal', label: '成交客户', count: 156 },
- // { key: 'silent', label: '沉默客户', count: 55 }
- ])
- const customers = ref([])
- const customerTotal = ref()
- const params = ref({
- pageIndex: 1,
- pageSize: 10,
- blurry:null,
- country:null,
- })
- const customerParams = ref({
- customerStatusDictValue: '',
- customerTypeDictValue: '',
- customerLevelDictValue: '',
- customerSourceDictValue: ''
- })
- const getCustomer = (type) => {
- let paramsData = {
- ...params.value,
- ...customerParams.value
- }
- dataLoading.value= true
- paramsData.blurry = searchQuery.value
- if(customerClassify.value == 1) {
- paramsData.hasPublicCustomer = 1
- }else if(customerClassify.value == 2) {
- paramsData.hasGarbageCustomer = 1
- }else if(customerClassify.value == 3) {
- paramsData.hasFollowCustomer = 1
- }else if(customerClassify.value == 4) {
- paramsData.hasOrderForm = 1
- paramsData.hasPublicCustomer = 0
- }
- getCustomerList(paramsData).then(res => {
- dataLoading.value= false
- // if(type=='init'){ //页面初始记录客户总数量
- // customerStats.value.total = res.result.total
- // }
- customerTotal.value = tabs.value[0].count = res.result.total
- customers.value = res.result.records
- })
- }
- getCustomer('init')
- const pageCurrentChange = (page) => {
- params.value.pageIndex = page
- getCustomer()
- }
- const getCustomerData = ()=>{
- getCustomer()
- }
- const regionValue = ref([])
- const getRegion = (value) => {
- params.value.country = value?value[1]:''
- getCustomer()
- }
- const customerDetailId = ref()
- const customerDetailRef = ref()
- const showCustomerDetail = (id) => {
- customerDetailRef.value.open(id)
- // aiContentLoading.value = false
- // detailLoading.value = true
- // showDetailModal.value = true
- // customerDetailId.value = id
- // getCustomerDetail({id:id}).then(res => {
- // detailLoading.value = false
- // if(res.success){
- // selectedCustomer.value = res.result
- // if(selectedCustomer.value.customerAnalysisResult){
- // formattedText.value = selectedCustomer.value.customerAnalysisResult.reasonSummary
- // }else{
- // formattedText.value = ''
- // }
- // }else{
- // ElMessage.warning(res.message)
- // }
- // })
- }
- // const customers = ref([
- // {
- // id: 1, flag: '🇸🇦', name: 'Riyadh Tech Distribution', status: 'prospect', contact: 'Ahmed Al-Rashid',
- // role: '采购总监', location: '沙特·利雅得', industry: '固态硬盘进口商', annualPurchase: '年采购$2M+', score: 92,
- // email: 'ahmed@riyahtech.sa', phone: '+966 50 123 4567', website: 'www.riyahtech.sa',
- // totalDeals: 3, totalAmount: 4560000, lastContact: '3天前',
- // aiInsights: [
- // { type: 'purchase', level: 'high', icon: 'fas fa-shopping-cart', title: '采购意愿强烈', description: '近30天内访问官网5次,下载产品手册,建议重点跟进' },
- // { type: 'timing', level: 'medium', icon: 'fas fa-clock', title: '最佳联系时间', description: '根据历史数据分析,周二上午10点联系成功率最高' },
- // { type: 'decision', level: 'high', icon: 'fas fa-user-tie', title: '决策人已识别', description: 'Ahmed Al-Rashid 为采购决策人,已验证邮箱有效性' }
- // ],
- // interactions: [
- // { id: 1, type: 'email', action: '发送报价单', detail: 'SSD采购报价已发送,等待回复', time: '3天前' },
- // { id: 2, type: 'visit', action: '官网访问', detail: '浏览了企业级SSD产品页面,停留8分钟', time: '5天前' },
- // { id: 3, type: 'call', action: '电话沟通', detail: '确认了采购需求,数量约5000片', time: '1周前' },
- // { id: 4, type: 'email', action: '首次联系', detail: '通过LinkedIn找到联系人,发送介绍邮件', time: '2周前' }
- // ],
- // opportunities: [
- // { id: 1, name: 'SSD批量采购', amount: 850000, stage: '谈判中', statusClass: 'negotiation', statusLabel: '跟进中' }
- // ]
- // },
- // {
- // id: 2, flag: '🇦🇪', name: 'Dubai Storage Solutions', status: 'prospect', contact: 'Mohammed Khan',
- // role: 'CEO', location: '阿联酋·迪拜', industry: '电子分销商', annualPurchase: '年采购$1.5M', score: 88,
- // email: 'mohammed@dubaistorage.ae', phone: '+971 50 987 6543', website: 'www.dubaistorage.ae',
- // totalDeals: 2, totalAmount: 2800000, lastContact: '1天前',
- // aiInsights: [
- // { type: 'purchase', level: 'medium', icon: 'fas fa-chart-line', title: '采购潜力', description: '公司规模扩张中,预计明年需求增长30%' }
- // ],
- // interactions: [
- // { id: 1, type: 'meeting', action: '视频会议', detail: '讨论Q2采购计划,对NVMe SSD感兴趣', time: '1天前' }
- // ],
- // opportunities: []
- // },
- // {
- // id: 3, flag: '🇰🇼', name: 'Kuwait Data Systems', status: 'intent', contact: 'Faisal Al-Mutairi',
- // role: 'IT总监', location: '科威特', industry: '数据中心集成商', annualPurchase: '年采购$2.5M', score: 85,
- // email: 'faisal@kwdata.kw', phone: '+965 99 888 777', website: 'www.kwdata.kw',
- // totalDeals: 5, totalAmount: 6800000, lastContact: '今天',
- // aiInsights: [
- // { type: 'timing', level: 'high', icon: 'fas fa-fire', title: '紧急需求', description: '数据中心扩容项目急需采购,建议立即跟进' }
- // ],
- // interactions: [
- // { id: 1, type: 'email', action: '回复询价', detail: '确认了技术规格,要求提供样品', time: '今天' }
- // ],
- // opportunities: [
- // { id: 1, name: '数据中心扩容项目', amount: 1200000, stage: '方案报价', statusClass: 'proposal', statusLabel: '待报价' }
- // ]
- // },
- // {
- // id: 4, flag: '🇩🇪', name: 'Berlin Tech GmbH', status: 'deal', contact: 'Hans Mueller',
- // role: '采购经理', location: '德国·柏林', industry: '企业级存储', annualPurchase: '年采购$3M+', score: 95,
- // email: 'hans@berlintech.de', phone: '+49 30 12345678', website: 'www.berlintech.de',
- // totalDeals: 8, totalAmount: 12500000, lastContact: '2天前',
- // aiInsights: [],
- // interactions: [
- // { id: 1, type: 'order', action: '订单确认', detail: 'PO-2026-0315 已确认,金额¥680,000', time: '2天前' }
- // ],
- // opportunities: [
- // { id: 1, name: 'NVMe SSD批量采购', amount: 680000, stage: '已成交', statusClass: 'won', statusLabel: '已成交' }
- // ]
- // }
- // ])
- // const filteredCustomers = computed(() => {
- // let result = customers.value
- // if (filterTab.value !== 'all') {
- // result = result.filter(c => c.status === filterTab.value)
- // }
- // if (searchQuery.value) {
- // const query = searchQuery.value.toLowerCase()
- // result = result.filter(c =>
- // c.name.toLowerCase().includes(query) ||
- // c.contact.toLowerCase().includes(query) ||
- // c.email?.toLowerCase().includes(query)
- // )
- // }
- // return result
- // })
- const getStatusBg = (status) => ({
- prospect: 'rgba(139, 92, 246, 0.2)',
- intent: 'rgba(245, 158, 11, 0.2)',
- deal: 'rgba(16, 185, 129, 0.2)',
- silent: 'rgba(148, 163, 184, 0.2)'
- }[status] || 'rgba(148, 163, 184, 0.2)')
- const getStatusColor = (status) => ({
- prospect: 'var(--secondary)',
- intent: 'var(--warning)',
- deal: 'var(--success)',
- silent: 'var(--text-secondary)'
- }[status] || 'var(--text-secondary)')
- const getStatusLabel = (status) => ({
- prospect: '潜客',
- intent: '意向',
- deal: '成交',
- silent: '沉默'
- }[status] || status)
- const sendEmail = (customer) => {
- showToastMessage(`正在发送邮件给 ${customer.contact}...`, 'success')
- }
- const createOpportunity = (customer) => {
- showDetailModal.value = false
- showToastMessage(`正在为 ${customer.name} 创建商机...`, 'success')
- }
- // 辅助函数:根据国家代码获取国旗
- const getFlagByCountry = (countryCode) => {
- const flagMap = {
- 'SA': '🇸🇦',
- 'AE': '🇦🇪',
- 'DE': '🇩🇪',
- 'FR': '🇫🇷',
- '': '🌐'
- }
- return flagMap[countryCode] || '🌐'
- }
- // 辅助函数:根据国家代码获取地区
- const getLocationByCountry = (countryCode) => {
- const locationMap = {
- 'SA': '沙特阿拉伯',
- 'AE': '阿联酋',
- 'DE': '德国',
- 'FR': '法国',
- '': '未填写'
- }
- return locationMap[countryCode] || '未填写'
- }
- const showToastMessage = (message, type = 'success') => {
- toastMessage.value = message
- toastType.value = type
- showToast.value = true
- setTimeout(() => showToast.value = false, 3000)
- }
- // ---------------- 暂时无用 ---------------------
- // 处理添加客户逻辑
- const handleAddCustomer = (customerData) => {
- // 模拟生成客户ID(实际项目中由后端生成)
- const newId = customers.value.length + 1
- // 构建完整的客户数据(补充默认值)
- const newCustomer = {
- id: newId,
- flag: getFlagByCountry(customerData.country),
- name: customerData.name,
- status: customerData.type,
- contact: customerData.contact,
- role: '未填写',
- location: getLocationByCountry(customerData.country),
- industry: '未填写',
- annualPurchase: '未填写',
- score: 80,
- email: customerData.email || '未填写',
- phone: customerData.phone || '未填写',
- website: '未填写',
- totalDeals: 0,
- totalAmount: 0,
- lastContact: '刚刚',
- aiInsights: [],
- interactions: [],
- opportunities: []
- }
- // 添加到客户列表
- customers.value.push(newCustomer)
- // 更新统计数据
- customerStats.total += 1
- if (customerData.type === 'prospect') customerStats.prospect += 1
- else if (customerData.type === 'intent') customerStats.intent += 1
- else if (customerData.type === 'deal') customerStats.deal += 1
- // 更新tabs计数
- tabs.forEach(tab => {
- if (tab.key === 'all') tab.count += 1
- else if (tab.key === customerData.type) tab.count += 1
- })
- // 显示提示
- showToastMessage('客户添加成功', 'success')
- }
- </script>
- <style scoped>
- @import '../assets/styles/customer.css';
- </style>
|