微信小程序页面迁移校验之前 P5任务处理之前

This commit is contained in:
Neo
2026-03-09 01:19:21 +08:00
parent 263bf96035
commit 6e20987d2f
1112 changed files with 153824 additions and 219694 deletions

View File

@@ -0,0 +1,11 @@
{
"navigationBarTitleText": "任务详情",
"usingComponents": {
"ai-float-button": "/components/ai-float-button/ai-float-button",
"note-modal": "/components/note-modal/note-modal",
"star-rating": "/components/star-rating/star-rating",
"heart-icon": "/components/heart-icon/heart-icon",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-loading": "tdesign-miniprogram/loading/loading"
}
}

View File

@@ -0,0 +1,92 @@
import { mockTaskDetails } from '../../utils/mock-data'
import type { TaskDetail, Note } from '../../utils/mock-data'
import { sortByTimestamp } from '../../utils/sort'
Page({
data: {
pageState: 'loading' as 'loading' | 'empty' | 'normal',
detail: null as TaskDetail | null,
sortedNotes: [] as Note[],
noteModalVisible: false,
/** 话术列表(竖线样式) */
talkingPoints: [
'王哥您好,上次打球聊得挺开心的,最近有空来玩吗?可以约几个球友一起~',
'王哥,最近店里新到了几副好球杆,知道您是行家,有空来试试手感?',
'王哥好呀,周末有个中式八球友谊赛,奖品挺丰富的,要不要来参加?',
'王哥,上次您推荐的那个朋友来过了,打得不错,下次可以一起约~',
'王哥您好,我们最近推出了老带新活动,您带朋友来都有优惠,了解一下?',
],
/** 近期服务记录 */
serviceRecords: [
{ table: '6号台', type: '基础课', typeClass: 'basic', duration: '1.5h', income: '¥150', drinks: '🍷 可乐x2', date: '2026-02-08 15:00' },
{ table: 'VIP1号房', type: '激励课', typeClass: 'incentive', duration: '2.0h', income: '¥200', drinks: '🍷 红牛x1 花生米x1', date: '2026-02-01 16:00' },
{ table: '3号台', type: '基础课', typeClass: 'basic', duration: '1.5h', income: '¥150', drinks: '🍷 矿泉水x2', date: '2026-01-25 14:30' },
],
},
onLoad(options) {
const id = options?.id || ''
this.loadData(id)
},
loadData(id: string) {
this.setData({ pageState: 'loading' })
setTimeout(() => {
// TODO: 替换为真实 API
const detail = mockTaskDetails.find((t) => t.id === id) || mockTaskDetails[2]
if (!detail) {
this.setData({ pageState: 'empty' })
return
}
const sorted = sortByTimestamp(detail.notes || []) as Note[]
this.setData({ pageState: 'normal', detail, sortedNotes: sorted })
}, 500)
},
onAddNote() {
this.setData({ noteModalVisible: true })
},
onNoteConfirm(e: WechatMiniprogram.CustomEvent) {
const { score, content } = e.detail
wx.showToast({ title: '备注已保存', icon: 'success' })
this.setData({ noteModalVisible: false })
const newNote: Note = {
id: `note-${Date.now()}`,
content,
tagType: 'customer',
tagLabel: `客户:${this.data.detail?.customerName || ''}`,
createdAt: new Date().toLocaleString('zh-CN', { hour12: false }),
}
this.setData({ sortedNotes: [newNote, ...this.data.sortedNotes] })
},
onNoteCancel() {
this.setData({ noteModalVisible: false })
},
onAskAssistant() {
const customerId = this.data.detail?.id || ''
wx.navigateTo({
url: `/pages/chat/chat?customerId=${customerId}`,
fail: () => wx.showToast({ title: '页面跳转失败', icon: 'none' }),
})
},
/** 记录互动 */
onRecordInteraction() {
this.setData({ noteModalVisible: true })
},
onBack() {
wx.navigateBack()
},
onViewAllRecords() {
const customerId = this.data.detail?.id || ''
wx.navigateTo({
url: `/pages/customer-service-records/customer-service-records?customerId=${customerId}`,
fail: () => wx.showToast({ title: '页面跳转失败', icon: 'none' }),
})
},
})

View File

