fix:修复bug
This commit is contained in:
@@ -0,0 +1,644 @@
|
||||
<template>
|
||||
<view class="order-container">
|
||||
<!-- 状态切换 -->
|
||||
<view class="status-tabs">
|
||||
<view v-for="(tab, index) in orderStatusTabs" :key="index" class="tab-item"
|
||||
:class="{ active: currentTab === index }" @click="switchTab(index)">
|
||||
{{ tab.text }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单列表 -->
|
||||
<view class="order-list">
|
||||
<view class="empty-state" v-if="orderList.length === 0">
|
||||
<view class="empty-icon">
|
||||
<image src="/static/orderList.png" mode="aspectFill" class="empty-icon"></image>
|
||||
</view>
|
||||
<text class="empty-text">{{ $t('order.noOrderRecord') }}</text>
|
||||
</view>
|
||||
|
||||
<OrderItemCard
|
||||
v-for="(order, index) in orderList"
|
||||
:key="index"
|
||||
:order="order"
|
||||
:orderStatusMap="orderStatusMap"
|
||||
@pay="handlePayment"
|
||||
@cancel="handleCancelOrder"
|
||||
@return-device="onReturnDevice"
|
||||
@details="navigateToDetails"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted
|
||||
} from 'vue';
|
||||
import OrderItemCard from '../../components/OrderItemCard.vue';
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
getOrderList,
|
||||
queryById,
|
||||
getOrderByOrderNoScorePayStatus,
|
||||
cancelOrder,
|
||||
createWxPayment
|
||||
} from '../../config/api/order.js';
|
||||
import {
|
||||
updateUserBalance
|
||||
} from '../../config/api/user.js';
|
||||
import {
|
||||
URL
|
||||
} from '../../config/url.js';
|
||||
import { useI18n } from '@/utils/i18n.js'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
// 初始化状态
|
||||
const currentTab = ref(0);
|
||||
const orderList = ref([]);
|
||||
|
||||
// 订单状态映射
|
||||
const orderStatusMap = reactive({
|
||||
'0': {
|
||||
get text() { return t('order.waitingForPayment') },
|
||||
class: 'status-waiting'
|
||||
},
|
||||
'1': {
|
||||
get text() { return t('order.inUse') },
|
||||
class: 'status-using'
|
||||
},
|
||||
'2': {
|
||||
get text() { return t('order.finished') },
|
||||
class: 'status-finished'
|
||||
},
|
||||
'3': {
|
||||
get text() { return t('order.cancelled') },
|
||||
class: 'status-cancelled'
|
||||
},
|
||||
'waiting_for_payment': {
|
||||
get text() { return t('order.waitingForPayment') },
|
||||
class: 'status-waiting'
|
||||
},
|
||||
'in_used': {
|
||||
get text() { return t('order.inUse') },
|
||||
class: 'status-using'
|
||||
},
|
||||
'used_done': {
|
||||
get text() { return t('order.finished') },
|
||||
class: 'status-finished'
|
||||
},
|
||||
'order_cancelled': {
|
||||
get text() { return t('order.cancelled') },
|
||||
class: 'status-cancelled'
|
||||
},
|
||||
'express_return': {
|
||||
get text() { return t('express.title') },
|
||||
class: 'status-express-return'
|
||||
}
|
||||
});
|
||||
|
||||
// 订单状态标签
|
||||
const orderStatusTabs = reactive([{
|
||||
get text() { return t('common.all') },
|
||||
status: []
|
||||
},
|
||||
{
|
||||
get text() { return t('order.waitingForPayment') },
|
||||
status: ['waiting_for_payment']
|
||||
},
|
||||
{
|
||||
get text() { return t('order.inUse') },
|
||||
status: ['in_used']
|
||||
},
|
||||
{
|
||||
get text() { return t('order.finished') },
|
||||
status: ['used_done']
|
||||
},
|
||||
{
|
||||
get text() { return t('order.cancelled') },
|
||||
status: ['order_cancelled']
|
||||
}
|
||||
]);
|
||||
|
||||
// 页面加载
|
||||
onLoad(async (options) => {
|
||||
// 如果有传入orderId参数,说明是从设备租借页面跳转过来的
|
||||
if (options && options.orderId) {
|
||||
try {
|
||||
// 获取特定订单信息
|
||||
const res = await queryById(options.orderId);
|
||||
if (res.code === 200 && res.data) {
|
||||
// 获取到的订单数据
|
||||
const orderData = res.data;
|
||||
|
||||
// 使用实际的startTime字段,如果没有则尝试使用createTime
|
||||
const orderStartTime = orderData.startTime || orderData.createTime || '';
|
||||
|
||||
// 格式化订单数据
|
||||
const formattedOrder = {
|
||||
orderNo: orderData.orderId,
|
||||
status: orderData.orderStatus,
|
||||
deviceId: orderData.deviceNo,
|
||||
payWay: orderData.payWay,
|
||||
startTime: orderStartTime,
|
||||
endTime: orderData.endTime || '',
|
||||
positionName: orderData.positionName || orderData.positionLocation || '',
|
||||
deviceName: orderData.deviceName || '',
|
||||
amount: orderData.payAmount || orderData.actualDeviceAmount || orderData.currentFee || orderData.residueAmount || '0.00'
|
||||
};
|
||||
|
||||
// 将订单添加到列表开头
|
||||
orderList.value = [formattedOrder, ...orderList.value];
|
||||
|
||||
// 根据订单状态切换到对应标签
|
||||
const tabIndex = orderStatusTabs.findIndex(tab =>
|
||||
tab.status.includes(orderData.orderStatus)
|
||||
);
|
||||
|
||||
if (tabIndex !== -1) {
|
||||
switchTab(tabIndex);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取订单详情失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取订单列表
|
||||
await loadOrderList();
|
||||
});
|
||||
|
||||
// 切换标签
|
||||
const switchTab = async (index) => {
|
||||
currentTab.value = index;
|
||||
// 根据状态获取订单列表
|
||||
const statusList = orderStatusTabs[index].status[0];
|
||||
await loadOrderList(statusList);
|
||||
};
|
||||
|
||||
// 加载订单列表
|
||||
const loadOrderList = async (statusList) => {
|
||||
try {
|
||||
if(statusList!=undefined){
|
||||
statusList = {
|
||||
orderStatus:statusList
|
||||
}
|
||||
}
|
||||
const res = await getOrderList(statusList);
|
||||
if (res.code === 200 && res.data && res.data.records) {
|
||||
// 处理订单列表数据
|
||||
orderList.value = res.data.records.map(item => {
|
||||
// 使用实际的startTime字段,如果没有则尝试使用createTime
|
||||
const orderStartTime = item.startTime || item.createTime || '';
|
||||
|
||||
return {
|
||||
orderNo: item.orderNo,
|
||||
orderId: item.orderId,
|
||||
orderStatus: item.orderStatus,
|
||||
deviceId: item.deviceNo,
|
||||
payWay: item.payWay,
|
||||
startTime: orderStartTime,
|
||||
endTime: item.endTime || '',
|
||||
positionName: item.positionName || item.positionLocation || '',
|
||||
deviceName: item.deviceName || '',
|
||||
amount: item.payAmount || item.actualDeviceAmount || item.currentFee || item.residueAmount || '0.00'
|
||||
};
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取订单列表失败:', error);
|
||||
uni.showToast({
|
||||
title: t('order.getOrderListFailed'),
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 处理订单完成事件
|
||||
const handleOrderCompleted = (orderData) => {
|
||||
console.log('订单列表页收到订单完成事件:', orderData)
|
||||
// 刷新订单列表,根据当前选中的标签刷新对应状态的订单
|
||||
const statusList = orderStatusTabs[currentTab.value].status[0]
|
||||
loadOrderList(statusList)
|
||||
}
|
||||
|
||||
// 设置页面标题并监听订单完成事件
|
||||
onMounted(() => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: t('order.myOrders')
|
||||
})
|
||||
|
||||
// 监听订单完成事件
|
||||
uni.$on('orderCompleted', handleOrderCompleted)
|
||||
})
|
||||
|
||||
// 页面卸载时移除事件监听
|
||||
onUnmounted(() => {
|
||||
uni.$off('orderCompleted', handleOrderCompleted)
|
||||
})
|
||||
|
||||
// 同步订单状态
|
||||
const getOrderStatus = async (order) => {
|
||||
try {
|
||||
const res = await getOrderByOrderNoScorePayStatus(order.orderNo);
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: t('order.syncSuccess'),
|
||||
icon: 'success'
|
||||
});
|
||||
await loadOrderList(orderStatusTabs[currentTab.value].status);
|
||||
}
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: t('order.syncFailed'),
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 跳转到订单详情页面(统一入口)
|
||||
const navigateToOrderDetail = (order) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/detail?orderId=${order.orderId || order.orderNo}&deviceId=${order.deviceId}`
|
||||
});
|
||||
};
|
||||
|
||||
// 组件事件:归还设备(实际跳转到订单详情页)
|
||||
const onReturnDevice = (order) => {
|
||||
navigateToOrderDetail(order);
|
||||
};
|
||||
|
||||
// 跳转到订单详情页
|
||||
const navigateToDetails = (order) => {
|
||||
navigateToOrderDetail(order);
|
||||
};
|
||||
|
||||
// 立即支付
|
||||
const handlePayment = async (order) => {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: t('common.processing')
|
||||
});
|
||||
|
||||
// 调用后端创建微信支付订单接口
|
||||
const res = await createWxPayment(order.orderNo);
|
||||
|
||||
if (res && res.code === 200) {
|
||||
const payParams = res.data;
|
||||
|
||||
// 调用微信支付
|
||||
await uni.requestPayment({
|
||||
...payParams,
|
||||
success: async () => {
|
||||
uni.showToast({
|
||||
title: t('payment.paymentSuccess'),
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 更新用户余额
|
||||
try {
|
||||
await updateUserBalance(order.orderId || order.orderNo);
|
||||
} catch (error) {
|
||||
console.warn('更新用户余额失败:', error);
|
||||
}
|
||||
|
||||
// 刷新订单列表
|
||||
await loadOrderList(orderStatusTabs[currentTab.value].status);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('支付失败:', err);
|
||||
throw new Error(t('payment.paymentFailedRetry'));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw new Error(res?.msg || '创建支付订单失败');
|
||||
}
|
||||
|
||||
uni.hideLoading();
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: error.message || t('payment.paymentFailed'),
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 取消订单
|
||||
const handleCancelOrder = async (order) => {
|
||||
try {
|
||||
uni.showModal({
|
||||
title: t('order.confirmCancel'),
|
||||
content: t('order.confirmCancelContent'),
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: t('common.processing')
|
||||
});
|
||||
|
||||
const result = await cancelOrder({
|
||||
orderId: order.orderNo
|
||||
});
|
||||
|
||||
if (result) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: t('order.cancelSuccess'),
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 刷新订单列表
|
||||
await loadOrderList();
|
||||
} else {
|
||||
throw new Error(result.msg || t('order.cancelFailed'));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: error.message || t('order.cancelFailed'),
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.order-container {
|
||||
min-height: 100vh;
|
||||
background: #f7f8fa;
|
||||
padding-bottom: 30rpx;
|
||||
|
||||
// 状态标签栏
|
||||
.status-tabs {
|
||||
display: flex;
|
||||
background: #fff;
|
||||
padding: 0 20rpx;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
height: 90rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
position: relative;
|
||||
|
||||
&.active {
|
||||
color: #07c160;
|
||||
font-weight: 500;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 40rpx;
|
||||
height: 4rpx;
|
||||
background: #07c160;
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单列表
|
||||
.order-list {
|
||||
padding: 20rpx;
|
||||
|
||||
// 订单项
|
||||
.order-item {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 20rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
|
||||
// 订单头部
|
||||
.order-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 24rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.order-id {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.order-status {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
|
||||
&.status-waiting {
|
||||
color: #FF9800;
|
||||
}
|
||||
|
||||
&.status-using {
|
||||
color: #07c160;
|
||||
}
|
||||
|
||||
&.status-finished {
|
||||
color: #4CAF50;
|
||||
}
|
||||
|
||||
&.status-cancelled {
|
||||
color: #9E9E9E;
|
||||
}
|
||||
|
||||
&.status-express-return {
|
||||
color: #FF9800;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单内容
|
||||
.order-body {
|
||||
padding: 24rpx;
|
||||
|
||||
.device-info {
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
|
||||
.device-left {
|
||||
flex: 1;
|
||||
margin-right: 20rpx;
|
||||
|
||||
.device-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.device-id {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.device-right {
|
||||
|
||||
// 支付分标识
|
||||
.payment-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: 8rpx;
|
||||
white-space: nowrap;
|
||||
|
||||
&.wx-score {
|
||||
background: rgba(7, 193, 96, 0.08);
|
||||
|
||||
.badge-icon {
|
||||
width: 32rpx;
|
||||
height: 26rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.badge-text {
|
||||
font-size: 22rpx;
|
||||
color: #07c160;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.divider {
|
||||
margin: 0 6rpx;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.member {
|
||||
background: rgba(25, 118, 210, 0.08);
|
||||
|
||||
.badge-text {
|
||||
font-size: 22rpx;
|
||||
color: #1976D2;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
&.deposit {
|
||||
background: #f5f5f5;
|
||||
|
||||
.badge-text {
|
||||
font-size: 22rpx;
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-times {
|
||||
.time-row {
|
||||
display: flex;
|
||||
font-size: 26rpx;
|
||||
margin-bottom: 8rpx;
|
||||
|
||||
.time-label {
|
||||
color: #999;
|
||||
width: 140rpx;
|
||||
}
|
||||
|
||||
.time-value {
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单底部
|
||||
.order-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20rpx 24rpx;
|
||||
background: #fafafa;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
|
||||
.price {
|
||||
font-size: 34rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6b6b;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
|
||||
.action-item {
|
||||
font-size: 26rpx;
|
||||
padding: 10rpx 30rpx;
|
||||
border-radius: 30rpx;
|
||||
margin-left: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
&.primary {
|
||||
background: #07c160;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&.secondary {
|
||||
background: #f5f5f5;
|
||||
color: #666;
|
||||
border: 1rpx solid #e0e0e0;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 空状态
|
||||
.empty-state {
|
||||
padding: 100rpx 0;
|
||||
text-align: center;
|
||||
|
||||
.empty-icon {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
margin: 0 auto 30rpx;
|
||||
background: #f5f5f5;
|
||||
// border-radius: 50%;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,708 @@
|
||||
<template>
|
||||
<view class="payment-container">
|
||||
<!-- 地点信息卡片 -->
|
||||
<view class="location-card">
|
||||
<view class="location-header">
|
||||
<!-- <view class="location-icon">📍</view> -->
|
||||
<image src="@/static/device_location.png" mode="aspectFit" class="location-icon"></image>
|
||||
<text class="location-name">{{ locationName }}</text>
|
||||
<view class="status-badge">{{ $t('device.available') }}</view>
|
||||
</view>
|
||||
<view class="device-info">
|
||||
<text class="device-label">{{ $t('order.deviceNo') }}:</text>
|
||||
<text class="device-value">{{ orderInfo.deviceNo || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单信息和费用信息 -->
|
||||
<view class="order-card">
|
||||
<view class="card-header">
|
||||
<view class="card-title-bar"></view>
|
||||
<view class="card-title">{{ $t('payment.orderInfo') }}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('order.orderNo') }}</text>
|
||||
<text class="value">{{ orderInfo.orderNo || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('order.deviceNo') }}</text>
|
||||
<text class="value">{{ orderInfo.deviceNo || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('payment.createTime') }}</text>
|
||||
<text class="value">{{ orderInfo.createTime || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 费用信息部分 -->
|
||||
<view class="card-header" style="margin-top: 32rpx;">
|
||||
<view class="card-title-bar"></view>
|
||||
<view class="card-title">{{ $t('payment.feeInfo') }}</view>
|
||||
</view>
|
||||
<view class="price-item">
|
||||
<text class="label">{{ $t('payment.deposit') }}</text>
|
||||
<text class="value">¥ {{ orderInfo.deposit || '90' }}</text>
|
||||
</view>
|
||||
<!-- <view class="price-item">
|
||||
<text class="label">{{ $t('payment.package') }}</text>
|
||||
<text class="value">{{ packageText }}</text>
|
||||
</view> -->
|
||||
<view class="price-item total">
|
||||
<text class="label">{{ $t('payment.total') }}</text>
|
||||
<view class="total-value">
|
||||
<text class="currency">¥</text>
|
||||
<text class="amount">{{ totalAmount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部操作栏 -->
|
||||
<view class="bottom-bar">
|
||||
<view class="pay-btn" @click="handlePayment">
|
||||
<text class="currency-small">¥</text>
|
||||
<text class="amount-large">{{ totalAmount }}</text>
|
||||
<text class="pay-text">{{ $t('payment.payNow') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
reactive,
|
||||
onMounted
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
queryById,
|
||||
createAntomPayment,
|
||||
getAntomPaymentMethods,
|
||||
getAntomPaymentStatus
|
||||
} from '@/config/api/order.js'
|
||||
import {
|
||||
getDeviceInfo
|
||||
} from '@/config/api/device.js'
|
||||
import {
|
||||
updateUserBalance
|
||||
} from '@/config/api/user.js'
|
||||
import {
|
||||
useI18n
|
||||
} from '@/utils/i18n.js'
|
||||
|
||||
const {
|
||||
t
|
||||
} = useI18n()
|
||||
|
||||
const orderId = ref(null)
|
||||
const deviceNo = ref(null)
|
||||
const orderInfo = ref({})
|
||||
const deviceInfo = ref(null)
|
||||
const passedTotalAmount = ref(null)
|
||||
const passedDepositAmount = ref(null)
|
||||
|
||||
// 倒计时相关
|
||||
const countdown = ref(15 * 60) // 15分钟 = 900秒
|
||||
let countdownTimer = null
|
||||
|
||||
// 支付方式相关
|
||||
const paymentMethods = ref([])
|
||||
const selectedPaymentMethod = ref('ALIPAY') // 默认选择支付宝
|
||||
|
||||
// 地点名称(可以从设备信息中获取,这里先用默认值)
|
||||
const locationName = ref('澎创办公室')
|
||||
|
||||
// 套餐文本(可以从设备信息中获取,这里先用默认值)
|
||||
const packageText = computed(() => {
|
||||
// 这里可以根据实际的设备信息动态生成
|
||||
return '2元/小时'
|
||||
})
|
||||
|
||||
const orderStatus = reactive({
|
||||
get text() {
|
||||
return t('payment.waitingForPayment')
|
||||
},
|
||||
get desc() {
|
||||
return t('payment.pleasePayIn15Min')
|
||||
},
|
||||
class: 'waiting'
|
||||
})
|
||||
|
||||
const totalAmount = computed(() => {
|
||||
if (passedTotalAmount.value !== null) {
|
||||
return parseFloat(passedTotalAmount.value).toFixed(2);
|
||||
}
|
||||
const deposit = parseFloat(orderInfo.value.deposit || passedDepositAmount.value || 99)
|
||||
return deposit.toFixed(2)
|
||||
})
|
||||
|
||||
// 加载订单信息
|
||||
const loadOrderInfo = async () => {
|
||||
// 检查 orderId 是否存在,如果不存在则尝试从缓存获取
|
||||
if (!orderId.value) {
|
||||
// #ifdef H5
|
||||
const cachedOrderId = uni.getStorageSync('pendingPaymentNo');
|
||||
if (cachedOrderId) {
|
||||
orderId.value = cachedOrderId;
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 如果两种方式都获取不到 orderId,提示并跳转
|
||||
if (!orderId.value) {
|
||||
uni.showToast({
|
||||
title: t('order.orderNotExist'),
|
||||
icon: 'none'
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}, 1500);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: t('common.loading')
|
||||
})
|
||||
|
||||
const res = await queryById(orderId.value)
|
||||
if (res.code === 200 && res.data) {
|
||||
const orderData = res.data
|
||||
|
||||
// 处理创建时间
|
||||
let formattedTime;
|
||||
try {
|
||||
if (orderData.createTime) {
|
||||
formattedTime = formatTime(new Date(orderData.createTime));
|
||||
} else {
|
||||
formattedTime = formatTime(new Date());
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('时间格式化错误:', e);
|
||||
formattedTime = formatTime(new Date());
|
||||
}
|
||||
|
||||
orderInfo.value = {
|
||||
orderNo: orderData.orderNo || orderData.orderId,
|
||||
deviceNo: orderData.deviceNo,
|
||||
createTime: formattedTime,
|
||||
deposit: passedDepositAmount.value || orderData.depositAmount || '99.00',
|
||||
orderStatus:orderData.orderStatus
|
||||
}
|
||||
|
||||
deviceNo.value = orderData.deviceNo;
|
||||
await loadDeviceInfo();
|
||||
await loadPaymentMethods();
|
||||
// #ifdef H5
|
||||
if(orderInfo.value.orderStatus=='waiting_for_payment'){
|
||||
startPaymentStatusPolling();
|
||||
}
|
||||
// #endif
|
||||
} else {
|
||||
throw new Error(t('order.getOrderFailed'))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取订单信息失败:', error)
|
||||
uni.showToast({
|
||||
title: error.message || t('order.getOrderFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
// 加载设备信息
|
||||
const loadDeviceInfo = async () => {
|
||||
if (!deviceNo.value) return;
|
||||
|
||||
try {
|
||||
const res = await getDeviceInfo(deviceNo.value);
|
||||
if (res.code === 200 && res.data) {
|
||||
deviceInfo.value = res.data.device;
|
||||
|
||||
if (deviceInfo.value && deviceInfo.value.depositAmount) {
|
||||
orderInfo.value.deposit = deviceInfo.value.depositAmount;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取设备信息失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取操作系统类型
|
||||
const getOsType = () => {
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
console.log(uni.getSystemInfoSync());
|
||||
|
||||
const platform = systemInfo.platform;
|
||||
console.log('当前系统类型:', uni.getSystemInfoSync().platform);
|
||||
|
||||
// 根据平台返回对应的 osType
|
||||
if (platform === 'android') {
|
||||
return 'ANDROID';
|
||||
} else if (platform === 'ios') {
|
||||
return 'IOS';
|
||||
} else {
|
||||
// 默认返回 ANDROID
|
||||
return 'ANDROID';
|
||||
}
|
||||
}
|
||||
|
||||
// 加载支付方式列表
|
||||
const loadPaymentMethods = async () => {
|
||||
if (!orderInfo.value.orderNo) return;
|
||||
|
||||
try {
|
||||
const osType = getOsType();
|
||||
console.log('当前系统类型:', osType);
|
||||
|
||||
const res = await getAntomPaymentMethods(orderInfo.value.orderNo, osType);
|
||||
if (res.code === 200 && res.data && res.data.paymentOptions) {
|
||||
paymentMethods.value = res.data.paymentOptions;
|
||||
console.log('支付方式列表:', paymentMethods.value);
|
||||
// 如果有支付方式,默认选择第一个
|
||||
if (paymentMethods.value.length > 0) {
|
||||
selectedPaymentMethod.value = paymentMethods.value[0].paymentMethodType;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取支付方式失败:', error);
|
||||
// 如果获取失败,使用默认支付方式
|
||||
paymentMethods.value = [{
|
||||
paymentMethodType: 'ALIPAY',
|
||||
paymentMethodName: '支付宝'
|
||||
},
|
||||
{
|
||||
paymentMethodType: 'WECHATPAY',
|
||||
paymentMethodName: '微信支付'
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// 选择支付方式
|
||||
const selectPaymentMethod = (methodType) => {
|
||||
selectedPaymentMethod.value = methodType;
|
||||
}
|
||||
|
||||
// 获取支付方式图标
|
||||
const getPaymentIcon = (methodType) => {
|
||||
const iconMap = {
|
||||
'ALIPAY': 'alipay',
|
||||
'WECHATPAY': 'wechat',
|
||||
'WECHAT': 'wechat'
|
||||
};
|
||||
return iconMap[methodType] || 'default';
|
||||
}
|
||||
|
||||
// 处理支付
|
||||
const handlePayment = async () => {
|
||||
if (!selectedPaymentMethod.value) {
|
||||
uni.showToast({
|
||||
title: '请选择支付方式',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: t('common.processing')
|
||||
})
|
||||
|
||||
const osType = getOsType();
|
||||
const res = await createAntomPayment(orderInfo.value.orderNo, selectedPaymentMethod.value, osType)
|
||||
|
||||
if (res && res.code === 200 && res.data) {
|
||||
const paymentUrl = res.data.h5Url;
|
||||
|
||||
if (!paymentUrl) {
|
||||
throw new Error('未获取到支付链接');
|
||||
}
|
||||
|
||||
uni.hideLoading();
|
||||
// #ifdef H5
|
||||
uni.setStorageSync('pendingPaymentNo', orderId.value);
|
||||
// 跳转到支付页面
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/webview/index?url=${encodeURIComponent(paymentUrl)}&title=支付`
|
||||
// });
|
||||
window.open(paymentUrl);
|
||||
// #endif
|
||||
|
||||
// 开始轮询支付状态
|
||||
startPaymentStatusPolling();
|
||||
|
||||
} else {
|
||||
throw new Error(res?.msg || t('payment.createPayOrderFailed'))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('支付失败:', error)
|
||||
uni.showToast({
|
||||
title: error.message || t('payment.paymentFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
// 轮询支付状态
|
||||
let pollingTimer = null;
|
||||
const startPaymentStatusPolling = () => {
|
||||
// 清除之前的定时器
|
||||
if (pollingTimer) {
|
||||
clearInterval(pollingTimer);
|
||||
}
|
||||
|
||||
let pollCount = 0;
|
||||
const maxPollCount = 60; // 最多轮询60次(5分钟)
|
||||
|
||||
pollingTimer = setInterval(async () => {
|
||||
pollCount++;
|
||||
|
||||
if (pollCount > maxPollCount) {
|
||||
clearInterval(pollingTimer);
|
||||
uni.showToast({
|
||||
title: '支付超时,请重新支付',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const osType = getOsType();
|
||||
const res = await getAntomPaymentStatus(orderInfo.value.orderNo, osType);
|
||||
if (res && res.code === 200 && res.data) {
|
||||
const paymentStatus = res.data.paymentStatus;
|
||||
|
||||
if (paymentStatus === 'SUCCESS') {
|
||||
clearInterval(pollingTimer);
|
||||
|
||||
// uni.showToast({
|
||||
// title: t('payment.paymentSuccess'),
|
||||
// icon: 'success'
|
||||
// });
|
||||
|
||||
try {
|
||||
await updateUserBalance(orderId.value);
|
||||
} catch (error) {
|
||||
console.warn('更新用户余额失败:', error);
|
||||
}
|
||||
console.log(orderInfo);
|
||||
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
url: `/pages/order/success?orderId=${orderId.value}&deviceId=${orderInfo.value.deviceNo}`
|
||||
});
|
||||
}, 1500);
|
||||
} else if (paymentStatus === 'FAIL' || paymentStatus === 'CANCELLED') {
|
||||
clearInterval(pollingTimer);
|
||||
uni.showToast({
|
||||
title: '支付失败,请重新支付',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('查询支付状态失败:', error);
|
||||
}
|
||||
}, 5000); // 每5秒查询一次
|
||||
}
|
||||
|
||||
// 更新导航栏倒计时
|
||||
const updateNavBarCountdown = () => {
|
||||
const minutes = Math.floor(countdown.value / 60).toString().padStart(2, '0')
|
||||
const seconds = (countdown.value % 60).toString().padStart(2, '0')
|
||||
uni.setNavigationBarTitle({
|
||||
title: `待支付 ${minutes}:${seconds}`
|
||||
})
|
||||
}
|
||||
|
||||
// 开始倒计时
|
||||
const startCountdown = () => {
|
||||
// 清除之前的定时器
|
||||
if (countdownTimer) {
|
||||
clearInterval(countdownTimer)
|
||||
}
|
||||
|
||||
// 立即更新一次
|
||||
updateNavBarCountdown()
|
||||
|
||||
// 每秒更新
|
||||
countdownTimer = setInterval(() => {
|
||||
countdown.value--
|
||||
|
||||
if (countdown.value <= 0) {
|
||||
clearInterval(countdownTimer)
|
||||
uni.showToast({
|
||||
title: t('order.paymentFailedRetry'),
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}, 1500)
|
||||
return
|
||||
}
|
||||
|
||||
updateNavBarCountdown()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
// 页面卸载时清除定时器
|
||||
onMounted(() => {
|
||||
return () => {
|
||||
if (pollingTimer) {
|
||||
clearInterval(pollingTimer);
|
||||
}
|
||||
if (countdownTimer) {
|
||||
clearInterval(countdownTimer);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// 格式化时间
|
||||
const formatTime = (date) => {
|
||||
const year = date.getFullYear()
|
||||
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||
const day = date.getDate().toString().padStart(2, '0')
|
||||
const hour = date.getHours().toString().padStart(2, '0')
|
||||
const minute = date.getMinutes().toString().padStart(2, '0')
|
||||
|
||||
return `${year}-${month}-${day} ${hour}:${minute}`
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
// 启动倒计时
|
||||
startCountdown()
|
||||
|
||||
// 优先从 options 中获取 orderId
|
||||
if (options && options.orderId) {
|
||||
orderId.value = options.orderId
|
||||
|
||||
if (options.totalAmount) {
|
||||
passedTotalAmount.value = options.totalAmount;
|
||||
}
|
||||
|
||||
if (options.depositAmount) {
|
||||
passedDepositAmount.value = options.depositAmount;
|
||||
}
|
||||
|
||||
if (options.feeConfig) {
|
||||
try {
|
||||
const feeConfigStr = decodeURIComponent(options.feeConfig)
|
||||
deviceInfo.value = {
|
||||
feeConfig: feeConfigStr
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('解析URL中的feeConfig失败:', e)
|
||||
}
|
||||
}
|
||||
|
||||
loadOrderInfo()
|
||||
}
|
||||
// #ifdef H5
|
||||
// 如果 options 中没有 orderId,尝试从缓存中获取(H5 环境)
|
||||
else {
|
||||
const cachedOrderId = uni.getStorageSync('pendingPaymentNo');
|
||||
console.log("订单编号:"+cachedOrderId);
|
||||
|
||||
if (cachedOrderId) {
|
||||
orderId.value = cachedOrderId;
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
loadOrderInfo()
|
||||
// 调用 loadOrderInfo,内部会再次检查 orderId 是否存在
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.payment-container {
|
||||
min-height: 100vh;
|
||||
background: #F5F5F5;
|
||||
padding: 24rpx;
|
||||
padding-bottom: 200rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.location-card {
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 32rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.location-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.location-icon {
|
||||
font-size: 40rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.location-name {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
background: #D4F4DD;
|
||||
color: #52C41A;
|
||||
font-size: 24rpx;
|
||||
padding: 8rpx 20rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.device-info {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
|
||||
.device-label {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.device-value {
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-card {
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 32rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.card-title-bar {
|
||||
width: 8rpx;
|
||||
height: 32rpx;
|
||||
background: #52C41A;
|
||||
border-radius: 4rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.info-item,
|
||||
.price-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 24rpx 0;
|
||||
|
||||
.label {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.price-item.total {
|
||||
padding-top: 32rpx;
|
||||
justify-content: flex-end !important;
|
||||
// border-top: 1rpx solid #F0F0F0;
|
||||
margin-top: 16rpx;
|
||||
|
||||
.label {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.total-value {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
|
||||
.currency {
|
||||
font-size: 22rpx;
|
||||
color: #52C41A;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
|
||||
.amount {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
color: #52C41A;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-bar {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #fff;
|
||||
padding: 24rpx;
|
||||
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
|
||||
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.06);
|
||||
z-index: 100;
|
||||
|
||||
.pay-btn {
|
||||
width: 100%;
|
||||
padding: 20rpx 0;
|
||||
// height: 96rpx;
|
||||
background: linear-gradient(135deg, #52C41A 0%, #73D13D 100%);
|
||||
border-radius: 48rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
box-shadow: 0 8rpx 24rpx rgba(82, 196, 26, 0.3);
|
||||
|
||||
.currency-small {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
margin-right: 4rpx;
|
||||
// text-align: ;
|
||||
}
|
||||
|
||||
.amount-large {
|
||||
font-size: 52rpx;
|
||||
font-weight: 700;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.pay-text {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.9;
|
||||
transform: scale(0.98);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,441 @@
|
||||
<template>
|
||||
<view class="success-container">
|
||||
<!-- 支付成功状态 -->
|
||||
<view class="status-card">
|
||||
<view class="status-icon success"></view>
|
||||
<view class="status-text">{{ $t('success.returnSuccess') }}</view>
|
||||
<view class="status-desc">{{ $t('success.returnSuccessDesc') }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单信息 -->
|
||||
<view class="order-card">
|
||||
<view class="card-title">{{ $t('success.orderInfo') }}</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('order.orderNo') }}</text>
|
||||
<text class="value">{{ orderInfo.orderNo || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('order.deviceNo') }}</text>
|
||||
<text class="value">{{ orderInfo.deviceNo || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('success.usedTime') }}</text>
|
||||
<text class="value">{{ orderInfo.usedTime || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('success.packageTime') }}</text>
|
||||
<text class="value">{{ orderInfo.packageTime || '1' + $t('time.hour') }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('success.extraTime') }}</text>
|
||||
<text class="value">{{ orderInfo.extraTime || '0' + $t('time.minute') }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('success.returnTime') }}</text>
|
||||
<text class="value">{{ orderInfo.endTime || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 费用信息 -->
|
||||
<view class="refund-card">
|
||||
<view class="card-title">{{ $t('payment.feeInfo') }}</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('success.packageFee') }}</text>
|
||||
<text class="value">¥{{ orderInfo.packagePrice || '0.00' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('success.extraFee') }}</text>
|
||||
<text class="value">¥{{ orderInfo.extraFee || '0.00' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('success.totalFee') }}</text>
|
||||
<text class="value">¥{{ orderInfo.currentFee || '0.00' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('success.depositAmount') }}</text>
|
||||
<text class="value">¥{{ orderInfo.deposit || '99.00' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('success.refundAmount') }}</text>
|
||||
<text class="value highlight">¥{{ orderInfo.refundAmount || '99.00' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('success.refundStatus') }}</text>
|
||||
<text class="value" :class="orderInfo.withdrawStatus || 'waiting'">{{ getWithdrawStatusText() }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 退款说明卡片 -->
|
||||
<view class="notice-card">
|
||||
<view class="card-title">{{ $t('success.refundNotice') }}</view>
|
||||
<view class="notice-content">
|
||||
<view>1. {{ $t('success.refundNotice1') }}</view>
|
||||
<view>2. {{ $t('success.refundNotice2') }}</view>
|
||||
<view>3. {{ $t('success.refundNotice3') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="button-group">
|
||||
<button class="primary-btn" @click="handleWithdraw" v-if="!orderInfo.isWithdrawn && orderInfo.refundAmount > 0">{{ $t('success.applyRefund') }}</button>
|
||||
<button class="primary-btn" @click="goToHome">{{ $t('success.backToHome') }}</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { queryById } from '@/config/api/order.js'
|
||||
import { withdrawDeposit } from '@/config/api/user.js'
|
||||
import {
|
||||
URL
|
||||
}from"@/config/url.js"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
orderId: '',
|
||||
orderInfo: {
|
||||
orderNo: '',
|
||||
deviceNo: '',
|
||||
usedTime: '',
|
||||
currentFee: '0.00',
|
||||
deposit: '99.00',
|
||||
refundAmount: '99.00',
|
||||
endTime: '',
|
||||
withdrawStatus: 'waiting',
|
||||
isWithdrawn: false
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
// 设置页面标题
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.$t('success.returnSuccess')
|
||||
})
|
||||
|
||||
if (options && options.orderId) {
|
||||
this.orderId = options.orderId;
|
||||
this.loadOrderInfo();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: this.$t('order.orderIdRequired'),
|
||||
icon: 'none'
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.goToHome();
|
||||
}, 1500);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取退款状态文本
|
||||
getWithdrawStatusText() {
|
||||
const statusMap = {
|
||||
'waiting': this.$t('success.refundWaiting'),
|
||||
'processing': this.$t('success.refundProcessing'),
|
||||
'success': this.$t('success.refundSuccess'),
|
||||
'failed': this.$t('success.refundFailed')
|
||||
};
|
||||
return statusMap[this.orderInfo.withdrawStatus] || this.$t('success.refundWaiting');
|
||||
},
|
||||
|
||||
// 加载订单信息
|
||||
async loadOrderInfo() {
|
||||
try {
|
||||
uni.showLoading({ title: this.$t('common.loading') });
|
||||
|
||||
const result = await queryById(this.orderId);
|
||||
if (result.code === 200 && result.data) {
|
||||
const orderData = result.data;
|
||||
|
||||
// 从remark字段中解析使用信息
|
||||
let packageMinutes = 60;
|
||||
let extraMinutes = 0;
|
||||
let usedMinutes = 0;
|
||||
let packagePrice = '0.00';
|
||||
let extraFee = '0.00';
|
||||
|
||||
if (orderData.remark) {
|
||||
try {
|
||||
// 解析remark字段
|
||||
const remarkInfo = orderData.remark;
|
||||
|
||||
// 尝试提取使用时长
|
||||
const usedTimeMatch = remarkInfo.match(/使用时长:(\d+)分钟/);
|
||||
if (usedTimeMatch && usedTimeMatch[1]) {
|
||||
usedMinutes = parseInt(usedTimeMatch[1]);
|
||||
}
|
||||
|
||||
// 尝试提取套餐时长
|
||||
const packageTimeMatch = remarkInfo.match(/套餐时长:(\d+)分钟/);
|
||||
if (packageTimeMatch && packageTimeMatch[1]) {
|
||||
packageMinutes = parseInt(packageTimeMatch[1]);
|
||||
}
|
||||
|
||||
// 尝试提取超出时长
|
||||
const extraTimeMatch = remarkInfo.match(/超出时长:(\d+)分钟/);
|
||||
if (extraTimeMatch && extraTimeMatch[1]) {
|
||||
extraMinutes = parseInt(extraTimeMatch[1]);
|
||||
}
|
||||
|
||||
// 尝试提取套餐费用
|
||||
const packagePriceMatch = remarkInfo.match(/套餐费用:([\d.]+)元/);
|
||||
if (packagePriceMatch && packagePriceMatch[1]) {
|
||||
packagePrice = packagePriceMatch[1];
|
||||
}
|
||||
|
||||
// 尝试提取超时费用
|
||||
const extraFeeMatch = remarkInfo.match(/超时费用:([\d.]+)元/);
|
||||
if (extraFeeMatch && extraFeeMatch[1]) {
|
||||
extraFee = extraFeeMatch[1];
|
||||
}
|
||||
|
||||
console.log('从remark解析到的信息:', {
|
||||
usedMinutes,
|
||||
packageMinutes,
|
||||
extraMinutes,
|
||||
packagePrice,
|
||||
extraFee
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('解析remark字段失败:', e);
|
||||
}
|
||||
}
|
||||
|
||||
this.orderInfo = {
|
||||
orderNo: orderData.orderNo || '',
|
||||
deviceNo: orderData.deviceNo || '',
|
||||
usedTime: usedMinutes + '分钟',
|
||||
packageTime: packageMinutes + '分钟',
|
||||
extraTime: extraMinutes + '分钟',
|
||||
packagePrice: packagePrice,
|
||||
extraFee: extraFee,
|
||||
currentFee: orderData.actualDeviceAmount || '0.00',
|
||||
deposit: orderData.depositAmount || '99.00',
|
||||
refundAmount: orderData.residueAmount || '99.00',
|
||||
endTime: orderData.endTime || '',
|
||||
withdrawStatus: orderData.withdrawStatus || 'waiting',
|
||||
isWithdrawn: orderData.withdrawStatus === 'success'
|
||||
};
|
||||
} else {
|
||||
throw new Error(result.msg || '获取订单信息失败');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载订单信息错误:', error);
|
||||
uni.showToast({
|
||||
title: error.message || this.$t('order.getOrderFailed'),
|
||||
icon: 'none'
|
||||
});
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
|
||||
// 申请退款
|
||||
async handleWithdraw() {
|
||||
try {
|
||||
uni.showLoading({ title: this.$t('common.processing') });
|
||||
|
||||
const res = await withdrawDeposit(this.orderInfo.orderNo)
|
||||
|
||||
if (res && res.code === 200) {
|
||||
uni.showToast({
|
||||
title: this.$t('order.refundSuccess'),
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 更新状态
|
||||
this.orderInfo.withdrawStatus = 'processing';
|
||||
this.orderInfo.isWithdrawn = true;
|
||||
|
||||
// 刷新订单信息
|
||||
setTimeout(() => {
|
||||
this.loadOrderInfo();
|
||||
}, 1500);
|
||||
} else {
|
||||
throw new Error(res?.msg || this.$t('order.refundFailed'));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('退款申请错误:', error);
|
||||
uni.showToast({
|
||||
title: error.message || this.$t('order.refundFailed'),
|
||||
icon: 'none'
|
||||
});
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
|
||||
// 返回首页
|
||||
goToHome() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.success-container {
|
||||
padding: 20px;
|
||||
background-color: #f8f8f8;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.status-card {
|
||||
background-color: #fff;
|
||||
border-radius: 12px;
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
|
||||
|
||||
.status-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
margin: 0 auto 16px;
|
||||
|
||||
&.success {
|
||||
background-color: #07c160;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 30px;
|
||||
height: 20px;
|
||||
border: 3px solid #fff;
|
||||
border-top: none;
|
||||
border-right: none;
|
||||
transform-origin: center;
|
||||
transform: translate(-50%, -70%) rotate(-45deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.status-text {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #07c160;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.status-desc {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
.order-card, .refund-card {
|
||||
background-color: #fff;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
|
||||
|
||||
.card-title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 16px;
|
||||
color: #333;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.value {
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
|
||||
&.highlight {
|
||||
color: #ff6b00;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
&.success {
|
||||
color: #07c160;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.button-group {
|
||||
margin-top: 40rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 20rpx;
|
||||
|
||||
.primary-btn, .secondary-btn {
|
||||
width: 50%;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
border-radius: 44rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.primary-btn {
|
||||
background: #07c160;
|
||||
color: #fff;
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
.secondary-btn {
|
||||
background: #f0f0f0;
|
||||
color: #333;
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.notice-card {
|
||||
background-color: #fff;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
|
||||
|
||||
.card-title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 16px;
|
||||
color: #333;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.notice-content {
|
||||
text-align: left;
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.waiting {
|
||||
color: #ffaa00;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,399 @@
|
||||
<template>
|
||||
<view class="success-container">
|
||||
<!-- 支付成功状态和订单信息 -->
|
||||
<view class="status-order-card">
|
||||
<!-- 支付成功状态 -->
|
||||
<view class="status-section">
|
||||
<view class="status-icon success"></view>
|
||||
<view class="status-text">{{ $t('success.paymentSuccess') }}</view>
|
||||
<view class="status-desc">{{ $t('success.paymentSuccessDesc') }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 分割线 -->
|
||||
<view class="section-divider"></view>
|
||||
|
||||
<!-- 订单信息 -->
|
||||
<view class="order-section">
|
||||
<view class="card-title">{{ $t('success.orderInfo') }}</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('order.orderNo') }}</text>
|
||||
<text class="value">{{ orderInfo.orderNo || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('order.deviceNo') }}</text>
|
||||
<text class="value">{{ orderInfo.deviceNo || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('success.paymentAmount') }}</text>
|
||||
<text class="value">¥{{ orderInfo.amount || '0.00' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">{{ $t('success.paymentTime') }}</text>
|
||||
<text class="value">{{ orderInfo.payTime || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 设备状态 -->
|
||||
<view class="device-status">
|
||||
<view class="status-message">{{ deviceMessage }}</view>
|
||||
<view class="loading-animation" v-if="isLoading">
|
||||
<view class="loading-circle"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="button-group">
|
||||
<view class="secondary-btn" @click="goToHome">{{ $t('success.backToHome') }}</view>
|
||||
<view class="primary-btn" @click="goToOrderList">{{ $t('success.viewOrder') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
getCurrentInstance
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
queryById,
|
||||
getOrderByOrderNo
|
||||
} from '@/config/api/order.js'
|
||||
|
||||
// 获取当前实例以访问 $t 方法
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance()
|
||||
|
||||
// 响应式数据
|
||||
const orderId = ref('')
|
||||
const orderInfo = ref({})
|
||||
const isLoading = ref(true)
|
||||
const deviceMessage = ref('')
|
||||
const hasTriggeredDevice = ref(false)
|
||||
|
||||
// 页面加载
|
||||
onLoad((options) => {
|
||||
// 设置页面标题
|
||||
uni.setNavigationBarTitle({
|
||||
title: proxy.$t('success.paymentSuccess')
|
||||
})
|
||||
|
||||
deviceMessage.value = proxy.$t('success.preparingDevice')
|
||||
|
||||
// #ifdef H5
|
||||
if (uni.getStorageSync('pendingPaymentNo')) {
|
||||
orderId.value = options.orderId
|
||||
loadOrderInfo()
|
||||
|
||||
// 添加页面显示监听,防止页面切换后重复触发弹出
|
||||
uni.$once('orderSuccess:' + orderId.value, () => {
|
||||
console.log('已经触发过弹出逻辑,不再重复触发')
|
||||
hasTriggeredDevice.value = true
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: proxy.$t('order.orderNotExist'),
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
goToHome()
|
||||
}, 1500)
|
||||
}
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
if (options && options.orderId) {
|
||||
orderId.value = options.orderId
|
||||
loadOrderInfo()
|
||||
|
||||
// 添加页面显示监听,防止页面切换后重复触发弹出
|
||||
uni.$once('orderSuccess:' + orderId.value, () => {
|
||||
console.log('已经触发过弹出逻辑,不再重复触发')
|
||||
hasTriggeredDevice.value = true
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: proxy.$t('order.orderNotExist'),
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
goToHome()
|
||||
}, 1500)
|
||||
}
|
||||
// #endif
|
||||
})
|
||||
|
||||
// 加载订单信息
|
||||
const loadOrderInfo = async () => {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: proxy.$t('common.loading')
|
||||
})
|
||||
|
||||
const res = await queryById(orderId.value)
|
||||
if (res.code === 200 && res.data) {
|
||||
const orderData = res.data
|
||||
orderInfo.value = {
|
||||
orderNo: orderData.orderNo || orderData.orderId,
|
||||
deviceNo: orderData.deviceNo,
|
||||
amount: orderData.payAmount || orderData.amount,
|
||||
payTime: orderData.payTime || formatTime(new Date())
|
||||
}
|
||||
|
||||
// 检查订单状态
|
||||
if (orderData.orderStatus === 'IN_USED') {
|
||||
// 如果已经是使用中状态,可能说明开锁已经完成
|
||||
deviceMessage.value = '设备已弹出,请取走您的风扇'
|
||||
isLoading.value = false
|
||||
|
||||
// 如果是第一次加载页面且设备已弹出,记录状态,避免重复弹出
|
||||
if (!hasTriggeredDevice.value) {
|
||||
uni.$emit('orderSuccess:' + orderId.value)
|
||||
hasTriggeredDevice.value = true
|
||||
}
|
||||
} else {
|
||||
// 在此页面不再触发设备弹出操作,仅更新展示文案和加载状态
|
||||
deviceMessage.value = proxy.$t('success.paymentSuccessDesc')
|
||||
isLoading.value = false
|
||||
}
|
||||
} else {
|
||||
throw new Error('获取订单信息失败')
|
||||
}
|
||||
|
||||
uni.hideLoading()
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: error.message || proxy.$t('order.getOrderFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化时间
|
||||
const formatTime = (date) => {
|
||||
const year = date.getFullYear()
|
||||
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||
const day = date.getDate().toString().padStart(2, '0')
|
||||
const hour = date.getHours().toString().padStart(2, '0')
|
||||
const minute = date.getMinutes().toString().padStart(2, '0')
|
||||
const second = date.getSeconds().toString().padStart(2, '0')
|
||||
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
|
||||
}
|
||||
|
||||
// 返回首页
|
||||
const goToHome = () => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
|
||||
// 查看订单列表
|
||||
const goToOrderList = () => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/index'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.success-container {
|
||||
padding: 20px;
|
||||
padding-bottom: 180rpx;
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.status-order-card {
|
||||
background-color: #fff;
|
||||
border-radius: 12px;
|
||||
margin-bottom: 20px;
|
||||
overflow: hidden;
|
||||
|
||||
.status-section {
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
|
||||
.status-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
margin: 0 auto 16px;
|
||||
background-color: #07c160;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 30px;
|
||||
height: 20px;
|
||||
border: 3px solid #fff;
|
||||
border-top: none;
|
||||
border-right: none;
|
||||
transform-origin: center;
|
||||
transform: translate(-50%, -70%) rotate(-45deg);
|
||||
}
|
||||
}
|
||||
|
||||
.status-text {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #07c160;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.status-desc {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
.section-divider {
|
||||
height: 1px;
|
||||
background-color: #f0f0f0;
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
.order-section {
|
||||
padding: 20px;
|
||||
|
||||
.card-title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 16px;
|
||||
color: #333;
|
||||
padding-left: 12px;
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 4px;
|
||||
height: 16px;
|
||||
background-color: #07c160;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.value {
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.device-status {
|
||||
background-color: #fff;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
|
||||
.status-message {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.loading-animation {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 40px;
|
||||
|
||||
.loading-circle {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
border: 3px solid #f0f0f0;
|
||||
border-top-color: #07c160;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.button-group {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 20rpx 30rpx;
|
||||
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
|
||||
background: #fff;
|
||||
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
|
||||
.primary-btn {
|
||||
background-color: #07c160;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 32rpx;
|
||||
padding: 0 32rpx;
|
||||
font-size: 24rpx;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
white-space: nowrap;
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
.secondary-btn {
|
||||
background-color: #fff;
|
||||
color: #07c160;
|
||||
border: 2rpx solid #07c160;
|
||||
border-radius: 32rpx;
|
||||
padding: 0 32rpx;
|
||||
font-size: 24rpx;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
white-space: nowrap;
|
||||
|
||||
&:active {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user