Commit cbb6d660 by 前端

Merge branch 'hotfix_v5.8.3.2' into 'master'

上线合并

See merge request !96
2 parents ce72508f e685a44b
...@@ -739,4 +739,13 @@ module.exports = { ...@@ -739,4 +739,13 @@ module.exports = {
...data ...data
}) })
}, },
updateGoodsOrderRemark(data = {}) {
return http.post({
method: 'dj.api.smartcarlife.goodsOrder.remark',
projectName: 'pad',
...data
})
},
} }
...@@ -116,16 +116,15 @@ module.exports = { ...@@ -116,16 +116,15 @@ module.exports = {
}, },
/**搜索订单(含套餐) */ /**搜索订单(含套餐) */
getWorkPackageGoodsList (data) { getWorkPackageGoodsList (data) {
let params = data || {}
params.sceneType = 1
return http.post( return http.post(
{ {
method: 'dj.api.smartcarlife.order.search.containPackageGoods', method: 'dj.api.smartcarlife.order.search.containPackageGoods',
projectName: 'boutique', projectName: 'boutique',
...data, pageSize: 20,
pageSize: 10, pageNum: 1,
pageSize: 999999, statusList: [1],
statusList: [1] sceneType: 1,
...data
}, },
false, false,
'dj', 'dj',
......
...@@ -236,6 +236,14 @@ import { ...@@ -236,6 +236,14 @@ import {
import { storageApi } from '@/utils/cache' import { storageApi } from '@/utils/cache'
import RecordService from '@/utils/recordManager/RecordService.js' import RecordService from '@/utils/recordManager/RecordService.js'
import { getAiStreamSession } from '@/utils/aiAssistant/aiStreamSession.js' import { getAiStreamSession } from '@/utils/aiAssistant/aiStreamSession.js'
import {
trackAiBallClick,
trackAiThinkingTrigger,
trackAiQuestionSelect,
trackAiAnswerRender,
trackAiError,
AI_ERROR_TYPE
} from '@/utils/aiAssistant/aiAssistantTrack.js'
import { TransportType } from '@/utils/socket' import { TransportType } from '@/utils/socket'
const DEMO_CAPTURE_SECONDS = 60 const DEMO_CAPTURE_SECONDS = 60
const HELP_ANSWER_REQUEST_TIMEOUT = 90000 const HELP_ANSWER_REQUEST_TIMEOUT = 90000
...@@ -397,6 +405,7 @@ export default { ...@@ -397,6 +405,7 @@ export default {
// #ifdef APP-PLUS // #ifdef APP-PLUS
if (this.uiState === 'thinking') return if (this.uiState === 'thinking') return
if (this.menuVisible || this.questionMenuVisible || this.introVisible) return if (this.menuVisible || this.questionMenuVisible || this.introVisible) return
trackAiBallClick()
if (this.abnormalBubbleVisible) { if (this.abnormalBubbleVisible) {
this.abnormalBubbleVisible = false this.abnormalBubbleVisible = false
this._pendingBallTap = true this._pendingBallTap = true
...@@ -500,6 +509,7 @@ export default { ...@@ -500,6 +509,7 @@ export default {
this.qaList = [] this.qaList = []
this.selectedQaIndex = -1 this.selectedQaIndex = -1
trackAiThinkingTrigger(DEMO_CAPTURE_SECONDS)
this._logAi('info', `startThinking session=${sessionId}`) this._logAi('info', `startThinking session=${sessionId}`)
await this.$nextTick() await this.$nextTick()
...@@ -522,6 +532,7 @@ export default { ...@@ -522,6 +532,7 @@ export default {
return return
} }
this._logAi('error', `startThinking failed: ${(e && e.message) || e}`) this._logAi('error', `startThinking failed: ${(e && e.message) || e}`)
trackAiError(this._resolveAiErrorType(e))
this.streamStatus = 'error' this.streamStatus = 'error'
this.uiState = 'idle' this.uiState = 'idle'
this.resultVisible = false this.resultVisible = false
...@@ -534,11 +545,18 @@ export default { ...@@ -534,11 +545,18 @@ export default {
// #endif // #endif
}, },
selectQa(idx) { selectQa(idx) {
const item = this.qaList[idx]
if (item) {
trackAiQuestionSelect(idx, item.query || '')
}
this.selectedQaIndex = idx this.selectedQaIndex = idx
if (this.questionMenuVisible) { if (this.questionMenuVisible) {
this.questionMenuVisible = false this.questionMenuVisible = false
this.resultVisible = true this.resultVisible = true
} }
if (item && item.answer) {
this._trackAnswerRenderForIntent(idx)
}
}, },
/** 打开面板即开始监听/模拟流式 markdown,边收边渲染 */ /** 打开面板即开始监听/模拟流式 markdown,边收边渲染 */
beginStreamSession() { beginStreamSession() {
...@@ -705,6 +723,7 @@ export default { ...@@ -705,6 +723,7 @@ export default {
if (!this.qaList.length) { if (!this.qaList.length) {
this._logAi('info', 'response empty, no questions to show') this._logAi('info', 'response empty, no questions to show')
trackAiError(AI_ERROR_TYPE.NO_ANSWER)
return return
} }
if (isCancelled()) { if (isCancelled()) {
...@@ -720,9 +739,26 @@ export default { ...@@ -720,9 +739,26 @@ export default {
this.questionMenuVisible = false this.questionMenuVisible = false
this.selectedQaIndex = 0 this.selectedQaIndex = 0
this.resultVisible = true this.resultVisible = true
if (this.qaList[0] && this.qaList[0].answer) {
this._trackAnswerRenderForIntent(0)
}
} }
// #endif // #endif
}, },
_trackAnswerRenderForIntent(intentId) {
const renderStart = Date.now()
this.$nextTick(() => {
trackAiAnswerRender(intentId, Date.now() - renderStart)
})
},
_resolveAiErrorType(err) {
const msg = String((err && (err.errMsg || err.message)) || '')
if (/timeout/i.test(msg)) return AI_ERROR_TYPE.TIMEOUT
if (this._isHelpAnswerNetworkError(err) || /连接失败|network/i.test(msg)) {
return AI_ERROR_TYPE.NETWORK
}
return AI_ERROR_TYPE.OTHER
},
_logAi(level, msg) { _logAi(level, msg) {
// #ifdef APP-PLUS // #ifdef APP-PLUS
const text = `[AiAssistant] ${msg}` const text = `[AiAssistant] ${msg}`
......
...@@ -218,7 +218,6 @@ export default { ...@@ -218,7 +218,6 @@ export default {
page: '/pages/common/serviceDetail/index', page: '/pages/common/serviceDetail/index',
eventCode: 'app_service_center', eventCode: 'app_service_center',
sceneType: [1], sceneType: [1],
showOnActivityTab: true,
pageDirect: true, pageDirect: true,
noInterception: true noInterception: true
}, },
......
...@@ -48,9 +48,10 @@ ...@@ -48,9 +48,10 @@
<view <view
v-for="(item, index) in goodsList" v-for="(item, index) in goodsList"
:key="item.id || index" :key="item.id || index"
:class="['goods-item', { active: goodsIndex === index }]" class="goods-item-shell"
@click="handleGoodsClick(item, index)" @click="handleGoodsClick(item, index)"
> >
<view :class="['goods-item', { active: goodsIndex === index }]">
<view v-if="item.isMainPush" class="goods-item-badge">主推</view> <view v-if="item.isMainPush" class="goods-item-badge">主推</view>
<view v-else class="goods-item-badge badge02">次推</view> <view v-else class="goods-item-badge badge02">次推</view>
<view class="goods-item-img-wrap"> <view class="goods-item-img-wrap">
...@@ -66,6 +67,7 @@ ...@@ -66,6 +67,7 @@
</view> </view>
</view> </view>
</view> </view>
</view>
</scroll-view> </scroll-view>
</view> </view>
...@@ -324,8 +326,11 @@ export default { ...@@ -324,8 +326,11 @@ export default {
} }
} }
.goods-box { .goods-box {
$shadow-space: 10px;
width: 100%; width: 100%;
overflow: visible; overflow: visible;
// 允许横向阴影溢出父级,避免负 margin 扩展后被外层裁剪
clip-path: inset(0 -#{$shadow-space});
.goods-img-wrap { .goods-img-wrap {
position: relative; position: relative;
...@@ -375,26 +380,38 @@ export default { ...@@ -375,26 +380,38 @@ export default {
.goods-menu { .goods-menu {
$goods-item-height: 120px; $goods-item-height: 120px;
$shadow-space: 8px; $shadow-space: 10px;
$item-gap: 12px;
// 向外扩展滚动视口,配合首尾 margin 消除左右空隙并保留阴影绘制空间 // scroll-view 自身 padding 为视口边缘预留阴影区,负 margin 保持与父级同宽对齐
width: calc(100% + #{$shadow-space * 2}); width: calc(100% + #{$shadow-space * 2});
margin: toRpx(28) (-$shadow-space); margin: toRpx(28) (-$shadow-space) 0;
height: calc(#{$goods-item-height} + #{$shadow-space * 2}); height: calc(#{$goods-item-height} + #{$shadow-space * 2});
padding: $shadow-space;
box-sizing: border-box;
white-space: nowrap; white-space: nowrap;
.goods-menu-inner { .goods-menu-inner {
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
gap: 12px; align-items: stretch;
height: $goods-item-height; height: $goods-item-height;
padding: $shadow-space 0; box-sizing: border-box;
}
.goods-item-shell {
flex-shrink: 0;
padding: $shadow-space;
margin: (-$shadow-space) 0;
box-sizing: content-box; box-sizing: content-box;
& + & {
margin-left: calc(#{$item-gap} - #{$shadow-space * 2});
}
} }
.goods-item { .goods-item {
position: relative; position: relative;
flex-shrink: 0;
box-sizing: border-box; box-sizing: border-box;
width: 252px; width: 252px;
height: $goods-item-height; height: $goods-item-height;
...@@ -407,14 +424,6 @@ export default { ...@@ -407,14 +424,6 @@ export default {
box-shadow: 0 2px 8px 0 rgba(44, 102, 247, 0.10); box-shadow: 0 2px 8px 0 rgba(44, 102, 247, 0.10);
cursor: pointer; cursor: pointer;
&:first-child {
margin-left: $shadow-space;
}
&:last-child {
margin-right: $shadow-space;
}
&.active { &.active {
border: 1.5px solid rgba(44, 102, 247, 0.10); border: 1.5px solid rgba(44, 102, 247, 0.10);
background: linear-gradient(0deg, rgba(44, 102, 247, 0.05) 0%, rgba(44, 102, 247, 0.05) 100%), #FFF; background: linear-gradient(0deg, rgba(44, 102, 247, 0.05) 0%, rgba(44, 102, 247, 0.05) 100%), #FFF;
...@@ -518,4 +527,11 @@ export default { ...@@ -518,4 +527,11 @@ export default {
margin-top: toRpx(28); margin-top: toRpx(28);
} }
} }
::v-deep .goods-menu {
.uni-scroll-view,
.uni-scroll-view-content {
height: 100%;
}
}
</style> </style>
<template>
<view class="list-skeleton">
<view
v-for="groupIndex in groupCount"
:key="'skeleton-group-' + groupIndex"
class="list-skeleton__group"
>
<view class="list-skeleton__count">
<view class="list-skeleton__block list-skeleton__count-left"></view>
<view class="list-skeleton__block list-skeleton__count-right"></view>
</view>
<view
v-for="itemIndex in itemCount"
:key="'skeleton-item-' + groupIndex + '-' + itemIndex"
class="list-skeleton__item"
>
<view class="list-skeleton__block list-skeleton__avatar"></view>
<view class="list-skeleton__body">
<view class="list-skeleton__block list-skeleton__line list-skeleton__line--name"></view>
<view class="list-skeleton__block list-skeleton__line list-skeleton__line--meta"></view>
<view class="list-skeleton__block list-skeleton__line list-skeleton__line--group"></view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'ListSkeleton',
props: {
groupCount: {
type: Number,
default: 2
},
itemCount: {
type: Number,
default: 2
}
}
}
</script>
<style lang="scss" scoped>
$card-shadow-space: 4px;
$content-h-gap: 12px;
$item-side-margin: $content-h-gap - $card-shadow-space;
@keyframes list-skeleton-shimmer {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
}
.list-skeleton {
&__group {
margin-bottom: 8px;
&:last-child {
margin-bottom: 0;
}
}
&__block {
border-radius: 4px;
background: linear-gradient(90deg, #F0F2F5 25%, #E4E8ED 50%, #F0F2F5 75%);
background-size: 200% 100%;
animation: list-skeleton-shimmer 1.4s ease-in-out infinite;
}
&__count {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 12px;
margin: 0 $item-side-margin 8px;
border-radius: 10px;
background: rgba(44, 102, 247, 0.03);
box-sizing: border-box;
min-height: 32px;
}
&__count-left {
width: 120px;
height: 14px;
}
&__count-right {
width: 56px;
height: 14px;
}
&__item {
display: flex;
align-items: flex-start;
gap: 8px;
padding: 10px 12px;
margin: 0 $item-side-margin 8px;
background: #FFFFFF;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(44, 102, 247, 0.06);
box-sizing: border-box;
}
&__avatar {
width: 32px;
height: 32px;
border-radius: 50%;
flex-shrink: 0;
}
&__body {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 8px;
padding-top: 2px;
}
&__line {
height: 14px;
&--name {
width: 72%;
}
&--meta {
width: 55%;
}
&--group {
width: 40%;
}
}
}
</style>
<template> <template>
<view :class="['container-right', { 'container-right--page': type === 'in' }]"> <view :class="['container-right', { 'container-right--page': type === 'in' }]">
<view class="customer-header"> <view
:class="['customer-header', { 'customer-header--gradient': enableHeaderGradient }]"
:style="enableHeaderGradient ? headerStyle : undefined"
>
<!-- 左 --> <!-- 左 -->
<view class="header-left"> <view class="header-left">
<image <image
v-if="showHeaderIcon"
class="header-left-icon" class="header-left-icon"
:src="require('@/assets/images/common/icon-file-custom.png')" :src="require('@/assets/images/common/icon-file-custom.png')"
mode="aspectFit" mode="aspectFit"
...@@ -28,6 +32,19 @@ ...@@ -28,6 +32,19 @@
</view> </view>
<scroll-view class="customer-list" scroll-y show-scrollbar="false"> <scroll-view class="customer-list" scroll-y show-scrollbar="false">
<view class="customer-list-inner"> <view class="customer-list-inner">
<!-- 加载骨架屏 -->
<ListSkeleton v-if="loading" />
<!-- 空状态 -->
<view v-else-if="isEmpty" class="customer-empty">
<image
class="customer-empty-icon"
:src="require('@/assets/images/common/noData.webp')"
mode="aspectFit"
/>
<text class="customer-empty-text">暂无客户档案</text>
</view>
<!-- 客户列表 -->
<template v-else>
<view <view
v-for="group in customerProfile" v-for="group in customerProfile"
:key="group.date" :key="group.date"
...@@ -90,14 +107,20 @@ ...@@ -90,14 +107,20 @@
</view> </view>
</view> </view>
</view> </view>
</template>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
<script> <script>
import ListSkeleton from './ListSkeleton.vue'
export default { export default {
name: 'CustomerSide', name: 'CustomerSide',
components: {
ListSkeleton
},
props: { props: {
type: { type: {
type: String, type: String,
...@@ -106,6 +129,45 @@ export default { ...@@ -106,6 +129,45 @@ export default {
customerProfile: { customerProfile: {
type: Array, type: Array,
default: () => [] default: () => []
},
loading: {
type: Boolean,
default: false
},
showHeaderIcon: {
type: Boolean,
default: true
},
enableHeaderGradient: {
type: Boolean,
default: false
},
headerGradient: {
type: Object,
default: null
}
},
computed: {
isEmpty() {
if (!this.customerProfile.length) return true
return !this.customerProfile.some(
group => (group.customerProfileInfoDTOS || []).length > 0
)
},
headerStyle() {
if (!this.enableHeaderGradient) return {}
const {
afterGradient = 'linear-gradient(0deg, #94c2ff00 0%, #5294ff 100%)',
beforeGradient = 'linear-gradient(-44.4deg, #94c2ff00 0%, #5294ff 100%)',
afterOpacity = 0.15,
beforeOpacity = 0.6
} = this.headerGradient || {}
return {
'--header-gradient-after': afterGradient,
'--header-gradient-before': beforeGradient,
'--header-gradient-after-opacity': afterOpacity,
'--header-gradient-before-opacity': beforeOpacity
}
} }
}, },
methods: { methods: {
...@@ -190,6 +252,10 @@ export default { ...@@ -190,6 +252,10 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
$card-shadow-space: 4px;
$content-h-gap: 12px;
$item-side-margin: $content-h-gap - $card-shadow-space;
.container-right { .container-right {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
...@@ -210,9 +276,46 @@ export default { ...@@ -210,9 +276,46 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: toRpx(8) 0 toRpx(28) 0; padding: toRpx(36) 12px toRpx(28);
border-bottom: 1px solid #F5F7FA; border-bottom: 1px solid #F5F7FA;
margin-top: toRpx(28);
&--gradient {
position: relative;
&::after {
content: '';
position: absolute;
left: 0;
top: 0;
z-index: 0;
width: 100%;
height: 100%;
background: var(--header-gradient-after, linear-gradient(0deg, #94c2ff00 0%, #5294ff 100%));
opacity: var(--header-gradient-after-opacity, 0.15);
pointer-events: none;
}
&::before {
content: '';
position: absolute;
left: toMinusRpx(20);
top: toMinusRpx(28);
z-index: 0;
width: toRpx(136);
height: toRpx(136);
opacity: var(--header-gradient-before-opacity, 0.6);
background: var(--header-gradient-before, linear-gradient(-44.4deg, #94c2ff00 0%, #5294ff 100%));
filter: blur(toRpx(24));
pointer-events: none;
}
.header-left,
.header-right {
position: relative;
z-index: 1;
}
}
.header-left { .header-left {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -241,7 +344,7 @@ export default { ...@@ -241,7 +344,7 @@ export default {
height: 32px; height: 32px;
border-radius: 8px; border-radius: 8px;
border: 1px solid rgba(44, 102, 247, 0.10); border: 1px solid rgba(44, 102, 247, 0.10);
background-color: #F2F2F2; background: rgba(44, 102, 247, 0.05);
.header-right-icon { .header-right-icon {
width: 16px; width: 16px;
...@@ -272,8 +375,32 @@ export default { ...@@ -272,8 +375,32 @@ export default {
} }
.customer-list-inner { .customer-list-inner {
padding: 12px 4px 4px; // 阴影绘制空间放在 inner,避免 scroll-view 裁剪左右 box-shadow
padding: 12px $card-shadow-space calc(4px + #{$card-shadow-space});
box-sizing: border-box; box-sizing: border-box;
min-height: 100%;
}
.customer-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 48px 12px;
min-height: 200px;
box-sizing: border-box;
.customer-empty-icon {
width: 120px;
height: 120px;
}
.customer-empty-text {
margin-top: 8px;
font-size: 14px;
line-height: 20px;
color: #999EA8;
}
} }
.customer-day-group { .customer-day-group {
...@@ -289,7 +416,7 @@ export default { ...@@ -289,7 +416,7 @@ export default {
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 8px 12px; padding: 8px 12px;
margin-bottom: 8px; margin: 0 $item-side-margin 8px;
border-radius: 10px; border-radius: 10px;
background: rgba(44, 102, 247, 0.05); background: rgba(44, 102, 247, 0.05);
box-sizing: border-box; box-sizing: border-box;
...@@ -345,7 +472,7 @@ export default { ...@@ -345,7 +472,7 @@ export default {
align-items: flex-start; align-items: flex-start;
gap: 8px; gap: 8px;
padding: 10px 12px; padding: 10px 12px;
margin-bottom: 8px; margin: 0 $item-side-margin 8px;
background: #FFFFFF; background: #FFFFFF;
border-radius: 8px; border-radius: 8px;
box-shadow: 0 2px 4px rgba(44, 102, 247, 0.10); box-shadow: 0 2px 4px rgba(44, 102, 247, 0.10);
......
...@@ -94,10 +94,15 @@ ...@@ -94,10 +94,15 @@
</view> </view>
</view> </view>
</view> </view>
<view class="content-right box-class scene1-box-shadow"> <view class="content-right box-class scene1-box-shadow content-right-customer">
<view class="common-title">服务中心</view> <view class="content-right-customer-inner">
<view class="content-box"> <CustomerSide
<MessageIndex class="message-box" ref="messageRef" /> :customerProfile="customerProfileList"
:loading="customerProfileLoading"
enable-header-gradient
:showHeaderIcon="false"
:headerGradient="customerHeaderGradient"
/>
</view> </view>
</view> </view>
</view> </view>
...@@ -110,7 +115,10 @@ ...@@ -110,7 +115,10 @@
@entranceClick="entranceClick" @entranceClick="entranceClick"
/> />
<view class="line"></view> <view class="line"></view>
<CustomerSide :customerProfile="customerProfileList" /> <CustomerSide
:customerProfile="customerProfileList"
:loading="customerProfileLoading"
/>
</view> </view>
</view> </view>
<!-- 挖掘潜客机会 --> <!-- 挖掘潜客机会 -->
...@@ -386,7 +394,14 @@ export default { ...@@ -386,7 +394,14 @@ export default {
}), }),
activityProductList: [], activityProductList: [],
prelearnData: {}, prelearnData: {},
customerProfileList: [] customerProfileList: [],
customerProfileLoading: true,
customerHeaderGradient: Object.freeze({
afterGradient: 'linear-gradient(0deg, #94c2ff00 0%, #5294ff 100%)',
beforeGradient: 'linear-gradient(-44.4deg, #94c2ff00 0%, #5294ff 100%)',
afterOpacity: 0.15,
beforeOpacity: 0.6
})
} }
}, },
beforeDestroy() { beforeDestroy() {
...@@ -493,7 +508,7 @@ export default { ...@@ -493,7 +508,7 @@ export default {
// 监听自定义事件 // 监听自定义事件
uni.$on('pageBack', () => { uni.$on('pageBack', () => {
this.$refs.leftBox.getMessageInfo() this.$refs.leftBox.getMessageInfo()
this.$refs.messageRef.getMessageSummary() this.$refs.messageRef?.getMessageSummary()
}) })
uni.$on('refreshCustomerProfileGroupInfo', () => { uni.$on('refreshCustomerProfileGroupInfo', () => {
this.getCustomerProfileGroupInfo() this.getCustomerProfileGroupInfo()
...@@ -706,7 +721,7 @@ export default { ...@@ -706,7 +721,7 @@ export default {
}, },
async changeTab({ item, index }) { async changeTab({ item, index }) {
if (index == 0) { if (index == 0) {
this.$refs.messageRef.getMessageSummary() this.$refs.messageRef?.getMessageSummary()
this.getCustomerProfileGroupInfo() this.getCustomerProfileGroupInfo()
this.getStrategyStatus() this.getStrategyStatus()
} }
...@@ -760,7 +775,8 @@ export default { ...@@ -760,7 +775,8 @@ export default {
} }
}, },
/** /**
* 查询当前进行中的营销活动商品列表 * @function 营销活动:
* @desc 查询当前进行中的营销活动商品列表
*/ */
async getActivityProductList() { async getActivityProductList() {
const { shopMerchantId: merchantId } = uni.$storage.get('userInfo') || {} const { shopMerchantId: merchantId } = uni.$storage.get('userInfo') || {}
...@@ -783,22 +799,27 @@ export default { ...@@ -783,22 +799,27 @@ export default {
}, },
/** /**
* 查询客户建档分页查询-月按天分组 * @function 客户档案:
* @desc 查询客户建档分页查询-月按天分组
*/ */
async getCustomerProfileGroupInfo() { async getCustomerProfileGroupInfo() {
const { shopMerchantId: merchantId } = uni.$storage.get('userInfo') || {} const { shopMerchantId: merchantId } = uni.$storage.get('userInfo') || {}
if (!merchantId) { if (!merchantId) {
this.customerProfileList = [] this.customerProfileList = []
this.customerProfileLoading = false
return return
} }
this.customerProfileLoading = true
try { try {
const res = await uni.$api.customerApi.getCustomerProfileGroupInfoAPI({ merchantId }) const res = await uni.$api.customerApi.getCustomerProfileGroupInfoAPI({ merchantId })
console.log('getCustomerProfileListInfo***') console.log('getCustomerProfileGroupInfo***', res)
this.customerProfileList = Array.isArray(res) ? res : [] this.customerProfileList = Array.isArray(res) ? res : []
} catch (error) { } catch (error) {
console.error('查询客户建档分组信息失败:', error) console.error('查询客户建档分组信息失败:', error)
this.customerProfileList = [] this.customerProfileList = []
} finally {
this.customerProfileLoading = false
} }
}, },
/** /**
...@@ -1404,6 +1425,35 @@ export default { ...@@ -1404,6 +1425,35 @@ export default {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
// transform: translateY(toMinusRpx(32)); // transform: translateY(toMinusRpx(32));
.content-left {
flex: 1 1 0;
min-width: 0;
width: auto;
}
.content-right-customer {
flex: 0 1 toRpx(720);
min-width: toRpx(320);
max-width: 40%;
width: auto;
height: calc(100% - 16px);
min-height: 0;
box-sizing: border-box;
padding: 0 0 16px;
display: flex;
flex-direction: column;
overflow: hidden;
.content-right-customer-inner {
margin-top: -10px;
}
&-inner {
flex: 1;
min-height: 0;
overflow: hidden;
}
}
.tab-container { .tab-container {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
...@@ -45,21 +45,28 @@ export default { ...@@ -45,21 +45,28 @@ export default {
return return
} }
this.componentLoading(params) this.componentLoading(params)
const { shopMerchantId } = userInfo, const { shopMerchantId } = userInfo
apiParams = { const isOrderSearch = !params.defeat && userInfo.sceneType == 1
const useWorkPackageGoods = params.defeat || isOrderSearch
let apiTargetName = useWorkPackageGoods ? 'getWorkPackageGoodsList' : 'getQuotationCustomerList'
let apiParams = useWorkPackageGoods
? {
merchantId: shopMerchantId,
pageSize: 20,
pageNum: 1,
statusList: [1],
sceneType: 1,
keyword: searchValue || ''
}
: {
merchantId: shopMerchantId, merchantId: shopMerchantId,
pageSize: 999999, pageSize: 999999,
currentPage: 1, currentPage: 1,
search: searchValue search: searchValue
} }
let apiTargetName = !params.defeat ? 'getQuotationCustomerList' : 'getWorkPackageGoodsList'
console.log(apiTargetName, 'apiTargetName')
if (params.defeat) {
apiParams.keyword = searchValue
}
const { list } = await uni.$api.popupApi[apiTargetName](apiParams) const { list } = await uni.$api.popupApi[apiTargetName](apiParams)
let customerList = list let customerList = list
if (params.defeat) { if (useWorkPackageGoods) {
const listArray = list.map(item => { const listArray = list.map(item => {
if (item.customer && item.customer.carSeriesName) { if (item.customer && item.customer.carSeriesName) {
item.carType = `${item.customer.carBrand || ''}-${item.customer.carChildsBrandName || ''}-${item.customer.carSeriesName || ''}` item.carType = `${item.customer.carBrand || ''}-${item.customer.carChildsBrandName || ''}-${item.customer.carSeriesName || ''}`
...@@ -72,8 +79,9 @@ export default { ...@@ -72,8 +79,9 @@ export default {
this.updateParams(params, customerList || []) this.updateParams(params, customerList || [])
}, },
initData (list) { initData (list) {
const { params: { idKey, defeat }, data } = this const { params: { idKey, defeat }, data, userInfo } = this
let key = defeat ? 'id' : 'customerPhone' const isOrderSearch = !defeat && userInfo.sceneType == 1
let key = defeat || isOrderSearch ? 'id' : 'customerPhone'
console.log(data, idKey) console.log(data, idKey)
if (data[idKey]) { if (data[idKey]) {
this.currentId = data[idKey] this.currentId = data[idKey]
...@@ -88,14 +96,16 @@ export default { ...@@ -88,14 +96,16 @@ export default {
this.getList(searchValue, true) this.getList(searchValue, true)
}, },
choose (i) { choose (i) {
let { params } = this let { params, userInfo } = this
let key = params.defeat ? 'id' : 'customerPhone' const isOrderSearch = !params.defeat && userInfo.sceneType == 1
let key = params.defeat || isOrderSearch ? 'id' : 'customerPhone'
this.currentId = i[key] this.currentId = i[key]
this.$emit('choose', i) this.$emit('choose', i)
}, },
checkActive (i) { checkActive (i) {
let { currentId, data, params } = this let { currentId, data, params, userInfo } = this
let key = params.defeat ? 'id' : 'customerPhone' const isOrderSearch = !params.defeat && userInfo.sceneType == 1
let key = params.defeat || isOrderSearch ? 'id' : 'customerPhone'
return currentId ? (i[key] == currentId) : (i[key]) == data[params.idKey] return currentId ? (i[key] == currentId) : (i[key]) == data[params.idKey]
} }
} }
......
...@@ -420,6 +420,17 @@ export default { ...@@ -420,6 +420,17 @@ export default {
this.pageParams.customerQr = '' this.pageParams.customerQr = ''
this.$refs.couponPopup.open() this.$refs.couponPopup.open()
this.customerType = customerType this.customerType = customerType
if (customerInfo.inviteRecordId) {
this.customerInfo = customerInfo
this.pageParams.carInfo = {
carChildsBrandId: customerInfo.carChildsBrandId,
carChildsBrandName: customerInfo.carChildsBrandName,
carBrandId: customerInfo.carBrandId,
carBrand: customerInfo.carBrand,
id: customerInfo.carSeriesId,
name: customerInfo.carSeriesName
}
}
if (customerInfo.customerCouponId) { if (customerInfo.customerCouponId) {
try { try {
uni.showLoading({ uni.showLoading({
...@@ -443,8 +454,6 @@ export default { ...@@ -443,8 +454,6 @@ export default {
if (data) { if (data) {
this.pageParams.customerCouponId = customerInfo.customerCouponId this.pageParams.customerCouponId = customerInfo.customerCouponId
this.pageParams.customerQr = data this.pageParams.customerQr = data
if (customerInfo.inviteRecordId) this.customerInfo = customerInfo
} else throw '生成小程序码失败,请重试!' } else throw '生成小程序码失败,请重试!'
} else throw message } else throw message
......
...@@ -245,6 +245,7 @@ export default { ...@@ -245,6 +245,7 @@ export default {
this.$refs.invitationCanvas.clearBoard() this.$refs.invitationCanvas.clearBoard()
}, },
openDetail (e) { openDetail (e) {
console.log('openDetail**e**', e);
this.couponPopupRef.open(0, { this.couponPopupRef.open(0, {
...e, ...e,
phoneNumber: e.customerPhone, phoneNumber: e.customerPhone,
......
...@@ -291,6 +291,11 @@ export default { ...@@ -291,6 +291,11 @@ export default {
showPayTips () { showPayTips () {
if (this.orderObj.payeeType == 0 && this.orderObj.selectPayType == 7) return true if (this.orderObj.payeeType == 0 && this.orderObj.selectPayType == 7) return true
else return false else return false
},
// 轻改场景:隐藏场景名称表单项(仅展示层)
hideSceneNameField () {
const { sceneType } = this.userInfo || {}
return sceneType == 1
} }
}, },
onload (options) { onload (options) {
...@@ -332,6 +337,9 @@ export default { ...@@ -332,6 +337,9 @@ export default {
} else { } else {
item.hidden = item._originHidden item.hidden = item._originHidden
} }
if (item.value === 'baseSceneCode' && this.hideSceneNameField) {
item.hidden = true
}
}) })
}) })
this.formList = list this.formList = list
......
...@@ -654,7 +654,12 @@ const popupTypeEnum = { ...@@ -654,7 +654,12 @@ const popupTypeEnum = {
// 订单类型弹窗(OrderTypePopup) // 订单类型弹窗(OrderTypePopup)
key: 'djOrderType', key: 'djOrderType',
list: '' list: ''
},
19: {
key: 'customer'
} }
} }
export { FORM_LIST, popupTypeEnum, payTypeList, DEFEAT_FORM_LIST } const titleList = [null, { addHtml: 'customer' }]
export { FORM_LIST, popupTypeEnum, payTypeList, DEFEAT_FORM_LIST, titleList }
...@@ -50,6 +50,14 @@ ...@@ -50,6 +50,14 @@
</view> </view>
</picker> </picker>
</template> </template>
<template v-else-if="i.type == 'radio'">
<radio-group class="radio-group flex" @change="radioChange($event, i)">
<label class="radio-item flex" v-for="item in i.radioList" :key="item.value">
<radio style="transform: scale(0.7)" :value="item.value" :checked="customerInfo[i.key] == item.value" />
<view class="radio-name">{{ item.name }}</view>
</label>
</radio-group>
</template>
<template v-else> <template v-else>
<view <view
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
...@@ -104,6 +112,14 @@ ...@@ -104,6 +112,14 @@
</view> </view>
</picker> </picker>
</template> </template>
<template v-else-if="i.type == 'radio'">
<radio-group class="radio-group flex" @change="radioChange($event, i)">
<label class="radio-item flex" v-for="item in i.radioList" :key="item.value">
<radio style="transform: scale(0.7)" :value="item.value" :checked="customerInfo[i.key] == item.value" />
<view class="radio-name">{{ item.name }}</view>
</label>
</radio-group>
</template>
<template v-else> <template v-else>
<view <view
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
...@@ -207,12 +223,15 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -207,12 +223,15 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
} }
], ],
default_optionalForm = [{ default_optionalForm = [{
label: '车架号', label: '性别',
valueKey: 'standNo', valueKey: 'customerSex',
key: 'standNo', key: 'customerSex',
type: 'input', type: 'radio',
inputType: 'text', current: 1,
maxlength: 17 radioList: [
{ value: 1, name: '男' },
{ value: 2, name: '女' }
]
}, },
{ {
label: '到店日期', label: '到店日期',
...@@ -222,6 +241,14 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -222,6 +241,14 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
dateFromToday: true dateFromToday: true
}, },
{ {
label: '车架号',
valueKey: 'standNo',
key: 'standNo',
type: 'input',
inputType: 'text',
maxlength: 17
},
{
label: '建档日期', label: '建档日期',
valueKey: 'filingDate', valueKey: 'filingDate',
key: 'filingDate', key: 'filingDate',
...@@ -288,6 +315,7 @@ export default { ...@@ -288,6 +315,7 @@ export default {
this.customerInfo = { this.customerInfo = {
customerName: '', customerName: '',
customerPhone: '', customerPhone: '',
customerSex: 1,
carTypeName: '', carTypeName: '',
carChildsBrandId: '', carChildsBrandId: '',
carChildsBrandName: '', carChildsBrandName: '',
...@@ -312,6 +340,11 @@ export default { ...@@ -312,6 +340,11 @@ export default {
if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD") if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD")
if (res.filingDate) res.filingDate = dayjs(res.filingDate).format("YYYY-MM-DD") if (res.filingDate) res.filingDate = dayjs(res.filingDate).format("YYYY-MM-DD")
this.customerInfo = res this.customerInfo = res
if (this.customerInfo.customerSex != null && this.customerInfo.customerSex !== '') {
this.customerInfo.customerSex = Number(this.customerInfo.customerSex)
} else {
this.customerInfo.customerSex = 1
}
if (!this.customerInfo.filingDate) { if (!this.customerInfo.filingDate) {
this.customerInfo.filingDate = dayjs().format('YYYY-MM-DD') this.customerInfo.filingDate = dayjs().format('YYYY-MM-DD')
} }
...@@ -367,6 +400,11 @@ export default { ...@@ -367,6 +400,11 @@ export default {
getDatePickerEnd (field) { getDatePickerEnd (field) {
return field.dateUnlimited ? '2099-12-31' : this.endDate return field.dateUnlimited ? '2099-12-31' : this.endDate
}, },
radioChange (e, field) {
const raw = e.detail.value
const sampleVal = field.radioList?.[0]?.value
this.customerInfo[field.key] = typeof sampleVal === 'number' ? Number(raw) : raw
},
bindDateChange (e, valueKey) { bindDateChange (e, valueKey) {
const value = e.detail.value const value = e.detail.value
this.customerInfo[valueKey] = value this.customerInfo[valueKey] = value
...@@ -503,10 +541,11 @@ export default { ...@@ -503,10 +541,11 @@ export default {
baseSceneCode:'100101', baseSceneCode:'100101',
customerName:params.customerName, customerName:params.customerName,
customerPhone:params.customerPhone, customerPhone:params.customerPhone,
customerSex: params.customerSex,
carBrand:params.carBrand, carBrand:params.carBrand,
carBrandId:params.carBrandId, carBrandId:params.carBrandId,
carChildsBrandId: params.carTypeId, carChildsBrandId: params.oneCarBrandId,
carChildsBrandName: params.carTypeName, carChildsBrandName: params.oneCarBrand,
standNo:params.standNo, standNo:params.standNo,
carSeriesId:params.carTypeId, carSeriesId:params.carTypeId,
carSeriesName:params.carTypeName, carSeriesName:params.carTypeName,
...@@ -707,6 +746,19 @@ export default { ...@@ -707,6 +746,19 @@ export default {
.error { .error {
border: toRpx(2) solid #f24724 !important; border: toRpx(2) solid #f24724 !important;
} }
.radio-group {
width: toRpx(738);
height: toRpx(76);
align-items: center;
gap: toRpx(48);
}
.radio-item {
align-items: center;
}
.radio-name {
color: #333333;
font-size: toRpx(28);
}
} }
.btns { .btns {
justify-content: center; justify-content: center;
......
...@@ -77,6 +77,14 @@ ...@@ -77,6 +77,14 @@
</view> </view>
</picker> </picker>
</template> </template>
<template v-else-if="i.type == 'radio'">
<radio-group class="radio-group flex" @change="radioChange($event, i)">
<label class="radio-item flex" v-for="item in i.radioList" :key="item.value">
<radio style="transform: scale(0.7)" :value="item.value" :checked="customerInfo[i.key] == item.value" />
<view class="radio-name">{{ item.name }}</view>
</label>
</radio-group>
</template>
<template v-else> <template v-else>
<view <view
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
...@@ -126,6 +134,14 @@ ...@@ -126,6 +134,14 @@
</view> </view>
</picker> </picker>
</template> </template>
<template v-else-if="i.type == 'radio'">
<radio-group class="radio-group flex" @change="radioChange($event, i)">
<label class="radio-item flex" v-for="item in i.radioList" :key="item.value">
<radio style="transform: scale(0.7)" :value="item.value" :checked="customerInfo[i.key] == item.value" />
<view class="radio-name">{{ item.name }}</view>
</label>
</radio-group>
</template>
<template v-else> <template v-else>
<view <view
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
...@@ -253,8 +269,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -253,8 +269,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
}, },
{ {
label: '车型', label: '车型',
valueKey: 'carChildsBrandName', valueKey: 'carSeriesName',
key: 'carChildsBrandId', key: 'carSeriesId',
type: 'select', type: 'select',
required: true, required: true,
popKey: 'carBrandVisible' popKey: 'carBrandVisible'
...@@ -282,8 +298,19 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -282,8 +298,19 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
type: 'readonly', type: 'readonly',
required: true, required: true,
merchantNameKey: 'merchantName' merchantNameKey: 'merchantName'
},{
label: '性别',
valueKey: 'customerSex',
key: 'customerSex',
type: 'radio',
current: 1,
radioList: [
{ value: 1, name: '男' },
{ value: 2, name: '女' }
]
}], }],
default_optionalForm = [{ default_optionalForm = [
{
label: '车架号', label: '车架号',
valueKey: 'standNo', valueKey: 'standNo',
key: 'standNo', key: 'standNo',
...@@ -360,23 +387,6 @@ export default { ...@@ -360,23 +387,6 @@ export default {
goodsSubOrderList () { goodsSubOrderList () {
return this.displayInfo.goodsSubOrderDTOS.filter(item => item) return this.displayInfo.goodsSubOrderDTOS.filter(item => item)
}, },
upgradeStatusInfo () {
const { customerInfo } = this
if (customerInfo.upgradeStatusName) {
return {
label: customerInfo.upgradeStatusName,
type: this.getUpgradeStatusType(customerInfo.upgradeStatusName)
}
}
const statusMap = {
1: { label: '待跟进', type: 'warning' },
2: { label: '已升级', type: 'success' },
3: { label: '战败', type: 'failed' },
4: { label: '已退款', type: 'refund' }
}
const status = customerInfo.upgradeStatus ?? customerInfo.orderStatus
return statusMap[status] || null
},
sceneType () { sceneType () {
const { sceneType } = uni.$storage.get('userInfo') || {} const { sceneType } = uni.$storage.get('userInfo') || {}
return sceneType return sceneType
...@@ -388,6 +398,9 @@ export default { ...@@ -388,6 +398,9 @@ export default {
isStartReceptionDisabled () { isStartReceptionDisabled () {
if (this.isRequiredFormIncomplete) return true if (this.isRequiredFormIncomplete) return true
return [2, 3, 4].includes(Number(this.customerInfo.customerStatus)) return [2, 3, 4].includes(Number(this.customerInfo.customerStatus))
},
isRemarkEditable () {
return Number(this.customerInfo.orderStatus) === 3
} }
}, },
data () { data () {
...@@ -512,6 +525,7 @@ export default { ...@@ -512,6 +525,7 @@ export default {
const requestParams = { const requestParams = {
id: this.customerInfo.id, id: this.customerInfo.id,
customerName: this.customerInfo.customerName, customerName: this.customerInfo.customerName,
customerSex: this.customerInfo.customerSex,
carBrand: this.customerInfo.carBrand, carBrand: this.customerInfo.carBrand,
carBrandId: this.customerInfo.carBrandId, carBrandId: this.customerInfo.carBrandId,
carChildsBrandName: this.customerInfo.carChildsBrandName, carChildsBrandName: this.customerInfo.carChildsBrandName,
...@@ -653,13 +667,6 @@ export default { ...@@ -653,13 +667,6 @@ export default {
goodsSubOrderDTOS: Array.isArray(info.goodsSubOrderDTOS) ? info.goodsSubOrderDTOS : [] goodsSubOrderDTOS: Array.isArray(info.goodsSubOrderDTOS) ? info.goodsSubOrderDTOS : []
} }
}, },
getUpgradeStatusType (label) {
if (label === '已升级') return 'success'
if (label === '待跟进') return 'warning'
if (label === '战败') return 'failed'
if (label === '已退款') return 'refund'
return 'default'
},
initForm () { initForm () {
const { sceneType } = uni.$storage.get("userInfo") const { sceneType } = uni.$storage.get("userInfo")
default_customerForm[0].maxlength = sceneType == 1 ? 20 : 50 default_customerForm[0].maxlength = sceneType == 1 ? 20 : 50
...@@ -676,6 +683,7 @@ export default { ...@@ -676,6 +683,7 @@ export default {
this.customerInfo = { this.customerInfo = {
customerName: '', customerName: '',
customerPhone: '', customerPhone: '',
customerSex: 1,
carBrand: '', carBrand: '',
carBrandId: '', carBrandId: '',
carSeriesName: '', carSeriesName: '',
...@@ -707,8 +715,15 @@ export default { ...@@ -707,8 +715,15 @@ export default {
if (res.deliveryDate) res.deliveryDate = dayjs(res.deliveryDate).format("YYYY-MM-DD") if (res.deliveryDate) res.deliveryDate = dayjs(res.deliveryDate).format("YYYY-MM-DD")
if (res.createdDate) res.createdDate = dayjs(res.createdDate).format("YYYY-MM-DD") if (res.createdDate) res.createdDate = dayjs(res.createdDate).format("YYYY-MM-DD")
if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD") if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD")
if (res.carChildsBrandId) res.carChildsBrandId = res.carSeriesId
if (res.carChildsBrandName) res.carChildsBrandName = res.carSeriesName
// 合并而非整对象替换,保留 initForm 中已声明的响应式字段(如 contact_name) // 合并而非整对象替换,保留 initForm 中已声明的响应式字段(如 contact_name)
Object.assign(this.customerInfo, res) Object.assign(this.customerInfo, res)
if (this.customerInfo.customerSex != null && this.customerInfo.customerSex !== '') {
this.customerInfo.customerSex = Number(this.customerInfo.customerSex)
} else {
this.customerInfo.customerSex = 1
}
if (!this.customerInfo.createdDate) { if (!this.customerInfo.createdDate) {
this.customerInfo.createdDate = dayjs().format('YYYY-MM-DD') this.customerInfo.createdDate = dayjs().format('YYYY-MM-DD')
} }
...@@ -817,9 +832,11 @@ export default { ...@@ -817,9 +832,11 @@ export default {
this.$refs[popkey].close() this.$refs[popkey].close()
if (popkey == 'carBrandVisible') { if (popkey == 'carBrandVisible') {
this.$refs.carBrandVisible.close() this.$refs.carBrandVisible.close()
console.log('选择车型***', item);
Object.assign(this.customerInfo, { Object.assign(this.customerInfo, {
carChildsBrandName: item.name, carChildsBrandName: item.carBrand,
carChildsBrandId: item.id, carChildsBrandId: item.carBrandId,
carBrand: item.carChildsBrandName, carBrand: item.carChildsBrandName,
carBrandId: item.carChildsBrandId, carBrandId: item.carChildsBrandId,
carSeriesName: item.name, carSeriesName: item.name,
...@@ -855,6 +872,11 @@ export default { ...@@ -855,6 +872,11 @@ export default {
this.syncInviteDateFromDelivery() this.syncInviteDateFromDelivery()
} }
}, },
radioChange (e, field) {
const raw = e.detail.value
const sampleVal = field.radioList?.[0]?.value
this.customerInfo[field.key] = typeof sampleVal === 'number' ? Number(raw) : raw
},
inputBlur (e, val) { inputBlur (e, val) {
const standNoVal = this.customerInfo.standNo const standNoVal = this.customerInfo.standNo
if (val.key === 'standNo' && standNoVal) { if (val.key === 'standNo' && standNoVal) {
...@@ -1180,6 +1202,19 @@ export default { ...@@ -1180,6 +1202,19 @@ export default {
.error { .error {
border: toRpx(2) solid #f24724 !important; border: toRpx(2) solid #f24724 !important;
} }
.radio-group {
width: toRpx(738);
height: toRpx(76);
align-items: center;
gap: toRpx(48);
}
.radio-item {
align-items: center;
}
.radio-name {
color: #333333;
font-size: toRpx(28);
}
.input--readonly { .input--readonly {
color: #666666; color: #666666;
background: #f5f7fa; background: #f5f7fa;
......
import { storageApi } from '@/utils/cache'
const EVENT = {
BALL_CLICK: 'app_ai_ball_click',
THINKING_TRIGGER: 'app_ai_thinking_trigger',
QUESTION_SELECT: 'app_ai_question_select',
ANSWER_RENDER: 'app_ai_answer_render',
ERROR: 'app_ai_error'
}
function getUserId() {
const { uuid } = storageApi.getUserInfo() || {}
return uuid || ''
}
function getSessionId() {
return storageApi.getSessionId() || ''
}
function getPageContext() {
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
return currentPage?.route || '/'
}
function track(eventCode, businessParam = {}) {
if (!uni.$track) return
uni.$track.add({
eventCode,
businessParam: {
user_id: getUserId(),
session_id: getSessionId(),
...businessParam
}
})
}
export function trackAiBallClick() {
track(EVENT.BALL_CLICK, {
timestamp: Date.now(),
page_context: getPageContext()
})
}
export function trackAiThinkingTrigger(audioDuration) {
track(EVENT.THINKING_TRIGGER, {
audio_duration: audioDuration
})
}
export function trackAiQuestionSelect(intentId, intentText) {
track(EVENT.QUESTION_SELECT, {
intent_id: intentId,
intent_text: intentText
})
}
export function trackAiAnswerRender(intentId, renderTime) {
track(EVENT.ANSWER_RENDER, {
intent_id: intentId,
render_time: renderTime
})
}
export function trackAiError(errorType) {
track(EVENT.ERROR, {
error_type: errorType,
timestamp: Date.now()
})
}
export const AI_ERROR_TYPE = {
TIMEOUT: 'timeout',
NETWORK: 'network_disconnect',
NO_ANSWER: 'no_answer',
OTHER: 'other'
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!