@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useId, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Overlay } from '@tbox.cn/app-agent-ui-kit/overlay';
|
|
3
3
|
import { Clock, MapPin, Phone, Star, Tag, X } from '@phosphor-icons/react';
|
|
4
4
|
import { ItemActionsRow, navigateToAlipayPage, sendCardAction } from '@tbox.cn/app-agent-sdk-client';
|
|
5
5
|
import { ImageWithFallback } from './ImageWithFallback';
|
|
@@ -7,6 +7,18 @@ import type { ActionDraft } from '@tbox.cn/app-contracts-mall';
|
|
|
7
7
|
|
|
8
8
|
const HIDDEN_DETAIL_ACTION_LABELS = new Set(['查看详情', '导航', '问问导购']);
|
|
9
9
|
|
|
10
|
+
/** 营业状态徽章:基础规格 + 按状态码取色(两段均为完整字面量,禁止拼接) */
|
|
11
|
+
const STATUS_BASE_CLASS = 'sg-status inline-block rounded-full px-2 py-0.5 text-xs leading-4 whitespace-nowrap';
|
|
12
|
+
const STATUS_TONE_CLASS: Record<string, string> = {
|
|
13
|
+
enabled: 'sg-status-enabled text-success bg-success-soft',
|
|
14
|
+
available: 'sg-status-available text-success bg-success-soft',
|
|
15
|
+
open: 'sg-status-open bg-[#e9f8ef] text-[#237a48]',
|
|
16
|
+
offline: 'sg-status-offline bg-[#fff4df] text-[#986415]',
|
|
17
|
+
closed: 'sg-status-closed bg-[#fff4df] text-[#986415]',
|
|
18
|
+
unknown: 'sg-status-unknown bg-[#fff4df] text-[#986415]',
|
|
19
|
+
disabled: 'sg-status-disabled bg-[#fff4df] text-[#986415]',
|
|
20
|
+
};
|
|
21
|
+
|
|
10
22
|
export interface ShopCouponData {
|
|
11
23
|
readonly name: string;
|
|
12
24
|
readonly imageUrl?: string;
|
|
@@ -57,28 +69,32 @@ export function ShopDetailSheet(props: {
|
|
|
57
69
|
/** 券行领取动作 id(按打开上下文的卡类型取对应变体:shop-list / shop-detail) */
|
|
58
70
|
readonly claimActionId?: string;
|
|
59
71
|
}) {
|
|
60
|
-
const { open, data, loading = false, cardId, isHistory, onClose, actionTokens, claimActionId } = props;
|
|
72
|
+
const { open, data: dataProp, loading = false, cardId, isHistory, onClose, actionTokens, claimActionId } = props;
|
|
61
73
|
const [closing, setClosing] = useState(false);
|
|
62
74
|
const [claimingRef, setClaimingRef] = useState<string | null>(null);
|
|
63
75
|
const [claimedRefs, setClaimedRefs] = useState<ReadonlySet<string>>(() => new Set());
|
|
64
|
-
const panelRef = useRef<HTMLElement>(null);
|
|
65
76
|
const closeButtonRef = useRef<HTMLButtonElement>(null);
|
|
66
|
-
const closingRef = useRef(false);
|
|
67
|
-
const closeTimerRef = useRef<number>();
|
|
68
|
-
const onCloseRef = useRef(onClose);
|
|
69
|
-
onCloseRef.current = onClose;
|
|
70
77
|
const titleId = useId();
|
|
78
|
+
const wasOpenRef = useRef(open);
|
|
71
79
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
// 两段式关闭:点关闭立刻把 open 交还父组件(父组件随即 abort 在飞请求并清掉 data),
|
|
81
|
+
// 本组件用最后一份 data 快照把退场动画播完(onExited 收尾)。
|
|
82
|
+
// 快照只服务「退出中」这一小段:只靠 data 会因父组件先清而闪空;不清 data 又播不出动画。
|
|
83
|
+
const lastDataRef = useRef<ShopDetailSheetData | null>(dataProp);
|
|
84
|
+
if (dataProp) lastDataRef.current = dataProp;
|
|
85
|
+
const data = dataProp ?? (closing ? lastDataRef.current : null);
|
|
86
|
+
const requestClose = useCallback(() => {
|
|
87
|
+
setClosing(true);
|
|
88
|
+
onClose();
|
|
89
|
+
}, [onClose]);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (open === wasOpenRef.current) return;
|
|
92
|
+
wasOpenRef.current = open;
|
|
93
|
+
if (open) setClosing(false);
|
|
94
|
+
}, [open]);
|
|
79
95
|
|
|
80
96
|
// DIRECT 领取结果监听(与 promotion-offer-list 逐字同构):成功 → 券行入已领态;
|
|
81
|
-
// 失败 → 全局 notice 通道(chat-store deps.toast
|
|
97
|
+
// 失败 → 全局 notice 通道(chat-store deps.toast)弹出轻提示,组件内零失败分支。
|
|
82
98
|
// REDIRECT/付费券复用抢购的 openLink,不进入本地领取状态机。
|
|
83
99
|
useEffect(() => {
|
|
84
100
|
if (!cardId || typeof window === 'undefined') return undefined;
|
|
@@ -107,55 +123,7 @@ export function ShopDetailSheet(props: {
|
|
|
107
123
|
[actionTokens, cardId, claimActionId],
|
|
108
124
|
);
|
|
109
125
|
|
|
110
|
-
|
|
111
|
-
if (closingRef.current) return;
|
|
112
|
-
closingRef.current = true;
|
|
113
|
-
setClosing(true);
|
|
114
|
-
const reducedMotion = window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches ?? false;
|
|
115
|
-
closeTimerRef.current = window.setTimeout(finishClose, reducedMotion ? 1 : 200);
|
|
116
|
-
}, [finishClose]);
|
|
117
|
-
|
|
118
|
-
useEffect(() => {
|
|
119
|
-
if (!open || !data) return;
|
|
120
|
-
closingRef.current = false;
|
|
121
|
-
setClosing(false);
|
|
122
|
-
const previousFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
123
|
-
const previousOverflow = document.body.style.overflow;
|
|
124
|
-
document.body.style.overflow = 'hidden';
|
|
125
|
-
closeButtonRef.current?.focus();
|
|
126
|
-
|
|
127
|
-
const onKeyDown = (event: KeyboardEvent) => {
|
|
128
|
-
if (event.key === 'Escape') {
|
|
129
|
-
event.preventDefault();
|
|
130
|
-
requestClose();
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (event.key !== 'Tab') return;
|
|
134
|
-
const focusable = panelRef.current?.querySelectorAll<HTMLElement>(
|
|
135
|
-
'button:not(:disabled), a[href], input:not(:disabled), [tabindex]:not([tabindex="-1"])',
|
|
136
|
-
);
|
|
137
|
-
if (!focusable || focusable.length === 0) return;
|
|
138
|
-
const first = focusable[0];
|
|
139
|
-
const last = focusable[focusable.length - 1];
|
|
140
|
-
if (event.shiftKey && document.activeElement === first) {
|
|
141
|
-
event.preventDefault();
|
|
142
|
-
last.focus();
|
|
143
|
-
} else if (!event.shiftKey && document.activeElement === last) {
|
|
144
|
-
event.preventDefault();
|
|
145
|
-
first.focus();
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
document.addEventListener('keydown', onKeyDown);
|
|
149
|
-
return () => {
|
|
150
|
-
document.removeEventListener('keydown', onKeyDown);
|
|
151
|
-
document.body.style.overflow = previousOverflow;
|
|
152
|
-
previousFocus?.focus();
|
|
153
|
-
};
|
|
154
|
-
}, [open, requestClose]);
|
|
155
|
-
|
|
156
|
-
useEffect(() => () => window.clearTimeout(closeTimerRef.current), []);
|
|
157
|
-
|
|
158
|
-
if (!open || !data || typeof document === 'undefined') return null;
|
|
126
|
+
if (!data) return null;
|
|
159
127
|
const phone = data.contactInfo?.find((item) => /phone|电话/i.test(item.channel));
|
|
160
128
|
// 营业时间缺省 → 商场默认营业时间(2026-09-03 用户裁定:周一-周日 10:00-22:00)
|
|
161
129
|
const hoursText = data.contactInfo?.find((item) => /hours|营业时间/i.test(item.channel))?.value
|
|
@@ -164,29 +132,26 @@ export function ShopDetailSheet(props: {
|
|
|
164
132
|
(action) => !HIDDEN_DETAIL_ACTION_LABELS.has(action.label.trim()),
|
|
165
133
|
) ?? [];
|
|
166
134
|
|
|
167
|
-
return
|
|
168
|
-
<
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
135
|
+
return (
|
|
136
|
+
<Overlay
|
|
137
|
+
open={open && !closing}
|
|
138
|
+
onDismiss={requestClose}
|
|
139
|
+
onExited={() => setClosing(false)}
|
|
140
|
+
placement="bottom"
|
|
141
|
+
labelledBy={titleId}
|
|
142
|
+
initialFocus={closeButtonRef}
|
|
143
|
+
panelProps={{ 'aria-busy': loading || undefined }}
|
|
144
|
+
exitMs={220}
|
|
145
|
+
rootClassName="sg-shop-sheet group text-foreground group-data-[state=closed]:animate-[sg-shop-sheet-out_180ms_ease-in_both] motion-reduce:animate-none"
|
|
146
|
+
maskClassName="bg-[rgba(18,21,19,0.52)] backdrop-blur-[2px]"
|
|
147
|
+
panelClassName="sg-shop-sheet__panel flex h-[86vh] max-h-[86vh] w-[min(100%,375px)] flex-col overflow-hidden rounded-t-[18px] bg-white shadow-[0_-8px_24px_rgba(24,31,27,0.18)] animate-[sg-shop-sheet-in_240ms_cubic-bezier(0.22,0.72,0.24,1)_both] group-data-[state=closed]:animate-[sg-shop-sheet-down_180ms_ease-in_both] motion-reduce:animate-none"
|
|
174
148
|
>
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
ref={panelRef}
|
|
178
|
-
className="sg-shop-sheet__panel"
|
|
179
|
-
role="dialog"
|
|
180
|
-
aria-modal="true"
|
|
181
|
-
aria-labelledby={titleId}
|
|
182
|
-
aria-busy={loading || undefined}
|
|
183
|
-
>
|
|
184
|
-
<header className="sg-shop-sheet__header">
|
|
185
|
-
<h2 id={titleId}>门店详情</h2>
|
|
149
|
+
<header className="sg-shop-sheet__header flex shrink-0 items-center border-b-[0.5px] border-border pt-[13px] pr-3.5 pb-[9px] pl-4">
|
|
150
|
+
<h2 id={titleId} className="min-w-0 flex-1 text-base leading-[22px] font-bold text-[#262c28]">门店详情</h2>
|
|
186
151
|
<button
|
|
187
152
|
ref={closeButtonRef}
|
|
188
153
|
type="button"
|
|
189
|
-
className="sg-shop-sheet__close"
|
|
154
|
+
className="sg-shop-sheet__close flex size-7 shrink-0 items-center justify-center rounded-full border-0 bg-transparent p-0 text-[#343936] focus-visible:outline-[1.5px] focus-visible:outline-offset-[1px] focus-visible:outline-[rgba(9,107,250,0.28)]"
|
|
190
155
|
aria-label="关闭门店详情"
|
|
191
156
|
onClick={requestClose}
|
|
192
157
|
>
|
|
@@ -194,45 +159,45 @@ export function ShopDetailSheet(props: {
|
|
|
194
159
|
</button>
|
|
195
160
|
</header>
|
|
196
161
|
|
|
197
|
-
<div className="sg-shop-sheet__body">
|
|
162
|
+
<div className="sg-shop-sheet__body min-h-0 flex-1 overflow-y-auto px-4 pb-[calc(19px_+_env(safe-area-inset-bottom))] [&::-webkit-scrollbar]:hidden">
|
|
198
163
|
{(data.coverUrl || data.logoUrl) && (
|
|
199
164
|
<ImageWithFallback
|
|
200
165
|
src={data.coverUrl ?? data.logoUrl}
|
|
201
166
|
alt=""
|
|
202
|
-
className="sg-shop-sheet__cover"
|
|
167
|
+
className="sg-shop-sheet__cover mt-[5px] block h-[150px] w-full max-w-full rounded-[10px] object-cover"
|
|
203
168
|
size={176}
|
|
204
169
|
/>
|
|
205
170
|
)}
|
|
206
171
|
|
|
207
|
-
<div className="sg-shop-sheet__identity">
|
|
208
|
-
<div className="sg-shop-sheet__identity-copy">
|
|
209
|
-
<div className="sg-shop-sheet__name-row">
|
|
210
|
-
<h3>{data.name}</h3>
|
|
172
|
+
<div className="sg-shop-sheet__identity mt-3.5 flex items-start gap-[9px]">
|
|
173
|
+
<div className="sg-shop-sheet__identity-copy min-w-0 flex-1">
|
|
174
|
+
<div className="sg-shop-sheet__name-row flex items-center gap-1.5">
|
|
175
|
+
<h3 className="min-w-0 flex-1 truncate text-lg leading-[23px] font-bold text-[#262c28]">{data.name}</h3>
|
|
211
176
|
</div>
|
|
212
177
|
{/* unknown 占位(线上厂商无真实营业状态,恒「营业状态以现场为准」)不显示——
|
|
213
178
|
2026-09-04 用户裁定,同 MerchantRow 2026-09-02 列表行同结论;营业时间 Clock 行常显 */}
|
|
214
179
|
{(data.rating || data.avgSpend || (data.status.code !== 'unknown' && data.status.label) || loading) && (
|
|
215
|
-
<div className="sg-shop-sheet__stats">
|
|
180
|
+
<div className="sg-shop-sheet__stats mt-[5px] flex flex-wrap items-center gap-x-[9px] gap-y-[5px] text-xs text-secondary-foreground">
|
|
216
181
|
{data.rating && (
|
|
217
|
-
<span className="sg-shop-sheet__rating">
|
|
182
|
+
<span className="sg-shop-sheet__rating inline-flex items-center gap-[2.5px] font-bold text-[#ef8e24]">
|
|
218
183
|
<Star size={15} weight="fill" />
|
|
219
184
|
{data.rating}
|
|
220
185
|
</span>
|
|
221
186
|
)}
|
|
222
187
|
{data.avgSpend && <span>人均 {data.avgSpend}</span>}
|
|
223
188
|
{loading
|
|
224
|
-
? <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--status" aria-hidden="true" />
|
|
189
|
+
? <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--status block h-[18px] w-[46px] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" aria-hidden="true" />
|
|
225
190
|
: data.status.code !== 'unknown' && (
|
|
226
|
-
<span className={
|
|
191
|
+
<span className={`${STATUS_BASE_CLASS} ${STATUS_TONE_CLASS[data.status.code] ?? STATUS_TONE_CLASS.unknown}`}>{data.status.label}</span>
|
|
227
192
|
)}
|
|
228
193
|
</div>
|
|
229
194
|
)}
|
|
230
195
|
</div>
|
|
231
196
|
{loading ? (
|
|
232
|
-
<span className="sg-shop-sheet__phone-skeleton" aria-hidden="true" />
|
|
197
|
+
<span className="sg-shop-sheet__phone-skeleton block size-[39px] shrink-0 rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" aria-hidden="true" />
|
|
233
198
|
) : phone && (
|
|
234
199
|
<a
|
|
235
|
-
className="sg-shop-sheet__phone"
|
|
200
|
+
className="sg-shop-sheet__phone flex size-[39px] no-underline shrink-0 flex-col items-center justify-center gap-[2px] rounded-full bg-[#f6f8fb] text-xs text-[#2f3539]"
|
|
236
201
|
href={phone.value.startsWith('tel:') ? phone.value : `tel:${phone.value}`}
|
|
237
202
|
aria-label={`拨打${data.name}电话`}
|
|
238
203
|
>
|
|
@@ -242,41 +207,41 @@ export function ShopDetailSheet(props: {
|
|
|
242
207
|
)}
|
|
243
208
|
</div>
|
|
244
209
|
|
|
245
|
-
<div className="sg-shop-sheet__facts">
|
|
246
|
-
<div>
|
|
210
|
+
<div className="sg-shop-sheet__facts mt-2.5 flex flex-col gap-[5px]">
|
|
211
|
+
<div className="flex flex-wrap items-center gap-1 text-xs leading-4 text-[#858b87]">
|
|
247
212
|
{data.businessCategories.length > 0 && (
|
|
248
213
|
<span>{data.businessCategories.join(' · ')}</span>
|
|
249
214
|
)}
|
|
250
|
-
<MapPin size={17} weight="fill" />
|
|
251
|
-
<span className="sg-shop-sheet__location">{data.location.displayText}</span>
|
|
215
|
+
<MapPin size={17} weight="fill" className="shrink-0 text-[#2979ff]" />
|
|
216
|
+
<span className="sg-shop-sheet__location text-[#2979ff]">{data.location.displayText}</span>
|
|
252
217
|
</div>
|
|
253
|
-
{!loading && data.operatingStatus && <div>{data.operatingStatus}</div>}
|
|
218
|
+
{!loading && data.operatingStatus && <div className="flex items-center gap-1 text-xs leading-4 text-[#858b87]">{data.operatingStatus}</div>}
|
|
254
219
|
{!loading && (
|
|
255
|
-
<div>
|
|
256
|
-
<Clock size={18} />
|
|
220
|
+
<div className="flex items-center gap-1 text-xs leading-4 text-[#858b87]">
|
|
221
|
+
<Clock size={18} className="shrink-0 text-[#2979ff]" />
|
|
257
222
|
<span>{hoursText}</span>
|
|
258
223
|
</div>
|
|
259
224
|
)}
|
|
260
225
|
{!loading && data.services && data.services.length > 0 && (
|
|
261
|
-
<div>支持{data.services.join('、')}</div>
|
|
226
|
+
<div className="flex items-center gap-1 text-xs leading-4 text-[#858b87]">支持{data.services.join('、')}</div>
|
|
262
227
|
)}
|
|
263
228
|
{loading && (
|
|
264
|
-
<div className="sg-shop-sheet__facts-skeleton" role="status" aria-label="门店详情加载中">
|
|
265
|
-
<span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--fact" aria-hidden="true" />
|
|
266
|
-
<span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--fact-short" aria-hidden="true" />
|
|
229
|
+
<div className="sg-shop-sheet__facts-skeleton flex w-full flex-col items-stretch gap-1.5" role="status" aria-label="门店详情加载中">
|
|
230
|
+
<span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--fact block h-3 w-[72%] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" aria-hidden="true" />
|
|
231
|
+
<span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--fact-short block h-3 w-[48%] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" aria-hidden="true" />
|
|
267
232
|
</div>
|
|
268
233
|
)}
|
|
269
234
|
</div>
|
|
270
235
|
|
|
271
236
|
{loading && (
|
|
272
|
-
<div className="sg-shop-sheet__details-skeleton" aria-hidden="true">
|
|
273
|
-
<span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-line" />
|
|
274
|
-
<span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-line-short" />
|
|
275
|
-
<span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-block" />
|
|
237
|
+
<div className="sg-shop-sheet__details-skeleton mt-3 flex flex-col gap-[7px]" aria-hidden="true">
|
|
238
|
+
<span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-line block h-3 w-[88%] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" />
|
|
239
|
+
<span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-line-short block h-3 w-[62%] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" />
|
|
240
|
+
<span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-block block h-13 w-full rounded-[9px] bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" />
|
|
276
241
|
</div>
|
|
277
242
|
)}
|
|
278
243
|
|
|
279
|
-
{!loading && data.description && <p className="sg-shop-sheet__description">{data.description}</p>}
|
|
244
|
+
{!loading && data.description && <p className="sg-shop-sheet__description mt-3 text-xs leading-4.5 text-[#666d68]">{data.description}</p>}
|
|
280
245
|
|
|
281
246
|
{!loading && data.coupons && data.coupons.length > 0 && (
|
|
282
247
|
<div className="sg-shop-sheet__coupons" aria-label="门店优惠">
|
|
@@ -284,7 +249,7 @@ export function ShopDetailSheet(props: {
|
|
|
284
249
|
<Tag size={16} weight="fill" aria-hidden="true" />
|
|
285
250
|
优惠活动
|
|
286
251
|
</h3>
|
|
287
|
-
<div className="sg-shop-sheet__coupon-list">
|
|
252
|
+
<div className="sg-shop-sheet__coupon-list bg-transparent p-0">
|
|
288
253
|
{data.coupons.map((coupon, index) => {
|
|
289
254
|
const purchaseOnly = coupon.salePrice !== undefined && coupon.salePrice > 0;
|
|
290
255
|
const redirectOnly = purchaseOnly || coupon.freeCouponClaimMode === 'REDIRECT';
|
|
@@ -293,10 +258,10 @@ export function ShopDetailSheet(props: {
|
|
|
293
258
|
const redirectAction = redirectOnly && Boolean(coupon.offerRef || coupon.purchaseUrl);
|
|
294
259
|
const claimed = coupon.offerRef !== undefined && claimedRefs.has(coupon.offerRef);
|
|
295
260
|
return (
|
|
296
|
-
<div key={index} className="sg-shop-sheet__coupon-row">
|
|
261
|
+
<div key={index} className="sg-shop-sheet__coupon-row relative grid min-h-[77px] grid-cols-[56px_minmax(0,1fr)_auto] items-center gap-x-2 overflow-hidden border-t-[0.5px] border-[#f0f1f4] bg-transparent py-[9px] first:border-t-0">
|
|
297
262
|
{/* 右上角金色类型标签(useBusinessType → applicableCategories,样式对齐神券类目标签) */}
|
|
298
263
|
{coupon.applicableCategories && coupon.applicableCategories.length > 0 && (
|
|
299
|
-
<span className="sg-shop-sheet__coupon-tag">
|
|
264
|
+
<span className="sg-shop-sheet__coupon-tag absolute top-[9px] right-0 max-w-[40%] truncate rounded-[0_6px_0_6px] bg-[linear-gradient(160deg,#f9e2ac_0%,#dabd88_100%)] px-[5px] py-[1.5px] text-xs leading-3 font-[650] text-[#746447]">
|
|
300
265
|
{coupon.applicableCategories.join('、')}
|
|
301
266
|
</span>
|
|
302
267
|
)}
|
|
@@ -304,39 +269,39 @@ export function ShopDetailSheet(props: {
|
|
|
304
269
|
<ImageWithFallback
|
|
305
270
|
src={coupon.imageUrl}
|
|
306
271
|
alt={coupon.name}
|
|
307
|
-
className="sg-shop-sheet__coupon-img"
|
|
272
|
+
className="sg-shop-sheet__coupon-img size-14 shrink-0 max-w-full rounded-[6px] object-cover shadow-[inset_0_0_0_0.5px_rgba(11,15,23,0.04)]"
|
|
308
273
|
size={112}
|
|
309
274
|
/>
|
|
310
275
|
)}
|
|
311
|
-
<div className="sg-shop-sheet__coupon-body">
|
|
312
|
-
<strong className="sg-shop-sheet__coupon-name">{coupon.name}</strong>
|
|
276
|
+
<div className="sg-shop-sheet__coupon-body flex min-w-0 flex-1 flex-col justify-center gap-[2.5px]">
|
|
277
|
+
<strong className="sg-shop-sheet__coupon-name line-clamp-2 text-xs leading-[15px] font-[750] text-[rgba(11,15,23,0.9)]">{coupon.name}</strong>
|
|
313
278
|
{coupon.faceValue !== undefined && (
|
|
314
|
-
<p className="sg-shop-sheet__coupon-price">
|
|
279
|
+
<p className="sg-shop-sheet__coupon-price mt-px flex items-baseline gap-1">
|
|
315
280
|
{/* 价格行角色对齐神券行(2026-09-05):主价格 = 售价、划线 = 原面值;
|
|
316
281
|
售价缺省退回面值为主。免费券主价格 =「免费」+ 面值划线(2026-09-05 文案对齐) */}
|
|
317
282
|
{coupon.salePrice === 0
|
|
318
283
|
? <>
|
|
319
|
-
<span className="sg-shop-sheet__coupon-free">免费</span>
|
|
320
|
-
<s className="sg-shop-sheet__coupon-face--strike">¥{coupon.faceValue}</s>
|
|
284
|
+
<span className="sg-shop-sheet__coupon-free text-sm leading-4 font-extrabold text-[#e8471c]">免费</span>
|
|
285
|
+
<s className="sg-shop-sheet__coupon-face--strike overflow-hidden text-xs line-through text-[rgba(11,15,23,0.38)]">¥{coupon.faceValue}</s>
|
|
321
286
|
</>
|
|
322
287
|
: coupon.salePrice !== undefined
|
|
323
288
|
? <>
|
|
324
|
-
<span className="sg-shop-sheet__coupon-face">¥{coupon.salePrice}</span>
|
|
325
|
-
<s className="sg-shop-sheet__coupon-face--strike">¥{coupon.faceValue}</s>
|
|
289
|
+
<span className="sg-shop-sheet__coupon-face text-sm leading-4 font-extrabold text-[#e8471c]">¥{coupon.salePrice}</span>
|
|
290
|
+
<s className="sg-shop-sheet__coupon-face--strike overflow-hidden text-xs line-through text-[rgba(11,15,23,0.38)]">¥{coupon.faceValue}</s>
|
|
326
291
|
</>
|
|
327
|
-
: <span className="sg-shop-sheet__coupon-face">¥{coupon.faceValue}</span>}
|
|
292
|
+
: <span className="sg-shop-sheet__coupon-face text-sm leading-4 font-extrabold text-[#e8471c]">¥{coupon.faceValue}</span>}
|
|
328
293
|
</p>
|
|
329
294
|
)}
|
|
330
295
|
{/* sub 行职责 = 可用时间文案(useWeekTime 解析,provider 直出;
|
|
331
296
|
适用分类已上移为右上角标签,validHours 不再展示(2026-09-05) */}
|
|
332
297
|
{coupon.usageTimeText && (
|
|
333
|
-
<p className="sg-shop-sheet__coupon-sub">{coupon.usageTimeText}</p>
|
|
298
|
+
<p className="sg-shop-sheet__coupon-sub line-clamp-2 text-xs leading-[11.5px] text-[rgba(11,15,23,0.55)]">{coupon.usageTimeText}</p>
|
|
334
299
|
)}
|
|
335
300
|
</div>
|
|
336
301
|
{redirectAction ? (
|
|
337
302
|
<button
|
|
338
303
|
type="button"
|
|
339
|
-
className="sg-shop-sheet__coupon-claim"
|
|
304
|
+
className="sg-shop-sheet__coupon-claim h-8 min-w-12 shrink-0 cursor-pointer rounded-full border-0 bg-[linear-gradient(160deg,#c3ad78_0%,#a89058_100%)] px-[7.5px] text-xs font-bold tracking-[0.5px] text-white enabled:hover:bg-[linear-gradient(160deg,#b39d68_0%,#967f4a_100%)] disabled:cursor-not-allowed disabled:opacity-45"
|
|
340
305
|
disabled={!coupon.purchaseUrl}
|
|
341
306
|
onClick={() => {
|
|
342
307
|
if (!coupon.purchaseUrl) return;
|
|
@@ -352,7 +317,7 @@ export function ShopDetailSheet(props: {
|
|
|
352
317
|
) : claimable && coupon.offerRef ? (
|
|
353
318
|
<button
|
|
354
319
|
type="button"
|
|
355
|
-
className="sg-shop-sheet__coupon-claim"
|
|
320
|
+
className="sg-shop-sheet__coupon-claim h-8 min-w-12 shrink-0 cursor-pointer rounded-full border-0 bg-[linear-gradient(160deg,#c3ad78_0%,#a89058_100%)] px-[7.5px] text-xs font-bold tracking-[0.5px] text-white enabled:hover:bg-[linear-gradient(160deg,#b39d68_0%,#967f4a_100%)] disabled:cursor-not-allowed disabled:opacity-45"
|
|
356
321
|
onClick={() => claimCoupon(coupon.offerRef!)}
|
|
357
322
|
disabled={claimingRef === coupon.offerRef || claimed}
|
|
358
323
|
>
|
|
@@ -371,13 +336,11 @@ export function ShopDetailSheet(props: {
|
|
|
371
336
|
actions={detailActions}
|
|
372
337
|
cardId={cardId}
|
|
373
338
|
isHistory={isHistory}
|
|
374
|
-
className="sg-shop-sheet__actions"
|
|
375
|
-
chipClassName="sg-shop-sheet__action"
|
|
339
|
+
className="sg-shop-sheet__actions mt-[15px] flex gap-1.5"
|
|
340
|
+
chipClassName="sg-shop-sheet__action inline-flex min-h-9 flex-1 items-center justify-center rounded-[9px] border-0 bg-[#313833] px-3 text-xs font-semibold text-white disabled:opacity-48"
|
|
376
341
|
/>
|
|
377
342
|
)}
|
|
378
343
|
</div>
|
|
379
|
-
|
|
380
|
-
</div>,
|
|
381
|
-
document.body,
|
|
344
|
+
</Overlay>
|
|
382
345
|
);
|
|
383
346
|
}
|
|
@@ -8,16 +8,16 @@ import { Storefront } from '@phosphor-icons/react';
|
|
|
8
8
|
|
|
9
9
|
export function ShopGuideHeader(props: { readonly subtitle: string }) {
|
|
10
10
|
return (
|
|
11
|
-
<header className="sg-rm-header">
|
|
11
|
+
<header className="sg-rm-header relative -mx-3 flex min-h-[77px] items-start justify-between gap-2 overflow-hidden bg-[#f9f0df] px-3.5 py-[15px] after:pointer-events-none after:absolute after:inset-y-0 after:right-0 after:w-[62%] after:bg-[image:var(--tbox-asset-sg-header,linear-gradient(135deg,#f9f0df,#f3e5cd))] after:bg-cover after:bg-right after:opacity-90">
|
|
12
12
|
{/* 头图经 CSS background(.sg-rm-header::after + --tbox-asset-sg-header 变量链,主题轨 T-2.3) */}
|
|
13
|
-
<div className="sg-rm-header-copy">
|
|
14
|
-
<div className="sg-rm-header-title-row">
|
|
13
|
+
<div className="sg-rm-header-copy relative z-[1] flex max-w-[66%] flex-col gap-[5px]">
|
|
14
|
+
<div className="sg-rm-header-title-row flex items-center gap-[5px] text-[#2f3a22]">
|
|
15
15
|
<Storefront size={22} weight="fill" />
|
|
16
|
-
<h3 className="sg-rm-header-title">门店导览</h3>
|
|
16
|
+
<h3 className="sg-rm-header-title text-base leading-[21px] font-bold text-[#2f3a22]">门店导览</h3>
|
|
17
17
|
</div>
|
|
18
|
-
<p className="sg-rm-header-subtitle">{props.subtitle}</p>
|
|
18
|
+
<p className="sg-rm-header-subtitle truncate text-xs leading-4 text-[#626b5c]">{props.subtitle}</p>
|
|
19
19
|
</div>
|
|
20
|
-
<span className="sg-rm-header-badge">商场导览</span>
|
|
20
|
+
<span className="sg-rm-header-badge absolute top-3 right-[11px] z-[2] rounded-full border-[0.5px] border-[rgba(57,76,43,0.14)] bg-[rgba(255,255,255,0.72)] px-[7px] py-[3.5px] text-xs leading-[13px] text-[#526a35]">商场导览</span>
|
|
21
21
|
</header>
|
|
22
22
|
);
|
|
23
23
|
}
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* 半屏浮层因有搜索与筛选、列表可能很长,保留自己的「当前显示 N 家门店」计数行。
|
|
7
7
|
*/
|
|
8
8
|
export function ShopGuideSectionLabel() {
|
|
9
|
-
return <div className="sg-rm-section-label">门店</div>;
|
|
9
|
+
return <div className="sg-rm-section-label mt-3.5 flex items-center justify-start gap-[7px] text-sm font-bold text-foreground">门店</div>;
|
|
10
10
|
}
|