Commit 6d11eab9 by Lin

feat(reception): 添加接待页面和优化相关API

- 在 pages.json 中新增接待页面路径
- 在 customer-api.uts 中添加获取素材响应和详情的接口
- 在 receiption.uts 中扩展查询对话内容和质检列表的功能
- 重构 HomeFrame 组件,优化接待中心的展示逻辑和样式
- 更新 receptionDetail 组件以动态显示客户信息和风险评估
- 移除不再使用的 ReceptionCenter 组件及相关样式
1 parent 7e21f29f
......@@ -6,4 +6,37 @@ export function getCustomerInfoListApi(data: UTSJSONObject): Promise<any> {
'projectName': 'boutique',
...data
} as UTSJSONObject)
}
\ No newline at end of file
}
export function getMaterialResponsePage(data: UTSJSONObject): Promise<any> {
return http.post({
'method': 'dj.api.smartcarlife.customervisits.getMaterialResponsePage',
'projectName': 'boutique',
...data
} as UTSJSONObject)
}
export function getMaterialDetail(data: UTSJSONObject): Promise<any> {
return http.post({
'method': 'dj.api.smartcarlife.customervisits.getMaterialById',
'projectName': 'boutique',
...data
} as UTSJSONObject)
}
// /**接待客户素材
// *
// */
// getMaterialResponsePage (data) {
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.getMaterialResponsePage',
// projectName: 'boutique',
// ...data
// })
// },
// /**素材详情 查询素材详情 */
// getMaterialDetail (data) {
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.getMaterialById',
// projectName: 'boutique',
// ...data
// })
// },
\ No newline at end of file
......@@ -90,6 +90,39 @@ export async function findVisitsInfo(params: UTSJSONObject): Promise<any> {
}
return await http.fetch("dj.api.smartcarlife.customervisits.findVisitsInfo", data, true, "dj")
}
// /**
// * 查询对话内容
// */
// findConversationDetailByBatchIdNew(data){
// return http.post({
// method: 'dj.pad.api.reception.findConversationDetailByBatchIdNew',
// projectName: 'pad',
// ...data
// })
// },
// /**查询质检列表|侧边栏 */
// findCheckResultByBatchId (data) {
// return http.post({
// method: 'dj.pad.api.reception.findCheckResultByBatchId',
// projectName: 'pad',
// ...data
// })
// },
// /**话术标签 */
// findRecordingTagByBatchId(data) {
// return http.post({
// method: 'dj.pad.api.reception.findRecordingTagByBatchId',
// projectName: 'pad',
// ...data
// })
// },
// getShortUrl(data){
// return http.post({
// method: 'dj.api.car.boutique.inspection.batch.file.short.url',
// projectName: 'boutique',
// ...data
// })
// },
/**
* 查询客户档案详情
*/
......@@ -173,7 +206,7 @@ export async function findVisitsInfo(params: UTSJSONObject): Promise<any> {
// "merchantId": 44218339,
// "pageNum": 1,
// "pageSize": 10,
// "reviewFlag": 0,
// "reviewFlag": 0, // 0=已复盘,1=未复盘
// "orderFinishFlag": 0,
// "bussinessType": 2
// }
......
......@@ -347,8 +347,8 @@ function onCarBrandsSelect(payload: UTSJSONObject): void {
const childStr = childV != null ? `${childV}` : ''
const modelStr = modelV != null ? `${modelV}` : ''
if (oneStr != '') parts.push(oneStr)
if (childStr != '') parts.push(childStr)
// if (oneStr != '') parts.push(oneStr)
// if (childStr != '') parts.push(childStr)
if (modelStr != '') parts.push(modelStr)
formData.value.brandModel = parts.join(' ')
const modelId = payload['id']
......
<template>
<view class="output-value-box">
<text class="output-value-title">本月产值</text>
<view class="output-value">
<view class="value">
<text class="value-num">{{ formattedNumber('actualProduction') }}</text>
<text class="unit">万</text>
</view>
<view class="sub-value flex">
<text class="sub-label">个人产值</text>
<text class="num">{{ formattedNumber('personalProduction') }}万</text>
</view>
</view>
<view class="output-canvas">
<canvas id="output-chart" class="canvas"></canvas>
<view class="chart-text">
<text class="chart-label">产值贡献</text>
<text class="chart-num">{{ formattedNumber('productionContribution') }}%</text>
</view>
</view>
<view class="output-view-wrap">
<view class="output-view flex">
<view class="item flex">
<text class="item-label">目标</text>
<text class="num">{{ formattedNumber('targetProduction') }}万</text>
</view>
<view class="divider"></view>
<view class="item flex">
<text class="item-label">达成比例</text>
<text class="num">{{ formattedNumber('achievementRatio', '%') }}</text>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
/** 页面数据:actualProduction、personalProduction、targetProduction、achievementRatio、productionContribution */
const props = withDefaults(
defineProps<{
pageData?: UTSJSONObject | null
dataShow?: boolean
}>(),
{
pageData: (): UTSJSONObject => ({}),
dataShow: true
}
);
/** 格式化数字,无数据时返回 --;unit 可选,如 '%'、'万' */
function formattedNumber(key: string, unit: string | null = null): string {
const pd = props.pageData;
const ds = props.dataShow;
if (pd == null || !ds) {
return "--";
}
const val = pd[key];
if (val == null || val == "") {
return "--";
}
let str = "" + val;
if (unit != null && unit != "") {
str = str + unit;
}
return str;
}
onMounted(() => {
drawChart();
});
watch(
() => props.pageData,
() => {
drawChart();
},
{ deep: true }
);
function drawChart() {
const pd = props.pageData;
if (pd == null) return;
// 获取 contribution 值,假设是 0-100 的数字
let contribution = 0;
const val = pd['productionContribution'];
if (val != null && val != "") {
contribution = parseFloat("" + val);
}
// 限制在 0-100
if (contribution < 0) contribution = 0;
if (contribution > 100) contribution = 100;
const ctx = uni.getElementById('output-chart')?.getContext('2d') as CanvasRenderingContext2D | null;
if (ctx == null) return;
const width = 100; // canvas 宽
const height = 100; // canvas 高
const centerX = width / 2;
const centerY = height / 2;
const radius = 38; // 半径
const lineWidth = 8; // 线宽
// 清空画布
ctx.clearRect(0, 0, width, height);
// 绘制背景圆环
ctx.beginPath();
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
ctx.lineWidth = lineWidth;
ctx.strokeStyle = '#F0F2F5'; // 浅灰色背景
ctx.lineCap = 'round';
ctx.stroke();
// 绘制进度条
const startAngle = -Math.PI / 2;
const endAngle = startAngle + (contribution / 100) * 2 * Math.PI;
// 只有当有进度时才绘制
if (contribution > 0) {
ctx.beginPath();
ctx.arc(centerX, centerY, radius, startAngle, endAngle);
ctx.lineWidth = lineWidth;
ctx.strokeStyle = '#4673ff'; // 蓝色进度
ctx.lineCap = 'round';
// 增加阴影,使效果更接近设计图
ctx.shadowBlur = 4;
ctx.shadowColor = 'rgba(70, 115, 255, 0.3)';
ctx.stroke();
// 绘制完后清除阴影,以免影响其他绘制
ctx.shadowBlur = 0;
}
}
</script>
<style scoped lang="scss">
/* 本月产值 - 基准 183px,toRpx/2 换算为 px;文字样式仅写在 text 上 */
.output-value-box {
position: relative;
height: 183px;
display: flex;
flex-direction: column;
box-sizing: border-box;
background-color: #ffffff; /* 确保背景色 */
border-radius: 12px; /* 圆角 */
padding: 0;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02); /* 轻微阴影,增强卡片质感 */
}
.output-value-title {
font-size: 14px;
font-weight: 500; /* 加粗一点 */
padding: 16px 16px 0;
color: #333333;
}
.output-value {
padding: 20px 0 0 20px;
flex-shrink: 0;
}
.value {
display: flex;
align-items: baseline;
margin-bottom: 8px;
}
.value-num {
color: #4673ff;
font-size: 32px; /* 加大字体 */
line-height: 32px;
font-weight: bold;
font-family: DINAlternate-Bold, Roboto-Bold, Helvetica-Bold, sans-serif; /* 字体回退 */
}
.unit {
color: #333333;
font-size: 14px;
font-weight: 400;
margin-left: 4px;
line-height: 18px;
}
.sub-value {
display: flex;
align-items: center;
}
.sub-value .sub-label {
color: #666666; /* 稍微浅一点的灰色 */
font-size: 12px;
}
.sub-value .num {
color: #4673ff;
font-size: 14px;
font-weight: 500;
margin-left: 4px;
}
.output-canvas {
position: absolute;
right: 16px;
top: 36px;
width: 100px;
height: 100px;
display: flex;
justify-content: center;
align-items: center;
}
.canvas {
width: 100px;
height: 100px;
position: absolute;
top: 0;
left: 0;
}
.chart-text {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 1; /* 确保在 canvas 上方 */
}
.chart-label {
font-size: 10px;
color: #666666;
margin-bottom: 2px;
}
.chart-num {
font-size: 16px;
color: #4673ff;
font-weight: bold;
}
/* 底部目标/达成比例栏 */
.output-view-wrap {
position: absolute;
left: 0;
right: 0;
bottom: 16px;
display: flex;
justify-content: center;
}
.output-view {
width: 90%; /* 稍微宽一点 */
max-width: 340px;
height: 36px; /* 加高一点 */
border-radius: 18px;
background: #F5F7FF; /* 浅蓝色背景,更接近设计图 */
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
box-sizing: border-box;
}
.output-view .item {
display: flex;
justify-content: center;
align-items: center;
flex: 1;
flex-shrink: 0;
}
.output-view .item-label {
color: #333333;
font-size: 12px;
}
.output-view .num {
margin-left: 6px;
color: #4673ff;
font-size: 14px;
font-weight: bold;
}
/* 中间竖线 */
.divider {
width: 1px;
height: 14px;
background: #D8DCE6; /* 调整分隔线颜色 */
flex-shrink: 0;
margin: 0 10px;
}
</style>
......@@ -13,24 +13,24 @@
<view class="card-top">
<view class="card-left">
<view class="name-row">
<text class="customer-name">李可</text>
<text class="customer-phone">15712162828</text>
<text class="customer-name">{{ cardCustomerName }}</text>
<text class="customer-phone">{{ cardPhoneDisplay }}</text>
</view>
<view class="tag-row">
<view class="tag-item">
<text class="tag-text">AITO问界</text>
<view class="tag-item" v-if="cardTagBrand != ''">
<text class="tag-text">{{ cardTagBrand }}</text>
</view>
<view class="tag-item">
<text class="tag-text">M9</text>
<view class="tag-item" v-if="cardTagModel != ''">
<text class="tag-text">{{ cardTagModel }}</text>
</view>
</view>
</view>
<view class="card-right">
<view class="score-wrap">
<text class="score-num">77</text>
<text class="score-num">{{ cardScoreDisplay }}</text>
<text class="score-unit">分</text>
</view>
<text class="risk-text">战败风险高</text>
<text class="risk-text">{{ cardRiskDisplay }}</text>
</view>
</view>
</view>
......@@ -357,6 +357,81 @@ const props = withDefaults(
}
);
/** 从接待列表项 item 安全读字符串(与 center.uvue 列表字段一致) */
function getItemStr(key: string): string {
const it = props.item;
if (it == null) {
return "";
}
const v = it[key];
if (v == null) {
return "";
}
return `${v}`;
}
function formatPhoneDisplay(phone: string): string {
if (phone == null || phone == "") {
return "";
}
const s = phone.replace(/\s/g, "");
if (s.length >= 11) {
return s.substring(0, 3) + " " + s.substring(3, 7) + " " + s.substring(7, 11);
}
return phone;
}
const cardCustomerName = computed((): string => getItemStr("customerName"));
const cardPhoneDisplay = computed((): string => formatPhoneDisplay(getItemStr("phoneNumber")));
/** 品牌标签:优先一级品牌 oneCarBrand,否则 carBrand(与预录/档案字段对齐) */
const cardTagBrand = computed((): string => {
const one = getItemStr("oneCarBrand");
if (one != "") {
return one;
}
return getItemStr("carBrand");
});
const cardTagModel = computed((): string => {
const model = getItemStr("carModel");
if (model != "") {
return model;
}
if (getItemStr("oneCarBrand") != "") {
return getItemStr("carBrand");
}
return "";
});
/** 质检/综合得分:兼容多种后端字段名 */
const cardScoreDisplay = computed((): string => {
let s = getItemStr("totalScore");
if (s == "") {
s = getItemStr("qualityScore");
}
if (s == "") {
s = getItemStr("inspectionScore");
}
if (s == "") {
s = getItemStr("score");
}
return s != "" ? s : "--";
});
/** 右侧结果文案:优先战败风险描述,否则接待结果名(成交/战败等) */
const cardRiskDisplay = computed((): string => {
let s = getItemStr("defeatRiskDesc");
if (s == "") {
s = getItemStr("riskDesc");
}
if (s == "") {
s = getItemStr("receptionResultName");
}
return s != "" ? s : "--";
});
const emit = defineEmits<{
close: []
tabClick: [item: UTSJSONObject]
......
......@@ -52,8 +52,8 @@
<slot name="home"></slot>
</view>
<view v-else-if="tabIndex == 1" class="reception-center-wrap">
<view v-show="!showReceptionDetail" class="reception-center-inner">
<ReceptionCenterCenter @show-reception-detail="onShowReceptionDetail" />
<view class="reception-center-inner">
<ReceptionCenter @show-reception-detail="onShowReceptionDetail" />
</view>
<view v-show="showReceptionDetail" class="reception-detail-inner">
<ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" />
......@@ -107,8 +107,8 @@
</view>
<!-- 横屏接待中心:仅显示右侧列表区 -->
<view v-else-if="tabIndex == 1" class="reception-center-wrap">
<view v-show="!showReceptionDetail" class="reception-center-inner">
<ReceptionCenterCenter :only-right="true" @show-reception-detail="onShowReceptionDetail" />
<view class="reception-center-inner">
<ReceptionCenter :only-right="true" @show-reception-detail="onShowReceptionDetail" />
</view>
<view v-if="showReceptionDetail" class="reception-detail-inner">
<ReceptionDetail :item="receptionDetailItem" @close="onReceptionDetailClose" />
......@@ -153,7 +153,7 @@ import { storage } from "@/utils/storage.uts";
import HomeFrameLeftSide from "./LeftSide.uvue";
import HomeFrameMessageIndex from "./MessageIndex.uvue";
import ReceptionCenterCenter from "./ReceptionCenter/center.uvue";
import ReceptionCenter from "./ReceptionCenter/center.uvue";
import ReceptionDetail from "./ReceptionCenter/receptionDetail.uvue";
const props = defineProps<{
......@@ -211,6 +211,7 @@ function hideDetailPage(): void {
}
function onChangeTab(index: number): void {
console.log('onChangeTabAACCC', index);
tabIndex.value = index;
}
......
......@@ -23,6 +23,11 @@
"style": {
"navigationStyle": "custom"
}
},{
"path": "pages/reception/index",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/boutique/index",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!