@tbox.cn/app-module-shopping-guide 0.9.12 → 1.0.0-alpha.6

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.
@@ -6,6 +6,16 @@ import { ImageWithFallback } from '../../components/ImageWithFallback';
6
6
  import { ItemActionsRow } from '@tbox.cn/app-agent-sdk-client';
7
7
  import type { ProductDetailCardData } from '@tbox.cn/app-contracts-mall';
8
8
 
9
+ /** 可用性徽章:基础规格 + 按状态码取色(完整字面量,禁止拼接) */
10
+ const AVAILABILITY_BASE_CLASS = 'sg-availability mt-1 inline-block text-xs text-secondary-foreground';
11
+ const AVAILABILITY_TONE_CLASS: Record<string, string> = {
12
+ in_stock: 'sg-availability-in_stock text-success',
13
+ available: 'sg-availability-available text-success',
14
+ out_of_stock: 'sg-availability-out_of_stock text-warning',
15
+ limited: 'sg-availability-limited',
16
+ unknown: 'sg-availability-unknown',
17
+ };
18
+
9
19
  export function ProductDetailCard(props: {
10
20
  data: ProductDetailCardData;
11
21
  cardId: string;
@@ -17,30 +27,30 @@ export function ProductDetailCard(props: {
17
27
  const current = Math.min(active, Math.max(images.length - 1, 0));
18
28
 
19
29
  return (
20
- <section className="sg-card sg-product-detail">
21
- <div className="sg-card-title">{data.name}</div>
22
- {data.brand && <div className="sg-card-subtitle">{data.brand}</div>}
30
+ <section className="sg-card sg-product-detail p-5 text-foreground">
31
+ <div className="sg-card-title -mx-5 -mt-5 mb-3 flex items-center gap-2 bg-[linear-gradient(135deg,#0e2f80_0%,#1e5ed7_100%)] p-3.5 text-base leading-6 font-bold text-white">{data.name}</div>
32
+ {data.brand && <div className="sg-card-subtitle mb-3 text-sm text-secondary-foreground">{data.brand}</div>}
23
33
 
24
34
  {images.length > 0 && (
25
- <div className="sg-carousel">
26
- <ImageWithFallback src={images[current]} alt={data.name} className="sg-carousel__stage" size={72} />
35
+ <div className="sg-carousel relative">
36
+ <ImageWithFallback src={images[current]} alt={data.name} className="sg-carousel__stage h-60 w-full max-w-full rounded-[12px] object-cover" size={72} />
27
37
  {images.length > 1 && (
28
- <span className="sg-carousel__count">
38
+ <span className="sg-carousel__count absolute right-2.5 bottom-2.5 rounded-full bg-[rgba(0,0,0,0.5)] px-2 py-0.5 text-xs leading-4 text-white">
29
39
  {current + 1}/{images.length}
30
40
  </span>
31
41
  )}
32
42
  {images.length > 1 && (
33
- <div className="sg-carousel__thumbs">
43
+ <div className="sg-carousel__thumbs mt-2 flex gap-2 overflow-x-auto">
34
44
  {images.map((src, i) => (
35
45
  <button
36
46
  key={i}
37
47
  type="button"
38
- className="sg-carousel__thumb"
48
+ className="sg-carousel__thumb size-12 shrink-0 cursor-pointer overflow-hidden rounded-[8px] border-2 border-transparent p-0 aria-[current=true]:border-[var(--tbox-domain-sg-accent,#096bfa)] [font-family:inherit]"
39
49
  aria-current={i === current}
40
50
  aria-label={`查看第 ${i + 1} 张图`}
41
51
  onClick={() => setActive(i)}
42
52
  >
43
- <img src={src} alt="" loading="lazy" referrerPolicy="no-referrer" />
53
+ <img className="h-full w-full max-w-full object-cover" src={src} alt="" loading="lazy" referrerPolicy="no-referrer" />
44
54
  </button>
45
55
  ))}
46
56
  </div>
@@ -48,48 +58,54 @@ export function ProductDetailCard(props: {
48
58
  </div>
49
59
  )}
50
60
 
51
- <div className="sg-price-block sg-price-block--detail">
52
- {data.price.sale && <span className="sg-price-sale sg-price-sale--lg">{data.price.sale.display}</span>}
61
+ <div className="sg-price-block sg-price-block--detail mt-1 flex flex-wrap items-baseline gap-2">
62
+ {data.price.sale && <span className="sg-price-sale sg-price-sale--lg text-2xl leading-7 font-bold tabular-nums text-[#ef4f43]">{data.price.sale.display}</span>}
53
63
  {data.price.original && data.price.sale && (
54
- <span className="sg-price-original">{data.price.original.display}</span>
64
+ <span className="sg-price-original text-xs line-through text-muted-foreground">{data.price.original.display}</span>
55
65
  )}
56
- {data.price.promotion && <span className="sg-price-promotion">{data.price.promotion.display}</span>}
66
+ {data.price.promotion && <span className="sg-price-promotion rounded-[8px] bg-[#fff1f3] px-1.5 py-[0.5px] text-xs leading-4 text-[#ef4f43]">{data.price.promotion.display}</span>}
57
67
  </div>
58
68
 
59
- <div className={`sg-availability sg-availability-${data.availability.status}`}>
69
+ <div className={`${AVAILABILITY_BASE_CLASS} ${AVAILABILITY_TONE_CLASS[data.availability.status] ?? ''}`}>
60
70
  {data.availability.label}
61
- {data.humanGuideAvailable && <span className="sg-availability__guide">支持人工导购</span>}
71
+ {data.humanGuideAvailable && <span className="sg-availability__guide ml-2 rounded-[8px] bg-muted px-1.5 py-[0.5px] text-xs">支持人工导购</span>}
62
72
  </div>
63
73
 
64
- {data.description && <div className="sg-product-desc">{data.description}</div>}
74
+ {data.description && <div className="sg-product-desc mt-2.5 text-sm leading-5 text-foreground">{data.description}</div>}
65
75
 
66
- <dl className="sg-attr-table">
76
+ <dl className="sg-attr-table m-0 mt-2.5 overflow-hidden rounded-[8px] border-[0.5px] border-border p-0">
67
77
  {data.attributes.map((a) => (
68
- <div key={a.name} className="sg-attr-row">
69
- <dt>{a.name}</dt>
70
- <dd>{a.value}</dd>
78
+ <div key={a.name} className="sg-attr-row flex gap-3 border-b-[0.5px] border-border px-3 py-2 text-sm last:border-b-0">
79
+ <dt className="flex-none text-secondary-foreground">{a.name}</dt>
80
+ <dd className="m-0 flex-1 text-right text-foreground">{a.value}</dd>
71
81
  </div>
72
82
  ))}
73
83
  </dl>
74
84
 
75
- <div className="sg-product-merchant">
85
+ <div className="sg-product-merchant mt-1.5 text-xs text-secondary-foreground">
76
86
  {data.merchant.name}
77
87
  {data.merchant.location?.displayText && (
78
- <span className="sg-merchant-location"> · {data.merchant.location.displayText}</span>
88
+ <span className="sg-merchant-location mt-1 flex flex-wrap items-center gap-[3px] text-xs text-secondary-foreground"> · {data.merchant.location.displayText}</span>
79
89
  )}
80
90
  </div>
81
91
 
82
92
  {data.promotionFacts.map((p) => (
83
- <div key={p} className="sg-promo-fact">
93
+ <div key={p} className="sg-promo-fact mt-1 text-xs leading-4.5 text-[#ef4f43]">
84
94
  {p}
85
95
  </div>
86
96
  ))}
87
97
 
88
98
  {data.categoryPath.length > 0 && (
89
- <div className="sg-category-path">{data.categoryPath.join(' / ')}</div>
99
+ <div className="sg-category-path mt-2 text-xs text-muted-foreground">{data.categoryPath.join(' / ')}</div>
90
100
  )}
91
101
 
92
- <ItemActionsRow actions={data.itemActions} cardId={cardId} isHistory={isHistory} className="sg-item-actions" chipClassName="sg-chip" />
102
+ <ItemActionsRow
103
+ actions={data.itemActions}
104
+ cardId={cardId}
105
+ isHistory={isHistory}
106
+ className="sg-item-actions mt-2 flex flex-wrap gap-1.5"
107
+ chipClassName="sg-chip inline-flex min-h-[30px] cursor-pointer items-center justify-center rounded-[9px] border border-border bg-[var(--tbox-domain-sg-surface,#f7faff)] px-3 text-xs font-medium whitespace-nowrap text-[var(--tbox-domain-sg-accent,#096bfa)] disabled:cursor-not-allowed disabled:opacity-50 [font-family:inherit] tracking-normal"
108
+ />
93
109
  </section>
94
110
  );
95
111
  }
@@ -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,
@@ -23,88 +33,88 @@ function ProductDetailSheet({
23
33
  onClose: () => void;
24
34
  }) {
25
35
  return createPortal(
26
- <div className="sg-product-sheet" role="dialog" aria-modal="true" aria-label={item.name}>
27
- <div className="sg-product-sheet__mask" onClick={onClose} />
28
- <div className="sg-product-sheet__panel">
29
- <div className="sg-product-sheet__header">
30
- <span className="sg-product-sheet__title">商品详情</span>
31
- <button type="button" className="sg-product-sheet__close" onClick={onClose} aria-label="关闭">
36
+ <div className="sg-product-sheet fixed inset-0 z-[1000] pb-[var(--tbox-chat-bottom-height,0px)]" role="dialog" aria-modal="true" aria-label={item.name}>
37
+ <div className="sg-product-sheet__mask fixed inset-0 bg-[rgba(11,15,23,0.5)]" onClick={onClose} />
38
+ <div className="sg-product-sheet__panel absolute inset-x-0 bottom-0 flex max-h-[calc(82vh-var(--tbox-chat-bottom-height,0px))] flex-col overflow-hidden rounded-t-[18px] bg-card shadow-[0_-6px_20px_rgba(11,15,23,0.12)]">
39
+ <div className="sg-product-sheet__header flex shrink-0 items-center px-4 pt-4 pb-2.5">
40
+ <span className="sg-product-sheet__title min-w-0 flex-1 text-base font-semibold text-foreground">商品详情</span>
41
+ <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={onClose} aria-label="关闭">
32
42
  <X size={18} />
33
43
  </button>
34
44
  </div>
35
45
 
36
- <div className="sg-product-sheet__body">
46
+ <div className="sg-product-sheet__body overflow-y-auto px-4 pb-6">
37
47
  {item.imageUrl && (
38
48
  <ImageWithFallback
39
49
  src={item.imageUrl}
40
50
  alt={item.name}
41
- className="sg-product-sheet__cover"
51
+ className="sg-product-sheet__cover mb-3.5 block h-[180px] w-full max-w-full rounded-[12px] object-cover"
42
52
  size={240}
43
53
  />
44
54
  )}
45
55
 
46
- <div className="sg-product-sheet__main">
56
+ <div className="sg-product-sheet__main pb-2">
47
57
  {item.badges.length > 0 && (
48
- <div className="sg-badges">
58
+ <div className="sg-badges mb-1.5 flex flex-wrap gap-1.5">
49
59
  {item.badges.map((b) => (
50
- <span key={b} className="sg-badge">{b}</span>
60
+ <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
61
  ))}
52
62
  </div>
53
63
  )}
54
- <div className="sg-product-sheet__name">{item.name}</div>
55
- {item.brand && <div className="sg-product-sheet__brand">{item.brand}</div>}
64
+ <div className="sg-product-sheet__name mt-1 text-lg leading-[26px] font-bold text-foreground">{item.name}</div>
65
+ {item.brand && <div className="sg-product-sheet__brand mt-[3px] text-sm text-muted-foreground">{item.brand}</div>}
56
66
 
57
- <div className="sg-product-sheet__price-row">
67
+ <div className="sg-product-sheet__price-row mt-2 flex items-baseline gap-1.5">
58
68
  {item.price.sale && (
59
- <span className="sg-price-sale">{item.price.sale.display}</span>
69
+ <span className="sg-price-sale text-base font-bold tabular-nums text-[#ef4f43]">{item.price.sale.display}</span>
60
70
  )}
61
71
  {item.price.original && item.price.sale && (
62
- <span className="sg-price-original">{item.price.original.display}</span>
72
+ <span className="sg-price-original text-xs line-through text-muted-foreground">{item.price.original.display}</span>
63
73
  )}
64
74
  {item.price.promotion && (
65
- <span className="sg-price-promotion">{item.price.promotion.display}</span>
75
+ <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
76
  )}
67
77
  {!item.price.sale && !item.price.original && !item.price.promotion && (
68
- <span className="sg-price-unavailable">价格暂无</span>
78
+ <span className="sg-price-unavailable text-xs text-muted-foreground">价格暂无</span>
69
79
  )}
70
80
  </div>
71
81
 
72
- <div className={`sg-availability sg-availability-${item.availability.status}`}>
82
+ <div className={`${AVAILABILITY_BASE_CLASS} ${AVAILABILITY_TONE_CLASS[item.availability.status] ?? ''}`}>
73
83
  {item.availability.label}
74
84
  </div>
75
85
 
76
- <div className="sg-product-sheet__merchant">
86
+ <div className="sg-product-sheet__merchant mt-1.5 text-sm text-secondary-foreground">
77
87
  <span>{item.merchant.name}</span>
78
88
  {item.merchant.location?.displayText && (
79
- <span className="sg-merchant-location"> · {item.merchant.location.displayText}</span>
89
+ <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
90
  )}
81
91
  </div>
82
92
 
83
93
  {item.reasons && item.reasons.length > 0 && (
84
- <div className="sg-reasons">
94
+ <div className="sg-reasons mt-1.5 flex flex-wrap gap-1.5">
85
95
  {item.reasons.map((r) => (
86
- <span key={r.code} className="sg-reason-tag">{r.label}</span>
96
+ <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
97
  ))}
88
98
  </div>
89
99
  )}
90
100
 
91
101
  {item.caveats.length > 0 && (
92
- <div className="sg-item-caveats">
102
+ <div className="sg-item-caveats mt-1.5">
93
103
  {item.caveats.map((c, i) => (
94
- <div key={i} className="sg-caveat-item">⚠️ {c}</div>
104
+ <div key={i} className="sg-caveat-item text-xs leading-4 text-muted-foreground">⚠️ {c}</div>
95
105
  ))}
96
106
  </div>
97
107
  )}
98
108
  </div>
99
109
 
100
110
  {item.availability.marketable && (
101
- <div className="sg-product-sheet__actions">
111
+ <div className="sg-product-sheet__actions mt-3 border-t-[0.5px] border-border pt-3">
102
112
  <ItemActionsRow
103
113
  actions={item.itemActions}
104
114
  cardId={cardId}
105
115
  isHistory={isHistory}
106
- className="sg-product-sheet__action-row"
107
- chipClassName="sg-product-sheet__chip"
116
+ className="sg-product-sheet__action-row flex gap-2"
117
+ 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
118
  />
109
119
  </div>
110
120
  )}
@@ -124,17 +134,17 @@ export function ProductListCard(props: {
124
134
  const [activeItem, setActiveItem] = useState<ProductItem | null>(null);
125
135
 
126
136
  return (
127
- <section className="sg-card sg-product-list">
128
- {data.summary && <div className="sg-card-summary">{data.summary}</div>}
137
+ <section className="sg-card sg-product-list p-5 text-foreground">
138
+ {data.summary && <div className="sg-card-summary mb-3 text-sm text-secondary-foreground">{data.summary}</div>}
129
139
 
130
140
  {data.items.length === 0 ? (
131
- <div className="sg-empty">{data.noResultsReason ?? '暂无相关商品'}</div>
141
+ <div className="sg-empty py-6 text-center text-sm text-muted-foreground">{data.noResultsReason ?? '暂无相关商品'}</div>
132
142
  ) : (
133
- <ul className="sg-product-list-items">
143
+ <ul className="sg-product-list-items m-0 list-none p-0">
134
144
  {data.items.map((item) => (
135
145
  <li
136
146
  key={item.productId}
137
- className="sg-product-item sg-product-item--clickable"
147
+ 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
148
  onClick={() => setActiveItem(item)}
139
149
  role="button"
140
150
  tabIndex={0}
@@ -143,59 +153,59 @@ export function ProductListCard(props: {
143
153
  <ImageWithFallback
144
154
  src={item.imageUrl}
145
155
  alt={item.name}
146
- className="sg-product-image"
156
+ className="sg-product-image size-20 shrink-0 max-w-full rounded-[8px] object-cover"
147
157
  size={44}
148
158
  />
149
- <div className="sg-product-info">
159
+ <div className="sg-product-info min-w-0 flex-1">
150
160
  {item.badges.length > 0 && (
151
- <div className="sg-badges">
161
+ <div className="sg-badges mb-1.5 flex flex-wrap gap-1.5">
152
162
  {item.badges.map((b) => (
153
- <span key={b} className="sg-badge">{b}</span>
163
+ <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
164
  ))}
155
165
  </div>
156
166
  )}
157
- <div className="sg-product-name">{item.name}</div>
167
+ <div className="sg-product-name text-base leading-[21px] font-semibold text-foreground">{item.name}</div>
158
168
  {item.brand && <div className="sg-product-brand">{item.brand}</div>}
159
- <div className="sg-price-block">
169
+ <div className="sg-price-block mt-1 flex flex-wrap items-baseline gap-2">
160
170
  {item.price.sale && (
161
- <span className="sg-price-sale">{item.price.sale.display}</span>
171
+ <span className="sg-price-sale text-base font-bold tabular-nums text-[#ef4f43]">{item.price.sale.display}</span>
162
172
  )}
163
173
  {item.price.original && item.price.sale && (
164
- <span className="sg-price-original">{item.price.original.display}</span>
174
+ <span className="sg-price-original text-xs line-through text-muted-foreground">{item.price.original.display}</span>
165
175
  )}
166
176
  {item.price.promotion && (
167
- <span className="sg-price-promotion">{item.price.promotion.display}</span>
177
+ <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
178
  )}
169
179
  {!item.price.sale && !item.price.original && !item.price.promotion && (
170
- <span className="sg-price-unavailable">价格暂无</span>
180
+ <span className="sg-price-unavailable text-xs text-muted-foreground">价格暂无</span>
171
181
  )}
172
182
  </div>
173
- <div className="sg-product-sheet__merchant">
183
+ <div className="sg-product-sheet__merchant mt-1.5 text-sm text-secondary-foreground">
174
184
  <span>{item.merchant.name}</span>
175
185
  {item.merchant.location?.displayText && (
176
- <span className="sg-merchant-location"> · {item.merchant.location.displayText}</span>
186
+ <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
187
  )}
178
188
  </div>
179
189
  </div>
180
- <div className="sg-product-item__arrow" aria-hidden="true">›</div>
190
+ <div className="sg-product-item__arrow ml-1 shrink-0 self-center text-base text-muted-foreground" aria-hidden="true">›</div>
181
191
  </li>
182
192
  ))}
183
193
  </ul>
184
194
  )}
185
195
 
186
196
  {data.pageInfo?.hasMore && (
187
- <div className="sg-page-info">
197
+ <div className="sg-page-info mt-2.5 text-center text-xs text-muted-foreground">
188
198
  已展示 {data.items.length} / {data.pageInfo.total} 件商品
189
199
  </div>
190
200
  )}
191
201
 
192
202
  {data.refinements.length > 0 && (
193
- <div className="sg-refinements">
203
+ <div className="sg-refinements mt-3 flex flex-wrap gap-2 border-t-[0.5px] border-dashed border-border pt-2.5">
194
204
  {data.refinements.map((r, i) => (
195
205
  <button
196
206
  key={i}
197
207
  type="button"
198
- className="sg-refinement-chip"
208
+ 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
209
  disabled={isHistory}
200
210
  onClick={() => {
201
211
  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={`sg-rm-tab${!activeTabCode ? ' sg-rm-tab--active' : ''}`}
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={`sg-rm-tab${isActive ? ' sg-rm-tab--active' : ''}`}
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 merchant={item} onSelect={() => openDetail(item)} />
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 merchant={data} onSelect={openDetail} />
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={`sg-rm-tab${!activeTabCode ? ' sg-rm-tab--active' : ''}`}
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={`sg-rm-tab${isActive ? ' sg-rm-tab--active' : ''}`}
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 merchant={item} onSelect={() => openDetail(item)} />
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={['sg-rm-item-head', 'sg-merchant-row', className].filter(Boolean).join(' ')}
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 src={merchant.logoUrl} alt="" className="sg-rm-item-image" size={96} />
45
- <div className="sg-rm-item-meta">
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>