fix PackageConfig*.vue style

This commit is contained in:
Timi
2026-09-06 01:10:22 +08:00
parent 3698f7151f
commit d929dbe622
7 changed files with 472 additions and 142 deletions
+142 -33
View File
@@ -2,10 +2,23 @@
<div v-can="permissionCodes.packageConfig.read" class="package-config-detail">
<template v-if="config">
<section class="hero" v-entrance-transition>
<span class="eyebrow" v-text="'套餐管理'" />
<div class="title"><h1 v-text="config.name || '未命名套餐'" /><t-tag :content="getPackageConfigStatusText(config.status)" variant="light-outline" :theme="getStatusTheme(config.status)" /></div>
<p v-text="config.description || '暂无套餐说明'" />
<div class="hero-meta"><span v-text="`${config.itemList?.length || 0} 项产品权益`" /><strong v-text="formatPackageAmount(config.standardAmount)" /></div>
<div class="header">
<span class="eyebrow" v-text="'套餐管理'" />
<t-tag
:content="getPackageConfigStatusText(config.status)"
variant="light-outline"
:theme="getStatusTheme(config.status)"
/>
</div>
<h1 class="title" v-text="config.name || '未命名套餐'" />
<p class="description" v-text="config.description || '暂无套餐说明'" />
<div class="items-price">
<span v-text="`${config.itemList?.length || 0} 项产品权益`" />
<div class="price text-bold">
<span class="red">¥</span>
<span class="red value" v-text="formatPackageAmount(config.standardAmount)" />
</div>
</div>
</section>
<t-cell-group title="基本信息" theme="card" v-entrance-transition="70">
<t-cell title="标准价" :note="formatPackageAmount(config.standardAmount)" />
@@ -13,13 +26,36 @@
<t-cell title="终止日期" :note="config.endAt ? Time.toDateTime(config.endAt) : '不限'" />
<t-cell title="最后修改人" :note="config.updater?.name || config.updater?.nick || '未知'" />
</t-cell-group>
<t-cell-group title="产品权益" theme="card" v-entrance-transition="140">
<t-cell-group class="product" title="产品权益" theme="card" v-entrance-transition="140">
<t-cell
class="item"
v-for="item in config.itemList || []"
:title="item.productNameSnapshot"
:key="item.id || `${item.productId}-${item.productUnitId}`"
:title="item.productNameSnapshot || '未命名产品'"
:note="`${item.defaultQuantity} ${item.unitSnapshot || ''}${item.remark ? `|${item.remark}` : ''}`"
/>
>
<template #leftIcon>
<t-image
v-if="getItemPhotoURL(item)"
:src="getItemPhotoURL(item)"
:alt="item.productNameSnapshot || '产品图片'"
fit="cover"
class="avatar"
/>
<div
v-else
class="avatar fallback"
v-text="(item.productNameSnapshot || '产').slice(0, 1)"
/>
</template>
<template #description>
<t-tag
:content="getProductTypeText(item.product?.productType)"
theme="primary"
variant="light"
/>
</template>
</t-cell>
<div v-if="!config.itemList?.length" class="empty" v-text="'暂无产品权益'" />
</t-cell-group>
<t-button
@@ -48,11 +84,12 @@ import { useUserStore } from "timi-web-api";
import PackageAPI from "@/api/PackageAPI";
import { useCurrentStoreStore } from "@/store/currentStoreStore";
import { useNavBarStore } from "@/store/navBarStore";
import type { GaoPackageConfig, PackageConfigStatus } from "@/types/Package";
import type { GaoPackageConfig, PackageConfigItem, PackageConfigStatus } from "@/types/Package";
import { getErrorMessage } from "@/utils/error";
import { formatPackageAmount, getPackageConfigStatusText } from "@/utils/package";
import { Message } from "@/utils/message";
import { gaoRoleCodes, permissionCodes } from "@/utils/permission";
import { getProductPhotoURL as getProductPhotoUrl, getProductTypeText } from "@/utils/product";
defineOptions({ name: "PackageConfigDetail" });
@@ -75,6 +112,10 @@ function getStatusTheme(status?: PackageConfigStatus): "success" | "warning" | "
return status === "ACTIVE" ? "success" : status === "INACTIVE" ? "warning" : "default";
}
function getItemPhotoURL(item: PackageConfigItem): string {
return getProductPhotoUrl(item.product || {});
}
async function loadData(): Promise<void> {
const id = String(route.params.id || "");
if (!id) {
@@ -157,55 +198,123 @@ onUnmounted(() => navBarStore.clearRight());
.hero {
margin: 0 1rem;
padding: 1rem;
background: var(--td-bg-color-container);
position: relative;
overflow: hidden;
background: linear-gradient(135deg, #ecfeff 0%, #eff6ff 48%, #fff7ed 100%);
border: 1px solid rgba(255, 255, 255, .72);
box-shadow: var(--td-shadow-1);
border-radius: 1rem;
border-radius: 1.25rem;
&::before {
content: "";
width: 9rem;
height: 9rem;
right: -3rem;
top: -4.5rem;
background: rgba(45, 212, 191, .2);
border-radius: 50%;
filter: blur(1rem);
position: absolute;
}
&::after {
content: "";
width: 7rem;
height: 7rem;
left: -3.5rem;
bottom: -4rem;
background: rgba(96, 165, 250, .16);
border-radius: 50%;
filter: blur(.75rem);
position: absolute;
}
> * {
z-index: 1;
position: relative;
}
.header {
display: flex;
justify-content: space-between;
.eyebrow {
color: var(--td-brand-color);
display: block;
font-size: .6875rem;
font-weight: 700;
letter-spacing: .08em;
}
}
.title {
gap: .5rem;
display: flex;
align-items: center;
justify-content: space-between;
}
.eyebrow {
color: var(--td-brand-color);
display: block;
font-size: .6875rem;
font-weight: 700;
letter-spacing: .08em;
}
h1 {
margin: 0;
font-size: 1.25rem;
line-height: 1.35;
}
p {
.description {
color: var(--td-text-color-secondary);
margin: .5rem 0 0;
line-height: 1.5;
}
.hero-meta {
.items-price {
gap: .75rem;
display: flex;
margin-top: .75rem;
color: var(--td-text-color-secondary);
align-items: center;
align-items: end;
justify-content: space-between;
}
strong {
color: #c2410c;
font-size: 1.2rem;
white-space: nowrap;
.price {
.value {
font-size: 1.5rem;
}
}
}
}
.product {
.item {
padding: 10px;
.item-title {
gap: .5rem;
display: flex;
align-items: center;
justify-content: space-between;
}
.avatar {
width: 3.5rem;
height: 3.5rem;
}
}
}
}
:deep(.package-config-detail .avatar .t-image__img) {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: inherit;
}
:global(html.theme-dark) .package-config-detail .hero {
background: linear-gradient(135deg, rgba(15, 118, 110, .3), rgba(37, 99, 235, .28) 52%, rgba(194, 65, 12, .24));
border-color: rgba(153, 246, 228, .16);
&::before {
background: rgba(45, 212, 191, .14);
}
&::after {
background: rgba(96, 165, 250, .12);
}
.eyebrow {
color: #99f6e4;
}