consumer模块完成度95%,检查消费者前端bug并修复
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user