Commit 10a368e0 by yancanhua

Merge branch 'release/venus-usedcar-h5/1.0.0' of http://192.168.3.233:8090/monor…

…epo/venus into release/venus-usedcar-h5/1.0.0
2 parents 585fe59d 1fbcb942
Pipeline #135 for 10a368e0 failed in 0 seconds
......@@ -156,6 +156,12 @@ export interface DetailRes {
id?: number;
/** 检测完成时间 */
inspectionCompletedTime?: string;
/** 是否有事故 0 否 1 是 */
accident?: string;
/** 是否有火烧 0 否 1 是 */
burn?: string;
/** 是否有涉水 0 否 1 是 */
wade?: string;
inspectionNodeList: InspectionNodeDetail[];
inspectionScoreVO?: InspectionDetailScoreVO;
licensePlate?: string;
......
......@@ -358,27 +358,27 @@ defineExpose({
<style lang="scss" scoped>
.formTitle {
width: 100%;
float: left;
background: #ffffff;
padding: 16px 12px;
display: flex;
width: 100%;
padding: 16px 12px;
background: #fff;
}
.radioText {
color: #666666;
font-size: 12px;
padding-left: 4px;
font-size: 12px;
color: #666;
}
.customizeList {
width: 100%;
float: left;
width: 100%;
}
.customizeList50 {
width: 50% !important;
float: left;
width: 50% !important;
}
.border-bottom {
......@@ -386,11 +386,11 @@ defineExpose({
}
.loadingBox {
width: 80px;
height: 80px;
position: absolute;
top: 50%;
left: 50%;
width: 80px;
height: 80px;
transform: translate(-50%, -50%);
}
</style>
<script setup lang="ts">
import type { InspectionDetailResultVO, InspectionNodeDetail } from "@api/modules/inspect-report";
import type {
InspectionDetailResultVO,
InspectionNodeDetail,
} from "@api/modules/inspect-report";
import { computed, onMounted, onUnmounted, ref } from "vue";
import { useRoute } from "vue-router";
......@@ -7,25 +10,25 @@ import { useRoute } from "vue-router";
import { detail } from "@api/modules/inspect-report";
interface InspectItem {
descriptions: string[];
images: string[];
name: string;
status: "abnormal" | "normal";
videos: string[];
name: string;
status: "abnormal" | "normal";
descriptions: string[];
images: string[];
videos: string[];
}
interface InspectCategory {
items: InspectItem[];
name: string;
totalCount: number;
name: string;
totalCount: number;
items: InspectItem[];
}
interface DisplayGroup {
icon: string;
iconColor: string;
items: InspectItem[];
label: string;
type: "abnormal" | "normal";
type: "abnormal" | "normal";
label: string;
icon: string;
iconColor: string;
items: InspectItem[];
}
const MAX_VISIBLE = 5;
......@@ -45,9 +48,11 @@ const collapseState = ref<Record<string, boolean>>({});
* image_upload → 图片,button_select → 文字描述
* - 其他类型 → 文字描述
*/
function extractLeafData(
leaf: InspectionNodeDetail,
): { descriptions: string[]; images: string[]; videos: string[] } {
function extractLeafData(leaf: InspectionNodeDetail): {
descriptions: string[];
images: string[];
videos: string[];
} {
const vo: InspectionDetailResultVO | null = leaf.inspectionResultVO;
const descriptions: string[] = [];
const images: string[] = [];
......@@ -115,8 +120,9 @@ function buildCategories(nodes: InspectionNodeDetail[]): InspectCategory[] {
.sort((a, b) => a.sortOrder - b.sortOrder);
return modules.map((mod) => {
const children = (mod.childrenNodes ?? [])
.sort((a, b) => a.sortOrder - b.sortOrder);
const children = (mod.childrenNodes ?? []).sort(
(a, b) => a.sortOrder - b.sortOrder
);
const items: InspectItem[] = [];
for (const child of children) {
......@@ -125,8 +131,9 @@ function buildCategories(nodes: InspectionNodeDetail[]): InspectCategory[] {
items.push(leafToItem(child));
} else {
// 情况①:nodeType=2 中间分组,展开其 nodeType=3 子节点
const leafNodes = (child.childrenNodes ?? [])
.sort((a, b) => a.sortOrder - b.sortOrder);
const leafNodes = (child.childrenNodes ?? []).sort(
(a, b) => a.sortOrder - b.sortOrder
);
for (const leaf of leafNodes) {
items.push(leafToItem(leaf));
}
......@@ -135,7 +142,8 @@ function buildCategories(nodes: InspectionNodeDetail[]): InspectCategory[] {
return {
name: mod.nodeName,
totalCount: (mod.failNum ?? 0) + (mod.successNum ?? 0) + (mod.noStructureNum ?? 0),
totalCount:
(mod.failNum ?? 0) + (mod.successNum ?? 0) + (mod.noStructureNum ?? 0),
items,
};
});
......@@ -195,7 +203,8 @@ function onPreview(images: string[], index: number) {
previewVisible.value = true;
}
const CDN_BASE = "https://img02.glsx.com.cn/weapp/resource/venus/web/venus-usedcar-quality";
const CDN_BASE =
"https://img02.glsx.com.cn/weapp/resource/venus/web/venus-usedcar-quality";
const CDN = {
fail: `${CDN_BASE}/fail.png`,
success: `${CDN_BASE}/success.png`,
......@@ -318,8 +327,7 @@ onUnmounted(() => {
<div v-for="group in cat.groups"
:key="group.type"
class="group-card">
<div class="group-header"
@click="toggleCollapse(catIdx, group.type)">
<div class="group-header" @click="toggleCollapse(catIdx, group.type)">
<div class="group-header__left">
<img alt=""
class="group-type-icon"
......@@ -329,9 +337,15 @@ onUnmounted(() => {
</span>
</div>
<div class="group-header__right">
<span>{{ isExpanded(catIdx, group.type) ? '收起' : '展开' }}</span>
<span>
{{
isExpanded(catIdx, group.type) ? "收起" : "展开"
}}
</span>
<van-icon color="#969799"
:name="isExpanded(catIdx, group.type) ? 'arrow-up' : 'arrow-down'"
:name="
isExpanded(catIdx, group.type) ? 'arrow-up' : 'arrow-down'
"
size="10" />
</div>
</div>
......@@ -344,7 +358,7 @@ onUnmounted(() => {
{{ item.name }}
</div>
<div v-if="item.descriptions.length > 0" class="item-desc">
{{ item.descriptions.join('、') }}
{{ item.descriptions.join("、") }}
</div>
<div v-if="item.images.length > 0" class="image-row">
<!-- 超过5张只渲染前5张,第5张叠加 +N 遮罩,N=隐藏数量 -->
......@@ -357,7 +371,10 @@ onUnmounted(() => {
radius="4"
:src="img"
width="56" />
<div v-if="item.images.length > MAX_VISIBLE && imgIdx === MAX_VISIBLE - 1"
<div v-if="
item.images.length > MAX_VISIBLE &&
imgIdx === MAX_VISIBLE - 1
"
class="image-more-mask"
@click.stop="onPreview(item.images, MAX_VISIBLE)">
+{{ item.images.length - MAX_VISIBLE }}
......@@ -465,7 +482,8 @@ onUnmounted(() => {
}
.category-name {
font-weight: 700;
font-size: 18px;
font-weight: 600;
}
.category-count {
......@@ -519,8 +537,24 @@ onUnmounted(() => {
}
.inspect-item {
box-sizing: border-box;
padding: $spacing-md $spacing-base;
margin: 0 12px ;
background: #f8f9fb;
border-top: 1px solid #f2f3f5;
border-radius: 0;
&:first-child:not(:last-child) {
border-radius: 8px 8px 0 0;
}
&:last-child:not(:first-child) {
border-radius: 0 0 8px 8px;
}
&:first-child:last-child {
border-radius: 8px;
}
}
.item-name {
......@@ -536,7 +570,7 @@ onUnmounted(() => {
font-size: 13px;
line-height: 1.6;
// font-size: $font-size-sm;
color:#999;
color: #999;
}
.image-row {
......
......@@ -34,6 +34,7 @@ const reportData = ref({
carName: "",
licensePlate: "",
vin: "",
emissionStandard: "",
coverUrl: "",
tags: [] as { text: string; type: string }[],
registrationDate: "",
......@@ -44,9 +45,12 @@ const reportData = ref({
appearanceScore: 0,
skeletonLevel: "",
interiorLevel: "",
hasAccident: false,
hasFire: false,
hasFlood: false,
/** 是否有事故 0 否 1 是 */
accident: "0",
/** 是否有火烧 0 否 1 是 */
burn: "0",
/** 是否有涉水 0 否 1 是 */
wade: "0",
scoreDescriptions: [] as { label: string; text: string }[],
totalInspectItems: 0,
inspectDetails: [] as {
......@@ -62,6 +66,31 @@ const reportData = ref({
albums: [] as FileInfo[],
});
function isInspectionRiskYes(value: null | number | string | undefined): boolean {
if (value === null || value === undefined) {
return false;
}
return String(value) === "1";
}
const riskIndicatorItems = computed(() => {
const d = reportData.value;
const item = (field: "accident" | "burn" | "wade", yesLabel: string, noLabel: string) => {
const active = isInspectionRiskYes(d[field]);
return {
key: field,
active,
label: active ? yesLabel : noLabel,
icon: active ? CDN.fail : CDN.success,
};
};
return [
item("accident", "事故", "无事故"),
item("burn", "火烧", "无火烧"),
item("wade", "涉水", "无涉水"),
];
});
// ===== 接口请求 =====
const loading = ref(false);
......@@ -91,7 +120,11 @@ async function fetchDetail() {
reportData.value.registrationDate = res.registrationDate ?? "";
reportData.value.mileage = res.mileage ?? "";
reportData.value.displacement = res.displacement ?? "";
reportData.value.emissionStandard = res.emissionStandard ?? "";
reportData.value.inspectDate = res.inspectionCompletedTime ?? "";
reportData.value.accident = res.accident ?? "0";
reportData.value.burn = res.burn ?? "0";
reportData.value.wade = res.wade ?? "0";
// 车况评分
const score = res.inspectionScoreVO;
......@@ -375,8 +408,13 @@ onMounted(() => {
</div>
<div class="vehicle-plate">
<span>{{ reportData.licensePlate }}</span>
<!-- <div class="vehicle-plate__extra"> -->
<span class="vehicle-vin">{{ reportData.vin }}</span>
<span v-if="reportData.emissionStandard"
class="vehicle-emission">
{{ reportData.emissionStandard }}
</span>
<!-- </div> -->
</div>
<div class="vehicle-tags">
<img alt="认证标签"
......@@ -404,29 +442,20 @@ onMounted(() => {
</div>
<!-- 车况评分 -->
<div class="section-card">
<div class="section-card section-card--score">
<div class="section-header">
<div class="section-title-bar">
<span class="section-title">车况评分</span>
</div>
<div class="risk-indicators">
<span class="risk-item" :class="{ active: reportData.hasAccident }">
<span v-for="row in riskIndicatorItems"
:key="row.key"
class="risk-item"
:class="{ active: row.active }">
<img alt=""
class="risk-icon"
:src="CDN.fail" />
事故
</span>
<span class="risk-item" :class="{ active: reportData.hasFire }">
<img alt=""
class="risk-icon"
:src="CDN.fail" />
火烧
</span>
<span class="risk-item" :class="{ active: reportData.hasFlood }">
<img alt=""
class="risk-icon"
:src="CDN.fail" />
水泡
:src="row.icon" />
{{ row.label }}
</span>
</div>
</div>
......@@ -518,7 +547,7 @@ onMounted(() => {
<!-- 检测详情 -->
<div class="section-card">
<div class="section-header">
<div class="section-header section-header--inspect-detail">
<div class="section-title-bar">
<span class="section-title">检测详情</span>
</div>
......@@ -681,9 +710,9 @@ onMounted(() => {
font-weight: 500;
color: #fff;
cursor: pointer;
background: $color-primary;
background: #2c66f7;
border: none;
border-radius: $radius-base;
border-radius: 40px;
}
// ===== 顶部认证头 =====
......@@ -778,8 +807,8 @@ onMounted(() => {
&__badge {
position: absolute;
right: 9px;
bottom: 8px;
right: 12px;
bottom: 12px;
z-index: 1;
padding: 2px 7px;
font-size: 10px;
......@@ -822,15 +851,27 @@ onMounted(() => {
.vehicle-plate {
display: flex;
gap: $spacing-sm;
align-items: center;
align-items: flex-start;
font-size: $font-size-sm;
color: $color-text-secondary;
}
.vehicle-plate__extra {
display: flex;
flex-direction: column;
gap: 4px;
min-width: 0;
}
.vehicle-vin {
color: $color-text-disabled;
}
.vehicle-emission {
font-size: $font-size-sm;
color: $color-text-secondary;
}
.vehicle-tags {
display: flex;
flex-wrap: wrap;
......@@ -884,11 +925,15 @@ onMounted(() => {
// ===== 通用 section 卡片 =====
.section-card {
padding: $spacing-base;
margin: $spacing-md $spacing-base 0;
margin: 12px #{$spacing-base} 0;
background: #fff;
border-radius: $radius-md;
}
.section-card.section-card--score {
margin-top: 4px;
}
.section-header {
display: flex;
align-items: center;
......@@ -896,6 +941,9 @@ onMounted(() => {
padding: $spacing-base;
margin: -#{$spacing-base} -#{$spacing-base} $spacing-base;
margin-bottom: 0;
}
.section-header--inspect-detail {
background: linear-gradient(180deg, #185efe1a 0%, #185efe00 100%);
border-radius: $radius-md $radius-md 0 0;
}
......@@ -1240,6 +1288,15 @@ onMounted(() => {
overflow: hidden;
border-radius: $radius-base;
// 指示器置于轮播区域正中(默认在底部)
:deep(.van-swipe__indicators) {
top: 80%;
bottom: auto;
left: 50%;
pointer-events: none;
transform: translate(-50%, -50%);
}
:deep(.van-swipe__indicator) {
opacity: 0.65;
}
......@@ -1272,7 +1329,7 @@ onMounted(() => {
.video-slide-label {
position: absolute;
bottom: 25px;
bottom: 30px;
left: 10px;
z-index: 1;
max-width: calc(100% - 20px);
......@@ -1289,6 +1346,7 @@ onMounted(() => {
position: absolute;
top: 50%;
left: 50%;
z-index: 3;
display: flex;
align-items: center;
justify-content: center;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!