移除系统配置获取金额

This commit is contained in:
2026-05-12 15:35:50 +08:00
parent 2f0479ea05
commit ec05584bb7
7 changed files with 99 additions and 234 deletions
+13 -31
View File
@@ -264,12 +264,6 @@
import {
useI18n
} from '@/utils/i18n.js'
import {
fetchAndCacheDanaPaymentConfig,
DANA_SINGLE_STORAGE_KEY,
DANA_TOTAL_STORAGE_KEY,
parseDanaStorageNumber
} from '@/utils/danaPaymentConfig.js'
const {
t
@@ -329,23 +323,6 @@
const convertToOwnPopup = ref(null)
const lastDeviceEjectTime = ref(0) // 上次点击"宝未弹出"的时间戳
const currencyCode = ref('CNY')
const danaPaymentTotal = ref(0)
const danaPaymentSingle = ref(6000)
const loadDanaPaymentCache = () => {
try {
const cachedTotal = parseDanaStorageNumber(uni.getStorageSync(DANA_TOTAL_STORAGE_KEY))
const cachedSingle = parseDanaStorageNumber(uni.getStorageSync(DANA_SINGLE_STORAGE_KEY))
if (cachedTotal !== null) {
danaPaymentTotal.value = cachedTotal
}
if (cachedSingle !== null && cachedSingle > 0) {
danaPaymentSingle.value = cachedSingle
}
} catch (e) {
console.warn('读取 DANA 金额缓存失败,使用默认值:', e)
}
}
const resolveCurrencyCode = (orderData = {}) => {
const explicitCurrency = String(
@@ -546,7 +523,7 @@
const orderTypeText = orderTypeMap[orderInfo.value.orderType] || orderInfo.value.orderType
if (currencyCode.value === 'IDR') {
return `Rp${formatAmountDisplay(danaPaymentSingle.value)}/${orderTypeText}`
return `Rp${formatAmountDisplay(orderInfo.value.unitPrice)}/${orderTypeText}`
}
return `${formatAmountDisplay(orderInfo.value.unitPrice)}${getCurrencyUnitText()}/${orderTypeText}`
}
@@ -686,9 +663,19 @@
return orderInfo.value.orderStatus === 'in_used' ? t('order.used') : t('order.duration')
}
// 总金额展示:使用本地缓存 danaPaymentTotal(结构如 { type: 'number', data: 99000 }),由 loadDanaPaymentCache 同步到 danaPaymentTotal
// 获取订单费用(不含单位)
const getOrderFee = () => {
return formatAmountDisplay(String(danaPaymentTotal.value))
let fee
if (orderInfo.value.originalFee) {
fee = orderInfo.value.originalFee || '0'
} else if (orderInfo.value.payAmount) {
fee = orderInfo.value.payAmount
} else {
fee = orderInfo.value.currentFee
}
// 移除小数位,仅显示整数金额
return formatAmountDisplay(String(fee).replace(/[元¥]/g, ''))
}
// 解析开始时间
@@ -1446,10 +1433,6 @@
// 生命周期钩子
onLoad((options) => {
loadDanaPaymentCache()
void fetchAndCacheDanaPaymentConfig()
.then(() => loadDanaPaymentCache())
.catch((e) => console.warn('DANA 配置刷新失败:', e))
console.log('订单详情页加载,参数:', JSON.stringify(options))
// 设置页面标题
@@ -1492,7 +1475,6 @@
})
onShow(() => {
loadDanaPaymentCache()
isPageActive.value = true
if (orderInfo.value.orderStatus === 'in_used' && orderInfo.value.isSupportExpressReturn !== 'no') {
startExpressCountdown()