fix sku display
This commit is contained in:
@@ -46,6 +46,10 @@
|
||||
<t-form-item label="兑换商品" required-mark content-align="right" arrow @click="skuVisible = true">
|
||||
<span v-text="skuName || '请选择兑换商品'" />
|
||||
</t-form-item>
|
||||
<product-sku-form-item
|
||||
:sku="selectedSku?.sku"
|
||||
:unit="selectedSku?.unit"
|
||||
/>
|
||||
<t-form-item label="兑换数量" content-align="right" required-mark>
|
||||
<t-stepper
|
||||
v-model="quantity"
|
||||
@@ -97,10 +101,26 @@
|
||||
v-for="item in skuList"
|
||||
:key="item.id"
|
||||
:title="item.product?.name || item.sku?.name || '未命名产品'"
|
||||
:note="`${item.sku?.specSummary || item.sku?.code || '默认 SKU'} · ${item.unit?.name || ''} · ${formatPoint(item.defaultPointCost)} / 单位`"
|
||||
:note="`${formatPoint(item.defaultPointCost)} / ${item.unit?.name || '单位未知'}`"
|
||||
class="item"
|
||||
arrow
|
||||
@click="selectSku(item)"
|
||||
/>
|
||||
>
|
||||
<template #left-icon>
|
||||
<t-image
|
||||
v-if="getProductPhoto(item)"
|
||||
:src="getProductPhoto(item)"
|
||||
:alt="item.product?.name || item.sku?.name || '产品图片'"
|
||||
fit="cover"
|
||||
class="avatar"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
class="avatar fallback"
|
||||
v-text="(item.product?.name || item.sku?.name || '产').slice(0, 1)"
|
||||
/>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-empty v-if="!skuList.length" description="暂无启用的兑换商品" />
|
||||
</div>
|
||||
</bottom-popup>
|
||||
@@ -124,7 +144,7 @@ import { getErrorMessage } from "@/utils/error";
|
||||
import { Message } from "@/utils/message";
|
||||
import { formatWanInteger } from "@/utils/money";
|
||||
import { normalizePackageQuantity } from "@/utils/package";
|
||||
import { getProductQuantityStep } from "@/utils/product";
|
||||
import { getProductPhotoURL, getProductQuantityStep } from "@/utils/product";
|
||||
import { uploadPhotoList } from "@/utils/photo";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
|
||||
@@ -254,6 +274,11 @@ function selectSku(item: PointRedeemSku): void {
|
||||
skuVisible.value = false;
|
||||
}
|
||||
|
||||
function getProductPhoto(item: PointRedeemSku): string {
|
||||
const product = item.product || item.sku;
|
||||
return product ? getProductPhotoURL(product) : "";
|
||||
}
|
||||
|
||||
function closeSkuPicker(): void {
|
||||
skuVisible.value = false;
|
||||
}
|
||||
@@ -351,6 +376,32 @@ onUnmounted(() => navBarStore.clearRight());
|
||||
max-height: 70vh;
|
||||
overflow: auto;
|
||||
padding: 1rem 0;
|
||||
|
||||
.item {
|
||||
padding: .625rem 1rem;
|
||||
border-radius: 1rem;
|
||||
|
||||
:deep(.t-cell__title) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
border-radius: .5rem !important;
|
||||
}
|
||||
|
||||
.fallback {
|
||||
color: var(--td-brand-color);
|
||||
display: flex;
|
||||
font-size: 1rem;
|
||||
background: var(--td-brand-color-1);
|
||||
font-weight: 600;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:global(html.theme-dark) {
|
||||
|
||||
Reference in New Issue
Block a user