微信小程序页面迁移校验之前 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,94 @@
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: [
'赵姐您好!上次打球感觉怎么样?新到的球杆手感还习惯吗?这周末您有空的话,可以提前帮您预留老位置~',
'赵姐,最近店里新进了一批斯诺克专用巧克粉,手感特别好,下次来的时候可以试试~',
'赵姐好呀,上次您说想学几个高级杆法,我最近整理了一些教学视频,要不要发给您先看看?',
'赵姐这周六下午VIP包厢有空位要不要帮您提前预留可以叫上朋友一起来打球~',
'赵姐您好,我们下个月有个会员积分兑换活动,您的积分可以换不少好东西,到时候提醒您哦~',
],
/** 近期服务记录 */
serviceRecords: [
{ table: 'VIP2号房', type: '基础课', typeClass: 'basic', duration: '2.0h', income: '¥190', drinks: '🍷 红牛x2 花生米x1', date: '2026-02-04 15:00' },
{ table: '8号台', type: '激励课', typeClass: 'incentive', duration: '1.5h', income: '¥120', drinks: '🍷 可乐x2', date: '2026-01-30 16:30' },
{ table: 'VIP2号房', type: '基础课', typeClass: 'basic', duration: '2.5h', income: '¥200', drinks: '🍷 百威x3 薯条x1', date: '2026-01-25 14:00' },
],
},
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[0]
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' }),
})
},
/** 记录回访 */
onRecordCallback() {
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,203 @@
<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-teal">
<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">135****6677</text>
</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">👩 女性 · VIP会员 · 入会1年半 · 忠实老客户</text>
<text class="clue-source">By:系统</text>
</view>
</view>
<view class="clue-item">
<view class="clue-tag clue-tag-success">消费<text>\n</text>习惯</view>
<view class="clue-body">
<text class="clue-text">☀️ 偏好周末下午 · 月均6-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">💰 高客单价 · 爱点酒水</text>
<text class="clue-source">By:系统</text>
</view>
<text class="clue-detail">场均消费 ¥420高于门店均值 ¥180酒水小食附加消费占比 40%偏好VIP包厢</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">斯诺克占比 85%,偶尔玩中式八球;对高级杆法有浓厚兴趣</text>
</view>
<view class="clue-item clue-item-detail">
<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>
<text class="clue-detail">2月4日到店时表示新球杆手感很好希望下次能提前预留VIP包厢</text>
</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">长期合作关系良好,共有 45 次服务记录。客户多次指定您服务,评价均为 5 星。</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-purple">任务建议</text>
<view class="suggestion-box suggestion-teal">
<view class="suggestion-header">
<text class="suggestion-icon">📞 常规回访要点</text>
<text class="ai-badge">AI智能洞察</text>
</view>
<text class="suggestion-desc">该客户上次到店是 3 天前,关系良好,进行常规关怀回访:</text>
<view class="suggestion-list">
<text class="suggestion-item">• 询问上次体验是否满意,是否有改进建议</text>
<text class="suggestion-item">• 告知近期新到的斯诺克相关设备或活动</text>
<text class="suggestion-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-teal" 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,458 @@
/* 加载态 & 空态 */
.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-teal {
background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 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);
}
/* 主体 */
.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-purple { border-left: 6rpx solid #7c3aed; 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-teal {
background: linear-gradient(135deg, #f0fdfa, #ecfeff);
border-color: #99f6e4;
}
.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: #0d9488;
}
.suggestion-desc {
font-size: var(--font-sm, 28rpx);
color: var(--color-gray-9, #5e5e5e);
line-height: 1.6;
margin-bottom: 16rpx;
display: block;
}
.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-teal {
background: linear-gradient(135deg, #14b8a6, #06b6d4);
box-shadow: 0 8rpx 24rpx rgba(20, 184, 166, 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);
}