@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.
- package/AGENTS.md +3 -3
- package/dist/{chunk-PAYDOSCV.js → chunk-MEDIFNS7.js} +444 -323
- package/dist/client/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/server/index.d.ts +12 -12
- package/package.json +5 -8
- 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 +59 -49
- 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 +63 -51
- package/src/client/components/ShopGuideHeader.tsx +6 -6
- package/src/client/components/ShopGuideSectionLabel.tsx +1 -1
- package/src/client/components/ShopListSheet.tsx +43 -22
- package/src/client/index.ts +0 -2
- package/tbox.module.json +0 -1
- package/tsup.config.ts +0 -5
- 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
package/dist/client/index.js
CHANGED
package/dist/index.js
CHANGED
package/dist/server/index.d.ts
CHANGED
|
@@ -1237,9 +1237,9 @@ declare const shoppingGuideCards: {
|
|
|
1237
1237
|
label: string;
|
|
1238
1238
|
queryText: string;
|
|
1239
1239
|
}[];
|
|
1240
|
+
mallId?: string | undefined;
|
|
1240
1241
|
summary?: string | undefined;
|
|
1241
1242
|
miniAppId?: string | undefined;
|
|
1242
|
-
mallId?: string | undefined;
|
|
1243
1243
|
noResultsReason?: string | undefined;
|
|
1244
1244
|
pageInfo?: {
|
|
1245
1245
|
pageSize: number;
|
|
@@ -1318,9 +1318,9 @@ declare const shoppingGuideCards: {
|
|
|
1318
1318
|
label: string;
|
|
1319
1319
|
queryText: string;
|
|
1320
1320
|
}[];
|
|
1321
|
+
mallId?: string | undefined;
|
|
1321
1322
|
summary?: string | undefined;
|
|
1322
1323
|
miniAppId?: string | undefined;
|
|
1323
|
-
mallId?: string | undefined;
|
|
1324
1324
|
noResultsReason?: string | undefined;
|
|
1325
1325
|
pageInfo?: {
|
|
1326
1326
|
pageSize: number;
|
|
@@ -1512,9 +1512,9 @@ declare const shoppingGuideCards: {
|
|
|
1512
1512
|
promotionFacts: string[];
|
|
1513
1513
|
coverUrls: string[];
|
|
1514
1514
|
description?: string | undefined;
|
|
1515
|
+
mallId?: string | undefined;
|
|
1515
1516
|
brand?: string | undefined;
|
|
1516
1517
|
miniAppId?: string | undefined;
|
|
1517
|
-
mallId?: string | undefined;
|
|
1518
1518
|
logoUrl?: string | undefined;
|
|
1519
1519
|
contactInfo?: {
|
|
1520
1520
|
value: string;
|
|
@@ -1571,9 +1571,9 @@ declare const shoppingGuideCards: {
|
|
|
1571
1571
|
promotionFacts: string[];
|
|
1572
1572
|
coverUrls: string[];
|
|
1573
1573
|
description?: string | undefined;
|
|
1574
|
+
mallId?: string | undefined;
|
|
1574
1575
|
brand?: string | undefined;
|
|
1575
1576
|
miniAppId?: string | undefined;
|
|
1576
|
-
mallId?: string | undefined;
|
|
1577
1577
|
logoUrl?: string | undefined;
|
|
1578
1578
|
contactInfo?: {
|
|
1579
1579
|
value: string;
|
|
@@ -2870,7 +2870,6 @@ declare const shoppingGuideCards: {
|
|
|
2870
2870
|
noResultsReason: zod.ZodOptional<zod.ZodString>;
|
|
2871
2871
|
observedAt: zod.ZodString;
|
|
2872
2872
|
}, "strip", zod.ZodTypeAny, {
|
|
2873
|
-
observedAt: string;
|
|
2874
2873
|
items: {
|
|
2875
2874
|
status: {
|
|
2876
2875
|
code: "enabled" | "unknown" | "disabled";
|
|
@@ -2911,6 +2910,7 @@ declare const shoppingGuideCards: {
|
|
|
2911
2910
|
rating?: string | undefined;
|
|
2912
2911
|
avgSpend?: string | undefined;
|
|
2913
2912
|
}[];
|
|
2913
|
+
observedAt: string;
|
|
2914
2914
|
summary?: string | undefined;
|
|
2915
2915
|
noResultsReason?: string | undefined;
|
|
2916
2916
|
categoryTabs?: {
|
|
@@ -2918,7 +2918,6 @@ declare const shoppingGuideCards: {
|
|
|
2918
2918
|
name: string;
|
|
2919
2919
|
}[] | undefined;
|
|
2920
2920
|
}, {
|
|
2921
|
-
observedAt: string;
|
|
2922
2921
|
items: {
|
|
2923
2922
|
status: {
|
|
2924
2923
|
code: "enabled" | "unknown" | "disabled";
|
|
@@ -2959,6 +2958,7 @@ declare const shoppingGuideCards: {
|
|
|
2959
2958
|
rating?: string | undefined;
|
|
2960
2959
|
avgSpend?: string | undefined;
|
|
2961
2960
|
}[];
|
|
2961
|
+
observedAt: string;
|
|
2962
2962
|
summary?: string | undefined;
|
|
2963
2963
|
noResultsReason?: string | undefined;
|
|
2964
2964
|
categoryTabs?: {
|
|
@@ -4250,9 +4250,9 @@ declare const serverModule: {
|
|
|
4250
4250
|
label: string;
|
|
4251
4251
|
queryText: string;
|
|
4252
4252
|
}[];
|
|
4253
|
+
mallId?: string | undefined;
|
|
4253
4254
|
summary?: string | undefined;
|
|
4254
4255
|
miniAppId?: string | undefined;
|
|
4255
|
-
mallId?: string | undefined;
|
|
4256
4256
|
noResultsReason?: string | undefined;
|
|
4257
4257
|
pageInfo?: {
|
|
4258
4258
|
pageSize: number;
|
|
@@ -4331,9 +4331,9 @@ declare const serverModule: {
|
|
|
4331
4331
|
label: string;
|
|
4332
4332
|
queryText: string;
|
|
4333
4333
|
}[];
|
|
4334
|
+
mallId?: string | undefined;
|
|
4334
4335
|
summary?: string | undefined;
|
|
4335
4336
|
miniAppId?: string | undefined;
|
|
4336
|
-
mallId?: string | undefined;
|
|
4337
4337
|
noResultsReason?: string | undefined;
|
|
4338
4338
|
pageInfo?: {
|
|
4339
4339
|
pageSize: number;
|
|
@@ -4525,9 +4525,9 @@ declare const serverModule: {
|
|
|
4525
4525
|
promotionFacts: string[];
|
|
4526
4526
|
coverUrls: string[];
|
|
4527
4527
|
description?: string | undefined;
|
|
4528
|
+
mallId?: string | undefined;
|
|
4528
4529
|
brand?: string | undefined;
|
|
4529
4530
|
miniAppId?: string | undefined;
|
|
4530
|
-
mallId?: string | undefined;
|
|
4531
4531
|
logoUrl?: string | undefined;
|
|
4532
4532
|
contactInfo?: {
|
|
4533
4533
|
value: string;
|
|
@@ -4584,9 +4584,9 @@ declare const serverModule: {
|
|
|
4584
4584
|
promotionFacts: string[];
|
|
4585
4585
|
coverUrls: string[];
|
|
4586
4586
|
description?: string | undefined;
|
|
4587
|
+
mallId?: string | undefined;
|
|
4587
4588
|
brand?: string | undefined;
|
|
4588
4589
|
miniAppId?: string | undefined;
|
|
4589
|
-
mallId?: string | undefined;
|
|
4590
4590
|
logoUrl?: string | undefined;
|
|
4591
4591
|
contactInfo?: {
|
|
4592
4592
|
value: string;
|
|
@@ -5883,7 +5883,6 @@ declare const serverModule: {
|
|
|
5883
5883
|
noResultsReason: zod.ZodOptional<zod.ZodString>;
|
|
5884
5884
|
observedAt: zod.ZodString;
|
|
5885
5885
|
}, "strip", zod.ZodTypeAny, {
|
|
5886
|
-
observedAt: string;
|
|
5887
5886
|
items: {
|
|
5888
5887
|
status: {
|
|
5889
5888
|
code: "enabled" | "unknown" | "disabled";
|
|
@@ -5924,6 +5923,7 @@ declare const serverModule: {
|
|
|
5924
5923
|
rating?: string | undefined;
|
|
5925
5924
|
avgSpend?: string | undefined;
|
|
5926
5925
|
}[];
|
|
5926
|
+
observedAt: string;
|
|
5927
5927
|
summary?: string | undefined;
|
|
5928
5928
|
noResultsReason?: string | undefined;
|
|
5929
5929
|
categoryTabs?: {
|
|
@@ -5931,7 +5931,6 @@ declare const serverModule: {
|
|
|
5931
5931
|
name: string;
|
|
5932
5932
|
}[] | undefined;
|
|
5933
5933
|
}, {
|
|
5934
|
-
observedAt: string;
|
|
5935
5934
|
items: {
|
|
5936
5935
|
status: {
|
|
5937
5936
|
code: "enabled" | "unknown" | "disabled";
|
|
@@ -5972,6 +5971,7 @@ declare const serverModule: {
|
|
|
5972
5971
|
rating?: string | undefined;
|
|
5973
5972
|
avgSpend?: string | undefined;
|
|
5974
5973
|
}[];
|
|
5974
|
+
observedAt: string;
|
|
5975
5975
|
summary?: string | undefined;
|
|
5976
5976
|
noResultsReason?: string | undefined;
|
|
5977
5977
|
categoryTabs?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/app-module-shopping-guide",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "门店导览模块:商品/商户搜索、推荐、对比、商场目录、人工导购、位置导航。",
|
|
6
6
|
"exports": {
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tbox.cn/app-contracts": "0.
|
|
23
|
-
"@tbox.cn/app-contracts-mall": "0.
|
|
24
|
-
"@tbox.cn/app-agent-sdk-
|
|
25
|
-
"@tbox.cn/app-agent-sdk-
|
|
22
|
+
"@tbox.cn/app-contracts": "1.0.0-alpha.6",
|
|
23
|
+
"@tbox.cn/app-contracts-mall": "1.0.0-alpha.6",
|
|
24
|
+
"@tbox.cn/app-agent-sdk-server": "1.0.0-alpha.6",
|
|
25
|
+
"@tbox.cn/app-agent-sdk-client": "1.0.0-alpha.6"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"zod": "3.25.76",
|
|
@@ -62,9 +62,6 @@
|
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
64
|
"license": "MIT",
|
|
65
|
-
"sideEffects": [
|
|
66
|
-
"**/*.css"
|
|
67
|
-
],
|
|
68
65
|
"scripts": {
|
|
69
66
|
"typecheck": "tsc --noEmit",
|
|
70
67
|
"test": "vitest run",
|
|
@@ -31,24 +31,24 @@ export function CategoryListCard(props: {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
|
-
<section className="sg-card sg-category-list">
|
|
35
|
-
<div className="sg-card-title">业态分类</div>
|
|
36
|
-
<ul className="sg-category-grid">
|
|
34
|
+
<section className="sg-card sg-category-list p-5 text-foreground">
|
|
35
|
+
<div className="sg-card-title mb-2 flex items-center gap-2 text-lg leading-6 font-bold text-foreground before:h-4 before:w-1 before:shrink-0 before:rounded-[2px] before:bg-[var(--tbox-domain-sg-accent,#096bfa)]">业态分类</div>
|
|
36
|
+
<ul className="sg-category-grid m-0 grid list-none grid-cols-3 gap-2 p-0">
|
|
37
37
|
{visible.map((c) => (
|
|
38
38
|
<li key={c.code}>
|
|
39
39
|
<button
|
|
40
40
|
type="button"
|
|
41
|
-
className="sg-category-cell"
|
|
41
|
+
className="sg-category-cell flex w-full cursor-pointer flex-col items-center gap-[5px] rounded-[12px] border-0 bg-[var(--tbox-domain-sg-surface,#f7faff)] px-1 pt-3.5 pb-2.5 text-center transition-[transform,background-color] duration-[120ms] active:scale-95 active:bg-[var(--tbox-domain-sg-border,#cfe0f7)] disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100 disabled:active:bg-[var(--tbox-domain-sg-surface,#f7faff)] [font-family:inherit] tracking-normal"
|
|
42
42
|
disabled={isHistory}
|
|
43
43
|
onClick={() => handleCategoryClick(c)}
|
|
44
44
|
aria-label={`查看${c.name}(${c.merchantCount} 家门店)`}
|
|
45
45
|
>
|
|
46
|
-
<span className="sg-category-icon-wrap" aria-hidden="true">
|
|
47
|
-
<span className="sg-category-icon">{categoryIcon(c.code)}</span>
|
|
46
|
+
<span className="sg-category-icon-wrap flex size-12 items-center justify-center rounded-full bg-[rgba(9,107,250,0.08)]" aria-hidden="true">
|
|
47
|
+
<span className="sg-category-icon text-2xl leading-none select-none">{categoryIcon(c.code)}</span>
|
|
48
48
|
</span>
|
|
49
|
-
<span className="sg-category-name">{c.name}</span>
|
|
49
|
+
<span className="sg-category-name text-sm leading-4.5 font-semibold break-all text-foreground">{c.name}</span>
|
|
50
50
|
{c.merchantCount > 0 && (
|
|
51
|
-
<span className="sg-category-count">{c.merchantCount} 家</span>
|
|
51
|
+
<span className="sg-category-count text-xs leading-3.5 text-secondary-foreground">{c.merchantCount} 家</span>
|
|
52
52
|
)}
|
|
53
53
|
</button>
|
|
54
54
|
</li>
|
|
@@ -58,13 +58,13 @@ export function CategoryListCard(props: {
|
|
|
58
58
|
{collapsible && (
|
|
59
59
|
<button
|
|
60
60
|
type="button"
|
|
61
|
-
className="sg-category-toggle"
|
|
61
|
+
className="sg-category-toggle mt-2.5 flex w-full cursor-pointer items-center justify-center gap-1 rounded-[8px] border-[0.5px] border-border bg-transparent py-2 text-xs text-secondary-foreground [font-family:inherit] tracking-normal"
|
|
62
62
|
aria-expanded={expanded}
|
|
63
63
|
onClick={() => setExpanded((v) => !v)}
|
|
64
64
|
>
|
|
65
65
|
<CaretDown
|
|
66
66
|
size={14}
|
|
67
|
-
className="sg-category-toggle__icon"
|
|
67
|
+
className="sg-category-toggle__icon transition-transform duration-150 data-[rotated]:rotate-180"
|
|
68
68
|
data-rotated={expanded || undefined}
|
|
69
69
|
/>
|
|
70
70
|
{expanded ? '收起' : `展开全部 ${data.categories.length} 类`}
|
|
@@ -72,19 +72,19 @@ export function CategoryListCard(props: {
|
|
|
72
72
|
)}
|
|
73
73
|
|
|
74
74
|
{data.buildings && data.buildings.length > 0 && (
|
|
75
|
-
<div className="sg-category-floors">
|
|
76
|
-
<div className="sg-category-floors__title">楼层导览</div>
|
|
75
|
+
<div className="sg-category-floors mt-3 border-t-[0.5px] border-border pt-2.5">
|
|
76
|
+
<div className="sg-category-floors__title mb-2 text-xs font-medium text-secondary-foreground">楼层导览</div>
|
|
77
77
|
{data.buildings.map((building) => (
|
|
78
|
-
<div key={building.buildingCode} className="sg-category-floors__building">
|
|
78
|
+
<div key={building.buildingCode} className="sg-category-floors__building mb-2">
|
|
79
79
|
{data.buildings!.length > 1 && (
|
|
80
|
-
<div className="sg-category-floors__building-name">{building.buildingName}</div>
|
|
80
|
+
<div className="sg-category-floors__building-name mb-[5px] text-xs text-muted-foreground">{building.buildingName}</div>
|
|
81
81
|
)}
|
|
82
|
-
<div className="sg-category-floors__floor-list">
|
|
82
|
+
<div className="sg-category-floors__floor-list flex flex-wrap gap-1.5">
|
|
83
83
|
{building.floors.map((floor) => (
|
|
84
84
|
<button
|
|
85
85
|
key={floor.floorCode}
|
|
86
86
|
type="button"
|
|
87
|
-
className="sg-category-floor-chip"
|
|
87
|
+
className="sg-category-floor-chip inline-flex cursor-pointer items-center gap-[3px] rounded-[20px] border-[0.5px] border-border bg-card px-2.5 py-[5px] text-xs text-foreground transition-[background-color,border-color] duration-100 active:border-[var(--tbox-domain-sg-accent,#096bfa)] active:bg-[#e8f0fe] disabled:cursor-not-allowed disabled:opacity-50 [font-family:inherit] tracking-normal"
|
|
88
88
|
disabled={isHistory}
|
|
89
89
|
onClick={() => {
|
|
90
90
|
if (isHistory) return;
|
|
@@ -97,7 +97,7 @@ export function CategoryListCard(props: {
|
|
|
97
97
|
>
|
|
98
98
|
<span className="sg-category-floor-chip__name">{floor.floorName}</span>
|
|
99
99
|
{floor.merchantCount > 0 && (
|
|
100
|
-
<span className="sg-category-floor-chip__count">{floor.merchantCount}</span>
|
|
100
|
+
<span className="sg-category-floor-chip__count text-xs text-muted-foreground">{floor.merchantCount}</span>
|
|
101
101
|
)}
|
|
102
102
|
</button>
|
|
103
103
|
))}
|
|
@@ -12,30 +12,33 @@ export function HumanGuideListCard(props: {
|
|
|
12
12
|
}) {
|
|
13
13
|
const { data, cardId, isHistory } = props;
|
|
14
14
|
return (
|
|
15
|
-
<section className="sg-card sg-human-guide">
|
|
16
|
-
<div className="sg-card-title">{data.merchantName} · 人工导购</div>
|
|
15
|
+
<section className="sg-card sg-human-guide p-5 text-foreground">
|
|
16
|
+
<div className="sg-card-title mb-2 flex items-center gap-2 text-lg leading-6 font-bold text-foreground before:h-4 before:w-1 before:shrink-0 before:rounded-[2px] before:bg-[var(--tbox-domain-sg-accent,#096bfa)]">{data.merchantName} · 人工导购</div>
|
|
17
17
|
{data.guides.length === 0 ? (
|
|
18
|
-
<div className="sg-empty">暂无导购员信息</div>
|
|
18
|
+
<div className="sg-empty py-6 text-center text-sm text-muted-foreground">暂无导购员信息</div>
|
|
19
19
|
) : (
|
|
20
|
-
<ul className="sg-guide-list">
|
|
20
|
+
<ul className="sg-guide-list m-0 list-none p-0">
|
|
21
21
|
{data.guides.map((g) => {
|
|
22
22
|
const contact = g.itemActions[0];
|
|
23
23
|
const contactDisabled = isHistory || !contact;
|
|
24
24
|
return (
|
|
25
|
-
<li key={g.guideId} className="sg-guide-item">
|
|
26
|
-
<ImageWithFallback src={g.avatarUrl} alt={g.name} className="sg-guide-avatar" size={48} />
|
|
27
|
-
<div className="sg-guide-info">
|
|
25
|
+
<li key={g.guideId} className="sg-guide-item flex items-center gap-3 border-b-[0.5px] border-border py-3 last:border-b-0">
|
|
26
|
+
<ImageWithFallback src={g.avatarUrl} alt={g.name} className="sg-guide-avatar size-12 shrink-0 max-w-full rounded-full object-cover" size={48} />
|
|
27
|
+
<div className="sg-guide-info min-w-0 flex-1">
|
|
28
28
|
<div className="sg-guide-head">
|
|
29
|
-
<span className="sg-merchant-name">{g.name}</span>
|
|
30
|
-
<span className={
|
|
29
|
+
<span className="sg-merchant-name min-w-0 flex-1 truncate text-base font-semibold text-foreground">{g.name}</span>
|
|
30
|
+
<span className={g.available
|
|
31
|
+
? 'sg-status sg-status-available inline-block rounded-full bg-success-soft px-2 py-0.5 text-xs leading-4 whitespace-nowrap text-success'
|
|
32
|
+
: 'sg-status sg-status-offline inline-block rounded-full bg-[#fff4df] px-2 py-0.5 text-xs leading-4 whitespace-nowrap text-[#986415]'}
|
|
33
|
+
>
|
|
31
34
|
{g.available ? '在线' : '离线'}
|
|
32
35
|
</span>
|
|
33
36
|
</div>
|
|
34
|
-
{g.title && <div className="sg-guide-title">{g.title}</div>}
|
|
37
|
+
{g.title && <div className="sg-guide-title mt-[2px] text-xs text-secondary-foreground">{g.title}</div>}
|
|
35
38
|
{g.contactInfo && g.contactInfo.length > 0 && (
|
|
36
|
-
<div className="sg-guide-channels">
|
|
39
|
+
<div className="sg-guide-channels mt-1 flex flex-wrap gap-1.5">
|
|
37
40
|
{g.contactInfo.map((c, i) => (
|
|
38
|
-
<span key={i} className="sg-guide-channel">
|
|
41
|
+
<span key={i} className="sg-guide-channel rounded-[8px] bg-muted px-1.5 py-[0.5px] text-xs text-secondary-foreground">
|
|
39
42
|
{c.channel}
|
|
40
43
|
</span>
|
|
41
44
|
))}
|
|
@@ -44,7 +47,7 @@ export function HumanGuideListCard(props: {
|
|
|
44
47
|
</div>
|
|
45
48
|
<button
|
|
46
49
|
type="button"
|
|
47
|
-
className="sg-guide-contact"
|
|
50
|
+
className="sg-guide-contact min-h-8 shrink-0 cursor-pointer rounded-[9px] border border-border bg-[var(--tbox-domain-sg-surface,#f7faff)] px-3 text-xs text-[var(--tbox-domain-sg-accent,#096bfa)] disabled:cursor-not-allowed disabled:opacity-50 [font-family:inherit] tracking-normal"
|
|
48
51
|
disabled={contactDisabled}
|
|
49
52
|
title={contact ? contact.label : '暂无可用的联系方式'}
|
|
50
53
|
onClick={() => {
|
|
@@ -64,7 +67,7 @@ export function HumanGuideListCard(props: {
|
|
|
64
67
|
})}
|
|
65
68
|
</ul>
|
|
66
69
|
)}
|
|
67
|
-
<p className="sg-guide-privacy">导购信息由门店提供,联系方式仅用于本次咨询</p>
|
|
70
|
+
<p className="sg-guide-privacy mt-2.5 text-xs leading-4 text-muted-foreground">导购信息由门店提供,联系方式仅用于本次咨询</p>
|
|
68
71
|
</section>
|
|
69
72
|
);
|
|
70
73
|
}
|
|
@@ -17,26 +17,26 @@ export function LocationHandoffCard(props: {
|
|
|
17
17
|
const navAction = data.itemActions.find((a) => a.kind === 'link');
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
<section className="sg-card sg-location-handoff">
|
|
21
|
-
<div className="sg-card-title">{data.merchantName} · 位置</div>
|
|
20
|
+
<section className="sg-card sg-location-handoff p-5 text-foreground">
|
|
21
|
+
<div className="sg-card-title mb-2 flex items-center gap-2 text-lg leading-6 font-bold text-foreground before:h-4 before:w-1 before:shrink-0 before:rounded-[2px] before:bg-[var(--tbox-domain-sg-accent,#096bfa)]">{data.merchantName} · 位置</div>
|
|
22
22
|
{data.mapUrl && (
|
|
23
|
-
<ImageWithFallback src={data.mapUrl} alt={`${data.merchantName} 位置示意`} className="sg-lh-map" size={88} />
|
|
23
|
+
<ImageWithFallback src={data.mapUrl} alt={`${data.merchantName} 位置示意`} className="sg-lh-map h-40 w-full max-w-full rounded-[12px] object-cover" size={88} />
|
|
24
24
|
)}
|
|
25
|
-
<div className="sg-lh-address">
|
|
26
|
-
<MapPin size={16} />
|
|
25
|
+
<div className="sg-lh-address mt-2.5 flex items-center gap-1.5 text-sm font-medium text-foreground">
|
|
26
|
+
<MapPin size={16} className="shrink-0 text-[var(--tbox-domain-sg-accent,#096bfa)]" />
|
|
27
27
|
<span>{data.location.displayText}</span>
|
|
28
28
|
</div>
|
|
29
29
|
{(data.location.buildingName || data.location.floorName || data.location.unitName) && (
|
|
30
|
-
<div className="sg-lh-detail">
|
|
31
|
-
{data.location.buildingName && <span>{data.location.buildingName}</span>}
|
|
32
|
-
{data.location.floorName && <span>{data.location.floorName}</span>}
|
|
33
|
-
{data.location.unitName && <span>{data.location.unitName}</span>}
|
|
30
|
+
<div className="sg-lh-detail mt-2 flex flex-wrap gap-1.5">
|
|
31
|
+
{data.location.buildingName && <span className="rounded-[8px] bg-muted px-2 py-0.5 text-xs text-secondary-foreground">{data.location.buildingName}</span>}
|
|
32
|
+
{data.location.floorName && <span className="rounded-[8px] bg-muted px-2 py-0.5 text-xs text-secondary-foreground">{data.location.floorName}</span>}
|
|
33
|
+
{data.location.unitName && <span className="rounded-[8px] bg-muted px-2 py-0.5 text-xs text-secondary-foreground">{data.location.unitName}</span>}
|
|
34
34
|
</div>
|
|
35
35
|
)}
|
|
36
36
|
{level === 'route_available' && navAction && (
|
|
37
37
|
<button
|
|
38
38
|
type="button"
|
|
39
|
-
className="sg-lh-nav"
|
|
39
|
+
className="sg-lh-nav mt-3 flex h-10 w-full cursor-pointer items-center justify-center gap-1.5 rounded-[9px] border-0 bg-[linear-gradient(108deg,#2493ff_0%,#0b63ff_100%)] text-sm font-medium text-white shadow-[0_4px_11px_rgba(18,118,255,0.35)] [font-family:inherit] tracking-normal"
|
|
40
40
|
onClick={() => {
|
|
41
41
|
sendCardAction(cardId, { type: 'openLink', url: navAction.url });
|
|
42
42
|
}}
|
|
@@ -17,37 +17,37 @@ export function MallDirectoryCard(props: {
|
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
<section className="sg-card sg-mall-directory">
|
|
21
|
-
<div className="sg-card-title">{data.mallName} · 楼层目录</div>
|
|
20
|
+
<section className="sg-card sg-mall-directory p-5 text-foreground">
|
|
21
|
+
<div className="sg-card-title mb-2 flex items-center gap-2 text-lg leading-6 font-bold text-foreground before:h-4 before:w-1 before:shrink-0 before:rounded-[2px] before:bg-[var(--tbox-domain-sg-accent,#096bfa)]">{data.mallName} · 楼层目录</div>
|
|
22
22
|
{data.buildings.map((b) => {
|
|
23
23
|
const open = openBuilding === b.buildingCode;
|
|
24
24
|
return (
|
|
25
|
-
<div key={b.buildingCode} className="sg-dir-building">
|
|
25
|
+
<div key={b.buildingCode} className="sg-dir-building mt-2 overflow-hidden rounded-[10px] border-[0.5px] border-border">
|
|
26
26
|
<button
|
|
27
27
|
type="button"
|
|
28
|
-
className="sg-dir-building__head"
|
|
28
|
+
className="sg-dir-building__head flex w-full cursor-pointer items-center gap-2 border-0 bg-card p-3 text-left text-foreground [font-family:inherit] tracking-normal"
|
|
29
29
|
aria-expanded={open}
|
|
30
30
|
onClick={() => setOpenBuilding(open ? null : b.buildingCode)}
|
|
31
31
|
>
|
|
32
|
-
<Storefront size={18} />
|
|
33
|
-
<span className="sg-dir-building__name">{b.buildingName}</span>
|
|
34
|
-
<span className="sg-dir-building__count">{b.floors.length} 层</span>
|
|
35
|
-
<CaretDown size={16} className="sg-dir-building__chevron" data-rotated={open || undefined} />
|
|
32
|
+
<Storefront size={18} className="text-[var(--tbox-domain-sg-accent,#096bfa)]" />
|
|
33
|
+
<span className="sg-dir-building__name min-w-0 flex-1 text-sm font-semibold">{b.buildingName}</span>
|
|
34
|
+
<span className="sg-dir-building__count text-xs text-muted-foreground">{b.floors.length} 层</span>
|
|
35
|
+
<CaretDown size={16} className="sg-dir-building__chevron text-[var(--tbox-domain-sg-accent,#096bfa)] data-[rotated]:rotate-180 data-[rotated]:transition-transform" data-rotated={open || undefined} />
|
|
36
36
|
</button>
|
|
37
37
|
{open && (
|
|
38
|
-
<ul className="sg-dir-floors">
|
|
38
|
+
<ul className="sg-dir-floors m-0 list-none border-t-[0.5px] border-border bg-muted p-0">
|
|
39
39
|
{b.floors.map((f) => (
|
|
40
|
-
<li key={f.floorCode} className="sg-dir-floor">
|
|
41
|
-
<div className="sg-dir-floor__info">
|
|
42
|
-
<span className="sg-dir-floor__name">{f.floorName}</span>
|
|
43
|
-
<span className="sg-dir-floor__cats">
|
|
40
|
+
<li key={f.floorCode} className="sg-dir-floor flex items-center justify-between gap-2 border-b-[0.5px] border-border px-3 py-2 last:border-b-0">
|
|
41
|
+
<div className="sg-dir-floor__info grid min-w-0 gap-1">
|
|
42
|
+
<span className="sg-dir-floor__name text-sm font-medium text-foreground">{f.floorName}</span>
|
|
43
|
+
<span className="sg-dir-floor__cats truncate text-xs text-muted-foreground">
|
|
44
44
|
{f.businessCategories.join(' / ') || `${f.merchantCount} 家商户`}
|
|
45
45
|
</span>
|
|
46
46
|
</div>
|
|
47
47
|
{f.itemActions && f.itemActions.length > 0 && (
|
|
48
48
|
<button
|
|
49
49
|
type="button"
|
|
50
|
-
className="sg-chip sg-dir-floor__action"
|
|
50
|
+
className="sg-chip sg-dir-floor__action inline-flex min-h-[28px] shrink-0 cursor-pointer items-center justify-center rounded-[9px] border border-border bg-[var(--tbox-domain-sg-surface,#f7faff)] px-2.5 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"
|
|
51
51
|
disabled={isHistory}
|
|
52
52
|
onClick={() => {
|
|
53
53
|
if (isHistory) return;
|
|
@@ -5,6 +5,18 @@ import { ItemActionsRow } from '@tbox.cn/app-agent-sdk-client';
|
|
|
5
5
|
import { formatDistance } from '../view';
|
|
6
6
|
import type { NearbyMallListCardData } from '@tbox.cn/app-contracts-mall';
|
|
7
7
|
|
|
8
|
+
/** 营业状态徽章:基础规格 + 按状态码取色(完整字面量,禁止拼接) */
|
|
9
|
+
const STATUS_BASE_CLASS = 'sg-status inline-block rounded-full px-2 py-0.5 text-xs leading-4 whitespace-nowrap';
|
|
10
|
+
const STATUS_TONE_CLASS: Record<string, string> = {
|
|
11
|
+
enabled: 'sg-status-enabled text-success bg-success-soft',
|
|
12
|
+
available: 'sg-status-available text-success bg-success-soft',
|
|
13
|
+
open: 'sg-status-open bg-[#e9f8ef] text-[#237a48]',
|
|
14
|
+
offline: 'sg-status-offline bg-[#fff4df] text-[#986415]',
|
|
15
|
+
closed: 'sg-status-closed bg-[#fff4df] text-[#986415]',
|
|
16
|
+
disabled: 'sg-status-disabled bg-[#fff4df] text-[#986415]',
|
|
17
|
+
unknown: 'sg-status-unknown bg-[#fff4df] text-[#986415]',
|
|
18
|
+
};
|
|
19
|
+
|
|
8
20
|
export function NearbyMallListCard(props: {
|
|
9
21
|
data: NearbyMallListCardData;
|
|
10
22
|
cardId: string;
|
|
@@ -12,24 +24,30 @@ export function NearbyMallListCard(props: {
|
|
|
12
24
|
}) {
|
|
13
25
|
const { data, cardId, isHistory } = props;
|
|
14
26
|
if (data.malls.length === 0) {
|
|
15
|
-
return <section className="sg-card"><div className="sg-empty">暂无附近商场</div></section>;
|
|
27
|
+
return <section className="sg-card p-5 text-foreground"><div className="sg-empty py-6 text-center text-sm text-muted-foreground">暂无附近商场</div></section>;
|
|
16
28
|
}
|
|
17
29
|
return (
|
|
18
|
-
<section className="sg-card sg-nearby-malls">
|
|
19
|
-
<div className="sg-card-title">附近商场</div>
|
|
20
|
-
{data.query && <div className="sg-card-summary">查询「{data.query}」</div>}
|
|
21
|
-
<ul className="sg-nearby-list">
|
|
30
|
+
<section className="sg-card sg-nearby-malls p-5 text-foreground">
|
|
31
|
+
<div className="sg-card-title mb-2 flex items-center gap-2 text-lg leading-6 font-bold text-foreground before:h-4 before:w-1 before:shrink-0 before:rounded-[2px] before:bg-[var(--tbox-domain-sg-accent,#096bfa)]">附近商场</div>
|
|
32
|
+
{data.query && <div className="sg-card-summary mb-3 text-sm text-secondary-foreground">查询「{data.query}」</div>}
|
|
33
|
+
<ul className="sg-nearby-list m-0 list-none p-0">
|
|
22
34
|
{data.malls.map((m) => (
|
|
23
|
-
<li key={m.mallId} className="sg-nearby-item">
|
|
35
|
+
<li key={m.mallId} className="sg-nearby-item border-b-[0.5px] border-border py-3 last:border-b-0">
|
|
24
36
|
<div className="sg-nearby-item__head">
|
|
25
|
-
<span className="sg-merchant-name">{m.name}</span>
|
|
26
|
-
<span className={
|
|
37
|
+
<span className="sg-merchant-name min-w-0 flex-1 truncate text-base font-semibold text-foreground">{m.name}</span>
|
|
38
|
+
<span className={`${STATUS_BASE_CLASS} ${STATUS_TONE_CLASS[m.status.code] ?? STATUS_TONE_CLASS.unknown}`}>{m.status.label}</span>
|
|
27
39
|
</div>
|
|
28
|
-
<div className="sg-nearby-item__meta">
|
|
40
|
+
<div className="sg-nearby-item__meta mt-1 flex justify-between gap-2 text-xs text-secondary-foreground">
|
|
29
41
|
<span>{m.address}</span>
|
|
30
|
-
<span className="sg-nearby-item__distance">{formatDistance(m.distanceKm)}</span>
|
|
42
|
+
<span className="sg-nearby-item__distance shrink-0 font-medium text-[var(--tbox-domain-sg-accent,#096bfa)]">{formatDistance(m.distanceKm)}</span>
|
|
31
43
|
</div>
|
|
32
|
-
<ItemActionsRow
|
|
44
|
+
<ItemActionsRow
|
|
45
|
+
actions={m.itemActions}
|
|
46
|
+
cardId={cardId}
|
|
47
|
+
isHistory={isHistory}
|
|
48
|
+
className="sg-item-actions mt-2 flex flex-wrap gap-1.5"
|
|
49
|
+
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"
|
|
50
|
+
/>
|
|
33
51
|
</li>
|
|
34
52
|
))}
|
|
35
53
|
</ul>
|
|
@@ -5,6 +5,17 @@ import { useEffect, useState } from 'react';
|
|
|
5
5
|
import { ImageWithFallback } from '../../components/ImageWithFallback';
|
|
6
6
|
import type { ProductComparisonCardData } from '@tbox.cn/app-contracts-mall';
|
|
7
7
|
|
|
8
|
+
/** 可用性徽章:基础规格 + 按状态码取色(完整字面量,禁止拼接) */
|
|
9
|
+
const AVAILABILITY_BASE_CLASS = 'sg-availability mt-1 inline-block text-xs text-secondary-foreground';
|
|
10
|
+
const AVAILABILITY_TONE_CLASS: Record<string, string> = {
|
|
11
|
+
in_stock: 'sg-availability-in_stock text-success',
|
|
12
|
+
available: 'sg-availability-available text-success',
|
|
13
|
+
out_of_stock: 'sg-availability-out_of_stock text-warning',
|
|
14
|
+
limited: 'sg-availability-limited',
|
|
15
|
+
unknown: 'sg-availability-unknown',
|
|
16
|
+
};
|
|
17
|
+
const CELL_CLASS = 'border-b-[0.5px] border-border p-2 text-left align-top';
|
|
18
|
+
|
|
8
19
|
export function ProductComparisonCard(props: {
|
|
9
20
|
data: ProductComparisonCardData;
|
|
10
21
|
isHistory: boolean;
|
|
@@ -25,36 +36,36 @@ export function ProductComparisonCard(props: {
|
|
|
25
36
|
const attrNames = Array.from(new Set(data.products.flatMap((p) => p.attributes.map((a) => a.name))));
|
|
26
37
|
|
|
27
38
|
return (
|
|
28
|
-
<section className={`sg-card sg-product-comparison${stale ? ' sg-product-comparison--stale' : ''}`}>
|
|
29
|
-
<div className="sg-card-title">商品对比</div>
|
|
39
|
+
<section className={`sg-card sg-product-comparison p-5 text-foreground ${stale ? ' sg-product-comparison--stale' : ''}`}>
|
|
40
|
+
<div className="sg-card-title mb-2 flex items-center gap-2 text-lg leading-6 font-bold text-foreground before:h-4 before:w-1 before:shrink-0 before:rounded-[2px] before:bg-[var(--tbox-domain-sg-accent,#096bfa)]">商品对比</div>
|
|
30
41
|
{stale && (
|
|
31
|
-
<div className="sg-stale-notice">
|
|
42
|
+
<div className="sg-stale-notice mb-2.5 rounded-[8px] bg-warning-soft px-2.5 py-2 text-xs leading-4.5 text-warning">
|
|
32
43
|
<span>对比数据已过期,请重新发起对比</span>
|
|
33
44
|
</div>
|
|
34
45
|
)}
|
|
35
46
|
|
|
36
|
-
<div className="sg-compare-wrap">
|
|
37
|
-
<table className=
|
|
47
|
+
<div className="sg-compare-wrap overflow-x-auto">
|
|
48
|
+
<table className={`sg-compare w-full border-collapse text-xs ${stale ? ' opacity-60' : ''}`}>
|
|
38
49
|
<thead>
|
|
39
50
|
<tr>
|
|
40
|
-
<th scope="col" className=
|
|
51
|
+
<th scope="col" className={`sg-compare__label ${CELL_CLASS} font-medium whitespace-nowrap text-secondary-foreground`} />
|
|
41
52
|
{data.products.map((p) => (
|
|
42
|
-
<th key={p.productId} scope="col">
|
|
43
|
-
<ImageWithFallback src={p.imageUrl} alt={p.name} className="sg-compare__img" size={40} />
|
|
44
|
-
<div className="sg-compare__name">{p.name}</div>
|
|
45
|
-
<div className="sg-price-sale">{p.price.sale?.display ?? '—'}</div>
|
|
53
|
+
<th key={p.productId} scope="col" className={CELL_CLASS}>
|
|
54
|
+
<ImageWithFallback src={p.imageUrl} alt={p.name} className="sg-compare__img size-14 max-w-full rounded-[8px] object-cover" size={40} />
|
|
55
|
+
<div className="sg-compare__name mt-1 leading-4.5 font-semibold text-foreground">{p.name}</div>
|
|
56
|
+
<div className="sg-price-sale text-base font-bold tabular-nums text-[#ef4f43]">{p.price.sale?.display ?? '—'}</div>
|
|
46
57
|
</th>
|
|
47
58
|
))}
|
|
48
59
|
</tr>
|
|
49
60
|
</thead>
|
|
50
61
|
<tbody>
|
|
51
62
|
<tr>
|
|
52
|
-
<th scope="row" className=
|
|
63
|
+
<th scope="row" className={`sg-compare__label ${CELL_CLASS} font-medium whitespace-nowrap text-secondary-foreground`}>
|
|
53
64
|
库存
|
|
54
65
|
</th>
|
|
55
66
|
{data.products.map((p) => (
|
|
56
|
-
<td key={p.productId}>
|
|
57
|
-
<span className={
|
|
67
|
+
<td key={p.productId} className={CELL_CLASS}>
|
|
68
|
+
<span className={`${AVAILABILITY_BASE_CLASS} ${AVAILABILITY_TONE_CLASS[p.availability.status] ?? ''}`}>
|
|
58
69
|
{p.availability.label}
|
|
59
70
|
</span>
|
|
60
71
|
</td>
|
|
@@ -62,13 +73,13 @@ export function ProductComparisonCard(props: {
|
|
|
62
73
|
</tr>
|
|
63
74
|
{attrNames.map((name) => (
|
|
64
75
|
<tr key={name}>
|
|
65
|
-
<th scope="row" className=
|
|
76
|
+
<th scope="row" className={`sg-compare__label ${CELL_CLASS} font-medium whitespace-nowrap text-secondary-foreground`}>
|
|
66
77
|
{name}
|
|
67
78
|
</th>
|
|
68
79
|
{data.products.map((p) => {
|
|
69
80
|
const attr = p.attributes.find((a) => a.name === name);
|
|
70
81
|
return (
|
|
71
|
-
<td key={p.productId} className={attr ? '' : 'sg-compare__cell-empty'}>
|
|
82
|
+
<td key={p.productId} className={`${CELL_CLASS}${attr ? '' : ' sg-compare__cell-empty text-muted-foreground'}`}>
|
|
72
83
|
{attr?.value ?? '—'}
|
|
73
84
|
</td>
|
|
74
85
|
);
|
|
@@ -80,9 +91,9 @@ export function ProductComparisonCard(props: {
|
|
|
80
91
|
</div>
|
|
81
92
|
|
|
82
93
|
{data.products.some((p) => p.caveats.length > 0) && (
|
|
83
|
-
<div className="sg-item-caveats">
|
|
94
|
+
<div className="sg-item-caveats mt-1.5">
|
|
84
95
|
{data.products.flatMap((p) => p.caveats.map((c, i) => ({ key: `${p.productId}-${i}`, text: c }))).map(({ key, text }) => (
|
|
85
|
-
<div key={key} className="sg-caveat-item">
|
|
96
|
+
<div key={key} className="sg-caveat-item text-xs leading-4 text-muted-foreground">
|
|
86
97
|
⚠️ {text}
|
|
87
98
|
</div>
|
|
88
99
|
))}
|
|
@@ -90,7 +101,7 @@ export function ProductComparisonCard(props: {
|
|
|
90
101
|
)}
|
|
91
102
|
|
|
92
103
|
{/* 到期后整卡降透明(交互全禁)。标记仅 stale 态显示——isHistory 是"历史不可交互"而非"数据过期",两者语义分离 */}
|
|
93
|
-
<span className="sg-compare__stale-marker" hidden={!stale}>
|
|
104
|
+
<span className="sg-compare__stale-marker mt-2 block text-xs text-warning" hidden={!stale}>
|
|
94
105
|
对比数据可能已过期
|
|
95
106
|
</span>
|
|
96
107
|
</section>
|