| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375 |
- <template>
- <view class="client-detail" :class="{ 'dark-mode': isDarkTheme }">
- <!-- 顶部导航栏 -->
- <view class="header">
- <view class="back-icon" @click="handleBack"></view>
- <text class="header-title">客户信息</text>
- <view class="header-right"></view>
- </view>
- <!-- 客户基本信息 -->
- <view class="client-basic-info">
- <image :src="clientInfo.avatar" class="client-avatar" mode="aspectFill"></image>
- <view class="basic-info">
- <text class="client-name">{{ clientInfo.gender }} · {{ clientInfo.name }}</text>
- <view class="status-tag-wrapper">
- <text class="status-tag register-tag registered">已注册</text>
- <text class="status-tag match-tag" :class="{ 'matched': followForm.matchStatus === 1, 'unmatched': followForm.matchStatus === 0 || followForm.matchStatus === null }">
- {{ followForm.matchStatus === 1 ? '已匹配' : '未匹配' }}
- </text>
- </view>
- <view class="client-tags">
- <text class="tag" v-for="(tag, index) in clientInfo.tags" :key="index">{{ tag }}</text>
- </view>
- </view>
- </view>
- <!-- 择偶要求 -->
- <view class="requirement-section">
- <view class="section-title">
- <text class="title-icon">💑</text>
- <text class="title-text">择偶要求</text>
- </view>
- <text class="requirement-content">{{ clientInfo.requirement }}</text>
- </view>
- <!-- 联系方式 -->
- <view class="contact-section">
- <view class="contact-item">
- <text class="contact-label">联系方式</text>
- <view class="contact-value">
- <text class="contact-number">{{ clientInfo.contact }}</text>
- <text class="copy-btn" @click="handleCopy(clientInfo.contact)">复制</text>
- </view>
- </view>
- <view class="contact-item" v-if="clientInfo.backupContact">
- <text class="contact-label">备用联系方式</text>
- <view class="contact-value">
- <text class="contact-number">{{ clientInfo.backupContact }}</text>
- <text class="copy-btn" @click="handleCopy(clientInfo.backupContact)">复制</text>
- </view>
- </view>
- </view>
- <!-- 跟进统计 -->
- <view class="stats-section">
- <text class="stats-title">跟进统计</text>
- <view class="stats-grid">
- <view class="stat-item">
- <text class="stat-value">{{ clientInfo.stats.followTimes }}</text>
- <text class="stat-label">跟进次数</text>
- </view>
- <view class="stat-item">
- <text class="stat-value">{{ clientInfo.stats.matchCount }}</text>
- <text class="stat-label">匹配对象</text>
- </view>
- <view class="stat-item">
- <text class="stat-value">{{ clientInfo.stats.phoneCalls }}</text>
- <text class="stat-label">电话沟通</text>
- </view>
- <view class="stat-item">
- <text class="stat-value">{{ clientInfo.stats.interviews }}</text>
- <text class="stat-label">面谈次数</text>
- </view>
- </view>
- </view>
- <!-- 标签切换 -->
- <view class="tabs-section">
- <text class="tab" :class="{ active: activeTab === 'details' }" @click="switchTab('details')">详细信息</text>
- <text class="tab" :class="{ active: activeTab === 'follow' }" @click="switchTab('follow')">跟进</text>
- </view>
- <!-- 详细信息 -->
- <scroll-view scroll-y class="details-section" v-if="activeTab === 'details'">
- <!-- 基本信息 -->
- <view class="detail-item">
- <text class="detail-label">婚姻状况:</text>
- <text class="detail-value">{{ clientInfo.details.maritalStatus }}</text>
- </view>
- <view class="detail-item">
- <text class="detail-label">学历:</text>
- <text class="detail-value">{{ clientInfo.details.education }}</text>
- </view>
- <view class="detail-item">
- <text class="detail-label">职业:</text>
- <text class="detail-value">{{ clientInfo.details.occupation }}</text>
- </view>
- <view class="detail-item">
- <text class="detail-label">收入:</text>
- <text class="detail-value">
- {{ clientInfo.details.income }}
- <text v-if="clientInfo.details.income && clientInfo.details.income !== '未知'">万元/年</text>
- </text>
- </view>
- <view class="detail-item">
- <text class="detail-label">购房情况:</text>
- <text class="detail-value">{{ clientInfo.details.housing }}</text>
- </view>
- <!-- 择偶要求详情 -->
- <view class="sub-section-title requirement-section-title">择偶详细要求</view>
- <view class="detail-item">
- <text class="detail-label">年龄范围:</text>
- <text class="detail-value">{{ clientInfo.details.requirement.ageRange }}</text>
- </view>
- <view class="detail-item">
- <text class="detail-label">身高要求:</text>
- <text class="detail-value">{{ clientInfo.details.requirement.height }}</text>
- </view>
- <view class="detail-item">
- <text class="detail-label">婚姻状况:</text>
- <text class="detail-value">{{ clientInfo.details.requirement.maritalStatus }}</text>
- </view>
- <view class="detail-item">
- <text class="detail-label">学历要求:</text>
- <text class="detail-value">{{ clientInfo.details.requirement.education }}</text>
- </view>
- <view class="detail-item" v-if="clientInfo.details.requirement.other">
- <text class="detail-label">其他要求:</text>
- <text class="detail-value">{{ clientInfo.details.requirement.other }}</text>
- </view>
- <!-- 客户标签 -->
- <view class="sub-section-title tags-section-title">客户标签</view>
- <view class="client-tags">
- <text class="tag" v-for="(tag, index) in clientInfo.tags" :key="index">{{ tag }}</text>
- </view>
- </scroll-view>
- <!-- 跟进信息 -->
- <scroll-view scroll-y class="follow-section" v-else>
- <!-- 跟进方式 -->
- <view class="follow-group">
- <text class="group-label">跟进方式</text>
- <view class="follow-type-options">
- <view class="follow-type-item" :class="{ active: followForm.type === 'phone' }" @click="followForm.type = 'phone'">
- <text class="radio-circle"></text>
- <text class="option-text">电话</text>
- </view>
- <view class="follow-type-item" :class="{ active: followForm.type === 'meet' }" @click="followForm.type = 'meet'">
- <text class="radio-circle"></text>
- <text class="option-text">面谈</text>
- </view>
- <view class="follow-type-item" :class="{ active: followForm.type === 'other' }" @click="followForm.type = 'other'">
- <text class="radio-circle"></text>
- <text class="option-text">其他</text>
- </view>
- </view>
- </view>
- <!-- 匹配状态 -->
- <view class="follow-group">
- <text class="group-label">匹配状态</text>
- <view class="status-tags-row">
- <view class="status-tag" :class="{ active: followForm.matchStatus === 0 }" @click="handleMatchStatusChange(0)">未匹配</view>
- <view class="status-tag" :class="{ active: followForm.matchStatus === 1 }" @click="handleMatchStatusChange(1)">已匹配</view>
- </view>
- </view>
- <!-- 跟进进度 -->
- <view class="follow-group">
- <text class="group-label">跟进进度</text>
- <view class="status-tags-row">
- <view class="status-tag" :class="{ active: followForm.progress === 'notMet' }" @click="followForm.progress = 'notMet'">未见面</view>
- <view class="status-tag" :class="{ active: followForm.progress === 'communicating' }" @click="followForm.progress = 'communicating'">沟通中</view>
- <view class="status-tag" :class="{ active: followForm.invitationStatus === 0 }" @click="handleInvitationStatusChange(0)">未邀约</view>
- <view class="status-tag" :class="{ active: followForm.invitationStatus === 1 }" @click="handleInvitationStatusChange(1)">已邀约</view>
- </view>
- </view>
- <!-- 邀约时间 -->
- <view class="follow-group">
- <text class="group-label">邀约时间</text>
- <view class="input-like">
- <picker mode="date" :value="followForm.inviteDate" @change="onInviteDateChange">
- <view class="picker-inner">{{ followForm.inviteDate || '请选择日期' }}</view>
- </picker>
- </view>
- </view>
- <!-- 跟进备注 -->
- <view class="follow-group">
- <text class="group-label">跟进备注</text>
- <textarea class="textarea" v-model="followForm.remark" placeholder="请输入跟进备注详细信息..." placeholder-style="color:#C5A4D8" />
- </view>
- <!-- 提交按钮(预留) -->
- <view class="follow-submit-btn" @click="handleSubmitFollow">保存跟进</view>
- </scroll-view>
- </view>
- </template>
- <script>
- export default {
- name: 'client-detail',
- data() {
- return {
- activeTab: 'details',
- followForm: {
- type: 'phone',
- progress: 'matched',
- matchStatus: 0, // 0-未匹配,1-已匹配
- invitationStatus: 0, // 0-未邀约,1-已邀约
- inviteDate: '',
- remark: ''
- },
- resourceId: null, // 资源ID
- clientInfo: {
- id: 1,
- name: '',
- gender: '男',
- status: '已匹配',
- tags: [],
- avatar: '',
- requirement: '暂无要求',
- contact: '',
- backupContact: '',
- originalPhone: '', // 保存原始手机号用于复制
- originalBackupPhone: '', // 保存原始备用手机号用于复制
- stats: {
- followTimes: 0,
- matchCount: 0,
- phoneCalls: 0,
- interviews: 0
- },
- details: {
- maritalStatus: '',
- education: '',
- occupation: '',
- income: '',
- housing: '',
- requirement: {
- ageRange: '',
- height: '',
- maritalStatus: '',
- education: '',
- other: ''
- }
- }
- },
- isDarkTheme: false
- }
- },
- onShow() {
- const stored = uni.getStorageSync('matchmakerDarkMode')
- if (stored === true || stored === false) {
- this.isDarkTheme = stored
- }
-
- // 如果已经有resourceId,刷新统计数据
- if (this.resourceId) {
- this.loadFollowStatistics(this.resourceId)
- }
- },
- onLoad(options) {
- console.log('=== 客户详情页面 onLoad ===')
- console.log('options:', JSON.stringify(options, null, 2))
-
- // 从URL参数获取资源ID
- let resourceId = null
- if (options.resourceId) {
- resourceId = options.resourceId
- console.log('从resourceId参数获取:', resourceId)
- } else if (options.id) {
- // 兼容旧的id参数
- resourceId = options.id
- console.log('从id参数获取 (兼容):', resourceId)
- }
-
- if (resourceId) {
- // 确保resourceId是数字类型
- resourceId = parseInt(resourceId)
- if (isNaN(resourceId) || resourceId <= 0) {
- console.error('资源ID无效:', resourceId)
- uni.showToast({
- title: '资源ID无效',
- icon: 'none'
- })
- return
- }
- console.log('最终使用的resourceId:', resourceId, '类型:', typeof resourceId)
- this.resourceId = resourceId
- this.loadClientInfo(resourceId)
- } else {
- console.error('未获取到资源ID')
- uni.showToast({
- title: '未获取到资源ID',
- icon: 'none'
- })
- }
- },
- methods: {
- // 返回上一页
- handleBack() {
- uni.navigateBack()
- },
- // 复制联系方式
- handleCopy(contact) {
- // 如果传入的是脱敏的手机号,使用原始手机号
- let phoneToCopy = contact
- if (contact === this.clientInfo.contact && this.clientInfo.originalPhone) {
- phoneToCopy = this.clientInfo.originalPhone
- } else if (contact === this.clientInfo.backupContact && this.clientInfo.originalBackupPhone) {
- phoneToCopy = this.clientInfo.originalBackupPhone
- } else {
- // 尝试从脱敏号码中提取
- phoneToCopy = contact.replace(/\*+/g, '')
- }
-
- uni.setClipboardData({
- data: phoneToCopy,
- success: () => {
- uni.showToast({
- title: '复制成功',
- icon: 'success'
- })
- },
- fail: () => {
- uni.showToast({
- title: '复制失败',
- icon: 'none'
- })
- }
- })
- },
- // 切换标签
- switchTab(tab) {
- this.activeTab = tab
- },
- // 邀约日期变更
- onInviteDateChange(e) {
- this.followForm.inviteDate = e.detail.value
- },
- // 匹配状态变更
- handleMatchStatusChange(status) {
- this.followForm.matchStatus = status
- },
- // 邀约状态变更
- handleInvitationStatusChange(status) {
- this.followForm.invitationStatus = status
- // 如果选择已邀约且没有设置邀约时间,提示用户选择
- if (status === 1 && !this.followForm.inviteDate) {
- uni.showToast({
- title: '请选择邀约时间',
- icon: 'none'
- })
- }
- },
- // 加载最新的跟进信息,更新表单字段
- async loadLatestFollowInfo(resourceId) {
- try {
- const baseUrl = process.env.NODE_ENV === 'development'
- ? 'http://localhost:8083/api' // 开发环境 - 通过网关
- : 'https://your-domain.com/api' // 生产环境
-
- // 获取最新的跟进记录
- const [error, res] = await uni.request({
- url: `${baseUrl}/my-resource/latest-follow/${resourceId}`,
- method: 'GET',
- header: {
- 'Content-Type': 'application/json'
- }
- })
-
- if (error) {
- console.error('加载最新跟进信息失败:', error)
- return
- }
-
- if (res.statusCode === 200 && res.data && res.data.code === 200) {
- const followUp = res.data.data
-
- if (followUp) {
- // 更新跟进方式(1-电话,2-面谈,3-其他)
- if (followUp.followType !== null && followUp.followType !== undefined) {
- const followType = followUp.followType
- if (followType === 1) {
- this.followForm.type = 'phone'
- } else if (followType === 2) {
- this.followForm.type = 'meet'
- } else if (followType === 3) {
- this.followForm.type = 'other'
- }
- }
-
- // 更新跟进进度(1-已匹配,2-未见面,3-沟通中)
- if (followUp.followProgress !== null && followUp.followProgress !== undefined) {
- const progress = followUp.followProgress
- if (progress === 1) {
- this.followForm.progress = 'matched'
- } else if (progress === 2) {
- this.followForm.progress = 'notMet'
- } else if (progress === 3) {
- this.followForm.progress = 'communicating'
- }
- }
-
- // 更新匹配状态
- if (followUp.isMatch !== null && followUp.isMatch !== undefined) {
- this.followForm.matchStatus = parseInt(followUp.isMatch) || 0
- }
-
- // 更新邀约状态
- if (followUp.isInvitation !== null && followUp.isInvitation !== undefined) {
- this.followForm.invitationStatus = parseInt(followUp.isInvitation) || 0
- }
-
- // 更新邀约时间
- if (followUp.invitationTime) {
- const date = new Date(followUp.invitationTime)
- const year = date.getFullYear()
- const month = String(date.getMonth() + 1).padStart(2, '0')
- const day = String(date.getDate()).padStart(2, '0')
- this.followForm.inviteDate = `${year}-${month}-${day}`
- } else {
- this.followForm.inviteDate = ''
- }
-
- // 更新备注
- if (followUp.remark !== null && followUp.remark !== undefined) {
- this.followForm.remark = followUp.remark || ''
- } else {
- this.followForm.remark = ''
- }
-
- console.log('表单字段已更新:', {
- type: this.followForm.type,
- progress: this.followForm.progress,
- matchStatus: this.followForm.matchStatus,
- invitationStatus: this.followForm.invitationStatus,
- inviteDate: this.followForm.inviteDate,
- remark: this.followForm.remark
- })
- } else {
- console.log('暂无跟进记录,保持表单当前值')
- }
- }
- } catch (e) {
- console.error('加载最新跟进信息异常:', e)
- }
- },
- // 加载跟进统计数据
- async loadFollowStatistics(resourceId) {
- try {
- const baseUrl = process.env.NODE_ENV === 'development'
- ? 'http://localhost:8083/api' // 开发环境 - 通过网关
- : 'https://your-domain.com/api' // 生产环境
-
- const [error, res] = await uni.request({
- url: `${baseUrl}/my-resource/follow-statistics/${resourceId}`,
- method: 'GET',
- header: {
- 'Content-Type': 'application/json'
- }
- })
-
- if (error) {
- console.error('加载统计数据失败:', error)
- return
- }
-
- if (res.statusCode === 200 && res.data && res.data.code === 200) {
- const statistics = res.data.data
- console.log('=== 统计数据响应 ===')
- console.log('完整响应:', JSON.stringify(res.data, null, 2))
- console.log('统计数据对象:', statistics)
- console.log('followCount:', statistics?.followCount, statistics?.follow_count)
- console.log('matchCount:', statistics?.matchCount, statistics?.match_count)
- console.log('phoneCount:', statistics?.phoneCount, statistics?.phone_count)
- console.log('interviewCount:', statistics?.interviewCount, statistics?.interview_count)
-
- // 更新统计数据(支持驼峰和下划线两种字段名格式)
- if (this.clientInfo && this.clientInfo.stats) {
- const followCount = statistics?.followCount ?? statistics?.follow_count ?? 0
- const matchCount = statistics?.matchCount ?? statistics?.match_count ?? 0
- const phoneCount = statistics?.phoneCount ?? statistics?.phone_count ?? 0
- const interviewCount = statistics?.interviewCount ?? statistics?.interview_count ?? 0
-
- this.clientInfo.stats.followTimes = followCount
- this.clientInfo.stats.matchCount = matchCount
- this.clientInfo.stats.phoneCalls = phoneCount
- this.clientInfo.stats.interviews = interviewCount
-
- console.log('更新后的统计数据:', {
- followTimes: this.clientInfo.stats.followTimes,
- matchCount: this.clientInfo.stats.matchCount,
- phoneCalls: this.clientInfo.stats.phoneCalls,
- interviews: this.clientInfo.stats.interviews
- })
- } else {
- console.warn('clientInfo或stats不存在')
- }
- } else {
- console.error('统计数据接口返回错误:', res.data)
- }
- } catch (e) {
- console.error('加载统计数据异常:', e)
- }
- },
- // 提交跟进
- async handleSubmitFollow() {
- if (!this.resourceId) {
- uni.showToast({
- title: '资源ID不存在',
- icon: 'none'
- })
- return
- }
-
- try {
- uni.showLoading({
- title: '保存中...'
- })
-
- const baseUrl = process.env.NODE_ENV === 'development'
- ? 'http://localhost:8083/api' // 开发环境 - 通过网关
- : 'https://your-domain.com/api' // 生产环境
-
- // 准备请求数据
- // 跟进方式转换:phone->1, meet->2, other->3
- let followType = 1 // 默认电话
- if (this.followForm.type === 'meet') {
- followType = 2
- } else if (this.followForm.type === 'other') {
- followType = 3
- }
-
- // 跟进进度转换:matched->1, notMet->2, communicating->3
- let progress = 1 // 默认已匹配
- if (this.followForm.progress === 'notMet') {
- progress = 2
- } else if (this.followForm.progress === 'communicating') {
- progress = 3
- }
-
- const requestData = {
- followType: followType,
- progress: this.followForm.progress, // 保持字符串格式,后端会转换
- matchStatus: this.followForm.matchStatus,
- invitationStatus: this.followForm.invitationStatus,
- invitationTime: this.followForm.inviteDate || null,
- remark: this.followForm.remark || '' // 添加备注字段
- }
-
- console.log('保存跟进数据:', requestData)
-
- const [error, res] = await uni.request({
- url: `${baseUrl}/my-resource/update-follow/${this.resourceId}`,
- method: 'PUT',
- data: requestData,
- header: {
- 'Content-Type': 'application/json'
- }
- })
-
- uni.hideLoading()
-
- if (error) {
- console.error('保存跟进失败:', error)
- uni.showToast({
- title: '保存失败',
- icon: 'none'
- })
- return
- }
-
- if (res.statusCode === 200 && res.data && res.data.code === 200) {
- uni.showToast({
- title: '跟进已保存',
- icon: 'success'
- })
-
- // 刷新统计数据
- if (this.resourceId) {
- this.loadFollowStatistics(this.resourceId)
- }
-
- // 重新加载最新的跟进信息,更新表单字段
- if (this.resourceId) {
- this.loadLatestFollowInfo(this.resourceId)
- }
-
- // 触发资源列表刷新事件
- uni.$emit('refreshResourceList')
- } else {
- const errorMsg = res.data?.message || '保存失败'
- uni.showToast({
- title: errorMsg,
- icon: 'none'
- })
- }
- } catch (e) {
- uni.hideLoading()
- console.error('保存跟进异常:', e)
- uni.showToast({
- title: '保存失败,请稍后重试',
- icon: 'none'
- })
- }
- },
- // 从API加载客户信息
- async loadClientInfo(resourceId) {
- try {
- console.log('=== 开始加载客户信息 ===')
- console.log('resourceId:', resourceId, '类型:', typeof resourceId)
-
- uni.showLoading({
- title: '加载中...'
- })
-
- const baseUrl = process.env.NODE_ENV === 'development'
- ? 'http://localhost:8083/api' // 开发环境 - 通过网关
- : 'https://your-domain.com/api' // 生产环境
-
- const requestUrl = `${baseUrl}/my-resource/client-detail/${resourceId}`
- console.log('请求URL:', requestUrl)
-
- const [error, res] = await uni.request({
- url: requestUrl,
- method: 'GET',
- timeout: 30000, // 设置30秒超时
- header: {
- 'Content-Type': 'application/json'
- }
- })
-
- console.log('请求结果 - error:', error)
- console.log('请求结果 - res:', res)
-
- uni.hideLoading()
-
- if (error) {
- console.error('加载客户信息失败:', error)
- let errorMsg = '加载失败'
- if (error.errMsg) {
- if (error.errMsg.includes('timeout') || error.errMsg.includes('超时')) {
- errorMsg = '请求超时,请检查网络连接'
- } else if (error.errMsg.includes('fail')) {
- errorMsg = '网络连接失败,请检查服务器是否启动'
- }
- }
- uni.showToast({
- title: errorMsg,
- icon: 'none',
- duration: 3000
- })
- return
- }
-
- if (res.statusCode === 200 && res.data && res.data.code === 200) {
- const data = res.data.data
-
- console.log('=== 客户详情数据 ===')
- console.log('完整数据:', JSON.stringify(data, null, 2))
-
- // 支持驼峰和下划线两种字段名格式
- const resourceId = data.resourceId || data.resource_id
- const avatarUrl = data.avatarUrl || data.avatar_url
- const backupPhone = data.backupPhone || data.backup_phone
- const marrStatus = data.marrStatus !== undefined ? data.marrStatus : data.marr_status
- // 择偶要求从my_resource表的mate_selection_criteria字段获取
- const mateSelectionCriteria = data.mateSelectionCriteria || data.mate_selection_criteria
-
- // 择偶要求详情字段(从partner_requirement表,用于详情页)
- const minAge = data.minAge !== undefined ? data.minAge : data.min_age
- const maxAge = data.maxAge !== undefined ? data.maxAge : data.max_age
- const minHeight = data.minHeight !== undefined ? data.minHeight : data.min_height
- const maxHeight = data.maxHeight !== undefined ? data.maxHeight : data.max_height
- const educationLevel = data.educationLevel !== undefined ? data.educationLevel : data.education_level
- const salaryRange = data.salaryRange !== undefined ? data.salaryRange : data.salary_range
- const houseRequirement = data.houseRequirement !== undefined ? data.houseRequirement : data.house_requirement
- const carRequirement = data.carRequirement !== undefined ? data.carRequirement : data.car_requirement
- const maritalStatusRequirement = data.maritalStatusRequirement !== undefined ? data.maritalStatusRequirement : data.marital_status_requirement
- const preferredCity = data.preferredCity || data.preferred_city
- const otherRequirements = data.otherRequirements || data.other_requirements
-
- console.log('资源ID:', resourceId)
- console.log('姓名:', data.name)
- console.log('头像URL:', avatarUrl)
- console.log('备用手机号:', backupPhone)
- console.log('择偶要求(mate_selection_criteria):', mateSelectionCriteria)
- console.log('择偶要求详情数据:', {
- minAge, maxAge, minHeight, maxHeight,
- educationLevel, salaryRange, houseRequirement,
- carRequirement, maritalStatusRequirement,
- preferredCity, otherRequirements
- })
-
- // 处理标签列表(从后端返回的tags字段,如果没有则使用星座和职业)
- let clientTags = []
- if (data.tags && Array.isArray(data.tags) && data.tags.length > 0) {
- // 使用后端返回的标签
- clientTags = data.tags
- } else {
- // 如果没有tags,使用星座和职业作为标签
- if (data.constellation) {
- clientTags.push(data.constellation)
- }
- if (data.occupation) {
- clientTags.push(data.occupation)
- }
- }
-
- // 加载匹配状态和邀约状态
- const isMatch = data.isMatch !== null && data.isMatch !== undefined ? data.isMatch :
- (data.is_match !== null && data.is_match !== undefined ? data.is_match : 0)
- const isInvitation = data.isInvitation !== null && data.isInvitation !== undefined ? data.isInvitation :
- (data.is_Invitation !== null && data.is_Invitation !== undefined ? data.is_Invitation : 0)
- const invitationTime = data.invitationTime || data.Invitation_time
-
- this.followForm.matchStatus = parseInt(isMatch) || 0
- this.followForm.invitationStatus = parseInt(isInvitation) || 0
- if (invitationTime) {
- // 将日期转换为YYYY-MM-DD格式
- const date = new Date(invitationTime)
- const year = date.getFullYear()
- const month = String(date.getMonth() + 1).padStart(2, '0')
- const day = String(date.getDate()).padStart(2, '0')
- this.followForm.inviteDate = `${year}-${month}-${day}`
- }
-
- // 映射数据到clientInfo
- this.clientInfo = {
- id: resourceId,
- name: data.name || '',
- gender: data.gender === 1 ? '男' : data.gender === 2 ? '女' : '未知',
- status: '已匹配', // 可以根据实际字段判断
- tags: clientTags, // 使用处理后的标签列表
- avatar: avatarUrl || '',
- requirement: mateSelectionCriteria || '暂无要求', // 择偶要求显示my_resource表的mate_selection_criteria字段
- contact: data.phone ? data.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '',
- backupContact: backupPhone ? backupPhone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '',
- originalPhone: data.phone || '', // 保存原始手机号
- originalBackupPhone: backupPhone || '', // 保存原始备用手机号
- stats: {
- followTimes: 0, // 将从统计数据接口获取
- matchCount: 0,
- phoneCalls: 0,
- interviews: 0
- },
- details: {
- maritalStatus: this.formatMaritalStatus(marrStatus),
- education: data.diploma || '未知',
- occupation: data.occupation || '未知',
- income: data.income || '未知',
- housing: data.house === 1 ? '已购房' : data.house === 0 ? '未购房' : '未知',
- requirement: {
- ageRange: minAge && maxAge ? `${minAge}-${maxAge}岁` : '不限',
- height: minHeight ? `${minHeight}cm以上` : '不限',
- maritalStatus: this.formatMaritalStatusRequirement(maritalStatusRequirement),
- education: this.formatEducationLevel(educationLevel),
- other: otherRequirements || ''
- }
- }
- }
-
- // 标签已经在上面处理过了,这里不需要再添加
-
- console.log('=== 映射后的clientInfo ===')
- console.log('clientInfo:', JSON.stringify(this.clientInfo, null, 2))
-
- // 加载跟进统计数据
- this.loadFollowStatistics(resourceId)
- } else {
- uni.showToast({
- title: res.data.message || '加载失败',
- icon: 'none'
- })
- }
- } catch (e) {
- uni.hideLoading()
- console.error('加载客户信息失败:', e)
- uni.showToast({
- title: '加载失败',
- icon: 'none'
- })
- }
- },
- // 格式化婚姻状况
- formatMaritalStatus(status) {
- if (status === null || status === undefined) return '未知'
- switch (status) {
- case 0: return '未婚'
- case 1: return '离异'
- case 2: return '丧偶'
- default: return '未知'
- }
- },
- // 格式化婚姻状况要求
- formatMaritalStatusRequirement(status) {
- if (status === null || status === undefined) return '不限'
- switch (status) {
- case 0: return '不限'
- case 1: return '未婚'
- case 2: return '离异'
- case 3: return '丧偶'
- default: return '不限'
- }
- },
- // 格式化学历要求
- formatEducationLevel(level) {
- if (level === null || level === undefined) return '不限'
- switch (level) {
- case 0: return '不限'
- case 1: return '高中及以上'
- case 2: return '专科及以上'
- case 3: return '本科及以上'
- case 4: return '硕士及以上'
- case 5: return '博士及以上'
- default: return '不限'
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .client-detail {
- min-height: 100vh;
- background: linear-gradient(180deg, #FFF5F8 0%, #F8E8F0 50%, #FFF9F9 100%);
- padding-top: 90rpx;
- }
- /* 顶部导航栏 */
- .header {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- height: 90rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 20rpx;
- background: linear-gradient(135deg, #FCE4EC 0%, #F8BBD0 100%);
- z-index: 999;
- .back-icon {
- width: 44rpx;
- height: 44rpx;
- background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23333"><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>');
- background-size: contain;
- background-repeat: no-repeat;
- background-position: center;
- }
- .header-title {
- font-size: 38rpx;
- font-weight: bold;
- color: #333;
- }
- .header-right {
- width: 44rpx;
- }
- }
- /* 客户基本信息 */
- .client-basic-info {
- display: flex;
- align-items: flex-start;
- padding: 35rpx;
- background: linear-gradient(135deg, #FFFFFF 0%, #FFFBFD 100%);
- margin: 20rpx;
- border-radius: 24rpx;
- box-shadow: 0 8rpx 24rpx rgba(156, 39, 176, 0.12), 0 2rpx 8rpx rgba(156, 39, 176, 0.08);
- border: 1rpx solid rgba(243, 229, 245, 0.8);
- .client-avatar {
- width: 160rpx;
- height: 160rpx;
- border-radius: 50%;
- margin-right: 30rpx;
- background-color: #F5F5F5;
- }
- .basic-info {
- flex: 1;
- .client-name {
- font-size: 38rpx;
- font-weight: 600;
- color: #2C2C2C;
- margin-bottom: 12rpx;
- letter-spacing: 0.5rpx;
- display: block;
- }
- .status-tag-wrapper {
- display: flex;
- align-items: center;
- gap: 10rpx;
- margin-bottom: 18rpx;
- }
- .status-tag {
- display: inline-block;
- padding: 4rpx 12rpx;
- border-radius: 12rpx;
- font-size: 22rpx;
- font-weight: 500;
- &.register-tag {
- &.registered {
- background: #E8F5E9;
- color: #4CAF50;
- }
- }
- &.match-tag {
- &.matched {
- background: #E3F2FD;
- color: #2196F3;
- }
- &.unmatched {
- background: #FFF3E0;
- color: #FF9800;
- }
- }
- }
- .client-status {
- font-size: 26rpx;
- color: #FF6B8A;
- margin-bottom: 18rpx;
- display: inline-block;
- padding: 4rpx 16rpx;
- background: linear-gradient(135deg, #FFE5EB 0%, #FFF0F5 100%);
- border-radius: 12rpx;
- font-weight: 500;
- }
- .client-tags {
- display: flex;
- flex-wrap: wrap;
- gap: 10rpx;
- .tag {
- padding: 10rpx 22rpx;
- background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
- color: #7B1FA2;
- border-radius: 24rpx;
- font-size: 24rpx;
- font-weight: 600;
- box-shadow: 0 2rpx 8rpx rgba(156, 39, 176, 0.15);
- border: 1rpx solid rgba(156, 39, 176, 0.2);
- }
- }
- }
- }
- /* 择偶要求 */
- .requirement-section {
- padding: 35rpx;
- background: linear-gradient(135deg, #FFFFFF 0%, #FFFBFD 100%);
- margin: 0 20rpx 20rpx;
- border-radius: 24rpx;
- box-shadow: 0 8rpx 24rpx rgba(156, 39, 176, 0.12), 0 2rpx 8rpx rgba(156, 39, 176, 0.08);
- border: 1rpx solid rgba(243, 229, 245, 0.8);
- .section-title {
- display: flex;
- align-items: center;
- margin-bottom: 20rpx;
- .title-icon {
- font-size: 28rpx;
- margin-right: 10rpx;
- }
- .title-text {
- font-size: 30rpx;
- font-weight: 600;
- color: #2C2C2C;
- letter-spacing: 0.5rpx;
- }
- }
- .requirement-content {
- font-size: 28rpx;
- color: #555;
- line-height: 1.8;
- font-weight: 400;
- }
- }
- /* 联系方式 */
- .contact-section {
- padding: 35rpx;
- background: linear-gradient(135deg, #FFFFFF 0%, #FFFBFD 100%);
- margin: 0 20rpx 20rpx;
- border-radius: 24rpx;
- box-shadow: 0 8rpx 24rpx rgba(156, 39, 176, 0.12), 0 2rpx 8rpx rgba(156, 39, 176, 0.08);
- border: 1rpx solid rgba(243, 229, 245, 0.8);
- .contact-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 25rpx;
- &:last-child {
- margin-bottom: 0;
- }
- .contact-label {
- font-size: 28rpx;
- color: #2C2C2C;
- font-weight: 500;
- }
- .contact-value {
- display: flex;
- align-items: center;
- gap: 20rpx;
- .contact-number {
- font-size: 28rpx;
- color: #555;
- font-weight: 400;
- }
- .copy-btn {
- padding: 10rpx 24rpx;
- background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
- color: #7B1FA2;
- border-radius: 24rpx;
- font-size: 24rpx;
- font-weight: 600;
- box-shadow: 0 2rpx 8rpx rgba(156, 39, 176, 0.2);
- border: 1rpx solid rgba(156, 39, 176, 0.2);
- transition: all 0.3s;
-
- &:active {
- transform: scale(0.95);
- box-shadow: 0 1rpx 4rpx rgba(156, 39, 176, 0.3);
- }
- }
- }
- }
- }
- /* 跟进统计 */
- .stats-section {
- padding: 30rpx;
- background-color: #FFFFFF;
- margin: 0 20rpx 20rpx;
- border-radius: 20rpx;
- box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
- .stats-title {
- font-size: 28rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 25rpx;
- }
- .stats-grid {
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- gap: 20rpx;
- .stat-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 20rpx;
- background-color: #FFF3F5;
- border-radius: 15rpx;
- .stat-value {
- font-size: 48rpx;
- font-weight: bold;
- color: #FF6B8A;
- margin-bottom: 10rpx;
- }
- .stat-label {
- font-size: 22rpx;
- color: #666;
- }
- }
- }
- }
- /* 标签切换 */
- .tabs-section {
- display: flex;
- padding: 0 20rpx;
- background: linear-gradient(135deg, #FFFFFF 0%, #FFFBFD 100%);
- margin: 0 20rpx 20rpx;
- border-radius: 24rpx;
- box-shadow: 0 8rpx 24rpx rgba(156, 39, 176, 0.12), 0 2rpx 8rpx rgba(156, 39, 176, 0.08);
- border: 1rpx solid rgba(243, 229, 245, 0.8);
- .tab {
- flex: 1;
- text-align: center;
- padding: 24rpx 0;
- font-size: 30rpx;
- color: #888;
- font-weight: 500;
- transition: all 0.3s;
- position: relative;
- &.active {
- color: #7B1FA2;
- font-weight: 600;
-
- &::after {
- content: '';
- position: absolute;
- bottom: 0;
- left: 50%;
- transform: translateX(-50%);
- width: 60rpx;
- height: 6rpx;
- background: linear-gradient(90deg, #9C27B0 0%, #E1BEE7 100%);
- border-radius: 3rpx;
- }
- }
- }
- }
- /* 详细信息滚动区域 */
- .details-section {
- padding: 35rpx 25rpx 100rpx;
- background: linear-gradient(135deg, #FFFFFF 0%, #FFFBFD 100%);
- margin: 0 20rpx 20rpx;
- border-radius: 24rpx;
- box-shadow: 0 8rpx 24rpx rgba(156, 39, 176, 0.12), 0 2rpx 8rpx rgba(156, 39, 176, 0.08);
- border: 1rpx solid rgba(243, 229, 245, 0.8);
- box-sizing: border-box;
- position: relative;
- .detail-item {
- display: flex;
- margin-bottom: 28rpx;
- padding: 12rpx 0;
- border-bottom: 1rpx solid rgba(240, 240, 240, 0.6);
-
- &:last-of-type {
- border-bottom: none;
- }
- .detail-label {
- width: 200rpx;
- font-size: 28rpx;
- color: #2C2C2C;
- font-weight: 500;
- letter-spacing: 0.3rpx;
- }
- .detail-value {
- flex: 1;
- font-size: 28rpx;
- color: #555;
- font-weight: 400;
- text-align: right;
- }
- }
- .sub-section-title {
- font-size: 32rpx;
- font-weight: 600;
- color: #2C2C2C;
- margin: 30rpx 0 20rpx;
- padding-bottom: 12rpx;
- border-bottom: 2rpx solid rgba(240, 240, 240, 0.8);
- letter-spacing: 0.5rpx;
- }
-
- /* 择偶详细要求部分 - 添加明显的上分隔 */
- .requirement-section-title {
- margin-top: 60rpx;
- padding: 32rpx 24rpx 20rpx;
- border-top: 3rpx solid rgba(156, 39, 176, 0.15);
- border-bottom: 2rpx solid rgba(156, 39, 176, 0.1);
- position: relative;
- background: linear-gradient(135deg, #F8F4F9 0%, #FFFBFD 100%);
- border-radius: 16rpx 16rpx 0 0;
- }
-
- .requirement-section-title::before {
- content: '';
- position: absolute;
- left: 0;
- top: 0;
- width: 8rpx;
- height: 100%;
- background: linear-gradient(180deg, #9C27B0 0%, #BA68C8 50%, #E1BEE7 100%);
- border-radius: 0 4rpx 4rpx 0;
- box-shadow: 2rpx 0 8rpx rgba(156, 39, 176, 0.2);
- }
-
- /* 客户标签部分 - 添加明显的上分隔 */
- .tags-section-title {
- margin-top: 60rpx;
- padding: 32rpx 24rpx 20rpx;
- border-top: 3rpx solid rgba(156, 39, 176, 0.15);
- border-bottom: 2rpx solid rgba(156, 39, 176, 0.1);
- position: relative;
- background: linear-gradient(135deg, #F8F4F9 0%, #FFFBFD 100%);
- border-radius: 16rpx 16rpx 0 0;
- }
-
- .tags-section-title::before {
- content: '';
- position: absolute;
- left: 0;
- top: 0;
- width: 8rpx;
- height: 100%;
- background: linear-gradient(180deg, #9C27B0 0%, #BA68C8 50%, #E1BEE7 100%);
- border-radius: 0 4rpx 4rpx 0;
- box-shadow: 2rpx 0 8rpx rgba(156, 39, 176, 0.2);
- }
- .client-tags {
- display: flex;
- flex-wrap: wrap;
- gap: 12rpx;
- padding: 20rpx 0;
- .tag {
- padding: 12rpx 24rpx;
- background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
- color: #7B1FA2;
- border-radius: 24rpx;
- font-size: 26rpx;
- font-weight: 600;
- box-shadow: 0 2rpx 8rpx rgba(156, 39, 176, 0.15);
- border: 1rpx solid rgba(156, 39, 176, 0.2);
- transition: all 0.3s;
-
- &:active {
- transform: scale(0.95);
- }
- }
- }
- }
- /* 跟进信息 */
- .follow-section {
- background-color: #FFFFFF;
- margin: 0 20rpx 20rpx;
- border-radius: 20rpx;
- box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
- padding: 30rpx 20rpx 40rpx;
- max-height: 700rpx;
- box-sizing: border-box;
- }
- .follow-group {
- margin-bottom: 30rpx;
- .group-label {
- font-size: 28rpx;
- color: #333;
- font-weight: bold;
- margin-bottom: 16rpx;
- display: block;
- }
- }
- /* 跟进方式单选 */
- .follow-type-options {
- display: flex;
- align-items: center;
- gap: 30rpx;
- .follow-type-item {
- display: flex;
- align-items: center;
- gap: 10rpx;
- font-size: 26rpx;
- color: #666;
- .radio-circle {
- width: 26rpx;
- height: 26rpx;
- border-radius: 50%;
- border: 2rpx solid #C5A4D8;
- box-sizing: border-box;
- }
- &.active {
- color: #D81B60;
- .radio-circle {
- background-color: #D81B60;
- border-color: #D81B60;
- }
- }
- }
- }
- /* 跟进进度标签 */
- .status-tags-row {
- display: flex;
- flex-wrap: wrap;
- gap: 16rpx;
- .status-tag {
- min-width: 140rpx;
- text-align: center;
- padding: 14rpx 20rpx;
- border-radius: 20rpx;
- border: 2rpx solid #E1BEE7;
- font-size: 26rpx;
- color: #9C27B0;
- background-color: #FAF5FF;
- box-sizing: border-box;
- &.active {
- background-color: #F8BBD0;
- border-color: #F06292;
- color: #FFFFFF;
- }
- }
- }
- /* 邀约状态/时间 等输入类展示 */
- .input-like {
- width: 100%;
- padding: 18rpx 22rpx;
- border-radius: 16rpx;
- background-color: #FAF5FF;
- font-size: 26rpx;
- color: #666;
- box-sizing: border-box;
- }
- .picker-inner {
- font-size: 26rpx;
- color: #666;
- }
- /* 备注输入框 */
- .textarea {
- width: 100%;
- min-height: 160rpx;
- padding: 18rpx 22rpx;
- border-radius: 16rpx;
- background-color: #FAF5FF;
- font-size: 26rpx;
- color: #333;
- box-sizing: border-box;
- }
- /* 保存按钮 */
- .follow-submit-btn {
- margin-top: 10rpx;
- width: 100%;
- padding: 22rpx 0;
- text-align: center;
- border-radius: 26rpx;
- background: linear-gradient(135deg, #F48FB1 0%, #EC407A 100%);
- color: #FFFFFF;
- font-size: 30rpx;
- font-weight: bold;
- }
- </style>
|