@tbox.cn/app-module-shopping-guide 0.9.12 → 1.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +3 -3
- package/dist/chunk-MBJPTP72.js +1692 -0
- package/dist/client/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/server/index.d.ts +696 -696
- package/package.json +12 -9
- package/src/client/cards/category-list/index.tsx +17 -17
- package/src/client/cards/human-guide-list/index.tsx +17 -14
- package/src/client/cards/location-handoff/index.tsx +10 -10
- package/src/client/cards/mall-directory/index.tsx +14 -14
- package/src/client/cards/nearby-mall-list/index.tsx +29 -11
- package/src/client/cards/product-comparison/index.tsx +29 -18
- package/src/client/cards/product-detail/index.tsx +41 -25
- package/src/client/cards/product-list/index.tsx +74 -54
- package/src/client/cards/recommend-merchants/index.tsx +19 -9
- package/src/client/cards/shop-detail/index.tsx +13 -9
- package/src/client/cards/shop-list/index.tsx +19 -9
- package/src/client/components/ImageWithFallback.tsx +1 -1
- package/src/client/components/MerchantRow.tsx +23 -13
- package/src/client/components/ShopDetailSheet.tsx +94 -131
- package/src/client/components/ShopGuideHeader.tsx +6 -6
- package/src/client/components/ShopGuideSectionLabel.tsx +1 -1
- package/src/client/components/ShopListSheet.tsx +58 -96
- package/src/client/index.ts +0 -2
- package/tbox.module.json +0 -1
- package/tests/cards-render.test.tsx +40 -7
- package/tsup.config.ts +0 -5
- package/dist/chunk-PAYDOSCV.js +0 -1676
- package/dist/shopping-guide-62BDCPW5.css +0 -2600
- package/src/client/styles/shopping-guide.css +0 -2600
- package/src/client/types/css.d.ts +0 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* 点击商品行唤起半屏展示完整信息(portal + sheet 模式,参考 ToolCallDetailOverlay)。
|
|
4
4
|
*/
|
|
5
5
|
import { useState } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { Overlay } from '@tbox.cn/app-agent-ui-kit/overlay';
|
|
7
7
|
import { X } from '@phosphor-icons/react';
|
|
8
8
|
import { ItemActionsRow, sendCardAction } from '@tbox.cn/app-agent-sdk-client';
|
|
9
9
|
import { ImageWithFallback } from '../../components/ImageWithFallback';
|
|
@@ -11,6 +11,16 @@ import type { ProductListCardData } from '@tbox.cn/app-contracts-mall';
|
|
|
11
11
|
|
|
12
12
|
type ProductItem = ProductListCardData['items'][number];
|
|
13
13
|
|
|
14
|
+
/** 可用性徽章:基础规格 + 按状态码取色(完整字面量,禁止拼接) */
|
|
15
|
+
const AVAILABILITY_BASE_CLASS = 'sg-availability mt-1 inline-block text-xs text-secondary-foreground';
|
|
16
|
+
const AVAILABILITY_TONE_CLASS: Record<string, string> = {
|
|
17
|
+
in_stock: 'sg-availability-in_stock text-success',
|
|
18
|
+
available: 'sg-availability-available text-success',
|
|
19
|
+
out_of_stock: 'sg-availability-out_of_stock text-warning',
|
|
20
|
+
limited: 'sg-availability-limited',
|
|
21
|
+
unknown: 'sg-availability-unknown',
|
|
22
|
+
};
|
|
23
|
+
|
|
14
24
|
function ProductDetailSheet({
|
|
15
25
|
item,
|
|
16
26
|
cardId,
|
|
@@ -22,96 +32,106 @@ function ProductDetailSheet({
|
|
|
22
32
|
isHistory: boolean;
|
|
23
33
|
onClose: () => void;
|
|
24
34
|
}) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
// 两段式关闭:父组件是条件挂载,立刻归还就播不出退场动画。
|
|
36
|
+
const [closing, setClosing] = useState(false);
|
|
37
|
+
const requestClose = () => setClosing(true);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Overlay
|
|
41
|
+
open={!closing}
|
|
42
|
+
onDismiss={requestClose}
|
|
43
|
+
onExited={onClose}
|
|
44
|
+
placement="bottom"
|
|
45
|
+
label={item.name}
|
|
46
|
+
exitMs={200}
|
|
47
|
+
rootClassName="sg-product-sheet group pb-[var(--tbox-chat-bottom-height,0px)]"
|
|
48
|
+
maskClassName="bg-[rgba(11,15,23,0.5)]"
|
|
49
|
+
panelClassName="sg-product-sheet__panel flex max-h-[calc(82vh-var(--tbox-chat-bottom-height,0px))] w-full flex-col overflow-hidden rounded-t-[18px] bg-card shadow-[0_-6px_20px_rgba(11,15,23,0.12)] animate-[tbox-sheet-in_200ms_ease-out] group-data-[state=closed]:animate-[tbox-sheet-out_200ms_ease-in_both] motion-reduce:animate-none"
|
|
50
|
+
>
|
|
51
|
+
<div className="sg-product-sheet__header flex shrink-0 items-center px-4 pt-4 pb-2.5">
|
|
52
|
+
<span className="sg-product-sheet__title min-w-0 flex-1 text-base font-semibold text-foreground">商品详情</span>
|
|
53
|
+
<button type="button" className="sg-product-sheet__close flex size-7 shrink-0 items-center justify-center rounded-full border-0 bg-muted text-secondary-foreground" onClick={requestClose} aria-label="关闭">
|
|
32
54
|
<X size={18} />
|
|
33
55
|
</button>
|
|
34
56
|
</div>
|
|
35
57
|
|
|
36
|
-
<div className="sg-product-sheet__body">
|
|
58
|
+
<div className="sg-product-sheet__body overflow-y-auto px-4 pb-6">
|
|
37
59
|
{item.imageUrl && (
|
|
38
60
|
<ImageWithFallback
|
|
39
61
|
src={item.imageUrl}
|
|
40
62
|
alt={item.name}
|
|
41
|
-
className="sg-product-sheet__cover"
|
|
63
|
+
className="sg-product-sheet__cover mb-3.5 block h-[180px] w-full max-w-full rounded-[12px] object-cover"
|
|
42
64
|
size={240}
|
|
43
65
|
/>
|
|
44
66
|
)}
|
|
45
67
|
|
|
46
|
-
<div className="sg-product-sheet__main">
|
|
68
|
+
<div className="sg-product-sheet__main pb-2">
|
|
47
69
|
{item.badges.length > 0 && (
|
|
48
|
-
<div className="sg-badges">
|
|
70
|
+
<div className="sg-badges mb-1.5 flex flex-wrap gap-1.5">
|
|
49
71
|
{item.badges.map((b) => (
|
|
50
|
-
<span key={b} className="sg-badge">{b}</span>
|
|
72
|
+
<span key={b} className="sg-badge rounded-[8px] bg-muted px-1.5 py-[0.5px] text-xs leading-4 text-secondary-foreground">{b}</span>
|
|
51
73
|
))}
|
|
52
74
|
</div>
|
|
53
75
|
)}
|
|
54
|
-
<div className="sg-product-sheet__name">{item.name}</div>
|
|
55
|
-
{item.brand && <div className="sg-product-sheet__brand">{item.brand}</div>}
|
|
76
|
+
<div className="sg-product-sheet__name mt-1 text-lg leading-[26px] font-bold text-foreground">{item.name}</div>
|
|
77
|
+
{item.brand && <div className="sg-product-sheet__brand mt-[3px] text-sm text-muted-foreground">{item.brand}</div>}
|
|
56
78
|
|
|
57
|
-
<div className="sg-product-sheet__price-row">
|
|
79
|
+
<div className="sg-product-sheet__price-row mt-2 flex items-baseline gap-1.5">
|
|
58
80
|
{item.price.sale && (
|
|
59
|
-
<span className="sg-price-sale">{item.price.sale.display}</span>
|
|
81
|
+
<span className="sg-price-sale text-base font-bold tabular-nums text-[#ef4f43]">{item.price.sale.display}</span>
|
|
60
82
|
)}
|
|
61
83
|
{item.price.original && item.price.sale && (
|
|
62
|
-
<span className="sg-price-original">{item.price.original.display}</span>
|
|
84
|
+
<span className="sg-price-original text-xs line-through text-muted-foreground">{item.price.original.display}</span>
|
|
63
85
|
)}
|
|
64
86
|
{item.price.promotion && (
|
|
65
|
-
<span className="sg-price-promotion">{item.price.promotion.display}</span>
|
|
87
|
+
<span className="sg-price-promotion rounded-[8px] bg-[#fff1f3] px-1.5 py-[0.5px] text-xs leading-4 text-[#ef4f43]">{item.price.promotion.display}</span>
|
|
66
88
|
)}
|
|
67
89
|
{!item.price.sale && !item.price.original && !item.price.promotion && (
|
|
68
|
-
<span className="sg-price-unavailable">价格暂无</span>
|
|
90
|
+
<span className="sg-price-unavailable text-xs text-muted-foreground">价格暂无</span>
|
|
69
91
|
)}
|
|
70
92
|
</div>
|
|
71
93
|
|
|
72
|
-
<div className={
|
|
94
|
+
<div className={`${AVAILABILITY_BASE_CLASS} ${AVAILABILITY_TONE_CLASS[item.availability.status] ?? ''}`}>
|
|
73
95
|
{item.availability.label}
|
|
74
96
|
</div>
|
|
75
97
|
|
|
76
|
-
<div className="sg-product-sheet__merchant">
|
|
98
|
+
<div className="sg-product-sheet__merchant mt-1.5 text-sm text-secondary-foreground">
|
|
77
99
|
<span>{item.merchant.name}</span>
|
|
78
100
|
{item.merchant.location?.displayText && (
|
|
79
|
-
<span className="sg-merchant-location"> · {item.merchant.location.displayText}</span>
|
|
101
|
+
<span className="sg-merchant-location mt-1 flex flex-wrap items-center gap-[3px] text-xs text-secondary-foreground"> · {item.merchant.location.displayText}</span>
|
|
80
102
|
)}
|
|
81
103
|
</div>
|
|
82
104
|
|
|
83
105
|
{item.reasons && item.reasons.length > 0 && (
|
|
84
|
-
<div className="sg-reasons">
|
|
106
|
+
<div className="sg-reasons mt-1.5 flex flex-wrap gap-1.5">
|
|
85
107
|
{item.reasons.map((r) => (
|
|
86
|
-
<span key={r.code} className="sg-reason-tag">{r.label}</span>
|
|
108
|
+
<span key={r.code} className="sg-reason-tag rounded-full bg-[#fff1f3] px-2 py-0.5 text-xs leading-4 text-[#ef4f43]">{r.label}</span>
|
|
87
109
|
))}
|
|
88
110
|
</div>
|
|
89
111
|
)}
|
|
90
112
|
|
|
91
113
|
{item.caveats.length > 0 && (
|
|
92
|
-
<div className="sg-item-caveats">
|
|
114
|
+
<div className="sg-item-caveats mt-1.5">
|
|
93
115
|
{item.caveats.map((c, i) => (
|
|
94
|
-
<div key={i} className="sg-caveat-item">⚠️ {c}</div>
|
|
116
|
+
<div key={i} className="sg-caveat-item text-xs leading-4 text-muted-foreground">⚠️ {c}</div>
|
|
95
117
|
))}
|
|
96
118
|
</div>
|
|
97
119
|
)}
|
|
98
120
|
</div>
|
|
99
121
|
|
|
100
122
|
{item.availability.marketable && (
|
|
101
|
-
<div className="sg-product-sheet__actions">
|
|
123
|
+
<div className="sg-product-sheet__actions mt-3 border-t-[0.5px] border-border pt-3">
|
|
102
124
|
<ItemActionsRow
|
|
103
125
|
actions={item.itemActions}
|
|
104
126
|
cardId={cardId}
|
|
105
127
|
isHistory={isHistory}
|
|
106
|
-
className="sg-product-sheet__action-row"
|
|
107
|
-
chipClassName="sg-product-sheet__chip"
|
|
128
|
+
className="sg-product-sheet__action-row flex gap-2"
|
|
129
|
+
chipClassName="sg-product-sheet__chip flex-1 rounded-[9px] border-0 bg-[#e54650] py-2.5 text-center text-sm font-medium text-white"
|
|
108
130
|
/>
|
|
109
131
|
</div>
|
|
110
132
|
)}
|
|
111
133
|
</div>
|
|
112
|
-
|
|
113
|
-
</div>,
|
|
114
|
-
document.body,
|
|
134
|
+
</Overlay>
|
|
115
135
|
);
|
|
116
136
|
}
|
|
117
137
|
|
|
@@ -124,17 +144,17 @@ export function ProductListCard(props: {
|
|
|
124
144
|
const [activeItem, setActiveItem] = useState<ProductItem | null>(null);
|
|
125
145
|
|
|
126
146
|
return (
|
|
127
|
-
<section className="sg-card sg-product-list">
|
|
128
|
-
{data.summary && <div className="sg-card-summary">{data.summary}</div>}
|
|
147
|
+
<section className="sg-card sg-product-list p-5 text-foreground">
|
|
148
|
+
{data.summary && <div className="sg-card-summary mb-3 text-sm text-secondary-foreground">{data.summary}</div>}
|
|
129
149
|
|
|
130
150
|
{data.items.length === 0 ? (
|
|
131
|
-
<div className="sg-empty">{data.noResultsReason ?? '暂无相关商品'}</div>
|
|
151
|
+
<div className="sg-empty py-6 text-center text-sm text-muted-foreground">{data.noResultsReason ?? '暂无相关商品'}</div>
|
|
132
152
|
) : (
|
|
133
|
-
<ul className="sg-product-list-items">
|
|
153
|
+
<ul className="sg-product-list-items m-0 list-none p-0">
|
|
134
154
|
{data.items.map((item) => (
|
|
135
155
|
<li
|
|
136
156
|
key={item.productId}
|
|
137
|
-
className="sg-product-item sg-product-item--clickable"
|
|
157
|
+
className="sg-product-item sg-product-item--clickable flex cursor-pointer gap-3 border-b-[0.5px] border-border py-3 transition-colors duration-150 last:border-b-0 active:bg-muted"
|
|
138
158
|
onClick={() => setActiveItem(item)}
|
|
139
159
|
role="button"
|
|
140
160
|
tabIndex={0}
|
|
@@ -143,59 +163,59 @@ export function ProductListCard(props: {
|
|
|
143
163
|
<ImageWithFallback
|
|
144
164
|
src={item.imageUrl}
|
|
145
165
|
alt={item.name}
|
|
146
|
-
className="sg-product-image"
|
|
166
|
+
className="sg-product-image size-20 shrink-0 max-w-full rounded-[8px] object-cover"
|
|
147
167
|
size={44}
|
|
148
168
|
/>
|
|
149
|
-
<div className="sg-product-info">
|
|
169
|
+
<div className="sg-product-info min-w-0 flex-1">
|
|
150
170
|
{item.badges.length > 0 && (
|
|
151
|
-
<div className="sg-badges">
|
|
171
|
+
<div className="sg-badges mb-1.5 flex flex-wrap gap-1.5">
|
|
152
172
|
{item.badges.map((b) => (
|
|
153
|
-
<span key={b} className="sg-badge">{b}</span>
|
|
173
|
+
<span key={b} className="sg-badge rounded-[8px] bg-muted px-1.5 py-[0.5px] text-xs leading-4 text-secondary-foreground">{b}</span>
|
|
154
174
|
))}
|
|
155
175
|
</div>
|
|
156
176
|
)}
|
|
157
|
-
<div className="sg-product-name">{item.name}</div>
|
|
177
|
+
<div className="sg-product-name text-base leading-[21px] font-semibold text-foreground">{item.name}</div>
|
|
158
178
|
{item.brand && <div className="sg-product-brand">{item.brand}</div>}
|
|
159
|
-
<div className="sg-price-block">
|
|
179
|
+
<div className="sg-price-block mt-1 flex flex-wrap items-baseline gap-2">
|
|
160
180
|
{item.price.sale && (
|
|
161
|
-
<span className="sg-price-sale">{item.price.sale.display}</span>
|
|
181
|
+
<span className="sg-price-sale text-base font-bold tabular-nums text-[#ef4f43]">{item.price.sale.display}</span>
|
|
162
182
|
)}
|
|
163
183
|
{item.price.original && item.price.sale && (
|
|
164
|
-
<span className="sg-price-original">{item.price.original.display}</span>
|
|
184
|
+
<span className="sg-price-original text-xs line-through text-muted-foreground">{item.price.original.display}</span>
|
|
165
185
|
)}
|
|
166
186
|
{item.price.promotion && (
|
|
167
|
-
<span className="sg-price-promotion">{item.price.promotion.display}</span>
|
|
187
|
+
<span className="sg-price-promotion rounded-[8px] bg-[#fff1f3] px-1.5 py-[0.5px] text-xs leading-4 text-[#ef4f43]">{item.price.promotion.display}</span>
|
|
168
188
|
)}
|
|
169
189
|
{!item.price.sale && !item.price.original && !item.price.promotion && (
|
|
170
|
-
<span className="sg-price-unavailable">价格暂无</span>
|
|
190
|
+
<span className="sg-price-unavailable text-xs text-muted-foreground">价格暂无</span>
|
|
171
191
|
)}
|
|
172
192
|
</div>
|
|
173
|
-
<div className="sg-product-sheet__merchant">
|
|
193
|
+
<div className="sg-product-sheet__merchant mt-1.5 text-sm text-secondary-foreground">
|
|
174
194
|
<span>{item.merchant.name}</span>
|
|
175
195
|
{item.merchant.location?.displayText && (
|
|
176
|
-
<span className="sg-merchant-location"> · {item.merchant.location.displayText}</span>
|
|
196
|
+
<span className="sg-merchant-location mt-1 flex flex-wrap items-center gap-[3px] text-xs text-secondary-foreground"> · {item.merchant.location.displayText}</span>
|
|
177
197
|
)}
|
|
178
198
|
</div>
|
|
179
199
|
</div>
|
|
180
|
-
<div className="sg-product-item__arrow" aria-hidden="true">›</div>
|
|
200
|
+
<div className="sg-product-item__arrow ml-1 shrink-0 self-center text-base text-muted-foreground" aria-hidden="true">›</div>
|
|
181
201
|
</li>
|
|
182
202
|
))}
|
|
183
203
|
</ul>
|
|
184
204
|
)}
|
|
185
205
|
|
|
186
206
|
{data.pageInfo?.hasMore && (
|
|
187
|
-
<div className="sg-page-info">
|
|
207
|
+
<div className="sg-page-info mt-2.5 text-center text-xs text-muted-foreground">
|
|
188
208
|
已展示 {data.items.length} / {data.pageInfo.total} 件商品
|
|
189
209
|
</div>
|
|
190
210
|
)}
|
|
191
211
|
|
|
192
212
|
{data.refinements.length > 0 && (
|
|
193
|
-
<div className="sg-refinements">
|
|
213
|
+
<div className="sg-refinements mt-3 flex flex-wrap gap-2 border-t-[0.5px] border-dashed border-border pt-2.5">
|
|
194
214
|
{data.refinements.map((r, i) => (
|
|
195
215
|
<button
|
|
196
216
|
key={i}
|
|
197
217
|
type="button"
|
|
198
|
-
className="sg-refinement-chip"
|
|
218
|
+
className="sg-refinement-chip cursor-pointer rounded-full border-[0.5px] border-border bg-card px-3 py-1 text-xs text-secondary-foreground disabled:cursor-not-allowed disabled:opacity-50 [font-family:inherit] tracking-normal"
|
|
199
219
|
disabled={isHistory}
|
|
200
220
|
onClick={() => {
|
|
201
221
|
if (isHistory) return;
|
|
@@ -19,6 +19,12 @@ type OverlayState =
|
|
|
19
19
|
| { readonly kind: 'list' }
|
|
20
20
|
| { readonly kind: 'detail'; readonly merchant: Merchant };
|
|
21
21
|
|
|
22
|
+
/** 品类 tab:选中态(--active)与默认态各一串完整字面量,避免拼接。 */
|
|
23
|
+
const TAB_CLASS =
|
|
24
|
+
'sg-rm-tab relative flex min-h-7 shrink-0 cursor-pointer items-center justify-center border-0 bg-transparent px-px pb-[7px] text-xs font-medium whitespace-nowrap text-[#6b706d] transition-colors duration-150 [font-family:inherit] tracking-normal';
|
|
25
|
+
const TAB_ACTIVE_CLASS =
|
|
26
|
+
'sg-rm-tab sg-rm-tab--active relative flex min-h-7 shrink-0 cursor-pointer items-center justify-center border-0 bg-transparent px-px pb-[7px] text-xs font-semibold whitespace-nowrap text-foreground transition-colors duration-150 [font-family:inherit] tracking-normal after:absolute after:bottom-0 after:left-1/2 after:h-[3px] after:w-[18px] after:-translate-x-1/2 after:rounded-[1.5px] after:bg-[#30372f]';
|
|
27
|
+
|
|
22
28
|
export function RecommendMerchantsCard(props: {
|
|
23
29
|
data: RecommendMerchantsCardData;
|
|
24
30
|
cardId: string;
|
|
@@ -65,17 +71,17 @@ export function RecommendMerchantsCard(props: {
|
|
|
65
71
|
|
|
66
72
|
return (
|
|
67
73
|
<>
|
|
68
|
-
<section className="sg-card sg-recommend-merchants">
|
|
74
|
+
<section className="sg-card sg-recommend-merchants overflow-hidden rounded-[14px] px-3 pb-3 text-foreground">
|
|
69
75
|
<ShopGuideHeader subtitle={data.summary ?? '按品类发现值得逛的门店'} />
|
|
70
76
|
|
|
71
77
|
{visibleTabs.length > 0 && (
|
|
72
|
-
<div className="sg-rm-tabs" aria-label="按门店品类筛选">
|
|
78
|
+
<div className="sg-rm-tabs mt-[9px] flex gap-4 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden" aria-label="按门店品类筛选">
|
|
73
79
|
{/* 「全部」承载「未筛选」这个本就存在的状态——此前它只能靠再点一次已选中的 tab
|
|
74
80
|
回到,而 tab 形态下「点选中项取消」并不直观。与浮层的分类导航同一套语义。 */}
|
|
75
81
|
<button
|
|
76
82
|
type="button"
|
|
77
83
|
aria-pressed={!activeTabCode}
|
|
78
|
-
className={
|
|
84
|
+
className={!activeTabCode ? TAB_ACTIVE_CLASS : TAB_CLASS}
|
|
79
85
|
onClick={() => setActiveTabCode('')}
|
|
80
86
|
>
|
|
81
87
|
<span>全部</span>
|
|
@@ -87,7 +93,7 @@ export function RecommendMerchantsCard(props: {
|
|
|
87
93
|
key={tab.code}
|
|
88
94
|
type="button"
|
|
89
95
|
aria-pressed={isActive}
|
|
90
|
-
className={
|
|
96
|
+
className={isActive ? TAB_ACTIVE_CLASS : TAB_CLASS}
|
|
91
97
|
onClick={() => setActiveTabCode(tab.code)}
|
|
92
98
|
>
|
|
93
99
|
<span>{tab.name}</span>
|
|
@@ -98,21 +104,25 @@ export function RecommendMerchantsCard(props: {
|
|
|
98
104
|
)}
|
|
99
105
|
|
|
100
106
|
{filteredItems.length === 0 ? (
|
|
101
|
-
<div className="sg-empty">{data.noResultsReason ?? '暂时没有符合条件的门店'}</div>
|
|
107
|
+
<div className="sg-empty py-6 text-center text-sm text-muted-foreground">{data.noResultsReason ?? '暂时没有符合条件的门店'}</div>
|
|
102
108
|
) : (
|
|
103
109
|
<>
|
|
104
110
|
<ShopGuideSectionLabel />
|
|
105
|
-
<ul className="sg-rm-list">
|
|
111
|
+
<ul className="sg-rm-list mt-1 mr-0 mb-0 ml-0 flex list-none flex-col p-0">
|
|
106
112
|
{previewItems.map((item) => (
|
|
107
|
-
<li key={item.merchantId} className="sg-rm-item">
|
|
108
|
-
<MerchantRow
|
|
113
|
+
<li key={item.merchantId} className="sg-rm-item py-2.5">
|
|
114
|
+
<MerchantRow
|
|
115
|
+
merchant={item}
|
|
116
|
+
className="items-start bg-transparent p-0 focus-visible:rounded-[6px] focus-visible:outline-offset-[3px]"
|
|
117
|
+
onSelect={() => openDetail(item)}
|
|
118
|
+
/>
|
|
109
119
|
</li>
|
|
110
120
|
))}
|
|
111
121
|
</ul>
|
|
112
122
|
{filteredItems.length > PREVIEW_ITEM_COUNT && (
|
|
113
123
|
<button
|
|
114
124
|
type="button"
|
|
115
|
-
className="sg-rm-view-all"
|
|
125
|
+
className="sg-rm-view-all mt-[2px] flex min-h-8 w-full cursor-pointer items-center justify-center gap-[2px] border-0 bg-transparent p-0 text-xs text-[#686d69] focus-visible:rounded-[5px] focus-visible:outline-[1.5px] focus-visible:outline-offset-[1px] focus-visible:outline-[rgba(9,107,250,0.28)] [font-family:inherit] tracking-normal"
|
|
116
126
|
onClick={() => setOverlay({ kind: 'list' })}
|
|
117
127
|
>
|
|
118
128
|
查看全部门店
|
|
@@ -88,24 +88,28 @@ export function ShopDetailCard(props: {
|
|
|
88
88
|
|
|
89
89
|
return (
|
|
90
90
|
<>
|
|
91
|
-
<section className="sg-card sg-recommend-merchants sg-shop-detail">
|
|
91
|
+
<section className="sg-card sg-recommend-merchants sg-shop-detail overflow-hidden rounded-[14px] px-3 pb-3 text-foreground">
|
|
92
92
|
<ShopGuideHeader subtitle={data.brand ?? data.businessCategories.join(' · ') ?? '门店详情'} />
|
|
93
93
|
|
|
94
|
-
<ul className="sg-rm-list">
|
|
95
|
-
<li className="sg-rm-item">
|
|
94
|
+
<ul className="sg-rm-list mt-1 mr-0 mb-0 ml-0 flex list-none flex-col p-0">
|
|
95
|
+
<li className="sg-rm-item py-2.5">
|
|
96
96
|
{/* 与列表卡一致:历史卡仍可下钻只读详情,故不传 disabled。 */}
|
|
97
|
-
<MerchantRow
|
|
97
|
+
<MerchantRow
|
|
98
|
+
merchant={data}
|
|
99
|
+
className="items-start bg-transparent p-0 focus-visible:rounded-[6px] focus-visible:outline-offset-[3px]"
|
|
100
|
+
onSelect={openDetail}
|
|
101
|
+
/>
|
|
98
102
|
</li>
|
|
99
103
|
</ul>
|
|
100
104
|
{(hoursText || phone) && (
|
|
101
|
-
<div className="sg-shop-detail__facts">
|
|
102
|
-
<span className="sg-shop-detail__fact">
|
|
103
|
-
<Clock size={15} weight="duotone" aria-hidden="true" />
|
|
105
|
+
<div className="sg-shop-detail__facts flex flex-wrap gap-x-2.5 gap-y-1 px-3 pb-[9px]">
|
|
106
|
+
<span className="sg-shop-detail__fact inline-flex items-center gap-[3px] text-xs leading-[13px] text-[rgba(11,15,23,0.72)]">
|
|
107
|
+
<Clock size={15} weight="duotone" aria-hidden="true" className="shrink-0 text-[rgba(35,104,236,0.8)]" />
|
|
104
108
|
{hoursText}
|
|
105
109
|
</span>
|
|
106
110
|
{phone && (
|
|
107
|
-
<span className="sg-shop-detail__fact">
|
|
108
|
-
<Phone size={15} weight="duotone" aria-hidden="true" />
|
|
111
|
+
<span className="sg-shop-detail__fact inline-flex items-center gap-[3px] text-xs leading-[13px] text-[rgba(11,15,23,0.72)]">
|
|
112
|
+
<Phone size={15} weight="duotone" aria-hidden="true" className="shrink-0 text-[rgba(35,104,236,0.8)]" />
|
|
109
113
|
{phone.value}
|
|
110
114
|
</span>
|
|
111
115
|
)}
|
|
@@ -18,6 +18,12 @@ type OverlayState =
|
|
|
18
18
|
| { readonly kind: 'list' }
|
|
19
19
|
| { readonly kind: 'detail'; readonly merchant: Merchant };
|
|
20
20
|
|
|
21
|
+
/** 品类 tab:选中态(--active)与默认态各一串完整字面量,避免拼接。 */
|
|
22
|
+
const TAB_CLASS =
|
|
23
|
+
'sg-rm-tab relative flex min-h-7 shrink-0 cursor-pointer items-center justify-center border-0 bg-transparent px-px pb-[7px] text-xs font-medium whitespace-nowrap text-[#6b706d] transition-colors duration-150 [font-family:inherit] tracking-normal';
|
|
24
|
+
const TAB_ACTIVE_CLASS =
|
|
25
|
+
'sg-rm-tab sg-rm-tab--active relative flex min-h-7 shrink-0 cursor-pointer items-center justify-center border-0 bg-transparent px-px pb-[7px] text-xs font-semibold whitespace-nowrap text-foreground transition-colors duration-150 [font-family:inherit] tracking-normal after:absolute after:bottom-0 after:left-1/2 after:h-[3px] after:w-[18px] after:-translate-x-1/2 after:rounded-[1.5px] after:bg-[#30372f]';
|
|
26
|
+
|
|
21
27
|
/** 从列表 item 快速投影 ShopDetailSheetData(即时展示用,不含电话/营业时间/coupons 等完整字段) */
|
|
22
28
|
function projectSheetDataFromItem(merchant: Merchant): ShopDetailSheetData {
|
|
23
29
|
return {
|
|
@@ -123,17 +129,17 @@ export function ShopListCard(props: {
|
|
|
123
129
|
|
|
124
130
|
return (
|
|
125
131
|
<>
|
|
126
|
-
<section className="sg-card sg-recommend-merchants sg-shop-list">
|
|
132
|
+
<section className="sg-card sg-recommend-merchants sg-shop-list overflow-hidden rounded-[14px] px-3 pb-3 text-foreground">
|
|
127
133
|
<ShopGuideHeader subtitle={data.summary ?? '按品类快速找到想逛的门店'} />
|
|
128
134
|
|
|
129
135
|
{allTabs.length > 0 && (
|
|
130
|
-
<div className="sg-rm-tabs" aria-label="按门店品类筛选">
|
|
136
|
+
<div className="sg-rm-tabs mt-[9px] flex gap-4 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden" aria-label="按门店品类筛选">
|
|
131
137
|
{/* 「全部」承载「未筛选」这个本就存在的状态——此前它只能靠再点一次已选中的 tab
|
|
132
138
|
回到,而 tab 形态下「点选中项取消」并不直观。与浮层的分类导航同一套语义。 */}
|
|
133
139
|
<button
|
|
134
140
|
type="button"
|
|
135
141
|
aria-pressed={!activeTabCode}
|
|
136
|
-
className={
|
|
142
|
+
className={!activeTabCode ? TAB_ACTIVE_CLASS : TAB_CLASS}
|
|
137
143
|
onClick={() => setActiveTabCode('')}
|
|
138
144
|
>
|
|
139
145
|
<span>全部</span>
|
|
@@ -145,7 +151,7 @@ export function ShopListCard(props: {
|
|
|
145
151
|
key={tab.code}
|
|
146
152
|
type="button"
|
|
147
153
|
aria-pressed={isActive}
|
|
148
|
-
className={
|
|
154
|
+
className={isActive ? TAB_ACTIVE_CLASS : TAB_CLASS}
|
|
149
155
|
onClick={() => setActiveTabCode(tab.code)}
|
|
150
156
|
>
|
|
151
157
|
<span>{tab.name}</span>
|
|
@@ -156,15 +162,19 @@ export function ShopListCard(props: {
|
|
|
156
162
|
)}
|
|
157
163
|
|
|
158
164
|
{filteredItems.length === 0 ? (
|
|
159
|
-
<div className="sg-empty">{data.noResultsReason ?? '暂时没有符合条件的门店'}</div>
|
|
165
|
+
<div className="sg-empty py-6 text-center text-sm text-muted-foreground">{data.noResultsReason ?? '暂时没有符合条件的门店'}</div>
|
|
160
166
|
) : (
|
|
161
167
|
<>
|
|
162
168
|
<ShopGuideSectionLabel />
|
|
163
|
-
<ul className="sg-rm-list">
|
|
169
|
+
<ul className="sg-rm-list mt-1 mr-0 mb-0 ml-0 flex list-none flex-col p-0">
|
|
164
170
|
{previewItems.map((item) => (
|
|
165
|
-
<li key={item.merchantId} className="sg-rm-item">
|
|
171
|
+
<li key={item.merchantId} className="sg-rm-item py-2.5">
|
|
166
172
|
{/* 历史卡保留只读浏览:门店行可下钻详情(与 recommend-merchants 同口径)。 */}
|
|
167
|
-
<MerchantRow
|
|
173
|
+
<MerchantRow
|
|
174
|
+
merchant={item}
|
|
175
|
+
className="items-start bg-transparent p-0 focus-visible:rounded-[6px] focus-visible:outline-offset-[3px]"
|
|
176
|
+
onSelect={() => openDetail(item)}
|
|
177
|
+
/>
|
|
168
178
|
</li>
|
|
169
179
|
))}
|
|
170
180
|
</ul>
|
|
@@ -173,7 +183,7 @@ export function ShopListCard(props: {
|
|
|
173
183
|
{filteredItems.length > PREVIEW_ITEM_COUNT && (
|
|
174
184
|
<button
|
|
175
185
|
type="button"
|
|
176
|
-
className="sg-rm-view-all"
|
|
186
|
+
className="sg-rm-view-all mt-[2px] flex min-h-8 w-full cursor-pointer items-center justify-center gap-[2px] border-0 bg-transparent p-0 text-xs text-[#686d69] focus-visible:rounded-[5px] focus-visible:outline-[1.5px] focus-visible:outline-offset-[1px] focus-visible:outline-[rgba(9,107,250,0.28)] [font-family:inherit] tracking-normal"
|
|
177
187
|
onClick={() => setOverlay({ kind: 'list' })}
|
|
178
188
|
>
|
|
179
189
|
查看全部门店
|
|
@@ -16,7 +16,7 @@ export function ImageWithFallback(props: {
|
|
|
16
16
|
const [failed, setFailed] = useState(false);
|
|
17
17
|
if (!src || failed) {
|
|
18
18
|
return (
|
|
19
|
-
<div className={`img-fallback ${className ?? ''}`.trim()} aria-label={alt} role="img">
|
|
19
|
+
<div className={`img-fallback grid place-items-center text-[#c4c8ce] ${className ?? ''}`.trim()} aria-label={alt} role="img">
|
|
20
20
|
<ImageSquare weight="duotone" size={Math.round(size * 0.45)} />
|
|
21
21
|
</div>
|
|
22
22
|
);
|
|
@@ -36,41 +36,51 @@ export function MerchantRow(props: {
|
|
|
36
36
|
return (
|
|
37
37
|
<button
|
|
38
38
|
type="button"
|
|
39
|
-
className={[
|
|
39
|
+
className={[
|
|
40
|
+
'sg-rm-item-head',
|
|
41
|
+
'sg-merchant-row',
|
|
42
|
+
'flex w-full cursor-pointer gap-[9px] border-0 text-left text-inherit [font-family:inherit] tracking-normal focus-visible:outline-[1.5px] focus-visible:outline-[rgba(9,107,250,0.28)]',
|
|
43
|
+
className,
|
|
44
|
+
].filter(Boolean).join(' ')}
|
|
40
45
|
aria-label={`查看${merchant.name}详情`}
|
|
41
46
|
disabled={disabled}
|
|
42
47
|
onClick={onSelect}
|
|
43
48
|
>
|
|
44
|
-
<ImageWithFallback
|
|
45
|
-
|
|
49
|
+
<ImageWithFallback
|
|
50
|
+
src={merchant.logoUrl}
|
|
51
|
+
alt=""
|
|
52
|
+
className="sg-rm-item-image size-[68px] shrink-0 rounded-[9px] bg-card object-contain max-w-full max-[700px]:size-[70px] [&>svg]:size-[30px]"
|
|
53
|
+
size={96}
|
|
54
|
+
/>
|
|
55
|
+
<div className="sg-rm-item-meta flex min-w-0 flex-1 flex-col gap-1">
|
|
46
56
|
{/* 名称独占一行:状态胶囊原先钉在右侧,长店名会被挤到省略号
|
|
47
57
|
(「跃动运动集合空间旗舰体验店」只显示得出前八个字)。 */}
|
|
48
|
-
<div className="sg-rm-item-name-row">
|
|
49
|
-
<span className="sg-rm-item-name">{merchant.name}</span>
|
|
58
|
+
<div className="sg-rm-item-name-row flex items-center justify-between gap-1">
|
|
59
|
+
<span className="sg-rm-item-name truncate text-sm leading-[19px] font-semibold text-foreground">{merchant.name}</span>
|
|
50
60
|
</div>
|
|
51
61
|
{(merchant.rating || merchant.avgSpend) && (
|
|
52
|
-
<div className="sg-rm-item-stats">
|
|
62
|
+
<div className="sg-rm-item-stats flex flex-wrap items-center gap-1">
|
|
53
63
|
{merchant.rating && (
|
|
54
|
-
<span className="sg-rm-item-rating">
|
|
64
|
+
<span className="sg-rm-item-rating inline-flex items-center gap-[2px] text-xs font-semibold text-[#f5a623]">
|
|
55
65
|
<Star size={14} weight="fill" />
|
|
56
66
|
{merchant.rating}
|
|
57
67
|
</span>
|
|
58
68
|
)}
|
|
59
|
-
{merchant.avgSpend && <span className="sg-rm-item-avg-spend">人均 {merchant.avgSpend}</span>}
|
|
69
|
+
{merchant.avgSpend && <span className="sg-rm-item-avg-spend text-xs text-secondary-foreground">人均 {merchant.avgSpend}</span>}
|
|
60
70
|
</div>
|
|
61
71
|
)}
|
|
62
72
|
{merchant.businessCategories.length > 0 && (
|
|
63
|
-
<div className="sg-rm-item-tags" aria-label="门店业态">
|
|
73
|
+
<div className="sg-rm-item-tags flex gap-1 overflow-hidden" aria-label="门店业态">
|
|
64
74
|
{merchant.businessCategories.map((category) => (
|
|
65
|
-
<span key={category} className="sg-rm-item-tag">{category}</span>
|
|
75
|
+
<span key={category} className="sg-rm-item-tag max-w-20 shrink-0 truncate rounded-[3.5px] bg-[#fff4df] px-[5px] py-px text-xs leading-3.5 text-[#986415]">{category}</span>
|
|
66
76
|
))}
|
|
67
77
|
</div>
|
|
68
78
|
)}
|
|
69
79
|
{/* 营业状态与营业时间不进行内(2026-09-02):线上厂商数据拿不到真实营业状态,
|
|
70
80
|
恒为「营业状态以现场为准」,展示等于噪音;详情半屏仍显示状态字段。 */}
|
|
71
|
-
<div className="sg-rm-item-location">
|
|
72
|
-
<MapPin size={13} weight="fill" />
|
|
73
|
-
<span>{merchant.location.displayText}</span>
|
|
81
|
+
<div className="sg-rm-item-location flex items-center gap-1 overflow-hidden whitespace-nowrap text-xs leading-[15px] text-secondary-foreground">
|
|
82
|
+
<MapPin size={13} weight="fill" className="shrink-0 text-muted-foreground" />
|
|
83
|
+
<span className="overflow-hidden text-ellipsis">{merchant.location.displayText}</span>
|
|
74
84
|
</div>
|
|
75
85
|
</div>
|
|
76
86
|
</button>
|