完善下单逻辑及其ui展示,修复支付倒计时显示错误bug

This commit is contained in:
2026-05-25 15:35:41 +08:00
parent d25f80ccdd
commit cecb51a8e2
40 changed files with 13040 additions and 3217 deletions

View File

@@ -28,6 +28,27 @@ const orderId = ref('')
const orderNo = ref('')
const amount = ref(0)
const getOptionString = (options: UTSJSONObject, key: string): string => {
try {
const value = options.getString(key)
if (value != null) {
return value
}
} catch (e) {
}
try {
const normalized = JSON.parse(JSON.stringify(options)) as UTSJSONObject
const value = normalized.getString(key)
if (value != null) {
return value
}
} catch (e) {
}
return ''
}
// 定义 loadOrderInfo 函数(必须在 onMounted 之前)
const loadOrderInfo = async () => {
try {
@@ -60,12 +81,12 @@ onLoad((options) => {
if (options == null) return
const optionsObj = options as UTSJSONObject
const orderIdValue = optionsObj.getString('orderId') ?? ''
const orderIdValue = getOptionString(optionsObj, 'orderId')
if (orderIdValue != '') {
orderId.value = orderIdValue
orderNo.value = orderIdValue
const amountValue = optionsObj.getString('amount') ?? ''
const amountValue = getOptionString(optionsObj, 'amount')
if (amountValue != '') {
const amountStr = amountValue
console.log('[payment-success] amountStr:', amountStr)