feat(project): 优惠券列表门店标签显示具体门店名称
All checks were successful
Build and Deploy TenantUI / build-and-deploy (push) Successful in 50s
All checks were successful
Build and Deploy TenantUI / build-and-deploy (push) Successful in 50s
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
|||||||
resolveCouponFaceConditionText,
|
resolveCouponFaceConditionText,
|
||||||
resolveCouponFaceValueText,
|
resolveCouponFaceValueText,
|
||||||
resolveCouponRuleText,
|
resolveCouponRuleText,
|
||||||
|
resolveCouponStoreTagText,
|
||||||
resolveCouponTypeClass,
|
resolveCouponTypeClass,
|
||||||
resolveCouponTypeLabel,
|
resolveCouponTypeLabel,
|
||||||
resolveCouponValidityText,
|
resolveCouponValidityText,
|
||||||
@@ -25,6 +26,7 @@ import {
|
|||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
item: CouponCardViewModel;
|
item: CouponCardViewModel;
|
||||||
|
storeNameMap: Record<string, string>;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
@@ -83,12 +85,17 @@ function resolveClaimedText(item: CouponCardViewModel) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mcp-bottom">
|
<div class="mcp-bottom">
|
||||||
|
<div class="mcp-meta-tags">
|
||||||
<span
|
<span
|
||||||
class="mcp-status-tag"
|
class="mcp-status-tag"
|
||||||
:class="COUPON_STATUS_TAG_CLASS_MAP[item.displayStatus]"
|
:class="COUPON_STATUS_TAG_CLASS_MAP[item.displayStatus]"
|
||||||
>
|
>
|
||||||
{{ COUPON_STATUS_TEXT_MAP[item.displayStatus] }}
|
{{ COUPON_STATUS_TEXT_MAP[item.displayStatus] }}
|
||||||
</span>
|
</span>
|
||||||
|
<span class="mcp-store-tag">
|
||||||
|
{{ resolveCouponStoreTagText(item, storeNameMap) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mcp-actions">
|
<div class="mcp-actions">
|
||||||
<template v-if="item.displayStatus === 'ended'">
|
<template v-if="item.displayStatus === 'ended'">
|
||||||
|
|||||||
@@ -113,6 +113,30 @@ export function resolveCouponRuleText(item: CouponCardViewModel) {
|
|||||||
return `${limitText} | ${channelText}`;
|
return `${limitText} | ${channelText}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 门店范围标签文本。 */
|
||||||
|
export function resolveCouponStoreTagText(
|
||||||
|
item: CouponCardViewModel,
|
||||||
|
storeNameMap: Record<string, string>,
|
||||||
|
) {
|
||||||
|
if (item.storeScopeMode === 'all') {
|
||||||
|
return '全部门店';
|
||||||
|
}
|
||||||
|
|
||||||
|
const storeNames = item.storeIds
|
||||||
|
.map((storeId) => storeNameMap[storeId])
|
||||||
|
.filter((name) => typeof name === 'string' && name.length > 0);
|
||||||
|
|
||||||
|
if (storeNames.length <= 0) {
|
||||||
|
return '指定门店';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (storeNames.length === 1) {
|
||||||
|
return storeNames[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${storeNames[0]}等${storeNames.length}家`;
|
||||||
|
}
|
||||||
|
|
||||||
/** 渠道文本。 */
|
/** 渠道文本。 */
|
||||||
export function resolveChannelsText(channels: MarketingCouponChannel[]) {
|
export function resolveChannelsText(channels: MarketingCouponChannel[]) {
|
||||||
const normalized = channels.toSorted();
|
const normalized = channels.toSorted();
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ export function useMarketingCouponPage() {
|
|||||||
value: item.id,
|
value: item.id,
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
const storeNameMap = computed<Record<string, string>>(() =>
|
||||||
|
Object.fromEntries(stores.value.map((item) => [item.id, item.name])),
|
||||||
|
);
|
||||||
|
|
||||||
const hasStore = computed(() => !!selectedStoreId.value);
|
const hasStore = computed(() => !!selectedStoreId.value);
|
||||||
|
|
||||||
@@ -192,6 +195,7 @@ export function useMarketingCouponPage() {
|
|||||||
setStatusFilter,
|
setStatusFilter,
|
||||||
setTypeFilter,
|
setTypeFilter,
|
||||||
stats,
|
stats,
|
||||||
|
storeNameMap,
|
||||||
storeOptions,
|
storeOptions,
|
||||||
stores,
|
stores,
|
||||||
submitDrawer,
|
submitDrawer,
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ const {
|
|||||||
setStatusFilter,
|
setStatusFilter,
|
||||||
setTypeFilter,
|
setTypeFilter,
|
||||||
stats,
|
stats,
|
||||||
|
storeNameMap,
|
||||||
storeOptions,
|
storeOptions,
|
||||||
submitDrawer,
|
submitDrawer,
|
||||||
total,
|
total,
|
||||||
@@ -139,6 +140,7 @@ function onTypeFilterChange(value: unknown) {
|
|||||||
v-for="item in rows"
|
v-for="item in rows"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:item="item"
|
:item="item"
|
||||||
|
:store-name-map="storeNameMap"
|
||||||
@edit="(row) => openEditDrawer(row.id)"
|
@edit="(row) => openEditDrawer(row.id)"
|
||||||
@view="(row) => openEditDrawer(row.id)"
|
@view="(row) => openEditDrawer(row.id)"
|
||||||
@enable="enableCoupon"
|
@enable="enableCoupon"
|
||||||
|
|||||||
@@ -173,6 +173,12 @@
|
|||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mcp-meta-tags {
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 6px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.mcp-status-tag {
|
.mcp-status-tag {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -201,4 +207,19 @@
|
|||||||
color: #92400e;
|
color: #92400e;
|
||||||
background: #fef3c7;
|
background: #fef3c7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mcp-store-tag {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
max-width: 180px;
|
||||||
|
height: 22px;
|
||||||
|
padding: 0 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #475569;
|
||||||
|
background: #f1f5f9;
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user