- Mock adapter implementing @vmall/shared ApiClient (localStorage-persisted cart/orders/invoices), runtime switch via mockApi flag (default on) - Fixed bilingual mock catalog: 3-level categories, 24 products w/ SKUs, stores, brands, banners, floors, seckill/collective/integral, comments, coupons, addresses, seeded orders/shipments/invoices - B2B2C mall shell: top bar, logo/search/cart header, dark nav + category mega-menu, value-prop footer, back-to-top; 1200px grid, #ca151e theme - UI primitives replacing element-plus: carousel, pagination, breadcrumb, qty stepper, rating stars, modal, tabs, step bar, product card - Pages: home floors, search (filters/sort/paging), goods detail (SKU picker, store rail, review tabs), cart -> checkout -> pay -> success, auth pages, user center (dashboard/orders/addresses/favorites/coupons/ invoices), stores, seckill, collective, integral - i18n split into per-domain locale modules (en+zh) - OpenSpec change mall-pc-storefront-replica archived; all specs green
90 lines
2.1 KiB
Vue
90 lines
2.1 KiB
Vue
<script setup lang="ts">
|
|
import type { Product } from "@vmall/shared";
|
|
import { t as pick } from "@vmall/shared";
|
|
import { commentCountOf, lowestSku, salesOf } from "~/mock/data";
|
|
|
|
const props = defineProps<{ product: Product }>();
|
|
const { locale } = useI18n();
|
|
|
|
const sku = computed(() => lowestSku(props.product));
|
|
const sales = computed(() => salesOf(props.product));
|
|
const comments = computed(() => commentCountOf(props.product));
|
|
</script>
|
|
|
|
<template>
|
|
<NuxtLink :to="`/goods/${product.slug}`" class="card hover-lift">
|
|
<div class="img">
|
|
<img :src="product.images[0] || '/mock/product-1.svg'" :alt="pick(product.name, locale)" loading="lazy" />
|
|
</div>
|
|
<div class="body">
|
|
<p class="name">{{ pick(product.name, locale) }}</p>
|
|
<p class="sub">{{ pick(product.description, locale) }}</p>
|
|
<p class="price-row">
|
|
<span v-if="sku" class="price"><PriceText :amount-minor="sku.price_minor" :currency="sku.currency" /></span>
|
|
<s v-if="sku" class="market"><PriceText :amount-minor="sku.price_minor + 10000" :currency="sku.currency" /></s>
|
|
</p>
|
|
<p class="meta">{{ $t("product.salesCount", { n: sales }) }} · {{ $t("product.commentCount", { n: comments }) }}</p>
|
|
</div>
|
|
</NuxtLink>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.card {
|
|
display: block;
|
|
background: #fff;
|
|
text-decoration: none;
|
|
color: inherit;
|
|
border: 1px solid var(--mall-line);
|
|
}
|
|
.img {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 16px;
|
|
}
|
|
.img img {
|
|
width: 180px;
|
|
height: 180px;
|
|
object-fit: contain;
|
|
}
|
|
.body {
|
|
padding: 0 14px 14px;
|
|
}
|
|
.name {
|
|
font-size: 13px;
|
|
line-height: 1.4;
|
|
height: 37px;
|
|
overflow: hidden;
|
|
margin: 0;
|
|
}
|
|
.card:hover .name {
|
|
color: var(--mall-red);
|
|
}
|
|
.sub {
|
|
font-size: 12px;
|
|
color: var(--mall-faint);
|
|
margin: 4px 0 8px;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
.price-row {
|
|
margin: 0;
|
|
}
|
|
.price {
|
|
color: var(--mall-red);
|
|
font-size: 16px;
|
|
font-weight: 700;
|
|
margin-right: 8px;
|
|
}
|
|
.market {
|
|
color: var(--mall-faint);
|
|
font-size: 12px;
|
|
}
|
|
.meta {
|
|
margin: 6px 0 0;
|
|
font-size: 12px;
|
|
color: var(--mall-faint);
|
|
}
|
|
</style>
|