consumer模块完成度95%,检查消费者前端bug并修复

This commit is contained in:
cyh666666
2026-03-09 17:20:59 +08:00
parent 7b5801a72b
commit 2262d1bfd9
128 changed files with 13485 additions and 1670 deletions

View File

@@ -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({

View File

@@ -1,5 +1,5 @@
<template>
<scroll-view class="exchange-page" scroll-y>
<scroll-view class="exchange-page" direction="vertical">
<view class="header">
<view class="points-info">
<text class="points-label">可用积分</text>
@@ -50,7 +50,7 @@
>
<image
class="product-image"
:src="product.image_url || defaultImage"
:src="product.image_url != null && product.image_url.length > 0 ? product.image_url : defaultImage"
mode="aspectFill"
/>
<view class="product-info">
@@ -86,7 +86,7 @@
<view class="popup-product" v-if="selectedProduct != null">
<image
class="popup-product-image"
:src="selectedProduct.image_url || defaultImage"
:src="selectedProduct.image_url != null && selectedProduct.image_url.length > 0 ? selectedProduct.image_url : defaultImage"
mode="aspectFill"
/>
<view class="popup-product-info">
@@ -200,7 +200,6 @@ const loadProducts = async (): Promise<void> => {
const parsed: PointProduct[] = []
for (let i = 0; i < productList.length; i++) {
const item = productList[i]
const itemAny = item as any
let id = ''
let name = ''
@@ -212,29 +211,23 @@ const loadProducts = async (): Promise<void> => {
let stock = 0
let status = 1
// UTSJSONObject2 需要使用 _getValue 方法
if (typeof itemAny._getValue === 'function') {
id = (itemAny._getValue('id') as string) ?? ''
name = (itemAny._getValue('name') as string) ?? ''
description = itemAny._getValue('description') as string | null
image_url = itemAny._getValue('image_url') as string | null
product_type = (itemAny._getValue('product_type') as string) ?? 'coupon'
points_required = (itemAny._getValue('points_required') as number) ?? 0
original_price = itemAny._getValue('original_price') as number | null
stock = (itemAny._getValue('stock') as number) ?? 0
status = (itemAny._getValue('status') as number) ?? 1
let itemObj: UTSJSONObject | null = null
if (item instanceof UTSJSONObject) {
itemObj = item
} else {
id = itemAny['id'] ?? ''
name = itemAny['name'] ?? ''
description = itemAny['description'] ?? null
image_url = itemAny['image_url'] ?? null
product_type = itemAny['product_type'] ?? 'coupon'
points_required = itemAny['points_required'] ?? 0
original_price = itemAny['original_price'] ?? null
stock = itemAny['stock'] ?? 0
status = itemAny['status'] ?? 1
itemObj = JSON.parse(JSON.stringify(item)) as UTSJSONObject
}
id = itemObj.getString('id') ?? ''
name = itemObj.getString('name') ?? ''
description = itemObj.getString('description')
image_url = itemObj.getString('image_url')
product_type = itemObj.getString('product_type') ?? 'coupon'
points_required = itemObj.getNumber('points_required') ?? 0
original_price = itemObj.getNumber('original_price')
stock = itemObj.getNumber('stock') ?? 0
status = itemObj.getNumber('status') ?? 1
const product: PointProduct = {
id,
name,
@@ -411,7 +404,7 @@ onMounted(() => {
}
.product-card {
width: calc(50% - 8px);
width: 48%;
margin: 4px;
background-color: white;
border-radius: 8px;
@@ -453,7 +446,7 @@ onMounted(() => {
.product-points {
display: flex;
flex-direction: row;
align-items: baseline;
align-items: center;
}
.points-num {
@@ -476,7 +469,6 @@ onMounted(() => {
.product-original {
font-size: 12px;
color: #999;
text-decoration: line-through;
}
.empty-state {
@@ -574,7 +566,7 @@ onMounted(() => {
.popup-product-points {
display: flex;
flex-direction: row;
align-items: baseline;
align-items: center;
margin-top: 8px;
}
@@ -701,7 +693,7 @@ onMounted(() => {
width: 60px;
height: 60px;
background-color: #52c41a;
border-radius: 50%;
border-radius: 30px;
display: flex;
align-items: center;
justify-content: center;

View File

@@ -1,5 +1,5 @@
<template>
<scroll-view class="points-page" scroll-y>
<scroll-view class="points-page" direction="vertical">
<view class="points-header">
<view class="points-info">
<text class="points-label">当前积分</text>
@@ -439,7 +439,7 @@ const formatDate = (dateStr: string): string => {
width: 32px;
height: 32px;
background-color: #52c41a;
border-radius: 50%;
border-radius: 16px;
display: flex;
align-items: center;
justify-content: center;
@@ -571,7 +571,7 @@ const formatDate = (dateStr: string): string => {
background-color: white;
border-radius: 16px 16px 0 0;
width: 100%;
max-height: 60%;
max-height: 400px;
padding: 16px;
}

View File

@@ -373,7 +373,7 @@ onMounted(() => {
.day-cell {
width: 14.28%;
aspect-ratio: 1;
height: 45px;
display: flex;
flex-direction: column;
align-items: center;
@@ -406,7 +406,7 @@ onMounted(() => {
width: 16px;
height: 16px;
background-color: #ff6b35;
border-radius: 50%;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;