Compare commits

...

3 Commits

Author SHA1 Message Date
赵毅
997502ef01 修改临停缴费页面的选择车辆的布局 2025-09-04 11:59:16 +08:00
赵毅
68839c2447 车牌颜色根据选择的颜色进行显示 2025-09-04 11:37:37 +08:00
赵毅
08e77df1a5 修改取消支付的信息提示 2025-09-04 09:43:24 +08:00
6 changed files with 185 additions and 61 deletions

View File

@ -3,16 +3,25 @@ page {
padding-top: 20rpx;
}
/* 车辆信息容器样式 */
.container-box{
height: 83vh;
overflow-y: auto;
}
.car-info-container {
width: 100%;
width: 92%;
background-color: #ffffff;
padding: 30rpx;
border-bottom: 1rpx solid #eeeeee;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
.car-info{
display: flex;
justify-content: space-between;
}
/* 车牌样式 */
.license-plate {
display: flex;
@ -27,6 +36,7 @@ page {
border-radius: 8rpx;
}
.plate-type {
background-color: #1890ff;
color: white;
@ -40,6 +50,62 @@ page {
font-size: 32rpx;
color: #333333;
font-weight: 500;
display: flex;
align-items: center;
padding: 15rpx 30rpx;
border-radius: 10rpx;
}
/* 蓝色车牌样式 */
.plate-color-blue {
background-color: #1890ff;
color: white;
}
/* 黄色车牌样式 */
.plate-color-yellow {
background-color: #ffc53d;
color: black;
}
/* 黑色车牌样式 */
.plate-color-black {
background-color: #333333;
color: white;
}
/* 白色车牌样式 */
.plate-color-white {
background-color: white;
color: black;
border: 1rpx solid #dddddd;
}
/* 绿色车牌样式 */
.plate-color-green {
background-color: #37bd75;
color: white;
}
/* 渐变绿底黑字车牌样式 */
.plate-color-gradient-green {
background: linear-gradient(180deg, #ffffff 0%, #2fe259 100%);
color: black;
}
/* 黄绿双拼底黑字车牌样式 */
.plate-color-yellow-green {
background: linear-gradient(90deg, #ffc53d 30%, #37bd75 0%);
color: black;
}
.plate-energy{
font-size: 24rpx;
padding: 7rpx 15rpx;
margin-left: 15rpx;
border-radius: 10rpx;
background-color: #f2f3f4;
color: #37bd75;
}
/* 添加车辆按钮样式 */

View File

@ -1,12 +1,28 @@
<template>
<view class="container">
<!-- 车辆信息区域 -->
<view class="car-info-container" v-for="(item, index) in carList" :key="index">
<view class="license-plate">
<view class="plate-type-box">
<text class="plate-type">{{ item.car_number_color }}</text>
<view class="container-box">
<view class="car-info-container" v-for="(item, index) in carList" :key="index">
<view class="car-info">
<view class="license-plate">
<view class="plate-type-box">
<text class="plate-type" :class="{
'plate-color-blue': item.car_number_color === '蓝色',
'plate-color-yellow': item.car_number_color === '黄色',
'plate-color-black': item.car_number_color === '黑色',
'plate-color-white': item.car_number_color === '白色',
'plate-color-green': item.car_number_color === '绿色',
'plate-color-gradient-green': item.car_number_color === '渐变绿底黑字',
'plate-color-yellow-green': item.car_number_color === '黄绿双拼底黑字'
}">{{ item.car_number_color }}</text>
</view>
<view class="plate-number">
{{ item.car_number }}
<view class="plate-energy" v-if="getActualCarNumberLength(item.car_number) > 7">新能源</view>
</view>
</view>
<u-icon name="trash" size="45rpx" @click="deleteCar(item)"></u-icon>
</view>
<text class="plate-number">{{ item.car_number }}</text>
</view>
</view>
@ -40,6 +56,40 @@ export default {
this.carList = res.car_list;
})
},
//
getActualCarNumberLength(carNumber) {
if (!carNumber) return 0;
//
const actualNumber = carNumber.replace(/\s/g, '');
return actualNumber.length;
},
deleteCar(item) {
uni.showModal({
title: '提示',
content: '确定删除该车辆吗?',
success: (res) => {
if (res.confirm) {
const params = {
user_id: uni.getStorageSync('userId'),
car_id: item.car_id
}
request(apiArr.deleteCar, "POST", params).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '删除成功',
icon: 'success',
duration: 2000
});
this.getCarList();
}
})
}
}
})
},
addCar() {
//
uni.navigateTo({

View File

@ -146,9 +146,8 @@ export default {
},
fail: (payErr) => {
console.log("支付失败", payErr)
uni.showToast({
title: payErr.errMsg || '支付失败',
title: payErr.errMsg == 'requestPayment:fail cancel' ? '用户取消支付' : '支付失败',
icon: 'none'
})
},

View File

@ -179,6 +179,8 @@ page {
/* 车辆下拉列表样式 */
.car-dropdown {
width: 33%;
height: 600rpx;
overflow-y: auto;
background-color: #ffffff;
border-top: 1rpx solid #f0f0f0;
position: absolute;

View File

@ -1,9 +1,9 @@
<template>
<view class="monthly-payment-container">
<!-- 顶部标题 -->
<view class="header">
<view class="header" @tap="toggleDropdown">
<text class="header-title">{{ headerTitle }}</text>
<u-icon :name="isDropdownOpen ? 'arrow-up' : 'arrow-down'" size="28" @tap="toggleDropdown"></u-icon>
<u-icon :name="isDropdownOpen ? 'arrow-up' : 'arrow-down'" size="28"></u-icon>
</view>
<!-- 下拉停车场列表 -->
<view v-if="isDropdownOpen" class="parking-list">
@ -25,7 +25,7 @@
</view>
<view class="parking-item-right">
<text class="parking-name">{{ park.parking_name }}</text>
<text class="parking-distance">{{ getParkDistance(park.lng, park.lat) }}km</text>
<text class="parking-distance">{{ park.distance }}km</text>
<text class="parking-address">{{ park.address }}</text>
</view>
<view class="parking-selected" v-if="park.isSelected"></view>
@ -194,6 +194,7 @@ export default {
methods: {
//
toggleDropdown() {
this.isCarDropdownOpen = false
this.isDropdownOpen = !this.isDropdownOpen;
},
@ -401,13 +402,10 @@ export default {
},
fail: (payErr) => {
console.log("支付失败", payErr)
uni.showToast({
title: payErr.errMsg || '支付失败',
title: payErr.errMsg == 'requestPayment:fail cancel' ? '用户取消支付' : '支付失败',
icon: 'none'
})
},
complete: () => {
//
}
})
@ -436,40 +434,49 @@ export default {
//
getParkList() {
request(apiArr.parkList, "POST", {}).then((res) => {
this.parkingLots = res.parking_list;
//
this.parkingLots = res.parking_list.map(park => {
try {
let locationData = uni.getStorageSync('location');
if (locationData) {
let location = locationData;
const userLat = location.lat;
const userLng = location.lng;
const parkLat = park.lat;
const parkLng = park.lng;
// 使Haversine
const R = 6371; //
const dLat = (parkLat - userLat) * Math.PI / 180;
const dLng = (parkLng - userLng) * Math.PI / 180;
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(userLat * Math.PI / 180) * Math.cos(parkLat * Math.PI / 180) *
Math.sin(dLng / 2) * Math.sin(dLng / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
const distance = (R * c).toFixed(1);
//
return { ...park, distance };
}
return park;
} catch (error) {
console.error('计算停车场距离时出错:', error);
return park;
}
});
//
this.parkingLots.sort((a, b) => {
//
if (a.distance !== undefined && b.distance !== undefined) {
return a.distance - b.distance;
}
if (a.distance !== undefined) return -1;
if (b.distance !== undefined) return 1;
return 0;
});
})
},
//
getParkDistance(parkLng, parkLat) {
try {
let locationData = uni.getStorageSync('location');
if (!locationData) {
return '未知';
}
let location = locationData;
const userLat = location.lat;
const userLng = location.lng;
// 使Haversine
const R = 6371; //
const dLat = (parkLat - userLat) * Math.PI / 180;
const dLng = (parkLng - userLng) * Math.PI / 180;
const a =
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(userLat * Math.PI / 180) * Math.cos(parkLat * Math.PI / 180) *
Math.sin(dLng / 2) * Math.sin(dLng / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
const distance = R * c;
//
return distance.toFixed(1);
} catch (error) {
console.error('计算距离时出错:', error);
return '未知';
}
},
},
onShow() {
this.getCarList();

View File

@ -43,7 +43,7 @@
<view class="group-price">
<view>{{ item.commodity_goods_info.sales_price }}/{{
item.commodity_goods_info.goods_unit
}}</view>
}}</view>
<!-- 运费 -->
<view class="goods-desc" style="margin-top: 10rpx;">运费 {{
item.commodity_goods_info.freight }}</view>
@ -128,7 +128,8 @@
<text class="name">请选择自提点</text>
</view>
</view>
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view>
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon>
</view>
</view>
</view>
<view class="address-info" v-else>
@ -501,14 +502,14 @@ export default {
},
submitPayment() {
//
const supplierIds = [...new Set(this.orderList2.map(item =>
const supplierIds = [...new Set(this.orderList2.map(item =>
item.commodity_goods_info.group_buy_activity_info?.supplier_id || 'default'
))];
const allHaveZTAddress = supplierIds.every(supplierId => {
const ztAddress = this.defZTAddress.find(adItem => adItem.id == supplierId);
return !!ztAddress;
});
const ztAddress = this.defZTAddress.find(adItem => adItem.id == supplierId);
return !!ztAddress;
});
if (!allHaveZTAddress) {
uni.showToast({
@ -524,16 +525,16 @@ export default {
goods_list: Object.keys(this.supplierGroups).map(supplierId => {
const group = this.supplierGroups[supplierId];
const firstItem = group[0];
// id
this.group_buy_activity_id = firstItem.commodity_goods_info.group_buy_activity_id;
// id
const ztAddress = this.defZTAddress.find(adItem => adItem.id == supplierId) || {};
//
const currentTime = new Date().getTime();
return {
supplier_id: firstItem.commodity_goods_info.group_buy_activity_info.supplier_id,
supplier_name: firstItem.supplier_name || '',
@ -605,9 +606,8 @@ export default {
},
fail: (payErr) => {
console.log("支付失败", payErr)
uni.showToast({
title: payErr.errMsg || '支付失败',
title: payErr.errMsg == 'requestPayment:fail cancel' ? '用户取消支付' : '支付失败',
icon: 'none'
})
},