2025-11-25 17:02:05 +08:00
|
|
|
|
<script lang="ts" setup>
|
2025-12-04 17:26:59 +08:00
|
|
|
|
import { getEbikeDetailForWorkAPI } from '@/api/operator'
|
2026-01-22 17:30:52 +08:00
|
|
|
|
import { systemInfo } from '@/utils/systemInfo'
|
2025-12-04 17:26:59 +08:00
|
|
|
|
import detaileTools from './components/detaileTools.vue'
|
|
|
|
|
|
import detailModule from './components/detailModule.vue'
|
2025-11-25 17:02:05 +08:00
|
|
|
|
|
|
|
|
|
|
definePage({
|
|
|
|
|
|
style: {
|
2026-01-22 17:30:52 +08:00
|
|
|
|
navigationStyle: 'custom',
|
2025-11-25 17:02:05 +08:00
|
|
|
|
},
|
|
|
|
|
|
})
|
2025-12-04 17:26:59 +08:00
|
|
|
|
|
|
|
|
|
|
const touchBoxShow = ref(true)
|
|
|
|
|
|
const currentOffset = ref(0) // 当前滑动偏移量(相对初始位置)
|
|
|
|
|
|
const initialTop = 100 // 假设初始 top 是 100px
|
|
|
|
|
|
const currentOpacity = ref(0)
|
2026-01-22 17:30:52 +08:00
|
|
|
|
const carDetail = ref<any>({})
|
2025-11-25 17:02:05 +08:00
|
|
|
|
const currentIndex = ref(0) // 当前选中的 tabbar index
|
2025-12-04 17:26:59 +08:00
|
|
|
|
const pageNum = ref(1)
|
2026-01-22 17:30:52 +08:00
|
|
|
|
const bikeId = ref('')
|
2025-11-25 17:02:05 +08:00
|
|
|
|
const tabList = ref([
|
|
|
|
|
|
{
|
2026-01-22 17:30:52 +08:00
|
|
|
|
name: '基本信息',
|
2025-11-25 17:02:05 +08:00
|
|
|
|
},
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
function tabClick(item: any) {
|
|
|
|
|
|
const { index } = item
|
|
|
|
|
|
currentIndex.value = index
|
2025-12-04 17:26:59 +08:00
|
|
|
|
// touchBoxShow.value = index === 0
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function handleTouchMove(e: any) {
|
|
|
|
|
|
const offsetTop = e.currentTarget.offsetTop
|
|
|
|
|
|
// console.log(offsetTop)
|
|
|
|
|
|
currentOffset.value = offsetTop
|
|
|
|
|
|
// console.log((offsetTop / 200) * 1)
|
|
|
|
|
|
// console.log(Math.min(1, (offsetTop / 200) * 1))
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function handleTouchEnd(e: any) {
|
|
|
|
|
|
const { curTop } = e
|
|
|
|
|
|
if (curTop <= 310) {
|
|
|
|
|
|
currentOpacity.value = 1
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (curTop > 600) {
|
|
|
|
|
|
currentOpacity.value = 0
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2025-11-25 17:02:05 +08:00
|
|
|
|
}
|
2026-01-22 17:30:52 +08:00
|
|
|
|
// 返回
|
|
|
|
|
|
function handleBack() {
|
|
|
|
|
|
uni.navigateBack()
|
|
|
|
|
|
}
|
2025-12-04 17:26:59 +08:00
|
|
|
|
|
|
|
|
|
|
async function getEbikeDetailForWork() {
|
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
|
title: '加载中...',
|
|
|
|
|
|
})
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getEbikeDetailForWorkAPI(bikeId.value)
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
if (res) {
|
|
|
|
|
|
carDetail.value = res
|
|
|
|
|
|
carDetail.value.bikeCode = bikeId.value
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (e) {
|
|
|
|
|
|
console.error('获取车辆详情报错------>', e)
|
|
|
|
|
|
}
|
|
|
|
|
|
finally {
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onLoad((query) => {
|
2026-01-22 17:30:52 +08:00
|
|
|
|
query.bikeCode = '42548803223'
|
2025-12-04 17:26:59 +08:00
|
|
|
|
const { bikeCode } = query
|
|
|
|
|
|
if (bikeCode) {
|
|
|
|
|
|
bikeId.value = bikeCode
|
|
|
|
|
|
getEbikeDetailForWork()
|
|
|
|
|
|
}
|
2025-11-25 17:02:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-01-22 17:30:52 +08:00
|
|
|
|
<view
|
|
|
|
|
|
class="detail_container"
|
|
|
|
|
|
:style="{
|
|
|
|
|
|
height: `${systemInfo.windowHeight}px`,
|
|
|
|
|
|
backgroundColor: '#f9f9f9',
|
|
|
|
|
|
}"
|
|
|
|
|
|
>
|
|
|
|
|
|
<!-- 头部 -->
|
|
|
|
|
|
<view class="detail_container_header">
|
|
|
|
|
|
<!-- 返回 -->
|
|
|
|
|
|
<view
|
|
|
|
|
|
class="back_bar"
|
|
|
|
|
|
:style="{
|
|
|
|
|
|
height: `${systemInfo.statusBarHeight + 44}px`,
|
2025-11-25 17:02:05 +08:00
|
|
|
|
}"
|
2026-01-22 17:30:52 +08:00
|
|
|
|
>
|
|
|
|
|
|
<view class="icon_back">
|
|
|
|
|
|
<uv-icon name="arrow-left" color="#222222" size="24" @click="handleBack" />
|
|
|
|
|
|
<text class="text">车辆详情</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<!-- tab 栏 -->
|
|
|
|
|
|
<view class="tab_bar">
|
|
|
|
|
|
<uv-tabs
|
|
|
|
|
|
:list="tabList"
|
|
|
|
|
|
line-color="#222222"
|
|
|
|
|
|
:active-style="{
|
|
|
|
|
|
color: '#222222',
|
|
|
|
|
|
fontSize: '30rpx',
|
|
|
|
|
|
fontWeight: 'bold',
|
|
|
|
|
|
}"
|
|
|
|
|
|
:item-style="{
|
|
|
|
|
|
padding: '8px 15px',
|
|
|
|
|
|
}"
|
|
|
|
|
|
:inactive-style="{
|
|
|
|
|
|
color: '#222222',
|
|
|
|
|
|
fontSize: '28rpx',
|
|
|
|
|
|
}"
|
|
|
|
|
|
@click="tabClick"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</view>
|
2025-11-25 17:02:05 +08:00
|
|
|
|
</view>
|
2026-01-22 17:30:52 +08:00
|
|
|
|
<!-- 填充区:为了解决ios回弹的问题 -->
|
|
|
|
|
|
<view
|
|
|
|
|
|
:style="{ width: '100%', height: `${systemInfo.statusBarHeight + 44 + 46}px` }"
|
|
|
|
|
|
/>
|
2025-11-25 17:02:05 +08:00
|
|
|
|
<!-- 内容区域 -->
|
2026-01-22 17:30:52 +08:00
|
|
|
|
<view
|
|
|
|
|
|
class="detail_container_content"
|
|
|
|
|
|
:style="{
|
|
|
|
|
|
height: `${systemInfo.safeArea.height - (44 + (systemInfo.safeAreaInsets.bottom ? systemInfo.safeAreaInsets.bottom : 46))}px`,
|
|
|
|
|
|
}"
|
|
|
|
|
|
>
|
2025-11-25 17:02:05 +08:00
|
|
|
|
<view
|
|
|
|
|
|
class="content_slide"
|
|
|
|
|
|
:style="{
|
|
|
|
|
|
transform: `translateX(${(-currentIndex * 100) / pageNum}%)`,
|
|
|
|
|
|
transition: 'transform .3s ease-in-out',
|
|
|
|
|
|
}"
|
|
|
|
|
|
>
|
2026-01-22 17:30:52 +08:00
|
|
|
|
<!-- 基本信息 -->
|
2025-11-25 17:02:05 +08:00
|
|
|
|
<view class="content_item">
|
2026-01-22 17:30:52 +08:00
|
|
|
|
<detailModule :data="carDetail" />
|
2025-11-25 17:02:05 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2026-01-22 17:30:52 +08:00
|
|
|
|
|
2025-12-04 17:26:59 +08:00
|
|
|
|
<!-- 滑动栏 -->
|
|
|
|
|
|
<you-touchbox
|
|
|
|
|
|
v-show="touchBoxShow"
|
|
|
|
|
|
:custom-style="{
|
|
|
|
|
|
backgroundColor: '#ffffff',
|
|
|
|
|
|
borderTopLeftRadius: '20px',
|
|
|
|
|
|
borderTopRightRadius: '20px',
|
|
|
|
|
|
boxShadow: '0 2rpx 8rpx rgba(0, 0, 0, 0.4)',
|
|
|
|
|
|
|
|
|
|
|
|
}"
|
|
|
|
|
|
min-top="100"
|
|
|
|
|
|
max-top="300"
|
|
|
|
|
|
@touch-change="handleTouchMove"
|
|
|
|
|
|
@touch-end="handleTouchEnd"
|
|
|
|
|
|
>
|
|
|
|
|
|
<detaileTools :bike-code="bikeId" />
|
|
|
|
|
|
</you-touchbox>
|
|
|
|
|
|
<!-- 蒙层 -->
|
|
|
|
|
|
<view
|
|
|
|
|
|
:style="{
|
|
|
|
|
|
opacity: currentOpacity,
|
|
|
|
|
|
pointerEvents: currentOpacity > 0 ? 'auto' : 'none',
|
|
|
|
|
|
}"
|
|
|
|
|
|
class="mask"
|
|
|
|
|
|
/>
|
2025-11-25 17:02:05 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.detail_container {
|
|
|
|
|
|
width: 100%;
|
2026-01-22 17:30:52 +08:00
|
|
|
|
overflow-y: hidden;
|
2025-11-25 17:02:05 +08:00
|
|
|
|
|
2026-01-22 17:30:52 +08:00
|
|
|
|
&_header {
|
2025-11-25 17:02:05 +08:00
|
|
|
|
width: 100%;
|
2026-01-22 17:30:52 +08:00
|
|
|
|
position: fixed;
|
|
|
|
|
|
z-index: 9999;
|
|
|
|
|
|
background-color: white;
|
|
|
|
|
|
|
|
|
|
|
|
.back_bar {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
|
|
|
|
.icon_back {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
bottom: 25rpx;
|
|
|
|
|
|
left: 30rpx;
|
|
|
|
|
|
|
|
|
|
|
|
.text {
|
|
|
|
|
|
font-family: SourceHanSansCN-Medium;
|
|
|
|
|
|
font-size: 34rpx;
|
|
|
|
|
|
color: #222222;
|
|
|
|
|
|
letter-spacing: 0;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tab_bar {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding-bottom: 7px;
|
|
|
|
|
|
}
|
2025-11-25 17:02:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-22 17:30:52 +08:00
|
|
|
|
&_content {
|
2025-11-25 17:02:05 +08:00
|
|
|
|
position: relative;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
|
|
|
|
|
|
.content_slide {
|
|
|
|
|
|
display: flex;
|
2026-01-22 17:30:52 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
overflow-y: auto;
|
2025-11-25 17:02:05 +08:00
|
|
|
|
|
|
|
|
|
|
.content_item {
|
2026-01-22 17:30:52 +08:00
|
|
|
|
width: 100%; /* 或者使用 100% 如果父容器固定宽度 */
|
2025-11-25 17:02:05 +08:00
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
vertical-align: top;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-04 17:26:59 +08:00
|
|
|
|
.mask {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
bottom: 0;
|
|
|
|
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
|
|
|
|
z-index: 99;
|
|
|
|
|
|
transition: opacity 0.3s ease;
|
|
|
|
|
|
// pointer-events: none; /* 不拦截点击 */
|
2025-11-25 17:02:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|