consumer模块完成度95%,检查消费者前端bug并修复
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<scroll-view class="records-page" scroll-y>
|
||||
<scroll-view class="records-page" direction="vertical">
|
||||
<view class="empty-state" v-if="!loading && records.length === 0">
|
||||
<text class="empty-text">暂无兑换记录</text>
|
||||
</view>
|
||||
@@ -85,39 +85,33 @@ const loadRecords = async (): Promise<void> => {
|
||||
let product_image: string | null = null
|
||||
let product_type = 'coupon'
|
||||
|
||||
// 使用 _getValue 方法
|
||||
if (typeof recordData._getValue === 'function') {
|
||||
id = (recordData._getValue('id') as string) ?? ''
|
||||
quantity = (recordData._getValue('quantity') as number) ?? 1
|
||||
points_used = (recordData._getValue('points_used') as number) ?? 0
|
||||
status = (recordData._getValue('status') as number) ?? 0
|
||||
tracking_no = recordData._getValue('tracking_no') as string | null
|
||||
created_at = (recordData._getValue('created_at') as string) ?? ''
|
||||
|
||||
// 获取关联的商品信息
|
||||
const product = recordData._getValue('product')
|
||||
if (product != null) {
|
||||
const productAny = product as any
|
||||
if (typeof productAny._getValue === 'function') {
|
||||
product_name = (productAny._getValue('name') as string) ?? ''
|
||||
product_image = productAny._getValue('image_url') as string | null
|
||||
product_type = (productAny._getValue('product_type') as string) ?? 'coupon'
|
||||
}
|
||||
}
|
||||
// 转换为 UTSJSONObject
|
||||
let recordObj: UTSJSONObject | null = null
|
||||
if (recordData instanceof UTSJSONObject) {
|
||||
recordObj = recordData
|
||||
} else {
|
||||
id = recordData['id'] ?? ''
|
||||
quantity = recordData['quantity'] ?? 1
|
||||
points_used = recordData['points_used'] ?? 0
|
||||
status = recordData['status'] ?? 0
|
||||
tracking_no = recordData['tracking_no'] ?? null
|
||||
created_at = recordData['created_at'] ?? ''
|
||||
|
||||
const product = recordData['product']
|
||||
if (product != null) {
|
||||
product_name = product['name'] ?? ''
|
||||
product_image = product['image_url'] ?? null
|
||||
product_type = product['product_type'] ?? 'coupon'
|
||||
recordObj = JSON.parse(JSON.stringify(recordData)) as UTSJSONObject
|
||||
}
|
||||
|
||||
id = recordObj.getString('id') ?? ''
|
||||
quantity = recordObj.getNumber('quantity') ?? 1
|
||||
points_used = recordObj.getNumber('points_used') ?? 0
|
||||
status = recordObj.getNumber('status') ?? 0
|
||||
tracking_no = recordObj.getString('tracking_no')
|
||||
created_at = recordObj.getString('created_at') ?? ''
|
||||
|
||||
// 获取关联的商品信息
|
||||
const product = recordObj.get('product')
|
||||
if (product != null) {
|
||||
let productObj: UTSJSONObject | null = null
|
||||
if (product instanceof UTSJSONObject) {
|
||||
productObj = product
|
||||
} else {
|
||||
productObj = JSON.parse(JSON.stringify(product)) as UTSJSONObject
|
||||
}
|
||||
product_name = productObj.getString('name') ?? ''
|
||||
product_image = productObj.getString('image_url')
|
||||
product_type = productObj.getString('product_type') ?? 'coupon'
|
||||
}
|
||||
|
||||
parsed.push({
|
||||
|
||||
Reference in New Issue
Block a user