移除系统配置获取金额

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
+15 -40
View File
@@ -117,12 +117,6 @@
import {
useI18n
} from '@/utils/i18n.js'
import {
fetchAndCacheDanaPaymentConfig,
DANA_TOTAL_STORAGE_KEY,
DANA_SINGLE_STORAGE_KEY,
parseDanaStorageNumber
} from '@/utils/danaPaymentConfig.js'
const {
t
@@ -135,23 +129,6 @@
const passedTotalAmount = ref(null)
const passedDepositAmount = ref(null)
const currencyCode = ref('USD')
const IDR_DEPOSIT_DISPLAY = ref(99000)
const IDR_SINGLE_DISPLAY = ref(6000)
const loadDanaTotalCache = () => {
try {
const cachedTotal = parseDanaStorageNumber(uni.getStorageSync(DANA_TOTAL_STORAGE_KEY))
const cachedSingle = parseDanaStorageNumber(uni.getStorageSync(DANA_SINGLE_STORAGE_KEY))
if (cachedTotal !== null && cachedTotal > 0) {
IDR_DEPOSIT_DISPLAY.value = cachedTotal
}
if (cachedSingle !== null && cachedSingle > 0) {
IDR_SINGLE_DISPLAY.value = cachedSingle
}
} catch (e) {
console.warn('读取 DANA 预支付缓存失败,使用默认值:', e)
}
}
// 支付方式相关(微信/支付宝/H5-Antom 多平台)
const paymentMethods = ref([])
@@ -178,7 +155,12 @@
const totalAmount = computed(() => {
if (currencyCode.value === 'IDR') {
return `${IDR_DEPOSIT_DISPLAY.value}`
const raw =
passedTotalAmount.value != null && passedTotalAmount.value !== ''
? passedTotalAmount.value
: orderInfo.value.deposit
const num = Number(String(raw ?? '').replace(/[^\d.-]/g, ''))
return Number.isFinite(num) ? String(Math.trunc(num)) : String(raw || '0')
}
if (passedTotalAmount.value !== null) {
return parseFloat(passedTotalAmount.value).toFixed(2);
@@ -281,10 +263,7 @@
currencyCode.value = (res.data?.position?.currency || currencyCode.value || 'USD').toUpperCase()
if (deviceInfo.value && deviceInfo.value.depositAmount) {
orderInfo.value.deposit = deviceInfo.value.depositAmount;
}
if (currencyCode.value === 'IDR') {
orderInfo.value.deposit = `${IDR_DEPOSIT_DISPLAY.value}`
orderInfo.value.deposit = deviceInfo.value.depositAmount
}
}
} catch (error) {
@@ -350,14 +329,14 @@
paymentMethodType: 'ALIPAY_DANA',
paymentMethodName: t('payment.ALIPAYDANA')
})
methods.push({
paymentMethodType: 'ALIPAY_HK',
paymentMethodName: t('payment.alipayHk')
})
methods.push({
paymentMethodType: 'ALIPAY_ID',
paymentMethodName: t('payment.alipayId')
})
// methods.push({
// paymentMethodType: 'ALIPAY_HK',
// paymentMethodName: t('payment.alipayHk')
// })
// methods.push({
// paymentMethodType: 'ALIPAY_ID',
// paymentMethodName: t('payment.alipayId')
// })
} catch (error) {
console.error('获取 Antom 支付方式失败:', error);
@@ -713,10 +692,6 @@
}
onLoad((options) => {
loadDanaTotalCache()
void fetchAndCacheDanaPaymentConfig()
.then(() => loadDanaTotalCache())
.catch((e) => console.warn('DANA 配置刷新失败:', e))
// 设置导航栏标题为待支付
uni.setNavigationBarTitle({
title: t('payment.waitingForPayment')