feat: chat integration, tenant admin spec, backend chat service, miniprogram updates, DEMO moved to tmp, XCX-TEST removed, migrations & docs

This commit is contained in:
Neo
2026-03-20 09:02:10 +08:00
parent 3d2e5f8165
commit beb88d5bea
388 changed files with 6436 additions and 25458 deletions

View File

@@ -1,4 +1,4 @@
import { mockCustomerDetail } from "../../utils/mock-data"
import { fetchCustomerDetail } from '../../services/api'
interface ConsumptionRecord {
id: string
@@ -248,15 +248,35 @@ Page({
const aiColors = ['red', 'orange', 'yellow', 'blue', 'indigo', 'purple'] as const
const aiColor = aiColors[Math.floor(Math.random() * aiColors.length)]
this.setData({ aiColor })
this.loadDetail()
const id = options?.id || options?.customerId || ''
this.loadDetail(id)
},
loadDetail() {
this.setData({ pageState: "normal" })
async loadDetail(id?: string) {
this.setData({ pageState: 'loading' })
try {
if (id) {
const detail = await fetchCustomerDetail(id)
if (detail) {
this.setData({
detail: {
...this.data.detail,
id: detail.id ?? id,
name: detail.name || this.data.detail.name,
phone: detail.phone || this.data.detail.phone,
},
})
}
}
this.setData({ pageState: 'normal' })
} catch {
this.setData({ pageState: 'error' })
}
},
onRetry() {
this.loadDetail()
const id = this.data.detail?.id || ''
this.loadDetail(id)
},
/** 查看/隐藏手机号 */
@@ -276,11 +296,19 @@ Page({
},
onViewServiceRecords() {
wx.navigateTo({ url: "/pages/customer-service-records/customer-service-records" })
const customerId = this.data.detail?.id || ''
wx.navigateTo({
url: `/pages/customer-service-records/customer-service-records?customerId=${customerId}`,
fail: () => wx.showToast({ title: '页面跳转失败', icon: 'none' }),
})
},
onStartChat() {
wx.navigateTo({ url: "/pages/chat/chat" })
const customerId = this.data.detail?.id || ''
wx.navigateTo({
url: `/pages/chat/chat?customerId=${customerId}`,
fail: () => wx.showToast({ title: '页面跳转失败', icon: 'none' }),
})
},
onAddNote() {