style:调整样式

This commit is contained in:
2025-10-28 18:32:23 +08:00
parent 449c63ecc4
commit 985d739324
9 changed files with 345 additions and 74 deletions
+63 -3
View File
@@ -38,13 +38,13 @@
<view class="info-icon">
<text class="icon-text"></text>
</view>
<text class="info-text">5/小时45/24小时</text>
<text class="info-text">{{ getPricingInfoText() }}</text>
</view>
<view class="pricing-info">
<view class="info-icon">
<text class="icon-text"></text>
</view>
<text class="info-text">前15分钟内归还免费不足60分钟按60分钟计费点总封顶99元持续计费至99元视为买断</text>
<text class="info-text">{{ getDetailInfoText() }}</text>
</view>
</view>
@@ -138,6 +138,7 @@
const deviceInfo = ref({})
const deviceId = ref('')
const deviceFeeConfig = ref({})
const positionInfo = ref({})
const deviceLocation = ref('一号教学楼大厅')
const batteryLevel = ref(95)
const hasActiveOrder = ref(false)
@@ -283,6 +284,11 @@
if (res.code == 200) {
deviceInfo.value = res.data.device || {}
// 保存 position 信息
if (res.data.position) {
positionInfo.value = res.data.position
}
// 更新设备位置信息
if (deviceInfo.value.deviceLocation) {
deviceLocation.value = deviceInfo.value.deviceLocation
@@ -377,10 +383,64 @@
const selectedPkg = reactive({
time: '1小时',
price: '5.00'
price: '5'
})
const depositAmount = ref('99.00')
// 计算计费单位时间(分钟)
const getBillingUnitMinutes = () => {
if (!deviceFeeConfig.value || !deviceFeeConfig.value.hourPrice) return 60
const hourPrice = parseFloat(deviceFeeConfig.value.hourPrice)
// hourPrice 为 0.5 时表示 30 分钟,为 1 时表示 60 分钟
return hourPrice === 0.5 ? 30 : 60
}
// 计算每个计费单位的价格
const getBillingUnitPrice = () => {
if (!deviceFeeConfig.value || !deviceFeeConfig.value.maxHourPrice) return '5'
const maxHourPrice = parseFloat(deviceFeeConfig.value.maxHourPrice)
const hourPrice = parseFloat(deviceFeeConfig.value.hourPrice || 1)
// maxHourPrice 是1小时的价格,需要根据 hourPrice 换算
const unitPrice = maxHourPrice * hourPrice
return unitPrice.toFixed(2)
}
// 获取免费时间(分钟)
const getFreeMinutes = () => {
if (!positionInfo.value || !positionInfo.value.freeRentTime) return 15
return parseInt(positionInfo.value.freeRentTime)
}
// 计算24小时封顶价格
const get24HourCapPrice = () => {
if (!deviceFeeConfig.value || !deviceFeeConfig.value.maxHourPrice || !deviceFeeConfig.value.maxHour) return '45.00'
const maxHourPrice = parseFloat(deviceFeeConfig.value.maxHourPrice)
const maxHour = parseFloat(deviceFeeConfig.value.maxHour)
return (maxHourPrice * maxHour).toFixed(2)
}
// 生成计费说明文本
const getPricingInfoText = () => {
const unitMinutes = getBillingUnitMinutes()
const unitPrice = getBillingUnitPrice()
const maxHourPrice = deviceFeeConfig.value.maxHourPrice || '5'
if (unitMinutes === 30) {
return `${unitPrice}元/${unitMinutes}分钟,${maxHourPrice}元/小时`
} else {
return `${maxHourPrice}元/小时`
}
}
// 生成详细说明文本
const getDetailInfoText = () => {
const freeMinutes = getFreeMinutes()
const unitMinutes = getBillingUnitMinutes()
const depositAmount = deviceInfo.value.depositAmount || '99'
return `${freeMinutes}分钟内归还免费,不足${unitMinutes}分钟按${unitMinutes}分钟计费,封顶${depositAmount}元,持续计费至${depositAmount}元视为买断`
}
// 提交租借订单
const submitRentOrder = async (payWay) => {
try {