HomeLease/pages/index/index.vue

591 lines
12 KiB
Vue
Raw Normal View History

2025-08-12 15:38:25 +08:00
<template>
<view class="home-container">
2025-08-12 17:49:16 +08:00
2025-08-12 15:38:25 +08:00
<!-- 头部信息 -->
<view class="header">
<view class="location-info">
2025-08-12 16:39:15 +08:00
<image class="location" :src="commonEnum.LOCATION"></image>
2025-08-12 15:38:25 +08:00
<text class="company-name">福鼎创特物联科技有限公司</text>
<text class="arrow">></text>
</view>
</view>
<!-- 公告栏 -->
<view class="announcement-bar">
2025-08-12 17:49:16 +08:00
<image class="announcementIcon" :src="commonEnum.ANNOUNCEMENT_ICON"></image>
<view class="announcement-box">
<text class="announcement-text">暂无更多公告! 暂无更多公告! 暂无更多公告!</text>
</view>
2025-08-12 15:38:25 +08:00
</view>
<!-- 轮播图 -->
<view class="banner-section">
2025-08-13 09:58:47 +08:00
<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
:duration="duration">
<swiper-item>
<image :src="commonEnum.TEMP1"></image>
</swiper-item>
<swiper-item>
<image :src="commonEnum.TEMP1"></image>
</swiper-item>
<swiper-item>
<image :src="commonEnum.TEMP1"></image>
</swiper-item>
<swiper-item>
<image :src="commonEnum.TEMP1"></image>
</swiper-item>
</swiper>
2025-08-12 15:38:25 +08:00
</view>
<!-- 设备列表 -->
<view class="equipment-section">
<view class="section-title">我的租赁设备</view>
<view class="equipment-list">
<view
v-for="equipment in equipmentList"
:key="equipment.id"
class="equipment-item"
@click="onEquipmentClick(equipment)"
>
<image class="equipment-image" :src="equipment.image" mode="aspectFit"></image>
<view class="equipment-info">
<view class="equipment-header">
<text class="equipment-name">{{equipment.name}}</text>
<text class="status-badge" :class="equipment.status">{{equipment.status === 'normal' ? '正常' : '异常'}}</text>
</view>
<view class="equipment-details">
2025-08-13 09:58:47 +08:00
<view class="detail-item-row">
<text class="detail-item-time">租赁时间:</text>
<text class="detail-item">{{equipment.startTime}}</text>
</view>
<view class="detail-item-row">
<text class="detail-item-time">到期时间:</text>
<text class="detail-item">{{equipment.endTime}}</text>
</view>
2025-08-12 15:38:25 +08:00
</view>
<button class="renew-btn" @click.stop="onRenew(equipment)">去续费</button>
</view>
</view>
</view>
</view>
<!-- 底部导航 -->
<view class="bottom-nav">
<view
v-for="(nav, index) in ['首页', '申请租赁', '个人中心']"
:key="index"
class="nav-item"
:class="{ active: index === 0 }"
@click="onNavClick(index)"
>
2025-08-13 09:58:47 +08:00
<image
class="nav-icon"
:src="getNavIcon(index)"
mode="aspectFit"
></image>
2025-08-12 15:38:25 +08:00
<text class="nav-text">{{nav}}</text>
</view>
</view>
</view>
</template>
<script>
2025-08-12 16:39:15 +08:00
import commonEnum from "../../enum/commonEnum";
2025-08-12 15:38:25 +08:00
export default {
data() {
return {
2025-08-13 09:58:47 +08:00
background: ['color1', 'color2', 'color3'],
indicatorDots: true,
autoplay: true,
interval: 2000,
duration: 500,
2025-08-12 16:39:15 +08:00
commonEnum : commonEnum,
2025-08-12 15:38:25 +08:00
title: '设备租赁',
currentBannerIndex: 0,
bannerList: [
{
id: 1,
name: '渝锦汇',
desc: '商用节能灶燃烧器',
features: '商用节能灶燃烧器,高效节能,安全可靠,适用于各类餐饮场所。采用先进燃烧技术,热效率高,节能环保。',
image: '/static/stove.svg'
},
{
id: 2,
name: '节能燃烧器',
desc: '高效节能设备',
features: '新一代节能燃烧器热效率提升30%,节能环保,安全可靠。',
image: '/static/burner.svg'
2025-08-12 18:00:36 +08:00
},
{
id: 3,
name: '商用炉具',
desc: '专业厨房设备',
features: '专业商用炉具,采用不锈钢材质,耐高温,易清洁,适合大型餐饮场所使用。',
image: '/static/stove.svg'
},
{
id: 4,
name: '燃气灶具',
desc: '高效燃气设备',
features: '高效燃气灶具,燃烧充分,热效率高,节能环保,安全可靠。',
image: '/static/burner.svg'
},
{
id: 5,
name: '厨房设备',
desc: '一体化解决方案',
features: '提供完整的厨房设备解决方案,从设计到安装,一站式服务。',
image: '/static/stove.svg'
2025-08-12 15:38:25 +08:00
}
],
equipmentList: [
{
id: 1,
name: '商用节能灶',
status: 'normal',
startTime: '2025-07-25 13:23:59',
endTime: '2026-07-25 13:23:59',
2025-08-13 09:58:47 +08:00
image: commonEnum.TEMP2
2025-08-12 15:38:25 +08:00
},
{
id: 2,
name: '节能燃烧器',
status: 'normal',
startTime: '2025-07-25 13:23:59',
endTime: '2026-07-25 13:23:59',
2025-08-13 09:58:47 +08:00
image: commonEnum.TEMP3
2025-08-12 15:38:25 +08:00
}
]
}
},
onLoad() {
// 页面加载时的逻辑
this.startBannerAutoPlay();
},
methods: {
// 轮播图自动播放
startBannerAutoPlay() {
setInterval(() => {
this.currentBannerIndex = (this.currentBannerIndex + 1) % this.bannerList.length;
}, 3000);
},
// 点击轮播指示器
onDotClick(index) {
this.currentBannerIndex = index;
},
2025-08-12 18:00:36 +08:00
// 点击轮播图
onBannerClick(index) {
this.currentBannerIndex = index;
},
2025-08-12 15:38:25 +08:00
// 去续费
onRenew(equipment) {
uni.showToast({
title: `正在处理${equipment.name}的续费`,
icon: 'none'
});
},
// 点击设备项
onEquipmentClick(equipment) {
uni.showToast({
title: `查看${equipment.name}详情`,
icon: 'none'
});
},
// 点击底部导航
onNavClick(index) {
const navItems = ['首页', '申请租赁', '个人中心'];
uni.showToast({
title: `切换到${navItems[index]}`,
icon: 'none'
});
2025-08-13 09:58:47 +08:00
},
// 获取导航图标
getNavIcon(index) {
const isActive = index === 0; // 当前首页是激活状态
switch(index) {
case 0: // 首页
return isActive ? this.commonEnum.HOME_ACTIVE : this.commonEnum.HOME;
case 1: // 申请租赁
return isActive ? this.commonEnum.RENT_ACTIVE : this.commonEnum.RENT;
case 2: // 个人中心
return isActive ? this.commonEnum.PERSONAL_CENTER_ACTIVE : this.commonEnum.PERSONAL_CENTER;
default:
return this.commonEnum.HOME;
}
2025-08-12 15:38:25 +08:00
}
}
}
</script>
2025-08-12 16:39:15 +08:00
<style lang="scss" scoped >
2025-08-12 17:49:16 +08:00
2025-08-13 09:58:47 +08:00
.swiper {
height: 300rpx;
.swiper-item {
display: block;
height: 300rpx;
line-height: 300rpx;
text-align: center;
}
}
2025-08-12 17:49:16 +08:00
2025-08-12 15:38:25 +08:00
.home-container {
2025-08-12 17:49:16 +08:00
background: linear-gradient(
to bottom,
#FFDDCA 0px,
#FFDDCA 450rpx,
#f5f5f5 450rpx,
#f5f5f5 100%
);
2025-08-12 15:38:25 +08:00
min-height: 100vh;
padding-bottom: 120rpx; /* 为底部导航留出空间 */
max-width: 750rpx;
margin: 0 auto;
2025-08-12 17:49:16 +08:00
z-index: -2;
2025-08-12 15:38:25 +08:00
}
/* 头部信息 */
.header {
2025-08-13 09:58:47 +08:00
2025-08-12 16:39:15 +08:00
padding: 106rpx 30rpx 20rpx 30rpx;
2025-08-12 15:38:25 +08:00
display: flex;
justify-content: space-between;
align-items: center;
2025-08-13 09:58:47 +08:00
background: #FFDDCA;
z-index: 999;
2025-08-12 16:39:15 +08:00
.location-info {
display: flex;
align-items: center;
gap: 10rpx;
flex: 1;
.location{
width: 27rpx;
height: 31rpx;
}
.company-name {
color: #3D3D3D;
font-size: 16px;
font-weight: 500;
}
.arrow {
font-size: 24rpx;
color: #666;
}
}
2025-08-12 15:38:25 +08:00
}
/* 公告栏 */
.announcement-bar {
2025-08-12 17:49:16 +08:00
background: white;
opacity: 0.5;
margin: 34rpx 19rpx 0 19rpx;
2025-08-12 15:38:25 +08:00
padding: 15rpx 30rpx;
display: flex;
align-items: center;
gap: 15rpx;
overflow: hidden;
2025-08-12 17:49:16 +08:00
height: 34rpx;
border-radius: 100rpx;
2025-08-13 09:58:47 +08:00
//border: #4cd964 solid 1px;
2025-08-12 17:49:16 +08:00
.announcementIcon {
height: 32rpx;
width: 32rpx;
flex-shrink: 0;
2025-08-12 16:39:15 +08:00
}
2025-08-12 17:49:16 +08:00
.announcement-box{
flex: 1;
overflow: hidden;
position: relative;
.announcement-text {
font-size: 13px;
opacity: 1;
color: black;
white-space: nowrap;
animation: scroll-text 10s linear infinite;
2025-08-13 09:58:47 +08:00
//border: #4cd964 solid 1px;
2025-08-12 17:49:16 +08:00
display: inline-block;
padding-left: 100%;
}
@keyframes scroll-text {
0% { transform: translateX(0); }
100% { transform: translateX(-100%); }
}
2025-08-12 16:39:15 +08:00
}
2025-08-12 15:38:25 +08:00
}
2025-08-12 16:39:15 +08:00
2025-08-12 15:38:25 +08:00
/* 轮播图 */
.banner-section {
padding: 30rpx;
}
2025-08-12 18:00:36 +08:00
.banner-container {
position: relative;
height: 400rpx;
overflow: hidden;
border-radius: 20rpx;
}
2025-08-12 15:38:25 +08:00
.banner-card {
2025-08-12 18:00:36 +08:00
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
2025-08-12 15:38:25 +08:00
background: #fff;
border-radius: 20rpx;
padding: 30rpx;
display: flex;
gap: 30rpx;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
2025-08-12 18:00:36 +08:00
opacity: 0;
transform: scale(0.8);
transition: all 0.5s ease;
cursor: pointer;
}
.banner-card.active {
opacity: 1;
transform: scale(1);
2025-08-12 15:38:25 +08:00
}
.banner-left {
display: flex;
flex-direction: column;
gap: 20rpx;
flex: 1;
}
.product-info {
display: flex;
align-items: center;
gap: 10rpx;
}
.flame-icon {
font-size: 24rpx;
color: #ff4757;
}
.product-name {
font-size: 28rpx;
font-weight: bold;
color: #333;
}
.product-desc {
font-size: 24rpx;
color: #666;
}
.product-image {
width: 200rpx;
height: 150rpx;
border-radius: 10rpx;
background-color: #f8f9fa;
}
.banner-right {
flex: 1;
}
.product-features {
font-size: 24rpx;
color: #666;
line-height: 1.6;
}
.banner-dots {
display: flex;
justify-content: center;
2025-08-12 18:00:36 +08:00
gap: 15rpx;
margin-top: 30rpx;
2025-08-12 15:38:25 +08:00
}
.dot {
2025-08-12 18:00:36 +08:00
width: 20rpx;
height: 20rpx;
2025-08-12 15:38:25 +08:00
border-radius: 50%;
background-color: #ddd;
2025-08-12 18:00:36 +08:00
transition: all 0.3s ease;
cursor: pointer;
2025-08-12 15:38:25 +08:00
}
.dot.active {
background-color: #ff9a9e;
2025-08-12 18:00:36 +08:00
transform: scale(1.2);
2025-08-12 15:38:25 +08:00
}
/* 设备列表 */
.equipment-section {
padding: 0 30rpx;
}
.section-title {
2025-08-13 09:58:47 +08:00
width: 180rpx;
height: 33rpx;
background: #FFFFFF;
font-size: 14px;
font-weight: 400;
color: #3D3D3D;
2025-08-12 15:38:25 +08:00
margin-bottom: 20rpx;
2025-08-13 09:58:47 +08:00
padding: 14rpx 20rpx;
border-radius: 4px;
2025-08-12 15:38:25 +08:00
}
.equipment-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.equipment-item {
background: #fff;
border-radius: 20rpx;
padding: 30rpx;
display: flex;
gap: 30rpx;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
2025-08-13 09:58:47 +08:00
justify-content: center;
align-items: center;
.equipment-image {
width: 160rpx;
height: 106rpx;
border-radius: 10rpx;
background-color: #f8f9fa;
flex-shrink: 0;
}
2025-08-12 15:38:25 +08:00
}
.equipment-item:active {
transform: scale(0.98);
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.15);
}
.equipment-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
2025-08-13 09:58:47 +08:00
2025-08-12 15:38:25 +08:00
}
.equipment-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15rpx;
}
.equipment-name {
2025-08-13 09:58:47 +08:00
font-size: 16px;
font-weight: 500;
color: #3D3D3D;
2025-08-12 15:38:25 +08:00
}
.status-badge {
2025-08-13 09:58:47 +08:00
padding: 4rpx 26rpx;
border-radius: 5rpx;
font-size: 24rpx;
color: #40C186;
2025-08-12 15:38:25 +08:00
}
.status-badge.normal {
2025-08-13 09:58:47 +08:00
background-color: #EBFFF6;
2025-08-12 15:38:25 +08:00
}
.status-badge.warning {
background-color: #faad14;
}
.status-badge.error {
background-color: #ff4d4f;
}
.equipment-details {
display: flex;
flex-direction: column;
gap: 8rpx;
margin-bottom: 15rpx;
}
2025-08-13 09:58:47 +08:00
.detail-item-row{
display: flex;
justify-content: space-between;
.detail-item-time{
color: #817F7F;
font-size: 26rpx;
}
.detail-item {
font-size: 24rpx;
color: #666;
}
}
2025-08-12 15:38:25 +08:00
.renew-btn {
2025-08-13 09:58:47 +08:00
margin-right: 0;
2025-08-12 18:13:28 +08:00
background: #F15A04;
2025-08-12 15:38:25 +08:00
color: #fff;
2025-08-13 09:58:47 +08:00
border-radius: 5px;
padding: 0 57rpx;
font-size: 32rpx;
2025-08-12 15:38:25 +08:00
font-weight: 500;
2025-08-13 09:58:47 +08:00
margin-top: 10rpx;
2025-08-12 15:38:25 +08:00
}
/* 底部导航 */
.bottom-nav {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #fff;
display: flex;
justify-content: space-around;
align-items: center;
padding: 20rpx 0;
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.1);
z-index: 1000;
}
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 8rpx;
padding: 10rpx;
transition: all 0.3s ease;
}
.nav-item:active {
transform: scale(0.95);
}
.nav-icon {
2025-08-13 09:58:47 +08:00
width: 48rpx;
height: 48rpx;
2025-08-12 15:38:25 +08:00
}
.nav-text {
font-size: 20rpx;
color: #999;
}
.nav-item.active .nav-text {
color: #ff9a9e;
}
</style>