fix:对接高德地图,修复地图bug

This commit is contained in:
2025-12-23 10:39:41 +08:00
parent d12986b85e
commit 76bdcd1aba
20 changed files with 964 additions and 399 deletions
+20 -45
View File
@@ -72,12 +72,12 @@
<!-- 底部操作区 -->
<view class="footer">
<button class="rent-button" :class="{ 'return-button': hasActiveOrder }"
@click="handleRent('wx-score-pay')">
@click="handleRent('alipay-score-pay')">
<text>{{ hasActiveOrder ? $t('order.returnDevice') : $t('device.rentDepositFree') }}</text>
</button>
<view class="wechat-credit">
<image src="/static/images/wxpayflag.png" mode="aspectFit" class="wx-icon"></image>
<text class="credit-text">{{ $t('device.wxPayScoreDesc') }}</text>
<view class="alipay-credit">
<image src="/static/images/alipay.svg" mode="aspectFit" class="alipay-icon"></image>
<text class="credit-text">{{ $t('device.alipayScoreDesc') }}</text>
</view>
</view>
@@ -123,7 +123,7 @@
cancelOrder
} from '@/config/api/order.js'
import {
initiateWeChatScorePayment,
initiateAlipayPayment,
getUserInfo,
getUserPhoneNumber
} from '@/util/index.js'
@@ -466,32 +466,8 @@
uni.showLoading({
title: $t('common.processing')
})
// --- 第一步:先请求订阅消息(必须在用户点击的同步上下文中)---
if (payWay === 'wx-score-pay') {
console.log('准备请求订阅消息(在异步操作之前),时间:', new Date().toLocaleTimeString());
try {
await new Promise((resolve, reject) => {
uni.requestSubscribeMessage({
tmplIds: ['o7OMTIcHnFBR7mvsggxFtdt8FfIgSl-v0swVUefGx6w'],
success: (subscribeRes) => {
console.log('订阅消息success回调,时间:', new Date()
.toLocaleTimeString(), subscribeRes);
resolve(subscribeRes);
},
fail: (subscribeErr) => {
console.log('订阅消息fail回调,时间:', new Date().toLocaleTimeString(),
subscribeErr);
// 订阅失败不影响主流程
resolve(subscribeErr);
}
});
});
console.log('订阅消息完成,时间:', new Date().toLocaleTimeString());
} catch (subscribeError) {
console.log('订阅消息异常', subscribeError);
}
}
// --- 订阅消息请求完成 ---
// --- 支付宝小程序不需要订阅消息,移除相关代码 ---
// 支付宝小程序使用消息推送,不需要订阅消息
console.log(deviceId.value);
// 调用设备租借接口
@@ -504,7 +480,7 @@
const order = rentResult.data
console.log('订单信息', order);
if (payWay == 'wx-pay') {
if (payWay == 'alipay-pay' || payWay == 'wx-pay') {
// 当支付方式为押金支付时
uni.hideLoading()
const res = await getOrderByOrderNo(order.orderNo);
@@ -519,29 +495,28 @@
url: `/pages/order/payment?orderId=${order.orderId}&packagePrice=${packagePrice}&totalAmount=${totalAmount}&depositAmount=${deposit}${deviceInfo.value && deviceInfo.value.feeConfig ? '&feeConfig=' + encodeURIComponent(deviceInfo.value.feeConfig) : ''}`
})
} else if (payWay == 'wx-score-pay') {
// 当支付方式为支付支付时
} else if (payWay == 'alipay-score-pay' || payWay == 'wx-score-pay') {
// 当支付方式为支付宝信用免押支付时
uni.hideLoading()
// 获取支付所需参数
// 获取支付宝信用免押所需参数
const res = await getOrderByOrderNoScore(order.orderNo);
uni.hideLoading()
if (res && res.code === 200) {
try {
// 调用微信支付分小程序
const payResult = await initiateWeChatScorePayment(res);
console.log('支付调用结果', payResult);
// 调用支付宝信用免押小程序
const payResult = await initiateAlipayPayment(res);
console.log('支付宝信用免押调用结果', payResult);
// 成功则跳转到等待页面
if (payResult.errCode == '0' && payResult.extraData && Object.keys(payResult.extraData)
.length > 0) {
console.log('支付分授权成功,准备跳转到等待页,时间:', new Date().toLocaleTimeString());
// 跳转到等待页面(订阅消息已经在前面完成了)
if (payResult && payResult.success !== false) {
console.log('支付宝信用免押授权成功,准备跳转到等待页,时间:', new Date().toLocaleTimeString());
// 跳转到等待页面
uni.redirectTo({
url: `/pages/waiting/index?orderNo=${order.orderNo}&orderId=${order.orderId}&deviceId=${deviceId.value}`
});
return;
} else {
console.log('支付未完成授权或用户取消extraData:', payResult.extraData);
console.log('支付宝信用免押未完成授权或用户取消:', payResult);
// 用户取消授权,需要取消订单
try {
uni.showLoading({
@@ -876,13 +851,13 @@
}
}
.wechat-credit {
.alipay-credit {
display: flex;
align-items: center;
justify-content: center;
margin-top: 16rpx;
.wx-icon {
.alipay-icon {
width: 48rpx;
height: 38rpx;
margin-right: 8rpx;