添加租赁申请背景图,修改导航栏样式,

This commit is contained in:
WindowBird 2025-08-16 14:39:34 +08:00
parent 656d923bde
commit 35f1f84a94
7 changed files with 740 additions and 47 deletions

View File

@ -1,3 +1,17 @@
view, swiper, swiper-item {
box-sizing: border-box;
}
.pageBg {
background: linear-gradient(to bottom, transparent, #fff 400rpx),
linear-gradient(to right, #beecd8 20%, #F4E2D8);
min-height: 80vh;
}
.loadingLayout {
padding: 30rpx 0;
}
.safe-area-inset-bottom {
height: env(safe-area-inset-bottom);
}

View File

@ -9,7 +9,6 @@
<view class="title">{{ title }}</view>
</view>
</view>
<view :style="{ height: getNavBarHeight() + 'px' }" class="fill"></view>
</view>
</template>
@ -38,7 +37,6 @@ defineProps({
left: 0;
width: 100%;
z-index: 10;
background: #ffddca;
.statusBar {
}

View File

@ -15,6 +15,8 @@ export const commonEnum = {
FIRE: 'https://api.ccttiot.com/image-1755063906561.png',
DOWN_ARROW: 'https://api.ccttiot.com/image-1755068355306.png',
FIRE_BACKGROUND: 'https://api.ccttiot.com/image-1755070666020.png',
FIRE_BACKGROUND_FULL: 'https://api.ccttiot.com/image-1755325033599.png',
COIN_BACKGROUND: 'https://api.ccttiot.com/image-1755070887001.png',
REQUEST_AGENT: 'https://api.ccttiot.com/image-1755071317260.png',
AGENCY_INTERESTS: 'https://api.ccttiot.com/image-1755071348347.png',

View File

@ -50,6 +50,13 @@
"style": {
"navigationBarTitleText": ""
}
},
{
"path" : "pages/agents/agents",
"style" :
{
"navigationStyle": "custom"
}
}
],
"tabBar": {

674
pages/agents/agents.vue Normal file
View File

@ -0,0 +1,674 @@
<template>
<view class="lease-page">
<!-- 头部区域 -->
<custom-nav-bar2 title="租赁申请"></custom-nav-bar2>
<view class="header">
<view class="header-content">
<view class="product-info">
<text class="product-name">渝锦汇节能灶燃烧器</text>
<text class="product-slogan">租来节能,灶就省钱</text>
</view>
<view class="header-graphic">
<image :src="commonEnum.FIRE" class="fire"></image>
</view>
</view>
</view>
<!-- 主要内容区域 -->
<view class="main-content">
<!-- 租赁信息表单 -->
<view class="form-section">
<view class="section-header">
<view class="section-indicator"></view>
<text class="section-title">填写租赁信息</text>
</view>
<view class="form-fields">
<!-- 姓名 -->
<view class="form-item">
<text class="field-label">姓名</text>
<input v-model="formData.name" class="field-input" placeholder="请输入姓名" />
</view>
<!-- 手机号 -->
<view class="form-item">
<text class="field-label">手机号</text>
<input
v-model="formData.phone"
class="field-input"
placeholder="请填写手机号"
type="number"
/>
</view>
<!-- 地址 -->
<view class="form-item address-form-item">
<text class="field-label">地址</text>
<view class="address-selector" @click="selectAddress">
<text class="address-text">{{ formData.address || '选择收货地址' }}</text>
<view class="map-icon-wrapper">
<text class="map-icon">📍</text>
</view>
</view>
</view>
<!-- 当前定位 -->
<view class="location-suggestion">
<view v-if="currentLocation" class="location-card">
<view class="location-content">
<view class="location-header">
<text class="location-title">当前定位</text>
<text class="location-company">{{ currentLocation.company }}</text>
</view>
<text class="location-address">{{ currentLocation.address }}</text>
</view>
<button class="use-location-btn" @click="useCurrentLocation">使用</button>
</view>
<view v-else class="location-card">
<view class="location-content">
<view class="location-header">
<text class="location-title">获取位置</text>
<text class="location-company">点击获取当前位置</text>
</view>
<text class="location-address">需要定位权限</text>
</view>
<button class="get-location-btn" @click="getCurrentLocation">获取</button>
</view>
</view>
<!-- 详细位置 -->
<view class="form-item">
<text class="field-label">详细位置</text>
<input v-model="formData.detailAddress" class="field-input" placeholder="例:6栋201室" />
</view>
<!-- 租赁设备 -->
<view class="form-item">
<text class="field-label">租赁设备</text>
<view class="selector" @click="selectEquipment">
<text class="selector-text">{{ formData.equipment || '选择设备类型' }}</text>
<text class="arrow-icon">></text>
</view>
</view>
<!-- 租赁周期 -->
<view class="form-item">
<text class="field-label">租赁周期</text>
<view class="selector" @click="selectPeriod">
<text class="selector-text">{{ formData.period || '1年' }}</text>
<text class="arrow-icon">></text>
</view>
</view>
</view>
</view>
<!-- 支付区域 -->
<view class="payment-section">
<button class="pay-button" @click="handlePayment">立即支付 ¥{{ totalAmount }}</button>
<view class="payment-details">
<view class="details-header" @click="toggleDetails">
<text class="details-title">明细</text>
<view :class="{ expanded: showDetails }" class="arrow-wrapper">
<image :src="commonEnum.DOWN_ARROW" class="details-arrow"></image>
</view>
</view>
<view v-if="showDetails" class="details-content">
<view class="detail-item">
<text class="detail-label">租金</text>
<text class="detail-value">¥{{ totalAmount }}</text>
</view>
</view>
</view>
</view>
</view>
<!-- 底部导航已由系统tabBar处理 -->
</view>
</template>
<script>
import commonEnum from '../../enum/commonEnum'
import { getLocationWithPermission, handleLocationError } from '@/utils/permission.js'
export default {
name: 'LeasePage',
computed: {
commonEnum() {
return commonEnum
},
},
onLoad() {
//
//this.getCurrentLocation()
},
data() {
return {
formData: {
name: '张珊珊',
phone: '',
address: '',
detailAddress: '',
equipment: '',
period: '1年',
},
currentLocation: null,
showDetails: false,
totalAmount: '100.10',
}
},
methods: {
//
async getCurrentLocation() {
try {
uni.showLoading({
title: '获取位置中...',
})
const location = await getLocationWithPermission()
console.log('位置信息:', location)
this.reverseGeocode(location.latitude, location.longitude)
} catch (err) {
uni.hideLoading()
handleLocationError(err)
}
},
//
reverseGeocode(latitude, longitude) {
uni.hideLoading()
// 使API
this.currentLocation = {
company: '当前位置',
address: `纬度: ${latitude.toFixed(6)}, 经度: ${longitude.toFixed(6)}`,
latitude: latitude,
longitude: longitude,
}
// 使uni-app
// #ifdef APP-PLUS || MP-WEIXIN
uni.reverseGeocoder({
location: {
latitude: latitude,
longitude: longitude,
},
success: res => {
console.log('逆地理编码结果:', res)
if (res.result) {
this.currentLocation = {
company: res.result.addressComponent?.city || '当前位置',
address:
res.result.formatted_addresses?.recommend || res.result.address || '未知地址',
latitude: latitude,
longitude: longitude,
}
}
},
fail: err => {
console.log('逆地理编码不可用,使用坐标信息')
},
})
// #endif
uni.showToast({
title: '位置获取成功',
icon: 'success',
})
},
selectAddress() {
//
uni.showToast({
title: '选择地址功能',
icon: 'none',
})
},
useCurrentLocation() {
if (!this.currentLocation) {
this.getCurrentLocation()
return
}
this.formData.address = this.currentLocation.company + ' ' + this.currentLocation.address
uni.showToast({
title: '已使用当前定位',
icon: 'success',
})
},
selectEquipment() {
//
uni.showActionSheet({
itemList: ['节能灶', '燃烧器', '燃气灶', '电磁炉'],
success: res => {
const equipmentList = ['节能灶', '燃烧器', '燃气灶', '电磁炉']
this.formData.equipment = equipmentList[res.tapIndex]
},
})
},
selectPeriod() {
//
uni.showActionSheet({
itemList: ['1个月', '3个月', '6个月', '1年', '2年'],
success: res => {
const periodList = ['1个月', '3个月', '6个月', '1年', '2年']
this.formData.period = periodList[res.tapIndex]
},
})
},
toggleDetails() {
this.showDetails = !this.showDetails
},
handlePayment() {
//
uni.showModal({
title: '确认支付',
content: `确认支付 ¥${this.totalAmount} 吗?`,
success: res => {
if (res.confirm) {
uni.showToast({
title: '支付成功',
icon: 'success',
})
}
},
})
},
// tabBar
goToHome() {
uni.switchTab({
url: '/pages/index/index',
})
},
goToProfile() {
uni.switchTab({
url: '/pages/profile/profile',
})
},
},
}
</script>
<style lang="scss" scoped>
.lease-page {
position: relative;
background: #f3f5f6;
border: #120d0d solid 2rpx;
}
//
.header {
padding: 200rpx 14rpx 10rpx 40rpx;
//border: #120d0d solid 2rpx;
background: linear-gradient(to bottom, #ffdecb 0, #f7ede6 600rpx);
.header-content {
position: relative;
}
.product-info {
margin-bottom: 40rpx;
//border: red solid 2rpx;
.product-name {
display: block;
font-size: 48rpx;
font-weight: bold;
margin-bottom: 20rpx;
color: #722b03;
}
.product-slogan {
font-size: 28rpx;
color: #f15a04;
}
}
.header-graphic {
position: absolute;
right: 0;
top: -85rpx;
//border: red solid 2rpx;
.fire {
width: 252rpx;
height: 224rpx;
}
}
}
//
.main-content {
background: #ffffff;
border-radius: 40rpx 40rpx 0 0;
margin: 0 30rpx;
padding: 40rpx;
min-height: 60vh;
//border: #120d0d solid 2rpx;
//box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.3);
}
//
.form-section {
margin-bottom: 60rpx;
//border: #0c1387 solid 2rpx;
.section-header {
display: flex;
align-items: center;
margin-bottom: 40rpx;
//border: red solid 2rpx;
.section-indicator {
width: 8rpx;
height: 40rpx;
background: #ff4757;
border-radius: 4rpx;
margin-right: 20rpx;
}
.section-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
}
}
.form-fields {
.form-item {
//margin-bottom: 40rpx;
display: flex;
align-items: center;
border-bottom: 1rpx solid #d8d8d8;
.field-label {
display: block;
font-size: 28rpx;
color: #333;
font-weight: 400;
flex: 1;
//border: 2rpx solid #d81313;
}
.field-input {
//border: 2rpx solid #d81313;
flex: 3;
height: 80rpx;
padding: 0 20rpx;
font-size: 28rpx;
&:focus {
border-color: #ff9a9e;
background: #fff;
}
}
}
}
//
.address-form-item {
margin-bottom: 20rpx;
}
//
.address-selector {
flex: 3;
display: flex;
align-items: center;
justify-content: space-between;
height: 80rpx;
padding: 0 20rpx;
border-radius: 12rpx;
transition: all 0.3s ease;
&:active {
background: #f0f0f0;
border-color: #ff6b6b;
}
.address-text {
flex: 1;
font-size: 28rpx;
color: #666;
margin-right: 20rpx;
}
.map-icon-wrapper {
display: flex;
align-items: center;
justify-content: center;
width: 40rpx;
height: 40rpx;
background: #ff6b6b;
border-radius: 50%;
.map-icon {
font-size: 24rpx;
color: white;
}
}
}
//
.location-suggestion {
margin-bottom: 40rpx;
.location-card {
display: flex;
align-items: center;
justify-content: space-between;
background: white;
border: 2rpx solid #e8f4fd;
border-radius: 16rpx;
padding: 24rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
position: relative;
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 6rpx;
background: #f3f5f6;
border-radius: 6rpx 0 0 6rpx;
}
.location-content {
flex: 1;
margin-right: 20rpx;
.location-header {
display: flex;
align-items: center;
margin-bottom: 8rpx;
.location-title {
font-size: 24rpx;
color: #ff6b6b;
font-weight: 500;
margin-right: 12rpx;
}
.location-company {
font-size: 26rpx;
color: #333;
font-weight: 500;
}
}
.location-address {
font-size: 24rpx;
color: #666;
line-height: 1.4;
}
}
.use-location-btn {
background: #f3f5f5;
color: #000000;
border: none;
border-radius: 24rpx;
padding: 12rpx 24rpx;
font-size: 24rpx;
font-weight: 500;
box-shadow: 0 4rpx 12rpx rgba(255, 107, 107, 0.3);
transition: all 0.3s ease;
&:active {
transform: translateY(2rpx);
box-shadow: 0 2rpx 8rpx rgba(255, 107, 107, 0.4);
}
}
.get-location-btn {
background: #ff6b6b;
color: #ffffff;
border: none;
border-radius: 24rpx;
padding: 12rpx 24rpx;
font-size: 24rpx;
font-weight: 500;
box-shadow: 0 4rpx 12rpx rgba(255, 107, 107, 0.3);
transition: all 0.3s ease;
&:active {
transform: translateY(2rpx);
box-shadow: 0 2rpx 8rpx rgba(255, 107, 107, 0.4);
}
}
}
}
//
.selector {
flex: 3;
display: flex;
justify-content: space-between;
align-items: center;
height: 80rpx;
border-radius: 12rpx;
padding: 0 20rpx;
transition: all 0.3s ease;
&:active {
background: #f0f0f0;
border-color: #ff6b6b;
}
.selector-text {
font-size: 28rpx;
color: #666;
}
.arrow-icon {
font-size: 24rpx;
color: #999;
transition: transform 0.3s ease;
}
&:active .arrow-icon {
transform: scale(1.2);
}
}
//
.payment-section {
display: flex;
flex-direction: column;
.pay-button {
width: 100%;
height: 100%;
background: #f15a04;
color: #fff;
border: none;
border-radius: 10rpx;
font-size: 32rpx;
font-weight: bold;
margin-bottom: 40rpx;
box-shadow: 0 10rpx 30rpx rgba(255, 154, 158, 0.3);
}
.payment-details {
.details-header {
display: flex;
align-items: center;
padding: 20rpx 0;
border-bottom: 2rpx solid #f0f0f0;
.details-title {
font-size: 28rpx;
color: #f15a04;
padding-right: 10rpx;
}
.arrow-wrapper {
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.3s ease;
&.expanded {
transform: rotate(180deg);
}
}
.details-arrow {
width: 20rpx;
height: 10rpx;
}
}
.details-content {
padding: 20rpx 0;
.detail-item {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.detail-label {
font-size: 28rpx;
color: #868686;
}
.detail-value {
font-size: 28rpx;
color: #3d3d3d;
font-weight: bold;
}
}
}
}
}
// 使tabBar
//
@keyframes pulse {
0% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(1.1);
opacity: 0.8;
}
100% {
transform: scale(1);
opacity: 1;
}
}
</style>

View File

@ -3,15 +3,11 @@
<!-- 头部区域 -->
<custom-nav-bar2 title="租赁申请"></custom-nav-bar2>
<view class="header">
<view class="header-content">
<view class="product-info">
<text class="product-name">渝锦汇节能灶燃烧器</text>
<text class="product-slogan">租来节能,灶就省钱</text>
</view>
<view class="header-graphic">
<image :src="commonEnum.FIRE" class="fire"></image>
</view>
</view>
<image
:src="commonEnum.FIRE_BACKGROUND_FULL"
class="fire-background-full"
mode="aspectFill"
></image>
</view>
<!-- 主要内容区域 -->
@ -295,52 +291,25 @@ export default {
.lease-page {
position: relative;
background: #f3f5f6;
border: #120d0d solid 2rpx;
}
//
.header {
padding: 50rpx 14rpx 10rpx 40rpx;
position: relative;
//border: #120d0d solid 2rpx;
background: white;
background: linear-gradient(to bottom, #ffdecb 0, #f7ede6 600rpx);
.header-content {
position: relative;
}
.product-info {
margin-bottom: 40rpx;
//border: red solid 2rpx;
.product-name {
display: block;
font-size: 48rpx;
font-weight: bold;
margin-bottom: 20rpx;
color: #722b03;
}
.product-slogan {
font-size: 28rpx;
color: #f15a04;
}
}
.header-graphic {
position: absolute;
right: 0;
top: -85rpx;
//border: red solid 2rpx;
.fire {
width: 252rpx;
height: 224rpx;
}
.fire-background-full {
width: 750rpx;
height: 592rpx;
}
}
//
.main-content {
position: relative;
top: -220rpx;
background: #ffffff;
border-radius: 40rpx 40rpx 0 0;
margin: 0 30rpx;

View File

@ -1,27 +1,56 @@
/**
* 获取系统信息对象同步获取只获取一次避免重复调用开销
*/
const SYSTEM_INFO = uni.getSystemInfoSync()
/**
* 获取状态栏高度单位px
* @returns {number} 状态栏高度默认兜底值15px
*/
export const getStatusBarHeight = () => SYSTEM_INFO.statusBarHeight || 15
/**
* 获取标题栏高度包含状态栏到标题栏底部的总高度
* @returns {number} 标题栏高度单位px
* @description
* - 小程序端通过胶囊按钮位置计算
* - 非小程序端返回默认值40px
*/
export const getTitleBarHeight = () => {
// 检查是否在小程序环境(支持获取菜单按钮位置)
if (uni.getMenuButtonBoundingClientRect) {
// 获取小程序菜单按钮(胶囊按钮)的布局信息
let { top, height } = uni.getMenuButtonBoundingClientRect()
// 计算公式:按钮高度 + (按钮顶部到状态栏底部的距离) * 2
return height + (top - getStatusBarHeight()) * 2
} else {
// 非小程序环境如H5/App返回默认高度
return 40
}
}
/**
* 获取整个导航栏高度状态栏 + 标题栏
* @returns {number} 导航栏总高度单位px
*/
export const getNavBarHeight = () => getStatusBarHeight() + getTitleBarHeight()
/**
* 获取左侧返回按钮的右侧边界坐标用于特殊平台布局计算
* @returns {number} 左侧图标右侧的X坐标单位px
* @platform 今日头条小程序专属逻辑
*/
export const getLeftIconLeft = () => {
// #ifdef MP-TOUTIAO
// 今日头条小程序获取自定义按钮位置信息
let {
leftIcon: { left, width },
} = tt.getCustomButtonBoundingClientRect()
return left + parseInt(width)
return left + parseInt(width) // 返回按钮右侧边界坐标
// #endif
// #ifndef MP-TOUTIAO
// 其他平台返回0表示不需要特殊处理
return 0
// #endif
}