小程序迁移 静态页面完成!!!

This commit is contained in:
Neo
2026-03-18 05:14:35 +08:00
parent 72bb11b34f
commit 075caf067f
124 changed files with 10407 additions and 2738 deletions

View File

@@ -1,6 +1,8 @@
import { mockTaskDetails } from '../../utils/mock-data'
import type { TaskDetail, Note } from '../../utils/mock-data'
import { sortByTimestamp } from '../../utils/sort'
import { formatRelativeTime } from '../../utils/time'
import { formatMoney } from '../../utils/money'
/** 维客线索项 */
interface RetentionClue {
@@ -17,18 +19,41 @@ interface RetentionClue {
interface ServiceRecord {
table: string
type: string
typeClass: 'basic' | 'incentive'
duration: string
income: string
typeClass: 'basic' | 'vip' | 'tip' | 'recharge' | 'incentive'
/** 卡片类型course=普通课recharge=充值提成 */
recordType?: 'course' | 'recharge'
duration: number // 折算后课时小时number
durationRaw?: number // 折算前课时小时number可选
income: number // 收入(元,整数)
/** 是否预估金额 */
isEstimate?: boolean
drinks: string
date: string
}
/** 服务汇总 */
interface ServiceSummary {
totalHours: string
totalIncome: string
avgIncome: string
totalHours: number
totalIncome: number
avgIncome: number
}
/**
* 将 ISO/空格分隔的日期字符串格式化为中文短格式
* "2026-02-07T21:30" → "2月7日 21:30"
* 与 customer-service-records 页面拼接方式保持一致
*/
function formatServiceDate(dateStr: string): string {
if (!dateStr) return dateStr
// 兼容 "2026-02-07T21:30" 和 "2026-02-07 21:30"
const normalized = dateStr.replace('T', ' ')
const [datePart, timePart] = normalized.split(' ')
if (!datePart) return dateStr
const parts = datePart.split('-')
if (parts.length < 3) return dateStr
const month = parseInt(parts[1], 10)
const day = parseInt(parts[2], 10)
return timePart ? `${month}${day}${timePart}` : `${month}${day}`
}
Page({
@@ -61,11 +86,12 @@ Page({
copiedIndex: -1,
// --- 近期服务记录 ---
serviceSummary: { totalHours: '6.0', totalIncome: 510', avgIncome: 170' } as ServiceSummary,
serviceSummary: { totalHours: 6.0, totalIncome: 510, avgIncome: 170 } as ServiceSummary,
serviceRecords: [
{ table: 'A12号台', type: '基础课', typeClass: 'basic', duration: '2.5h', income: '¥200', drinks: '🍷 百威x2 红牛x1', date: '2026-02-07 21:30' },
{ table: '3号台', type: '基础课', typeClass: 'basic', duration: '2.0h', income: '¥160', drinks: '🍷 可乐x1', date: '2026-02-01 20:30' },
{ table: 'VIP1号房', type: '激励课', typeClass: 'incentive', duration: '1.5h', income: '¥150', drinks: '🍷 芝华士x1 矿泉水x2', date: '2026-01-28 19:00' },
{ table: 'A12号台', type: '基础课', typeClass: 'basic', duration: 2.5, durationRaw: 3.0, income: 200, isEstimate: true, drinks: '🍷 百威x2 红牛x1', date: formatServiceDate('2026-02-07T21:30') },
{ table: '3号台', type: '基础课', typeClass: 'basic', duration: 2.0, durationRaw: 2.0, income: 160, isEstimate: false, drinks: '🍷 可乐x1', date: formatServiceDate('2026-02-01T20:30') },
{ table: 'VIP1号房', type: '包厢课', typeClass: 'vip', duration: 1.5, durationRaw: 1.5, income: 150, isEstimate: true, drinks: '🍷 芝华士x1 矿泉水x2', date: formatServiceDate('2026-01-28T19:00') },
{ table: '', type: '充值', typeClass: 'recharge', recordType: 'recharge', duration: 0, durationRaw: 0, income: 80, isEstimate: false, drinks: '', date: formatServiceDate('2026-01-15T10:00') },
] as ServiceRecord[],
// --- 放弃弹窗 ---
@@ -95,7 +121,7 @@ Page({
aiColor: 'indigo' as 'red' | 'orange' | 'yellow' | 'blue' | 'indigo' | 'purple',
},
onLoad(options) {
onLoad(options: { id?: string }) {
const id = options?.id || ''
// 随机 AI 配色
const aiColors = ['red', 'orange', 'yellow', 'blue', 'indigo', 'purple'] as const
@@ -128,14 +154,19 @@ Page({
// 添加更多 mock 备注
const mockNotes: Note[] = [
{ id: 'note-1', content: '已通过微信联系王先生,表示对新到的斯诺克球桌感兴趣,周末可能来体验。', tagType: 'customer', tagLabel: '客户:王先生', createdAt: '2026-03-10 16:30', score: 10 },
{ id: 'note-2', content: '王先生最近出差较多,到店频率降低。建议等他回来后再约。', tagType: 'customer', tagLabel: '客户:王先生', createdAt: '2026-03-05 14:20', score: 7.5 },
{ id: 'note-3', content: '上次到店时推荐了会员续费活动,客户说考虑一下。', tagType: 'customer', tagLabel: '客户:王先生', createdAt: '2026-02-28 18:45', score: 6 },
{ id: 'note-4', content: '客户对今天的服务非常满意,特别提到小燕的教学很专业。', tagType: 'customer', tagLabel: '客户:王先生', createdAt: '2026-02-20 21:15', score: 9.5 },
{ id: 'note-5', content: '完成高优先召回任务。客户反馈最近工作太忙,这周末会来店里。', tagType: 'customer', tagLabel: '客户:王先生', createdAt: '2026-02-15 10:30', score: 8 },
{ id: 'note-1', content: '已通过微信联系王先生,表示对新到的斯诺克球桌感兴趣,周末可能来体验。', tagType: 'customer', tagLabel: '客户:王先生', createdAt: '2026-03-10T16:30', score: 10 },
{ id: 'note-2', content: '王先生最近出差较多,到店频率降低。建议等他回来后再约。', tagType: 'customer', tagLabel: '客户:王先生', createdAt: '2026-03-05T14:20', score: 7.5 },
{ id: 'note-3', content: '上次到店时推荐了会员续费活动,客户说考虑一下。', tagType: 'customer', tagLabel: '客户:王先生', createdAt: '2026-02-28T18:45', score: 6 },
{ id: 'note-4', content: '客户对今天的服务非常满意,特别提到小燕的教学很专业。', tagType: 'customer', tagLabel: '客户:王先生', createdAt: '2026-02-20T21:15', score: 9.5 },
{ id: 'note-5', content: '完成高优先召回任务。客户反馈最近工作太忙,这周末会来店里。', tagType: 'customer', tagLabel: '客户:王先生', createdAt: '2026-02-15T10:30', score: 8 },
]
const sorted = sortByTimestamp(mockNotes) as Note[]
// 附加 timeLabel 字段
const notesWithLabel = mockNotes.map((n) => ({
...n,
timeLabel: formatRelativeTime(n.createdAt),
}))
const sorted = sortByTimestamp(notesWithLabel) as (Note & { timeLabel: string })[]
this.updateRelationshipDisplay(detail.heartScore)
this.setData({
pageState: 'normal',
@@ -193,6 +224,17 @@ Page({
this.setData({ phoneVisible: !this.data.phoneVisible })
},
/** 复制手机号 */
onCopyPhone() {
const phone = '13812345678'
wx.setClipboardData({
data: phone,
success: () => {
wx.showToast({ title: '手机号码已复制', icon: 'none' })
},
})
},
/** 展开/收起维客线索描述 */
onToggleClue(e: WechatMiniprogram.BaseEvent) {
const idx = e.currentTarget.dataset.index as number
@@ -280,8 +322,7 @@ Page({
},
/** 放弃 — 确认 */
onAbandonConfirm(e: WechatMiniprogram.CustomEvent<{ reason: string }>) {
const { reason } = e.detail
onAbandonConfirm(_e: WechatMiniprogram.CustomEvent<{ reason: string }>) {
this.setData({ abandonModalVisible: false })
wx.showLoading({ title: '处理中...' })
setTimeout(() => {