移除系统配置获取金额
This commit is contained in:
@@ -155,12 +155,6 @@
|
||||
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 {
|
||||
@@ -185,32 +179,9 @@
|
||||
const isWechatMiniProgram = ref(false)
|
||||
const isAlipayMiniProgram = ref(false)
|
||||
const isH5 = ref(false)
|
||||
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) {
|
||||
const fullUrl = decodeURIComponent(options.q)
|
||||
@@ -629,12 +600,10 @@
|
||||
const displayCurrencySymbol = computed(() => (isIdrCurrency.value ? 'Rp ' : '¥'))
|
||||
|
||||
const displayHourlyPrice = computed(() => {
|
||||
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.value}`
|
||||
return deviceInfo.value.depositAmount || '99'
|
||||
})
|
||||
|
||||
|
||||
@@ -191,7 +191,6 @@
|
||||
getCurrentAnnouncement,
|
||||
getCurrentAdvertisement
|
||||
} from '../../config/api/system.js'
|
||||
import { fetchAndCacheDanaPaymentConfig } from '../../utils/danaPaymentConfig.js'
|
||||
import {
|
||||
getProductList
|
||||
} from '../../config/api/product.js'
|
||||
@@ -619,10 +618,7 @@
|
||||
// 并行加载公告和广告(不依赖定位)
|
||||
await Promise.all([
|
||||
getNoticeText(),
|
||||
getBannerImages(),
|
||||
fetchAndCacheDanaPaymentConfig().catch((e) => {
|
||||
console.warn('获取 DANA 配置失败,继续使用本地默认值:', e)
|
||||
})
|
||||
getBannerImages()
|
||||
])
|
||||
|
||||
// #ifdef H5
|
||||
|
||||
+13
-31
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user