@@ -0,0 +1,193 @@
<wxs src="../../utils/format.wxs" module="fmt" />
<!-- 加载态 -->
<view class="page-loading" wx:if="{{pageState === 'loading'}}">
<t-loading theme="circular" size="80rpx" text="加载中..." />
</view>
<!-- 空态 -->
<view class="page-empty" wx:elif="{{pageState === 'empty'}}">
<t-icon name="info-circle" size="120rpx" color="#c5c5c5" />
<text class="empty-text">未找到任务信息</text>
</view>
<!-- 正常态 -->
<block wx:elif="{{pageState === 'normal'}}">
<!-- Banner - 粉色主题 -->
<view class="banner-area banner-pink">
<view class="banner-nav">
<view class="nav-back" bindtap="onBack">
<t-icon name="chevron-left" size="48rpx" color="#ffffff" />
</view>
<text class="nav-title">任务详情</text>
<view class="nav-placeholder"></view>
</view>
<view class="customer-info">
<view class="avatar-box">
<text class="avatar-text">{{detail.customerName[0] || '?'}}</text>
</view>
<view class="info-right">
<view class="name-row">
<text class="customer-name">{{detail.customerName}}</text>
<text class="task-type-tag">关系构建</text>
</view>
<view class="sub-info">
<text class="phone">137****8899</text>
<block wx:if="{{detail.preferences.length > 0}}">
<text class="pref-info">🎱 {{detail.preferences[0]}}</text>
</block>
</view>
</view>
</view>
</view>
<view class="main-content">
<!-- ① 维客线索 -->
<view class="card">
<view class="card-header">
<text class="section-title title-green">维客线索</text>
<text class="ai-badge">AI智能洞察</text>
</view>
<view class="clue-list">
<view class="clue-item">
<view class="clue-tag clue-tag-primary">客户<text>\n</text>基础</view>
<view class="clue-body">
<text class="clue-text">👤 普通会员 · 注册8个月 · 社交活跃</text>
<text class="clue-source">By:系统</text>
</view>
</view>
<view class="clue-item clue-item-detail">
<view class="clue-tag clue-tag-success">消费<text>\n</text>习惯</view>
<view class="clue-body">
<text class="clue-text">☀️ 偏好周末下午 · 月均3-4次 · 喜欢包厢</text>
<text class="clue-source">By:系统</text>
</view>
<text class="clue-detail">{{detail.consumptionHabits || '周末下午为主,偏好包厢'}}</text>
</view>
<view class="clue-item clue-item-detail">
<view class="clue-tag clue-tag-purple">玩法<text>\n</text>偏好</view>
<view class="clue-body">
<text class="clue-text">🎱 中式台球 · 麻将 · 喜欢组队</text>
<text class="clue-source">By:系统</text>
</view>
<text class="clue-detail">{{detail.socialPreference || '喜欢组队打球,社交型消费者'}}</text>
</view>
<view class="clue-item">
<view class="clue-tag clue-tag-error">重要<text>\n</text>反馈</view>
<view class="clue-body">
<text class="clue-text">⭐ 对服务满意,希望认识更多球友</text>
<text class="clue-source">By:小燕</text>
</view>
</view>
</view>
</view>
<!-- ② 与我的关系(含近期服务记录) -->
<view class="card">
<view class="card-header">
<text class="section-title title-blue">与我的关系</text>
<text class="ai-badge">AI智能洞察</text>
</view>
<view class="relationship-row">
<view class="rel-tag rel-tag-pink">
<heart-icon score="{{detail.heartScore}}" />
<text>{{detail.heartScore > 8.5 ? '非常好' : detail.heartScore > 7 ? '良好' : detail.heartScore > 5 ? '一般' : '待发展'}}</text>
</view>
<view class="rel-bar">
<view class="rel-bar-fill" style="width: {{detail.heartScore * 10}}%"></view>
</view>
<text class="rel-score">{{fmt.toFixed(detail.heartScore / 10, 2)}}</text>
</view>
<text class="card-desc">{{detail.aiAnalysis.summary}}</text>
<view class="svc-section">
<text class="svc-title">📋 近期服务记录</text>
<view class="svc-record" wx:for="{{serviceRecords}}" wx:key="date">
<view class="svc-row-top">
<view class="svc-tags">
<text class="svc-table">{{item.table}}</text>
<text class="svc-type svc-type-{{item.typeClass}}">{{item.type}}</text>
<text class="svc-duration">{{item.duration}}</text>
</view>
<text class="svc-income">{{item.income}}</text>
</view>
<view class="svc-row-bottom">
<text class="svc-drinks">{{item.drinks}}</text>
<text class="svc-date">{{item.date}}</text>
</view>
</view>
<view class="svc-more" bindtap="onViewAllRecords">
<text>查看全部服务记录 →</text>
</view>
</view>
</view>
<!-- ③ 任务建议 -->
<view class="card">
<text class="section-title title-pink-left">任务建议</text>
<view class="suggestion-box suggestion-pink">
<view class="suggestion-header">
<text class="suggestion-icon">💝 关系构建重点</text>
<text class="ai-badge">AI智能洞察</text>
</view>
<view class="suggestion-list">
<text class="suggestion-item" wx:for="{{detail.aiAnalysis.suggestions}}" wx:key="index">• {{item}}</text>
</view>
</view>
<view class="talking-section">
<view class="talking-header">
<text class="talking-title">💬 话术参考</text>
<text class="ai-badge">AI智能洞察</text>
</view>
<view class="talking-list">
<text class="talking-item" wx:for="{{talkingPoints}}" wx:key="index">"{{item}}"</text>
</view>
</view>
</view>
<!-- ④ 我给TA的备注 -->
<view class="card">
<view class="card-header">
<text class="section-title title-blue">我给TA的备注</text>
<text class="note-count">{{sortedNotes.length}} 条备注</text>
</view>
<block wx:if="{{sortedNotes.length > 0}}">
<view class="note-item" wx:for="{{sortedNotes}}" wx:key="id">
<view class="note-top">
<text class="note-date">{{item.createdAt}}</text>
<text class="note-tag-inline {{item.tagType === 'coach' ? 'tag-coach-inline' : 'tag-customer-inline'}}">{{item.tagLabel}}</text>
</view>
<text class="note-content">{{item.content}}</text>
</view>
</block>
<view class="note-empty" wx:else>
<t-icon name="edit-1" size="80rpx" color="#dcdcdc" />
<text class="empty-hint">快点击下方备注按钮,添加客人备注!</text>
</view>
</view>
</view>
<!-- 底部操作栏 -->
<view class="bottom-bar safe-area-bottom">
<view class="btn-ask btn-ask-pink" bindtap="onAskAssistant">
<t-icon name="chat" size="40rpx" color="#ffffff" />
<text>问问助手</text>
</view>
<view class="btn-note" bindtap="onAddNote">
<t-icon name="edit-1" size="40rpx" color="#242424" />
<text>备注</text>
</view>
</view>
<note-modal
visible="{{noteModalVisible}}"
customerName="{{detail.customerName}}"
initialScore="{{0}}"
initialContent=""
bind:confirm="onNoteConfirm"
bind:cancel="onNoteCancel"
/>
<ai-float-button bottom="{{200}}" customerId="{{detail.id}}" />
</block>
<dev-fab />

