diff --git a/pages_tool/card/detail.vue b/pages_tool/card/detail.vue index 405eb29..7540a5c 100644 --- a/pages_tool/card/detail.vue +++ b/pages_tool/card/detail.vue @@ -44,6 +44,11 @@ 切换名片 + + + + 预览名片 + - - + + + {{ item.name || '未留姓名' }} {{ item.status_text || '新客户' }} - 📱 {{ item.mobile }} + + 📱 {{ item.mobile }} 「{{ item.note }}」 - 来自名片:{{ item.card_name }} + + 来自名片:{{ item.card_name || '—' }} + 查看名片 › + {{ item.create_time_txt }} - 复制微信 - 更新状态 + 复制微信 + 更新状态 @@ -159,6 +164,28 @@ export default { data: text, success: () => uni.showToast({ title: '已复制', icon: 'success' }) }); + }, + // 该线索关联的名片编号(后端 lead/lists 行下发; 兼容常见字段名) + cardIdOf(item) { + if (!item) return ''; + return item.card_id || item.from_card_id || item.source_card_id || ''; + }, + // 点整条客户卡片 → 打开对方名片 + // 与交换名片(exchange.vue)同款写法: detail 接收 card_id(卡片编号字符串); + // 本人名下的卡 → 正常详情页; 非本人名下 → detail 兜底跳公开名片页(后端返回的 wap_url) + viewCard(item) { + const cardId = this.cardIdOf(item); + if (!cardId) { + // 后端 lead/lists 目前只下发 card_name(展示名), 没有名片编号 → 无法跳转。 + // 这里把该行真实字段打到控制台, 便于确认后端是否用了别的字段名(如 relation_id) + console.warn('[card/leads] 该行缺少名片编号(card_id/from_card_id/source_card_id), 无法打开对方名片; 可用字段:', + item ? Object.keys(item) : item, item); + uni.showToast({ title: '该客户未关联名片,无法查看', icon: 'none' }); + return; + } + uni.navigateTo({ + url: '/pages_tool/card/detail?card_id=' + encodeURIComponent(cardId) + }); } } }; @@ -289,15 +316,32 @@ export default { .lead-meta { display: flex; justify-content: space-between; + align-items: center; font-size: 22rpx; color: #999; margin-top: 14rpx; .meta-card { - max-width: 60%; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; + display: flex; + align-items: center; + max-width: 64%; + + // 有名片编号时才高亮/可点, 否则退化为普通文字 + &.tappable .meta-card-name { + color: var(--main-color, #0054a5); + } + + .meta-card-name { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .meta-card-arrow { + flex-shrink: 0; + margin-left: 8rpx; + color: var(--main-color, #0054a5); + } } }