代码优化

This commit is contained in:
BianLzhaoMin 2025-01-08 16:25:08 +08:00
parent 59784bd7c3
commit 01533c4e4c
2 changed files with 80 additions and 72 deletions

View File

@ -1,50 +1,58 @@
<template>
<!-- 装备详情 -->
<view class="swiper-container">
<van-swipe :autoplay="5000" lazy-render :show-indicators="false" @change="onSwiperChange">
<van-swipe-item v-for="image in images" :key="image.id">
<van-image fit="cover" position="center" :src="image.fileUrl" />
</van-swipe-item>
</van-swipe>
<view class="count-tip"> {{ activeIndex }}/{{ goodsPicCount }} </view>
</view>
<view>
<view class="swiper-container">
<van-swipe
:autoplay="5000"
lazy-render
:show-indicators="false"
@change="onSwiperChange"
>
<van-swipe-item v-for="image in images" :key="image.id">
<van-image fit="cover" position="center" :src="image.fileUrl" />
</van-swipe-item>
</van-swipe>
<view class="count-tip"> {{ activeIndex }}/{{ goodsPicCount }} </view>
</view>
<view class="goods-name card-style">
<view class="box_1">
<text style="color: #2cb0a0"> {{ deviceInfo.deviceName }} </text>
<view style="color: #fff">
<text class="no-bold"></text>
<text> {{ deviceInfo.dayLeasePrice }}</text>
<text class="no-bold">/ </text>
<view class="goods-name card-style">
<view class="box_1">
<text style="color: #2cb0a0"> {{ deviceInfo.deviceName }} </text>
<view style="color: #fff">
<text class="no-bold"></text>
<text> {{ deviceInfo.dayLeasePrice }}</text>
<text class="no-bold">/ </text>
</view>
</view>
<view class="text-right">
{{ deviceInfo.personPhone }} <van-icon name="phone-o"
/></view>
<view class="text-right">
<text> 发布时间{{ deviceInfo.createTime?.slice(0, 10) }} </text>
<text> 更新时间{{ deviceInfo.updateTime?.slice(0, 10) }}</text>
<text> 浏览次数{{ deviceInfo.searchNum }} </text>
</view>
</view>
<view class="text-right"> {{ deviceInfo.personPhone }} <van-icon name="phone-o" /></view>
<view class="text-right">
<text> 发布时间{{ deviceInfo.createTime?.slice(0, 10) }} </text>
<text> 更新时间{{ deviceInfo.updateTime?.slice(0, 10) }}</text>
<text> 浏览次数{{ deviceInfo.searchNum }} </text>
</view>
</view>
<view class="card-style goods-company">
<h4>安徽送变电公司</h4>
<view>
<text> 入驻时间{{ deviceInfo.companyCreateTime }} </text>
<text> 上架数量{{ deviceInfo.devUapNum }} </text>
<text> 访问量{{ deviceInfo.companyVisitNum }} </text>
<view class="card-style goods-company">
<h4>安徽送变电公司</h4>
<view>
<text> 入驻时间{{ deviceInfo.companyCreateTime }} </text>
<text> 上架数量{{ deviceInfo.devUapNum }} </text>
<text> 访问量{{ deviceInfo.companyVisitNum }} </text>
</view>
<view>
<van-icon name="location-o" />
<text> 合肥市 </text>
</view>
</view>
<view>
<van-icon name="location-o" />
<text> 合肥市 </text>
</view>
</view>
<view class="card-style goods-details">
<h4 class="h4-title">装备详情</h4>
<view v-for="item in goodsLabel" :key="item.goods_label">
<text> {{ item.goods_label }}{{ deviceInfo[item.label_content] }}</text>
</view>
<!-- <h4 class="h4-title">装备外观</h4>
<view class="card-style goods-details">
<h4 class="h4-title">装备详情</h4>
<view v-for="item in goodsLabel" :key="item.goods_label">
<text> {{ item.goods_label }}{{ deviceInfo[item.label_content] }}</text>
</view>
<!-- <h4 class="h4-title">装备外观</h4>
<van-image
style="margin-bottom: 6px"
fit="cover"
@ -67,31 +75,32 @@
<van-cell title="租赁开始时间" :value="item.leaseStartTime" />
<van-cell title="租赁结束时间" :value="item.leaseEndTime" />
</van-cell-group> -->
</view>
</view>
<van-action-bar v-show="memberStore.userType === 2" :safe-area-inset-bottom="true">
<van-action-bar-icon icon="chat-o" text="在线聊" @click="onLineMessage" />
<van-action-bar-icon
icon="shop-o"
text="预约车"
:badge="cartCount"
@click="onCartBarPage"
/>
<van-action-bar-button
color="#ffc758"
type="warning"
text="加入预约车"
@click="onAddCart"
:disabled="deviceInfo.isBookCar == 0 || userCompanyId == deviceInfo.companyId"
/>
<van-action-bar-button
color="#22ab9b"
type="danger"
text="立即租用"
@click="onRentNow"
:disabled="userCompanyId == deviceInfo.companyId"
/>
</van-action-bar>
<van-action-bar v-if="memberStore.userType === 2" :safe-area-inset-bottom="true">
<van-action-bar-icon icon="chat-o" text="在线聊" @click="onLineMessage" />
<van-action-bar-icon
icon="shop-o"
text="预约车"
:badge="cartCount"
@click="onCartBarPage"
/>
<van-action-bar-button
color="#ffc758"
type="warning"
text="加入预约车"
@click="onAddCart"
:disabled="deviceInfo.isBookCar == 0 || userCompanyId == deviceInfo.companyId"
/>
<van-action-bar-button
color="#22ab9b"
type="danger"
text="立即租用"
@click="onRentNow"
:disabled="userCompanyId == deviceInfo.companyId"
/>
</van-action-bar>
</view>
</template>
<script setup>
@ -107,6 +116,7 @@ const images = ref([])
const activeIndex = ref(1)
const deviceInfo = ref({})
const cartCount = ref(0)
const props = defineProps({
maId: {
type: [String, Number],
@ -272,7 +282,7 @@ onLoad(() => {
font-size: 14px;
color: #00a288;
}
.van-action-bar {
z-index: 10000;
.device-details {
background-color: skyblue;
}
</style>

View File

@ -4,16 +4,11 @@
<view class="tabs-container">
<van-icon name="arrow-left" @click="onHandleBack" />
<van-tabs v-model:active="activeTabs" swipeable color="#00a288" background="#c9ead4">
<van-tab v-for="(t, i) in tabList" :title="t.tab_name" />
<van-tab v-for="(t, i) in tabList" :title="t.tab_name" :key="i" />
</van-tabs>
</view>
<scroll-view
scroll-y
class="tabs-content"
:style="{ paddingBottom: actionBarHeight + 'px' }"
>
<DetailsModel v-if="activeTabs === 0" :maId="maId" />
<scroll-view scroll-y class="tabs-content" v-if="activeTabs !== 0">
<DetailsAppearance v-if="activeTabs === 1" :maId="maId" />
<DetailsProve v-if="activeTabs === 2" :maId="maId" />
<DetailsDetection v-if="activeTabs === 3" :maId="maId" />
@ -22,6 +17,9 @@
{{ tabList[activeTabs].tab_name }}
</view> -->
</scroll-view>
<scroll-view scroll-y v-else :style="{ paddingBottom: actionBarHeight + 'px' }">
<DetailsModel :maId="maId" />
</scroll-view>
</view>
</template>