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'
|
|
|
|
|
import detaileTools from './components/detaileTools.vue'
|
|
|
|
|
// import { systemInfo } from '@/utils/systemInfo'
|
|
|
|
|
import detailModule from './components/detailModule.vue'
|
2025-11-25 17:02:05 +08:00
|
|
|
|
|
|
|
|
definePage({
|
|
|
|
|
style: {
|
|
|
|
|
navigationBarTitleText: '车辆详情',
|
|
|
|
|
navigationBarBackgroundColor: '#1488f5',
|
|
|
|
|
navigationBarTextStyle: 'white',
|
|
|
|
|
},
|
|
|
|
|
})
|
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)
|
|
|
|
|
|
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)
|
2025-11-25 17:02:05 +08:00
|
|
|
const tabList = ref([
|
|
|
|
|
{
|
2025-12-04 17:26:59 +08:00
|
|
|
name: '车辆信息',
|
2025-11-25 17:02:05 +08:00
|
|
|
},
|
|
|
|
|
])
|
2025-12-04 17:26:59 +08:00
|
|
|
const bikeId = ref('')
|
|
|
|
|
const carDetail = ref<any>({})
|
2025-11-25 17:02:05 +08:00
|
|
|
const contentItemInnerConfig = reactive({
|
|
|
|
|
height: 300,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function tabClick(item: any) {
|
|
|
|
|
const { index } = item
|
|
|
|
|
currentIndex.value = index
|
2025-12-04 17:26:59 +08:00
|
|
|
// touchBoxShow.value = index === 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleTouchStart(e: any) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
}
|
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) => {
|
2025-11-25 17:02:05 +08:00
|
|
|
contentItemInnerConfig.height = 48
|
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>
|
|
|
|
|
<view class="detail_container">
|
|
|
|
|
<!-- 详情页头部 -->
|
|
|
|
|
<view class="header_tabs">
|
|
|
|
|
<uv-tabs
|
|
|
|
|
:list="tabList"
|
|
|
|
|
line-color="#ffffff"
|
|
|
|
|
:active-style="{
|
|
|
|
|
color: '#ffffff',
|
|
|
|
|
fontWeight: 'bold',
|
|
|
|
|
}"
|
|
|
|
|
:item-style="{
|
|
|
|
|
padding: '8px 15px',
|
|
|
|
|
}"
|
|
|
|
|
:inactive-style="{
|
|
|
|
|
color: '#ffffff',
|
|
|
|
|
fontSize: '30rpx',
|
|
|
|
|
}"
|
|
|
|
|
@click="tabClick"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 内容区域 -->
|
|
|
|
|
<view class="content_wrapper">
|
|
|
|
|
<view
|
|
|
|
|
class="content_slide"
|
|
|
|
|
:style="{
|
|
|
|
|
transform: `translateX(${(-currentIndex * 100) / pageNum}%)`,
|
|
|
|
|
transition: 'transform .3s ease-in-out',
|
|
|
|
|
}"
|
|
|
|
|
>
|
2025-12-04 17:26:59 +08:00
|
|
|
<!-- 车辆详情 -->
|
2025-11-25 17:02:05 +08:00
|
|
|
<view class="content_item">
|
|
|
|
|
<view
|
|
|
|
|
class="content_item_inner"
|
|
|
|
|
:style="{
|
|
|
|
|
height: `calc(100vh - ${contentItemInnerConfig.height}px)`,
|
|
|
|
|
}"
|
|
|
|
|
>
|
2025-12-04 17:26:59 +08:00
|
|
|
<detailModule :data="carDetail" />
|
2025-11-25 17:02:05 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
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-start="handleTouchStart"
|
|
|
|
|
@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%;
|
|
|
|
|
|
|
|
|
|
.header_tabs {
|
|
|
|
|
width: 100%;
|
|
|
|
|
position: relative;
|
|
|
|
|
padding-bottom: 10rpx;
|
|
|
|
|
background-color: #1488f5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content_wrapper {
|
|
|
|
|
position: relative;
|
|
|
|
|
width: 100%;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
|
|
|
|
.content_slide {
|
|
|
|
|
display: flex;
|
|
|
|
|
width: max-content;
|
|
|
|
|
|
|
|
|
|
.content_item {
|
|
|
|
|
width: 100vw; /* 或者使用 100% 如果父容器固定宽度 */
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
vertical-align: top;
|
|
|
|
|
|
|
|
|
|
.content_item_inner {
|
|
|
|
|
width: 100%;
|
2025-12-04 17:26:59 +08:00
|
|
|
background-color: #f2f2f2;
|
2025-11-25 17:02:05 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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>
|