修复bug

This commit is contained in:
2026-05-04 17:49:00 +08:00
parent e1c9068ab0
commit 2f0479ea05
10 changed files with 531 additions and 101 deletions
+31 -5
View File
@@ -155,6 +155,12 @@
import {
useI18n
} from '@/utils/i18n.js'
import {
fetchAndCacheDanaPaymentConfig,
DANA_TOTAL_STORAGE_KEY,
DANA_SINGLE_STORAGE_KEY,
parseDanaStorageNumber
} from '@/utils/danaPaymentConfig.js'
import DeviceDetailSkeleton from '@/components/DeviceDetailSkeleton.vue'
const {
@@ -179,11 +185,31 @@
const isWechatMiniProgram = ref(false)
const isAlipayMiniProgram = ref(false)
const isH5 = ref(false)
const IDR_DEPOSIT_DISPLAY = 99000
const IDR_HOUR_PRICE_DISPLAY = 6000
const IDR_DEPOSIT_DISPLAY = ref(99000)
const IDR_HOUR_PRICE_DISPLAY = ref(6000)
const loadDanaPricingCache = () => {
try {
const totalCached = parseDanaStorageNumber(uni.getStorageSync(DANA_TOTAL_STORAGE_KEY))
const singleCached = parseDanaStorageNumber(uni.getStorageSync(DANA_SINGLE_STORAGE_KEY))
if (totalCached !== null && totalCached > 0) {
IDR_DEPOSIT_DISPLAY.value = totalCached
}
if (singleCached !== null && singleCached > 0) {
IDR_HOUR_PRICE_DISPLAY.value = singleCached
}
} catch (e) {
console.warn('读取 DANA 金额缓存失败,使用默认值:', e)
}
}
// 生命周期 onLoad 钩子
onLoad(async (options) => {
loadDanaPricingCache()
void fetchAndCacheDanaPaymentConfig()
.then(() => loadDanaPricingCache())
.catch((e) => console.warn('DANA 配置刷新失败:', e))
// 普通链接二维码进入时,参数通常在 options.q(且为编码后的完整 URL
if (!options.deviceNo && options.q) {
@@ -603,12 +629,12 @@
const displayCurrencySymbol = computed(() => (isIdrCurrency.value ? 'Rp ' : '¥'))
const displayHourlyPrice = computed(() => {
if (isIdrCurrency.value) return `${IDR_HOUR_PRICE_DISPLAY}`
if (isIdrCurrency.value) return `${IDR_HOUR_PRICE_DISPLAY.value}`
return deviceFeeConfig.value.maxHourPrice || '5.00'
})
const displayDepositCap = computed(() => {
if (isIdrCurrency.value) return `${IDR_DEPOSIT_DISPLAY}`
if (isIdrCurrency.value) return `${IDR_DEPOSIT_DISPLAY.value}`
return deviceInfo.value.depositAmount || '99'
})
@@ -647,7 +673,7 @@
console.log(deviceId.value);
// 调用设备租借接口
const rentResult = await rentPowerBank(deviceId.value, phoneNumber.value,payWay.value)
const rentResult = await rentPowerBank(deviceId.value, phoneNumber.value,payWay)
if (rentResult.code !== 200) {
throw new Error(rentResult.msg || t('device.rentFailed'))
}