完成consumer端同步
This commit is contained in:
@@ -104,32 +104,33 @@ const loadOrderInfo = async () => {
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
if (options['orderId'] != null) {
|
||||
orderId.value = options['orderId'] as string
|
||||
if (options == null) return
|
||||
const optionsObj = options as UTSJSONObject
|
||||
const orderIdValue = optionsObj.getString('orderId') ?? ''
|
||||
if (orderIdValue != '') {
|
||||
orderId.value = orderIdValue
|
||||
loadOrderInfo()
|
||||
}
|
||||
})
|
||||
|
||||
const handleTypeChange = (e: any) => {
|
||||
// Use bracket notation to access detail property safely on 'any' type in UTS
|
||||
// The structure is e -> detail -> value
|
||||
// We need to cast e to UTSJSONObject first if we want to use bracket notation,
|
||||
// OR we can use JSON.parse/stringify trick if simple casting fails,
|
||||
// BUT the most standard way for UTS 'any' which is actually a Map/JSONObject at runtime:
|
||||
|
||||
const target = e as UTSJSONObject
|
||||
const detail = target['detail'] as UTSJSONObject
|
||||
const value = detail['value'] as string
|
||||
refundType.value = parseInt(value)
|
||||
const handleTypeChange = (e: UTSJSONObject) => {
|
||||
const eventObj = e as UTSJSONObject
|
||||
const detailRaw = eventObj.get('detail')
|
||||
if (detailRaw == null) return
|
||||
const detailObj = detailRaw as UTSJSONObject
|
||||
const valueStr = detailObj.getString('value') ?? '1'
|
||||
refundType.value = valueStr == '2' ? 2 : 1
|
||||
}
|
||||
|
||||
const handleReasonChange = (e: any) => {
|
||||
// Use bracket notation to access detail property safely on 'any' type in UTS
|
||||
const target = e as UTSJSONObject
|
||||
const detail = target['detail'] as UTSJSONObject
|
||||
const value = detail['value'] as number
|
||||
const index = value
|
||||
refundReason.value = reasonList[index]
|
||||
const handleReasonChange = (e: UTSJSONObject) => {
|
||||
const eventObj = e as UTSJSONObject
|
||||
const detailRaw = eventObj.get('detail')
|
||||
if (detailRaw == null) return
|
||||
const detailObj = detailRaw as UTSJSONObject
|
||||
const index = detailObj.getNumber('value') ?? 0
|
||||
if (index >= 0 && index < reasonList.length) {
|
||||
refundReason.value = reasonList[index]
|
||||
}
|
||||
}
|
||||
|
||||
const submitRefund = async () => {
|
||||
@@ -146,7 +147,7 @@ const submitRefund = async () => {
|
||||
const amount = parseFloat(refundAmount.value)
|
||||
console.log('解析后金额:', amount)
|
||||
|
||||
if (isNaN(amount) || amount <= 0 || amount > maxAmount.value) {
|
||||
if (Number.isNaN(amount) || amount <= 0 || amount > maxAmount.value) {
|
||||
uni.showToast({ title: '请输入有效的退款金额', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user