add:新增会员、优惠券
This commit is contained in:
+112
-49
@@ -4,7 +4,7 @@
|
||||
<view class="card device-info-card">
|
||||
<view class="device-location">
|
||||
<view class="location-left">
|
||||
<image src="/static/images/location-map.svg" mode="aspectFit" class="location-icon"></image>
|
||||
<image src="/static/device_location.png" mode="aspectFit" class="location-icon"></image>
|
||||
<text class="location-name">{{ deviceLocation }}</text>
|
||||
</view>
|
||||
<view class="device-status" :class="deviceStatus.class">
|
||||
@@ -23,16 +23,16 @@
|
||||
<text class="card-title">{{ $t('device.pricingRules') }}</text>
|
||||
</view>
|
||||
|
||||
<view class="pricing-banner">
|
||||
<view class="pricing-main">
|
||||
<text class="price-symbol">¥</text>
|
||||
<text class="price">{{ deviceFeeConfig.maxHourPrice || '5.00' }}</text>
|
||||
<text class="unit">/{{ getPriceUnit() }}</text>
|
||||
<view class="pricing-banner">
|
||||
<view class="pricing-main">
|
||||
<text class="price-symbol">¥</text>
|
||||
<text class="price">{{ deviceFeeConfig.maxHourPrice || '5.00' }}</text>
|
||||
<text class="unit">/{{ getPriceUnit() }}</text>
|
||||
</view>
|
||||
<view class="cap-badge">
|
||||
<text class="cap-text">{{ deviceInfo.depositAmount || '99' }}{{ $t('device.capLimit') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cap-badge">
|
||||
<text class="cap-text">{{ deviceInfo.depositAmount || '99' }}{{ $t('device.capLimit') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="pricing-info">
|
||||
<view class="info-icon">
|
||||
@@ -69,6 +69,16 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="promotion-tip" @click="goToPurchase">
|
||||
<view class="tip-left">
|
||||
<text class="tip-text">{{ $t('device.canUsePromotion') }}</text>
|
||||
</view>
|
||||
<view class="tip-right">
|
||||
<text class="buy-text">{{ $t('device.goToBuy') }}</text>
|
||||
<image src="/static/gotoBuy.png" mode="aspectFit" class="arrow-icon"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部操作区 -->
|
||||
<view class="footer">
|
||||
<button class="rent-button" :class="{ 'return-button': hasActiveOrder }"
|
||||
@@ -311,7 +321,7 @@
|
||||
deviceLocation.value = res.data.position.name
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 更新设备状态
|
||||
if (deviceInfo.value.status) {
|
||||
if (deviceInfo.value.status === 'online') {
|
||||
@@ -323,14 +333,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceInfo.value.feeConfig) {
|
||||
deviceFeeConfig.value = JSON.parse(deviceInfo.value.feeConfig)[0] || {}
|
||||
console.log('deviceFeeConfig', deviceFeeConfig.value);
|
||||
} else {
|
||||
deviceFeeConfig.value = {
|
||||
maxHourPrice: '5.00',
|
||||
if (deviceInfo.value.feeConfig) {
|
||||
deviceFeeConfig.value = JSON.parse(deviceInfo.value.feeConfig)[0] || {}
|
||||
console.log('deviceFeeConfig', deviceFeeConfig.value);
|
||||
} else {
|
||||
deviceFeeConfig.value = {
|
||||
maxHourPrice: '5.00',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -352,6 +362,14 @@
|
||||
})
|
||||
}
|
||||
|
||||
// 跳转到优惠专区
|
||||
const goToPurchase = () => {
|
||||
const positionId = positionInfo.value?.positionId || positionInfo.value?.id
|
||||
uni.navigateTo({
|
||||
url: `/pages/purchase/index?positionId=${positionId}`
|
||||
})
|
||||
}
|
||||
|
||||
// 检查订单状态
|
||||
const checkOrderStatus = async () => {
|
||||
try {
|
||||
@@ -405,7 +423,7 @@
|
||||
// 按分钟计费
|
||||
if (deviceInfo.value && deviceInfo.value.feeType === 'minute') {
|
||||
return '分钟'
|
||||
}else if(deviceInfo.value && deviceFeeConfig.value.hourPrice == '0.5'){
|
||||
} else if (deviceInfo.value && deviceFeeConfig.value.hourPrice == '0.5') {
|
||||
return '30分钟'
|
||||
}
|
||||
// 按小时计费(默认)
|
||||
@@ -429,12 +447,12 @@
|
||||
const getBillingUnitPrice = () => {
|
||||
if (!deviceFeeConfig.value || !deviceFeeConfig.value.maxHourPrice) return '5'
|
||||
const maxHourPrice = parseFloat(deviceFeeConfig.value.maxHourPrice)
|
||||
|
||||
|
||||
// 按分钟计费时,直接返回每分钟价格
|
||||
if (deviceInfo.value && deviceInfo.value.feeType === 'minute') {
|
||||
return maxHourPrice.toFixed(2)
|
||||
}
|
||||
|
||||
|
||||
// 按小时计费
|
||||
const hourPrice = parseFloat(deviceFeeConfig.value.hourPrice || 1)
|
||||
const unitPrice = maxHourPrice
|
||||
@@ -517,23 +535,23 @@
|
||||
throw new Error(rentResult.msg || $t('device.rentFailed'))
|
||||
}
|
||||
|
||||
// 获取后端返回的订单信息
|
||||
const order = rentResult.data
|
||||
console.log('订单信息', order);
|
||||
// 获取后端返回的订单信息
|
||||
const order = rentResult.data
|
||||
console.log('订单信息', order);
|
||||
|
||||
// 标记:本次是从设备详情页发起的下单流程,离开页面时不设置启动路径
|
||||
try {
|
||||
uni.setStorageSync('skipSetLaunchPathOnce', true)
|
||||
} catch (e) {
|
||||
console.warn('设置 skipSetLaunchPathOnce 失败:', e)
|
||||
}
|
||||
// 标记:本次是从设备详情页发起的下单流程,离开页面时不设置启动路径
|
||||
try {
|
||||
uni.setStorageSync('skipSetLaunchPathOnce', true)
|
||||
} catch (e) {
|
||||
console.warn('设置 skipSetLaunchPathOnce 失败:', e)
|
||||
}
|
||||
|
||||
if (payWay == 'wx-pay') {
|
||||
if (payWay == 'wx-pay') {
|
||||
// 当支付方式为押金支付时
|
||||
uni.hideLoading()
|
||||
const res = await getOrderByOrderNo(order.orderNo);
|
||||
console.log(res);
|
||||
|
||||
|
||||
const deposit = parseFloat(order.depositAmount);
|
||||
const packagePrice = parseFloat(order.unitPrice);
|
||||
const totalAmount = deposit.toFixed(2);
|
||||
@@ -688,15 +706,15 @@
|
||||
align-items: center;
|
||||
|
||||
.location-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-right: 12rpx;
|
||||
background-color: #10d673;
|
||||
// background-color: #10d673;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.location-name {
|
||||
font-size: 32rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
@@ -705,7 +723,7 @@
|
||||
.device-status {
|
||||
padding: 8rpx 24rpx;
|
||||
border-radius: 30rpx;
|
||||
font-size: 24rpx;
|
||||
font-size: 22rpx;
|
||||
|
||||
&.available {
|
||||
background-color: #d4f4dd;
|
||||
@@ -734,7 +752,7 @@
|
||||
align-items: center;
|
||||
|
||||
.id-label {
|
||||
font-size: 28rpx;
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
@@ -748,7 +766,7 @@
|
||||
// 计费规则卡片
|
||||
.pricing-card {
|
||||
.pricing-banner {
|
||||
background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
|
||||
background: #E6F7EC;
|
||||
border-radius: 20rpx;
|
||||
padding: 40rpx 30rpx;
|
||||
margin-bottom: 24rpx;
|
||||
@@ -762,21 +780,21 @@
|
||||
margin-bottom: 16rpx;
|
||||
|
||||
.price-symbol {
|
||||
font-size: 48rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #07c160;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-size: 80rpx;
|
||||
font-size: 64rpx;
|
||||
font-weight: bold;
|
||||
color: #07c160;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.unit {
|
||||
font-size: 32rpx;
|
||||
font-size: 28rpx;
|
||||
color: #07c160;
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
@@ -784,11 +802,11 @@
|
||||
|
||||
.cap-badge {
|
||||
background-color: #07c160;
|
||||
padding: 10rpx 32rpx;
|
||||
padding: 10rpx 28rpx;
|
||||
border-radius: 30rpx;
|
||||
|
||||
line-height: 1;
|
||||
.cap-text {
|
||||
font-size: 26rpx;
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
}
|
||||
@@ -860,6 +878,51 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 促销提示框
|
||||
.promotion-tip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx 30rpx;
|
||||
background: rgba(255, 244, 227, 1);
|
||||
border-radius: 22rpx;
|
||||
margin-bottom: 30rpx;
|
||||
transition: all 0.3s;
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.tip-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.tip-text {
|
||||
font-size: 26rpx;
|
||||
color: #A16300;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
.tip-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
|
||||
.buy-text {
|
||||
font-size: 26rpx;
|
||||
color: #A16300;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.arrow-icon {
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 底部操作区
|
||||
.footer {
|
||||
position: fixed;
|
||||
@@ -912,10 +975,10 @@
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.credit-text {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.credit-text {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user