View File

@@ -0,0 +1,443 @@
/* 加载态 & 空态 */
.page-loading,
.page-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 60vh;
gap: 24rpx;
}
.empty-text {
font-size: var(--font-sm, 28rpx);
color: var(--color-gray-6, #a6a6a6);
}
/* Banner - 粉色 */
.banner-area {
position: relative;
color: #ffffff;
padding-bottom: 48rpx;
}
.banner-pink {
background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
}
.banner-nav {
display: flex;
align-items: center;
justify-content: space-between;
height: 88rpx;
padding: 0 32rpx;
}
.nav-back { padding: 8rpx; }
.nav-title {
font-size: var(--font-base, 32rpx);
font-weight: 500;
}
.nav-placeholder { width: 48rpx; }
.customer-info {
display: flex;
align-items: center;
gap: 32rpx;
padding: 16rpx 40rpx 0;
}
.avatar-box {
width: 128rpx;
height: 128rpx;
border-radius: 32rpx;
background: rgba(255, 255, 255, 0.2);
display: flex;
align-items: center;
justify-content: center;
}
.avatar-text {
font-size: 48rpx;
font-weight: 700;
color: #ffffff;
}
.info-right { flex: 1; }
.name-row {
display: flex;
align-items: center;
gap: 16rpx;
margin-bottom: 16rpx;
}
.customer-name {
font-size: var(--font-xl, 40rpx);
font-weight: 600;
}
.task-type-tag {
font-size: var(--font-xs, 24rpx);
padding: 4rpx 16rpx;
background: rgba(255, 255, 255, 0.25);
border-radius: 100rpx;
}
.sub-info {
display: flex;
align-items: center;
gap: 32rpx;
}
.phone {
font-size: var(--font-sm, 28rpx);
color: rgba(255, 255, 255, 0.7);
}
.pref-info {
font-size: var(--font-xs, 24rpx);
color: rgba(255, 255, 255, 0.9);
}
/* 主体 */
.main-content {
padding: 32rpx;
padding-bottom: 200rpx;
display: flex;
flex-direction: column;
gap: 32rpx;
}
/* 卡片 */
.card {
background: #ffffff;
border-radius: var(--radius-xl, 32rpx);
padding: 40rpx;
box-shadow: var(--shadow-lg, 0 8rpx 32rpx rgba(0,0,0,0.06));
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 32rpx;
}
.section-title {
font-size: var(--font-sm, 28rpx);
font-weight: 600;
color: var(--color-gray-13, #242424);
}
.title-green { border-left: 6rpx solid #00a870; padding-left: 16rpx; }
.title-blue { border-left: 6rpx solid #0052d9; padding-left: 16rpx; }
.title-pink-left { border-left: 6rpx solid #ec4899; padding-left: 16rpx; margin-bottom: 32rpx; }
.ai-badge {
font-size: 22rpx;
color: var(--color-primary, #0052d9);
background: var(--color-primary-light, #ecf2fe);
padding: 4rpx 16rpx;
border-radius: 100rpx;
}
/* 维客线索 */
.clue-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.clue-item {
display: flex;
align-items: flex-start;
gap: 24rpx;
padding: 24rpx;
background: var(--color-gray-1, #f3f3f3);
border-radius: var(--radius-lg, 24rpx);
border: 1rpx solid var(--color-gray-3, #e7e7e7);
}
.clue-item-detail { flex-wrap: wrap; }
.clue-tag {
flex-shrink: 0;
width: 80rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 22rpx;
font-weight: 500;
border-radius: 8rpx;
text-align: center;
line-height: 1.2;
}
.clue-tag-primary { background: rgba(0, 82, 217, 0.1); color: #0052d9; }
.clue-tag-success { background: rgba(0, 168, 112, 0.1); color: #00a870; }
.clue-tag-purple { background: rgba(124, 58, 237, 0.1); color: #7c3aed; }
.clue-tag-error { background: rgba(227, 77, 89, 0.1); color: #e34d59; }
.clue-body {
flex: 1;
min-height: 80rpx;
position: relative;
}
.clue-text {
font-size: var(--font-sm, 28rpx);
color: var(--color-gray-13, #242424);
line-height: 1.5;
}
.clue-source {
position: absolute;
bottom: 0;
right: 0;
font-size: 22rpx;
color: var(--color-gray-6, #a6a6a6);
background: var(--color-gray-1, #f3f3f3);
padding-left: 8rpx;
}
.clue-detail {
width: 100%;
font-size: var(--font-xs, 24rpx);
color: var(--color-gray-8, #777777);
line-height: 1.6;
margin-top: 8rpx;
padding-left: 104rpx;
}
/* 关系区域 */
.relationship-row {
display: flex;
align-items: center;
gap: 16rpx;
margin-bottom: 16rpx;
}
.rel-tag {
display: flex;
align-items: center;
gap: 8rpx;
padding: 8rpx 24rpx;
border-radius: 24rpx;
font-size: var(--font-sm, 28rpx);
font-weight: 600;
color: #ffffff;
flex-shrink: 0;
}
.rel-tag-pink { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.rel-bar {
flex: 1;
height: 12rpx;
background: var(--color-gray-1, #f3f3f3);
border-radius: 100rpx;
overflow: hidden;
}
.rel-bar-fill {
height: 100%;
background: linear-gradient(90deg, #f9a8d4, #f43f5e);
border-radius: 100rpx;
}
.rel-score {
font-size: var(--font-lg, 36rpx);
font-weight: 700;
color: #ec4899;
}
.card-desc {
font-size: var(--font-sm, 28rpx);
color: var(--color-gray-8, #777777);
line-height: 1.6;
margin-bottom: 24rpx;
}
/* 近期服务记录 */
.svc-section {
background: var(--color-gray-1, #f3f3f3);
border-radius: var(--radius-lg, 24rpx);
padding: 24rpx;
margin-top: 8rpx;
}
.svc-title {
font-size: var(--font-sm, 28rpx);
font-weight: 600;
color: var(--color-gray-13, #242424);
margin-bottom: 24rpx;
display: block;
}
.svc-record {
padding: 16rpx 0;
border-bottom: 1rpx solid var(--color-gray-3, #e7e7e7);
}
.svc-record:last-of-type { border-bottom: none; }
.svc-row-top, .svc-row-bottom {
display: flex;
align-items: center;
justify-content: space-between;
}
.svc-row-top { margin-bottom: 8rpx; }
.svc-tags {
display: flex;
align-items: center;
gap: 12rpx;
}
.svc-table {
font-size: var(--font-xs, 24rpx);
color: var(--color-gray-9, #5e5e5e);
background: #ffffff;
padding: 4rpx 12rpx;
border-radius: 8rpx;
}
.svc-type {
font-size: 22rpx;
padding: 2rpx 12rpx;
border-radius: 8rpx;
color: #ffffff;
}
.svc-type-basic { background: #0052d9; }
.svc-type-incentive { background: #ed7b2f; }
.svc-duration {
font-size: var(--font-xs, 24rpx);
color: var(--color-gray-6, #a6a6a6);
}
.svc-income {
font-size: var(--font-sm, 28rpx);
font-weight: 600;
color: var(--color-gray-13, #242424);
}
.svc-drinks { font-size: 22rpx; color: var(--color-gray-6, #a6a6a6); }
.svc-date { font-size: 22rpx; color: var(--color-gray-6, #a6a6a6); }
.svc-more { text-align: center; margin-top: 24rpx; }
.svc-more text {
font-size: var(--font-xs, 24rpx);
color: var(--color-primary, #0052d9);
font-weight: 500;
}
/* 任务建议 - 粉色 */
.suggestion-box {
border-radius: var(--radius-lg, 24rpx);
padding: 32rpx;
border: 1rpx solid;
margin-bottom: 32rpx;
}
.suggestion-pink {
background: linear-gradient(135deg, #fdf2f8, #fff1f2);
border-color: #fbcfe8;
}
.suggestion-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24rpx;
}
.suggestion-icon {
font-size: var(--font-sm, 28rpx);
font-weight: 500;
color: #ec4899;
}
.suggestion-list {
display: flex;
flex-direction: column;
gap: 12rpx;
}
.suggestion-item {
font-size: var(--font-sm, 28rpx);
color: var(--color-gray-9, #5e5e5e);
line-height: 1.6;
}
/* 话术参考(竖线样式) */
.talking-section {
background: var(--color-gray-1, #f3f3f3);
border-radius: var(--radius-lg, 24rpx);
padding: 32rpx;
border: 1rpx solid var(--color-gray-3, #e7e7e7);
}
.talking-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24rpx;
}
.talking-title {
font-size: var(--font-sm, 28rpx);
font-weight: 500;
color: var(--color-gray-13, #242424);
}
.talking-list {
display: flex;
flex-direction: column;
gap: 24rpx;
}
.talking-item {
font-size: var(--font-sm, 28rpx);
color: var(--color-gray-9, #5e5e5e);
line-height: 1.6;
padding-left: 24rpx;
border-left: 4rpx solid rgba(0, 82, 217, 0.3);
}
/* 备注 */
.note-count {
font-size: var(--font-xs, 24rpx);
color: var(--color-gray-6, #a6a6a6);
}
.note-item {
padding: 28rpx;
background: var(--color-gray-1, #f3f3f3);
border-radius: var(--radius-lg, 24rpx);
border: 1rpx solid var(--color-gray-3, #e7e7e7);
margin-bottom: 24rpx;
}
.note-top {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12rpx;
}
.note-date {
font-size: var(--font-xs, 24rpx);
color: var(--color-gray-6, #a6a6a6);
}
.note-content {
font-size: var(--font-sm, 28rpx);
color: var(--color-gray-9, #5e5e5e);
line-height: 1.6;
}
.note-empty {
display: flex;
flex-direction: column;
align-items: center;
padding: 48rpx 0;
gap: 16rpx;
}
.empty-hint {
font-size: var(--font-sm, 28rpx);
color: var(--color-gray-5, #c5c5c5);
}
/* 底部操作栏 */
.bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 128rpx;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(20px);
border-top: 1rpx solid var(--color-gray-2, #eeeeee);
display: flex;
align-items: center;
gap: 24rpx;
padding: 0 32rpx;
z-index: 100;
}
.btn-ask {
flex: 1;
height: 88rpx;
color: #ffffff;
font-weight: 500;
border-radius: var(--radius-lg, 24rpx);
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
font-size: var(--font-base, 32rpx);
}
.btn-ask-pink {
background: linear-gradient(135deg, #ec4899, #f43f5e);
box-shadow: 0 8rpx 24rpx rgba(236, 72, 153, 0.3);
}
.btn-note {
flex: 1;
height: 88rpx;
background: var(--color-gray-1, #f3f3f3);
color: var(--color-gray-13, #242424);
font-weight: 500;
border-radius: var(--radius-lg, 24rpx);
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
font-size: var(--font-base, 32rpx);
}