|
|
@@ -12,30 +12,8 @@
|
|
|
<text class="loading-text">正在匹配中...</text>
|
|
|
</view>
|
|
|
|
|
|
- <!-- 资源跟进状态 -->
|
|
|
- <view class="follow-status-section" v-if="!loading && resourceFollowInfo">
|
|
|
- <!-- 匹配状态 -->
|
|
|
- <view class="follow-status-group">
|
|
|
- <text class="status-label">匹配状态</text>
|
|
|
- <view class="status-tags">
|
|
|
- <text class="status-tag" :class="{ 'active': resourceFollowInfo.isMatch === 1 }">
|
|
|
- {{ resourceFollowInfo.isMatch === 1 ? '已匹配' : '未匹配' }}
|
|
|
- </text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <!-- 跟进进度 -->
|
|
|
- <view class="follow-status-group">
|
|
|
- <text class="status-label">跟进进度</text>
|
|
|
- <view class="status-tags">
|
|
|
- <text class="status-tag" :class="{ 'active': resourceFollowInfo.isInvitation === 1 }">
|
|
|
- {{ resourceFollowInfo.isInvitation === 1 ? '已邀约' : '未邀约' }}
|
|
|
- </text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
<!-- 匹配客户列表 -->
|
|
|
- <scroll-view scroll-y class="match-list" v-else>
|
|
|
+ <scroll-view scroll-y class="match-list" v-if="!loading">
|
|
|
<view class="match-client" v-for="(client, index) in matchClients" :key="client.id || index">
|
|
|
<!-- 匹配度标签 -->
|
|
|
<view class="match-score-badge" v-if="client.matchScore">
|
|
|
@@ -65,8 +43,8 @@
|
|
|
</view>
|
|
|
<view class="contact-info">
|
|
|
<text class="contact-label">联系方式:</text>
|
|
|
- <text class="contact-number">{{ client.contact }}</text>
|
|
|
- <text class="copy-btn" @click="handleCopy(client.contact)">复制</text>
|
|
|
+ <text class="contact-number">{{ client.contact || '暂无' }}</text>
|
|
|
+ <text class="copy-btn" @click="handleCopy(index)">复制</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -109,8 +87,7 @@ export default {
|
|
|
return {
|
|
|
resourceId: null,
|
|
|
matchClients: [],
|
|
|
- loading: false,
|
|
|
- resourceFollowInfo: null // 资源跟进信息
|
|
|
+ loading: false
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
@@ -138,14 +115,99 @@ export default {
|
|
|
uni.navigateBack()
|
|
|
},
|
|
|
// 复制联系方式
|
|
|
- handleCopy(contact) {
|
|
|
+ handleCopy(index) {
|
|
|
+ console.log('=== 复制联系方式 ===')
|
|
|
+ console.log('传入的index:', index)
|
|
|
+
|
|
|
+ // 从matchClients数组中获取client对象
|
|
|
+ if (index === undefined || index === null || index < 0 || index >= this.matchClients.length) {
|
|
|
+ console.error('❌ index无效:', index)
|
|
|
+ console.log('当前matchClients数组长度:', this.matchClients.length)
|
|
|
+ uni.showToast({
|
|
|
+ title: '数据错误',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ const client = this.matchClients[index]
|
|
|
+ console.log('从数组获取的client:', client)
|
|
|
+
|
|
|
+ if (!client) {
|
|
|
+ console.error('❌ client对象为空')
|
|
|
+ console.log('当前matchClients数组:', this.matchClients)
|
|
|
+ uni.showToast({
|
|
|
+ title: '数据错误',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log('client.contact:', client.contact)
|
|
|
+ console.log('client.originalPhone:', client.originalPhone)
|
|
|
+ console.log('client.originalPhone类型:', typeof client.originalPhone)
|
|
|
+ console.log('client的所有属性:', Object.keys(client))
|
|
|
+
|
|
|
+ // 优先使用完整手机号(originalPhone),如果没有则使用脱敏的手机号
|
|
|
+ let phoneToCopy = ''
|
|
|
+
|
|
|
+ // 优先使用originalPhone(完整手机号)
|
|
|
+ const originalPhone = client.originalPhone || client.original_phone || client.originalphone
|
|
|
+ console.log('尝试获取originalPhone:', originalPhone)
|
|
|
+ if (originalPhone && typeof originalPhone === 'string' && originalPhone.trim() !== '') {
|
|
|
+ phoneToCopy = originalPhone.trim()
|
|
|
+ console.log('✅ 使用originalPhone:', phoneToCopy.substring(0, 3) + '****')
|
|
|
+ } else {
|
|
|
+ console.log('❌ originalPhone为空或无效,尝试使用contact')
|
|
|
+ // 如果没有originalPhone,尝试从脱敏的手机号中提取(但这样无法获取完整号码)
|
|
|
+ if (client.contact) {
|
|
|
+ try {
|
|
|
+ const contactStr = String(client.contact || '')
|
|
|
+ console.log('尝试从contact提取:', contactStr)
|
|
|
+ if (contactStr && contactStr.trim() !== '') {
|
|
|
+ // 去除星号(但这样只能得到部分号码,不是完整号码)
|
|
|
+ const extracted = contactStr.replace(/\*+/g, '').trim()
|
|
|
+ if (extracted.length >= 11) {
|
|
|
+ phoneToCopy = extracted
|
|
|
+ console.log('⚠️ 从脱敏号码提取:', phoneToCopy.substring(0, 3) + '****')
|
|
|
+ } else {
|
|
|
+ console.log('❌ 提取的号码长度不足:', extracted.length)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error('处理联系方式时出错:', e)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log('最终要复制的号码:', phoneToCopy ? phoneToCopy.substring(0, 3) + '****' : '空')
|
|
|
+
|
|
|
+ // 检查是否为空
|
|
|
+ if (!phoneToCopy || phoneToCopy === '') {
|
|
|
+ console.error('❌ 联系方式为空,无法复制')
|
|
|
+ uni.showToast({
|
|
|
+ title: '联系方式为空',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 复制到剪贴板
|
|
|
uni.setClipboardData({
|
|
|
- data: contact.replace(/\*+/g, ''),
|
|
|
+ data: phoneToCopy,
|
|
|
success: () => {
|
|
|
+ console.log('✅ 复制成功:', phoneToCopy.substring(0, 3) + '****')
|
|
|
uni.showToast({
|
|
|
title: '复制成功',
|
|
|
icon: 'success'
|
|
|
})
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.error('❌ 复制失败')
|
|
|
+ uni.showToast({
|
|
|
+ title: '复制失败',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -172,31 +234,14 @@ export default {
|
|
|
? 'http://localhost:8083/api' // 开发环境 - 通过网关
|
|
|
: 'https://your-domain.com/api' // 生产环境
|
|
|
|
|
|
- // 同时加载匹配结果和资源跟进信息
|
|
|
+ // 加载匹配结果
|
|
|
const [matchError, matchRes] = await uni.request({
|
|
|
url: `${baseUrl}/my-resource/precise-match/${resourceId}`,
|
|
|
method: 'GET'
|
|
|
})
|
|
|
|
|
|
- // 加载资源跟进信息
|
|
|
- const [followError, followRes] = await uni.request({
|
|
|
- url: `${baseUrl}/my-resource/client-detail/${resourceId}`,
|
|
|
- method: 'GET'
|
|
|
- })
|
|
|
-
|
|
|
this.loading = false
|
|
|
|
|
|
- // 处理跟进信息
|
|
|
- if (!followError && followRes.statusCode === 200 && followRes.data && followRes.data.code === 200) {
|
|
|
- const followData = followRes.data.data
|
|
|
- this.resourceFollowInfo = {
|
|
|
- isMatch: followData.isMatch !== null && followData.isMatch !== undefined ? followData.isMatch :
|
|
|
- (followData.is_match !== null && followData.is_match !== undefined ? followData.is_match : 0),
|
|
|
- isInvitation: followData.isInvitation !== null && followData.isInvitation !== undefined ? followData.isInvitation :
|
|
|
- (followData.is_Invitation !== null && followData.is_Invitation !== undefined ? followData.is_Invitation : 0)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if (matchError) {
|
|
|
console.error('加载匹配客户失败:', matchError)
|
|
|
uni.showToast({
|
|
|
@@ -209,9 +254,26 @@ export default {
|
|
|
if (matchRes.statusCode === 200 && matchRes.data && matchRes.data.code === 200) {
|
|
|
const matchList = matchRes.data.data || []
|
|
|
|
|
|
+ console.log('=== 后端返回的匹配列表 ===')
|
|
|
+ console.log('匹配列表长度:', matchList.length)
|
|
|
+ if (matchList.length > 0) {
|
|
|
+ console.log('第一个匹配项原始数据:', JSON.stringify(matchList[0], null, 2))
|
|
|
+ console.log('第一个匹配项的phone字段:', matchList[0].phone)
|
|
|
+ console.log('第一个匹配项的originalPhone字段:', matchList[0].originalPhone)
|
|
|
+ console.log('第一个匹配项的所有字段:', Object.keys(matchList[0]))
|
|
|
+ }
|
|
|
+
|
|
|
// 转换数据格式
|
|
|
- this.matchClients = matchList.map(item => {
|
|
|
- return {
|
|
|
+ this.matchClients = matchList.map((item, index) => {
|
|
|
+ // 确保 originalPhone 被正确映射
|
|
|
+ let originalPhoneValue = ''
|
|
|
+ if (item.originalPhone !== null && item.originalPhone !== undefined) {
|
|
|
+ originalPhoneValue = String(item.originalPhone).trim()
|
|
|
+ } else if (item.original_phone !== null && item.original_phone !== undefined) {
|
|
|
+ originalPhoneValue = String(item.original_phone).trim()
|
|
|
+ }
|
|
|
+
|
|
|
+ const mappedItem = {
|
|
|
id: item.userId,
|
|
|
name: item.nickname || '未知',
|
|
|
gender: item.gender === 1 ? '男' : item.gender === 2 ? '女' : '未知',
|
|
|
@@ -219,7 +281,8 @@ export default {
|
|
|
tags: item.tags || [],
|
|
|
avatar: item.avatarUrl || 'https://via.placeholder.com/150',
|
|
|
requirement: item.requirement || '暂无要求',
|
|
|
- contact: item.phone || '',
|
|
|
+ contact: (item.phone && typeof item.phone === 'string') ? item.phone : (item.phone ? String(item.phone) : ''),
|
|
|
+ originalPhone: originalPhoneValue,
|
|
|
matchScore: item.matchScore || 0,
|
|
|
age: item.age,
|
|
|
height: item.height,
|
|
|
@@ -228,6 +291,17 @@ export default {
|
|
|
occupation: item.occupation,
|
|
|
address: item.address
|
|
|
}
|
|
|
+
|
|
|
+ if (index === 0) {
|
|
|
+ console.log('=== 第一个匹配项映射后 ===')
|
|
|
+ console.log('contact:', mappedItem.contact)
|
|
|
+ console.log('originalPhone:', mappedItem.originalPhone)
|
|
|
+ console.log('originalPhone类型:', typeof mappedItem.originalPhone)
|
|
|
+ console.log('originalPhone是否为空:', !mappedItem.originalPhone || mappedItem.originalPhone === '')
|
|
|
+ console.log('映射后的完整对象:', mappedItem)
|
|
|
+ }
|
|
|
+
|
|
|
+ return mappedItem
|
|
|
})
|
|
|
|
|
|
console.log('匹配结果:', this.matchClients)
|