@tbox.cn/app-module-shopping-guide 0.2.1 → 0.8.2
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 +16 -0
- package/README.md +96 -0
- package/dist/chunk-AYQZO2FV.js +1496 -0
- package/dist/chunk-QDTU2FRN.js +1682 -0
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -8
- package/dist/server/index.d.ts +2512 -608
- package/dist/server/index.js +1 -7
- package/dist/shop-guide-header-art-pea-v2-OME4MKBW.jpg +0 -0
- package/dist/shopping-guide-OQ2SSHXL.css +2593 -0
- package/package.json +25 -16
- package/skills/shopping-guide/SKILL.md +127 -24
- package/src/client/assets/shop-guide-header-art-pea-v2.jpg +0 -0
- package/src/client/assets/shop-guide-header-art.png +0 -0
- package/src/client/assets.d.ts +10 -0
- package/src/client/cards/category-list/index.tsx +113 -0
- package/src/client/cards/human-guide-list/index.tsx +72 -0
- package/src/client/cards/index.ts +14 -0
- package/src/client/cards/location-handoff/index.tsx +52 -0
- package/src/client/cards/mall-directory/index.tsx +77 -0
- package/src/client/cards/nearby-mall-list/index.tsx +40 -0
- package/src/client/cards/product-comparison/index.tsx +100 -0
- package/src/client/cards/product-detail/index.tsx +97 -0
- package/src/client/cards/product-list/index.tsx +223 -0
- package/src/client/cards/recommend-merchants/index.tsx +147 -0
- package/src/client/cards/shop-detail/index.tsx +133 -0
- package/src/client/cards/shop-list/index.tsx +216 -0
- package/src/client/cards/view.ts +147 -0
- package/src/client/categories.ts +38 -0
- package/src/client/components/ImageWithFallback.tsx +34 -0
- package/src/client/components/MerchantRow.tsx +78 -0
- package/src/client/components/ShopDetailSheet.tsx +383 -0
- package/src/client/components/ShopGuideHeader.tsx +24 -0
- package/src/client/components/ShopGuideSectionLabel.tsx +10 -0
- package/src/client/components/ShopListSheet.tsx +293 -0
- package/src/client/index.ts +8 -6
- package/src/client/styles/shopping-guide.css +2593 -0
- package/src/client/types/css.d.ts +2 -0
- package/src/server/cards/category-list/meta.ts +0 -2
- package/src/server/cards/human-guide-list/meta.ts +0 -2
- package/src/server/cards/index.ts +10 -10
- package/src/server/cards/location-handoff/meta.ts +0 -2
- package/src/server/cards/mall-directory/meta.ts +0 -2
- package/src/server/cards/nearby-mall-list/meta.ts +1 -3
- package/src/server/cards/product-comparison/meta.ts +0 -2
- package/src/server/cards/product-detail/meta.ts +0 -2
- package/src/server/cards/product-list/meta.ts +0 -2
- package/src/server/cards/recommend-merchants/meta.ts +37 -0
- package/src/server/cards/recommend-merchants/samples.ts +189 -0
- package/src/server/cards/{merchant-detail → shop-detail}/meta.ts +6 -6
- package/src/server/cards/shop-detail/samples.ts +72 -0
- package/src/server/cards/{merchant-list → shop-list}/meta.ts +9 -9
- package/src/server/cards/shop-list/samples.ts +154 -0
- package/src/server/domain/value-objects.ts +1 -2
- package/src/server/handler.ts +63 -0
- package/src/server/index.ts +161 -101
- package/src/server/ports/index.ts +120 -91
- package/src/server/ports/local-adapters.ts +5 -55
- package/src/server/projections/index.ts +159 -41
- package/src/server/tools/index.ts +590 -315
- package/tbox.module.json +137 -0
- package/tests/cards-render.test.tsx +830 -0
- package/tests/floor-pretool.test.ts +275 -0
- package/tests/handler.test.ts +259 -0
- package/tests/merchant-list-limit.test.ts +53 -0
- package/tests/ports-resolve.test.ts +112 -0
- package/tests/samples.test.ts +71 -0
- package/tests/shopping-guide.test.ts +402 -234
- package/tests/skill.test.ts +86 -0
- package/tests/view.test.ts +42 -0
- package/tsup.config.ts +9 -1
- package/dist/chunk-AGBLC6XI.js +0 -1294
- package/dist/chunk-U4WDS5PQ.js +0 -173
- package/skills/shopping-guide/references/comparison-format.md +0 -5
- package/skills/shopping-guide/references/faq-answers.md +0 -5
- package/skills/shopping-guide/references/floor-directory.md +0 -4
- package/skills/shopping-guide/references/intent-patterns.md +0 -5
- package/skills/shopping-guide/references/location-format.md +0 -5
- package/skills/shopping-guide/references/policy-lookup.md +0 -5
- package/skills/shopping-guide/references/product-search-tips.md +0 -6
- package/skills/shopping-guide/references/recommendation-style.md +0 -5
- package/src/client/cards/index.tsx +0 -267
- package/src/server/cards/customer-service-faq/meta.ts +0 -18
- package/src/server/integrations/joycity/adapter.ts +0 -226
- package/src/server/integrations/joycity/auth-strategy.ts +0 -38
- package/src/server/integrations/joycity/gateway.ts +0 -128
- package/tbox.component.json +0 -48
package/dist/chunk-U4WDS5PQ.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
// src/client/cards/index.tsx
|
|
2
|
-
import { CardFrame, ValueText, StatusPill } from "@tbox.cn/app-sdk/client";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
var listStyle = { listStyle: "none", margin: 0, padding: 0 };
|
|
5
|
-
var itemStyle = {
|
|
6
|
-
padding: "8px 0",
|
|
7
|
-
borderBottom: "1px solid var(--tbox-divider, #f0f0f0)"
|
|
8
|
-
};
|
|
9
|
-
function ProductListCard(props) {
|
|
10
|
-
const { data } = props;
|
|
11
|
-
if (data.items.length === 0) {
|
|
12
|
-
return /* @__PURE__ */ jsx(CardFrame, { title: "\u5546\u54C1\u5217\u8868", children: data.noResultsReason ?? "\u6682\u65E0\u5546\u54C1" });
|
|
13
|
-
}
|
|
14
|
-
return /* @__PURE__ */ jsx(CardFrame, { title: "\u5546\u54C1\u5217\u8868", subtitle: data.summary, children: /* @__PURE__ */ jsx("ul", { style: listStyle, children: data.items.map((item) => /* @__PURE__ */ jsxs("li", { style: itemStyle, children: [
|
|
15
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", gap: 8 }, children: [
|
|
16
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 14, fontWeight: 600 }, children: item.name }),
|
|
17
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 14, color: "var(--tbox-primary, #e93b3d)" }, children: item.price.sale?.display ?? "" })
|
|
18
|
-
] }),
|
|
19
|
-
/* @__PURE__ */ jsxs("div", { style: { marginTop: 4, display: "flex", gap: 6, alignItems: "center", flexWrap: "wrap" }, children: [
|
|
20
|
-
/* @__PURE__ */ jsx(
|
|
21
|
-
StatusPill,
|
|
22
|
-
{
|
|
23
|
-
tone: item.availability.marketable ? "success" : "neutral",
|
|
24
|
-
text: item.availability.label
|
|
25
|
-
}
|
|
26
|
-
),
|
|
27
|
-
item.badges.map((b) => /* @__PURE__ */ jsx(StatusPill, { tone: "neutral", text: b }, b))
|
|
28
|
-
] }),
|
|
29
|
-
/* @__PURE__ */ jsx(ValueText, { label: "\u95E8\u5E97", value: `${item.merchant.name}${item.merchant.location ? ` \xB7 ${item.merchant.location.displayText}` : ""}` })
|
|
30
|
-
] }, item.productId)) }) });
|
|
31
|
-
}
|
|
32
|
-
function ProductDetailCard(props) {
|
|
33
|
-
const { data } = props;
|
|
34
|
-
return /* @__PURE__ */ jsxs(CardFrame, { title: data.name, subtitle: data.brand, children: [
|
|
35
|
-
data.imageUrls[0] && /* @__PURE__ */ jsx("img", { src: data.imageUrls[0], alt: data.name, style: { width: "100%", borderRadius: 8, marginBottom: 8 } }),
|
|
36
|
-
/* @__PURE__ */ jsx(ValueText, { label: "\u4EF7\u683C", value: data.price.sale?.display ?? "\u2014" }),
|
|
37
|
-
/* @__PURE__ */ jsx(ValueText, { label: "\u5E93\u5B58", value: data.availability.label }),
|
|
38
|
-
/* @__PURE__ */ jsx(
|
|
39
|
-
ValueText,
|
|
40
|
-
{
|
|
41
|
-
label: "\u95E8\u5E97",
|
|
42
|
-
value: `${data.merchant.name}${data.merchant.location ? ` \xB7 ${data.merchant.location.displayText}` : ""}`
|
|
43
|
-
}
|
|
44
|
-
),
|
|
45
|
-
data.attributes.map((a) => /* @__PURE__ */ jsx(ValueText, { label: a.name, value: a.value }, a.name)),
|
|
46
|
-
data.promotionFacts.map((p) => /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "var(--tbox-primary, #e93b3d)", marginTop: 4 }, children: p }, p))
|
|
47
|
-
] });
|
|
48
|
-
}
|
|
49
|
-
function MerchantListCard(props) {
|
|
50
|
-
const { data } = props;
|
|
51
|
-
if (data.items.length === 0) {
|
|
52
|
-
return /* @__PURE__ */ jsx(CardFrame, { title: "\u95E8\u5E97\u5217\u8868", children: data.noResultsReason ?? "\u6682\u65E0\u95E8\u5E97" });
|
|
53
|
-
}
|
|
54
|
-
return /* @__PURE__ */ jsx(CardFrame, { title: "\u95E8\u5E97\u5217\u8868", subtitle: data.summary, children: /* @__PURE__ */ jsx("ul", { style: listStyle, children: data.items.map((item) => /* @__PURE__ */ jsxs("li", { style: itemStyle, children: [
|
|
55
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", gap: 8 }, children: [
|
|
56
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 14, fontWeight: 600 }, children: item.name }),
|
|
57
|
-
/* @__PURE__ */ jsx(StatusPill, { tone: item.status.code === "enabled" ? "success" : "warning", text: item.status.label })
|
|
58
|
-
] }),
|
|
59
|
-
/* @__PURE__ */ jsx(ValueText, { label: "\u4F4D\u7F6E", value: item.location.displayText }),
|
|
60
|
-
item.promotionFacts.length > 0 && /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "var(--tbox-primary, #e93b3d)" }, children: item.promotionFacts.join(" \xB7 ") })
|
|
61
|
-
] }, item.merchantId)) }) });
|
|
62
|
-
}
|
|
63
|
-
function MerchantDetailCard(props) {
|
|
64
|
-
const { data } = props;
|
|
65
|
-
return /* @__PURE__ */ jsxs(CardFrame, { title: data.name, subtitle: data.brand, children: [
|
|
66
|
-
/* @__PURE__ */ jsx(StatusPill, { tone: data.status.code === "enabled" ? "success" : "warning", text: data.status.label }),
|
|
67
|
-
/* @__PURE__ */ jsx(ValueText, { label: "\u4F4D\u7F6E", value: data.location.displayText }),
|
|
68
|
-
/* @__PURE__ */ jsx(ValueText, { label: "\u4E1A\u6001", value: data.businessCategories.join(" / ") }),
|
|
69
|
-
data.description && /* @__PURE__ */ jsx("div", { style: { fontSize: 13, marginTop: 6 }, children: data.description }),
|
|
70
|
-
data.contactInfo?.map((c, i) => /* @__PURE__ */ jsx(ValueText, { label: c.channel, value: c.value }, i)),
|
|
71
|
-
data.promotionFacts.map((p) => /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "var(--tbox-primary, #e93b3d)", marginTop: 4 }, children: p }, p))
|
|
72
|
-
] });
|
|
73
|
-
}
|
|
74
|
-
function CategoryListCard(props) {
|
|
75
|
-
const { data } = props;
|
|
76
|
-
return /* @__PURE__ */ jsx(CardFrame, { title: "\u4E1A\u6001\u5206\u7C7B", children: /* @__PURE__ */ jsx("ul", { style: listStyle, children: data.categories.map((c) => /* @__PURE__ */ jsxs("li", { style: itemStyle, children: [
|
|
77
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between" }, children: [
|
|
78
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 14, fontWeight: 600 }, children: c.name }),
|
|
79
|
-
/* @__PURE__ */ jsxs("span", { style: { fontSize: 12, color: "var(--tbox-text-secondary, #888)" }, children: [
|
|
80
|
-
c.merchantCount,
|
|
81
|
-
" \u5BB6"
|
|
82
|
-
] })
|
|
83
|
-
] }),
|
|
84
|
-
c.subCategories && c.subCategories.length > 0 && /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "var(--tbox-text-secondary, #888)", marginTop: 2 }, children: c.subCategories.map((s) => s.name).join(" / ") })
|
|
85
|
-
] }, c.code)) }) });
|
|
86
|
-
}
|
|
87
|
-
function ProductComparisonCard(props) {
|
|
88
|
-
const { data } = props;
|
|
89
|
-
return /* @__PURE__ */ jsx(CardFrame, { title: "\u5546\u54C1\u5BF9\u6BD4", children: data.products.map((p) => /* @__PURE__ */ jsxs("div", { style: itemStyle, children: [
|
|
90
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", gap: 8 }, children: [
|
|
91
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 14, fontWeight: 600 }, children: p.name }),
|
|
92
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 14, color: "var(--tbox-primary, #e93b3d)" }, children: p.price.sale?.display ?? "\u2014" })
|
|
93
|
-
] }),
|
|
94
|
-
/* @__PURE__ */ jsx(ValueText, { label: "\u5E93\u5B58", value: p.availability.label }),
|
|
95
|
-
p.attributes.map((a) => /* @__PURE__ */ jsx(ValueText, { label: a.name, value: a.value }, a.name))
|
|
96
|
-
] }, p.productId)) });
|
|
97
|
-
}
|
|
98
|
-
function MallDirectoryCard(props) {
|
|
99
|
-
const { data } = props;
|
|
100
|
-
return /* @__PURE__ */ jsx(CardFrame, { title: `${data.mallName} \xB7 \u697C\u5C42\u76EE\u5F55`, children: data.buildings.map((b) => /* @__PURE__ */ jsxs("div", { style: { marginBottom: 8 }, children: [
|
|
101
|
-
/* @__PURE__ */ jsx("div", { style: { fontSize: 14, fontWeight: 600, marginBottom: 4 }, children: b.buildingName }),
|
|
102
|
-
b.floors.map((f) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", padding: "3px 0" }, children: [
|
|
103
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 13 }, children: f.floorName }),
|
|
104
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "var(--tbox-text-secondary, #888)" }, children: f.businessCategories.join(" / ") || `${f.merchantCount} \u5BB6` })
|
|
105
|
-
] }, f.floorCode))
|
|
106
|
-
] }, b.buildingCode)) });
|
|
107
|
-
}
|
|
108
|
-
function NearbyMallListCard(props) {
|
|
109
|
-
const { data } = props;
|
|
110
|
-
if (data.malls.length === 0) return /* @__PURE__ */ jsx(CardFrame, { title: "\u9644\u8FD1\u5546\u573A", children: "\u6682\u65E0\u9644\u8FD1\u5546\u573A" });
|
|
111
|
-
return /* @__PURE__ */ jsx(CardFrame, { title: "\u9644\u8FD1\u5546\u573A", children: data.malls.map((m) => /* @__PURE__ */ jsxs("div", { style: itemStyle, children: [
|
|
112
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", gap: 8 }, children: [
|
|
113
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 14, fontWeight: 600 }, children: m.name }),
|
|
114
|
-
/* @__PURE__ */ jsx(StatusPill, { tone: m.status.code === "open" ? "success" : "neutral", text: m.status.label })
|
|
115
|
-
] }),
|
|
116
|
-
/* @__PURE__ */ jsx(ValueText, { label: "\u5730\u5740", value: m.address }),
|
|
117
|
-
m.distanceKm !== void 0 && /* @__PURE__ */ jsx(ValueText, { label: "\u8DDD\u79BB", value: `${m.distanceKm.toFixed(1)} km` })
|
|
118
|
-
] }, m.mallId)) });
|
|
119
|
-
}
|
|
120
|
-
function CustomerServiceFaqCard(props) {
|
|
121
|
-
const { data } = props;
|
|
122
|
-
if (data.faqs.length === 0) {
|
|
123
|
-
return /* @__PURE__ */ jsx(CardFrame, { title: "\u5BA2\u670DFAQ", children: data.noResultsReason ?? "\u672A\u627E\u5230\u76F8\u5173\u5E38\u89C1\u95EE\u9898" });
|
|
124
|
-
}
|
|
125
|
-
return /* @__PURE__ */ jsx(CardFrame, { title: "\u76F8\u5173\u5E38\u89C1\u95EE\u9898", children: data.faqs.map((f, i) => /* @__PURE__ */ jsxs("div", { style: itemStyle, children: [
|
|
126
|
-
/* @__PURE__ */ jsx("div", { style: { fontSize: 13, fontWeight: 600 }, children: f.question }),
|
|
127
|
-
/* @__PURE__ */ jsx("div", { style: { fontSize: 13, marginTop: 4 }, children: f.answer })
|
|
128
|
-
] }, i)) });
|
|
129
|
-
}
|
|
130
|
-
function HumanGuideListCard(props) {
|
|
131
|
-
const { data } = props;
|
|
132
|
-
return /* @__PURE__ */ jsx(CardFrame, { title: `${data.merchantName} \xB7 \u4EBA\u5DE5\u5BFC\u8D2D`, children: data.guides.length === 0 ? /* @__PURE__ */ jsx("div", { style: { fontSize: 13 }, children: "\u6682\u65E0\u5BFC\u8D2D\u5458\u4FE1\u606F" }) : data.guides.map((g) => /* @__PURE__ */ jsxs("div", { style: itemStyle, children: [
|
|
133
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", gap: 8 }, children: [
|
|
134
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 14, fontWeight: 600 }, children: g.name }),
|
|
135
|
-
/* @__PURE__ */ jsx(StatusPill, { tone: g.available ? "success" : "neutral", text: g.available ? "\u5728\u7EBF" : "\u79BB\u7EBF" })
|
|
136
|
-
] }),
|
|
137
|
-
g.title && /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "var(--tbox-text-secondary, #888)" }, children: g.title })
|
|
138
|
-
] }, g.guideId)) });
|
|
139
|
-
}
|
|
140
|
-
function LocationHandoffCard(props) {
|
|
141
|
-
const { data } = props;
|
|
142
|
-
return /* @__PURE__ */ jsxs(CardFrame, { title: `${data.merchantName} \xB7 \u4F4D\u7F6E`, children: [
|
|
143
|
-
/* @__PURE__ */ jsx(ValueText, { label: "\u4F4D\u7F6E", value: data.location.displayText }),
|
|
144
|
-
data.location.buildingName && /* @__PURE__ */ jsx(ValueText, { label: "\u697C\u680B", value: data.location.buildingName }),
|
|
145
|
-
data.location.floorName && /* @__PURE__ */ jsx(ValueText, { label: "\u697C\u5C42", value: data.location.floorName }),
|
|
146
|
-
data.location.unitName && /* @__PURE__ */ jsx(ValueText, { label: "\u94FA\u4F4D", value: data.location.unitName })
|
|
147
|
-
] });
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// src/client/index.ts
|
|
151
|
-
var cards = {
|
|
152
|
-
"product-list": ProductListCard,
|
|
153
|
-
"product-detail": ProductDetailCard,
|
|
154
|
-
"merchant-list": MerchantListCard,
|
|
155
|
-
"merchant-detail": MerchantDetailCard,
|
|
156
|
-
"category-list": CategoryListCard,
|
|
157
|
-
"product-comparison": ProductComparisonCard,
|
|
158
|
-
"mall-directory": MallDirectoryCard,
|
|
159
|
-
"nearby-mall-list": NearbyMallListCard,
|
|
160
|
-
"customer-service-faq": CustomerServiceFaqCard,
|
|
161
|
-
"human-guide-list": HumanGuideListCard,
|
|
162
|
-
"location-handoff": LocationHandoffCard
|
|
163
|
-
};
|
|
164
|
-
var clientModule = {
|
|
165
|
-
cards,
|
|
166
|
-
register(ctx) {
|
|
167
|
-
ctx.cards.registerMap(cards);
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export {
|
|
172
|
-
clientModule
|
|
173
|
-
};
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* module-shopping-guide 客户端卡片渲染(011 K1:11 卡)。
|
|
3
|
-
* 只消费 SDK 基元(CardFrame/ValueText/StatusPill,封顶 5 件)+ antd-mobile + `--tbox-*` tokens。
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { CardFrame, ValueText, StatusPill } from '@tbox.cn/app-sdk/client';
|
|
7
|
-
import type {
|
|
8
|
-
ProductListCardData,
|
|
9
|
-
ProductDetailCardData,
|
|
10
|
-
MerchantListCardData,
|
|
11
|
-
MerchantDetailCardData,
|
|
12
|
-
CategoryListCardData,
|
|
13
|
-
ProductComparisonCardData,
|
|
14
|
-
MallDirectoryCardData,
|
|
15
|
-
NearbyMallListCardData,
|
|
16
|
-
CustomerServiceFaqCardData,
|
|
17
|
-
HumanGuideListCardData,
|
|
18
|
-
LocationHandoffCardData,
|
|
19
|
-
} from '@tbox.cn/app-contracts-mall';
|
|
20
|
-
|
|
21
|
-
const listStyle: React.CSSProperties = { listStyle: 'none', margin: 0, padding: 0 };
|
|
22
|
-
const itemStyle: React.CSSProperties = {
|
|
23
|
-
padding: '8px 0',
|
|
24
|
-
borderBottom: '1px solid var(--tbox-divider, #f0f0f0)',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export function ProductListCard(props: { data: ProductListCardData }) {
|
|
28
|
-
const { data } = props;
|
|
29
|
-
if (data.items.length === 0) {
|
|
30
|
-
return <CardFrame title="商品列表">{data.noResultsReason ?? '暂无商品'}</CardFrame>;
|
|
31
|
-
}
|
|
32
|
-
return (
|
|
33
|
-
<CardFrame title="商品列表" subtitle={data.summary}>
|
|
34
|
-
<ul style={listStyle}>
|
|
35
|
-
{data.items.map((item) => (
|
|
36
|
-
<li key={item.productId} style={itemStyle}>
|
|
37
|
-
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 8 }}>
|
|
38
|
-
<span style={{ fontSize: 14, fontWeight: 600 }}>{item.name}</span>
|
|
39
|
-
<span style={{ fontSize: 14, color: 'var(--tbox-primary, #e93b3d)' }}>
|
|
40
|
-
{item.price.sale?.display ?? ''}
|
|
41
|
-
</span>
|
|
42
|
-
</div>
|
|
43
|
-
<div style={{ marginTop: 4, display: 'flex', gap: 6, alignItems: 'center', flexWrap: 'wrap' }}>
|
|
44
|
-
<StatusPill
|
|
45
|
-
tone={item.availability.marketable ? 'success' : 'neutral'}
|
|
46
|
-
text={item.availability.label}
|
|
47
|
-
/>
|
|
48
|
-
{item.badges.map((b) => (
|
|
49
|
-
<StatusPill key={b} tone="neutral" text={b} />
|
|
50
|
-
))}
|
|
51
|
-
</div>
|
|
52
|
-
<ValueText label="门店" value={`${item.merchant.name}${item.merchant.location ? ` · ${item.merchant.location.displayText}` : ''}`} />
|
|
53
|
-
</li>
|
|
54
|
-
))}
|
|
55
|
-
</ul>
|
|
56
|
-
</CardFrame>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function ProductDetailCard(props: { data: ProductDetailCardData }) {
|
|
61
|
-
const { data } = props;
|
|
62
|
-
return (
|
|
63
|
-
<CardFrame title={data.name} subtitle={data.brand}>
|
|
64
|
-
{data.imageUrls[0] && (
|
|
65
|
-
<img src={data.imageUrls[0]} alt={data.name} style={{ width: '100%', borderRadius: 8, marginBottom: 8 }} />
|
|
66
|
-
)}
|
|
67
|
-
<ValueText label="价格" value={data.price.sale?.display ?? '—'} />
|
|
68
|
-
<ValueText label="库存" value={data.availability.label} />
|
|
69
|
-
<ValueText
|
|
70
|
-
label="门店"
|
|
71
|
-
value={`${data.merchant.name}${data.merchant.location ? ` · ${data.merchant.location.displayText}` : ''}`}
|
|
72
|
-
/>
|
|
73
|
-
{data.attributes.map((a) => (
|
|
74
|
-
<ValueText key={a.name} label={a.name} value={a.value} />
|
|
75
|
-
))}
|
|
76
|
-
{data.promotionFacts.map((p) => (
|
|
77
|
-
<div key={p} style={{ fontSize: 12, color: 'var(--tbox-primary, #e93b3d)', marginTop: 4 }}>
|
|
78
|
-
{p}
|
|
79
|
-
</div>
|
|
80
|
-
))}
|
|
81
|
-
</CardFrame>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function MerchantListCard(props: { data: MerchantListCardData }) {
|
|
86
|
-
const { data } = props;
|
|
87
|
-
if (data.items.length === 0) {
|
|
88
|
-
return <CardFrame title="门店列表">{data.noResultsReason ?? '暂无门店'}</CardFrame>;
|
|
89
|
-
}
|
|
90
|
-
return (
|
|
91
|
-
<CardFrame title="门店列表" subtitle={data.summary}>
|
|
92
|
-
<ul style={listStyle}>
|
|
93
|
-
{data.items.map((item) => (
|
|
94
|
-
<li key={item.merchantId} style={itemStyle}>
|
|
95
|
-
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 8 }}>
|
|
96
|
-
<span style={{ fontSize: 14, fontWeight: 600 }}>{item.name}</span>
|
|
97
|
-
<StatusPill tone={item.status.code === 'enabled' ? 'success' : 'warning'} text={item.status.label} />
|
|
98
|
-
</div>
|
|
99
|
-
<ValueText label="位置" value={item.location.displayText} />
|
|
100
|
-
{item.promotionFacts.length > 0 && (
|
|
101
|
-
<div style={{ fontSize: 12, color: 'var(--tbox-primary, #e93b3d)' }}>
|
|
102
|
-
{item.promotionFacts.join(' · ')}
|
|
103
|
-
</div>
|
|
104
|
-
)}
|
|
105
|
-
</li>
|
|
106
|
-
))}
|
|
107
|
-
</ul>
|
|
108
|
-
</CardFrame>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function MerchantDetailCard(props: { data: MerchantDetailCardData }) {
|
|
113
|
-
const { data } = props;
|
|
114
|
-
return (
|
|
115
|
-
<CardFrame title={data.name} subtitle={data.brand}>
|
|
116
|
-
<StatusPill tone={data.status.code === 'enabled' ? 'success' : 'warning'} text={data.status.label} />
|
|
117
|
-
<ValueText label="位置" value={data.location.displayText} />
|
|
118
|
-
<ValueText label="业态" value={data.businessCategories.join(' / ')} />
|
|
119
|
-
{data.description && <div style={{ fontSize: 13, marginTop: 6 }}>{data.description}</div>}
|
|
120
|
-
{data.contactInfo?.map((c, i) => (
|
|
121
|
-
<ValueText key={i} label={c.channel} value={c.value} />
|
|
122
|
-
))}
|
|
123
|
-
{data.promotionFacts.map((p) => (
|
|
124
|
-
<div key={p} style={{ fontSize: 12, color: 'var(--tbox-primary, #e93b3d)', marginTop: 4 }}>
|
|
125
|
-
{p}
|
|
126
|
-
</div>
|
|
127
|
-
))}
|
|
128
|
-
</CardFrame>
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export function CategoryListCard(props: { data: CategoryListCardData }) {
|
|
133
|
-
const { data } = props;
|
|
134
|
-
return (
|
|
135
|
-
<CardFrame title="业态分类">
|
|
136
|
-
<ul style={listStyle}>
|
|
137
|
-
{data.categories.map((c) => (
|
|
138
|
-
<li key={c.code} style={itemStyle}>
|
|
139
|
-
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
140
|
-
<span style={{ fontSize: 14, fontWeight: 600 }}>{c.name}</span>
|
|
141
|
-
<span style={{ fontSize: 12, color: 'var(--tbox-text-secondary, #888)' }}>
|
|
142
|
-
{c.merchantCount} 家
|
|
143
|
-
</span>
|
|
144
|
-
</div>
|
|
145
|
-
{c.subCategories && c.subCategories.length > 0 && (
|
|
146
|
-
<div style={{ fontSize: 12, color: 'var(--tbox-text-secondary, #888)', marginTop: 2 }}>
|
|
147
|
-
{c.subCategories.map((s) => s.name).join(' / ')}
|
|
148
|
-
</div>
|
|
149
|
-
)}
|
|
150
|
-
</li>
|
|
151
|
-
))}
|
|
152
|
-
</ul>
|
|
153
|
-
</CardFrame>
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export function ProductComparisonCard(props: { data: ProductComparisonCardData }) {
|
|
158
|
-
const { data } = props;
|
|
159
|
-
return (
|
|
160
|
-
<CardFrame title="商品对比">
|
|
161
|
-
{data.products.map((p) => (
|
|
162
|
-
<div key={p.productId} style={itemStyle}>
|
|
163
|
-
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 8 }}>
|
|
164
|
-
<span style={{ fontSize: 14, fontWeight: 600 }}>{p.name}</span>
|
|
165
|
-
<span style={{ fontSize: 14, color: 'var(--tbox-primary, #e93b3d)' }}>
|
|
166
|
-
{p.price.sale?.display ?? '—'}
|
|
167
|
-
</span>
|
|
168
|
-
</div>
|
|
169
|
-
<ValueText label="库存" value={p.availability.label} />
|
|
170
|
-
{p.attributes.map((a) => (
|
|
171
|
-
<ValueText key={a.name} label={a.name} value={a.value} />
|
|
172
|
-
))}
|
|
173
|
-
</div>
|
|
174
|
-
))}
|
|
175
|
-
</CardFrame>
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export function MallDirectoryCard(props: { data: MallDirectoryCardData }) {
|
|
180
|
-
const { data } = props;
|
|
181
|
-
return (
|
|
182
|
-
<CardFrame title={`${data.mallName} · 楼层目录`}>
|
|
183
|
-
{data.buildings.map((b) => (
|
|
184
|
-
<div key={b.buildingCode} style={{ marginBottom: 8 }}>
|
|
185
|
-
<div style={{ fontSize: 14, fontWeight: 600, marginBottom: 4 }}>{b.buildingName}</div>
|
|
186
|
-
{b.floors.map((f) => (
|
|
187
|
-
<div key={f.floorCode} style={{ display: 'flex', justifyContent: 'space-between', padding: '3px 0' }}>
|
|
188
|
-
<span style={{ fontSize: 13 }}>{f.floorName}</span>
|
|
189
|
-
<span style={{ fontSize: 12, color: 'var(--tbox-text-secondary, #888)' }}>
|
|
190
|
-
{f.businessCategories.join(' / ') || `${f.merchantCount} 家`}
|
|
191
|
-
</span>
|
|
192
|
-
</div>
|
|
193
|
-
))}
|
|
194
|
-
</div>
|
|
195
|
-
))}
|
|
196
|
-
</CardFrame>
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export function NearbyMallListCard(props: { data: NearbyMallListCardData }) {
|
|
201
|
-
const { data } = props;
|
|
202
|
-
if (data.malls.length === 0) return <CardFrame title="附近商场">暂无附近商场</CardFrame>;
|
|
203
|
-
return (
|
|
204
|
-
<CardFrame title="附近商场">
|
|
205
|
-
{data.malls.map((m) => (
|
|
206
|
-
<div key={m.mallId} style={itemStyle}>
|
|
207
|
-
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 8 }}>
|
|
208
|
-
<span style={{ fontSize: 14, fontWeight: 600 }}>{m.name}</span>
|
|
209
|
-
<StatusPill tone={m.status.code === 'open' ? 'success' : 'neutral'} text={m.status.label} />
|
|
210
|
-
</div>
|
|
211
|
-
<ValueText label="地址" value={m.address} />
|
|
212
|
-
{m.distanceKm !== undefined && <ValueText label="距离" value={`${m.distanceKm.toFixed(1)} km`} />}
|
|
213
|
-
</div>
|
|
214
|
-
))}
|
|
215
|
-
</CardFrame>
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export function CustomerServiceFaqCard(props: { data: CustomerServiceFaqCardData }) {
|
|
220
|
-
const { data } = props;
|
|
221
|
-
if (data.faqs.length === 0) {
|
|
222
|
-
return <CardFrame title="客服FAQ">{data.noResultsReason ?? '未找到相关常见问题'}</CardFrame>;
|
|
223
|
-
}
|
|
224
|
-
return (
|
|
225
|
-
<CardFrame title="相关常见问题">
|
|
226
|
-
{data.faqs.map((f, i) => (
|
|
227
|
-
<div key={i} style={itemStyle}>
|
|
228
|
-
<div style={{ fontSize: 13, fontWeight: 600 }}>{f.question}</div>
|
|
229
|
-
<div style={{ fontSize: 13, marginTop: 4 }}>{f.answer}</div>
|
|
230
|
-
</div>
|
|
231
|
-
))}
|
|
232
|
-
</CardFrame>
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
export function HumanGuideListCard(props: { data: HumanGuideListCardData }) {
|
|
237
|
-
const { data } = props;
|
|
238
|
-
return (
|
|
239
|
-
<CardFrame title={`${data.merchantName} · 人工导购`}>
|
|
240
|
-
{data.guides.length === 0 ? (
|
|
241
|
-
<div style={{ fontSize: 13 }}>暂无导购员信息</div>
|
|
242
|
-
) : (
|
|
243
|
-
data.guides.map((g) => (
|
|
244
|
-
<div key={g.guideId} style={itemStyle}>
|
|
245
|
-
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 8 }}>
|
|
246
|
-
<span style={{ fontSize: 14, fontWeight: 600 }}>{g.name}</span>
|
|
247
|
-
<StatusPill tone={g.available ? 'success' : 'neutral'} text={g.available ? '在线' : '离线'} />
|
|
248
|
-
</div>
|
|
249
|
-
{g.title && <div style={{ fontSize: 12, color: 'var(--tbox-text-secondary, #888)' }}>{g.title}</div>}
|
|
250
|
-
</div>
|
|
251
|
-
))
|
|
252
|
-
)}
|
|
253
|
-
</CardFrame>
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
export function LocationHandoffCard(props: { data: LocationHandoffCardData }) {
|
|
258
|
-
const { data } = props;
|
|
259
|
-
return (
|
|
260
|
-
<CardFrame title={`${data.merchantName} · 位置`}>
|
|
261
|
-
<ValueText label="位置" value={data.location.displayText} />
|
|
262
|
-
{data.location.buildingName && <ValueText label="楼栋" value={data.location.buildingName} />}
|
|
263
|
-
{data.location.floorName && <ValueText label="楼层" value={data.location.floorName} />}
|
|
264
|
-
{data.location.unitName && <ValueText label="铺位" value={data.location.unitName} />}
|
|
265
|
-
</CardFrame>
|
|
266
|
-
);
|
|
267
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { CardMeta } from '@tbox.cn/app-contracts';
|
|
2
|
-
import { customerServiceFaqCardDataSchema } from '@tbox.cn/app-contracts-mall';
|
|
3
|
-
|
|
4
|
-
const meta: CardMeta<typeof customerServiceFaqCardDataSchema> = {
|
|
5
|
-
cardType: 'customer-service-faq',
|
|
6
|
-
dataSchema: customerServiceFaqCardDataSchema,
|
|
7
|
-
allowedTools: ['customer-service-faq'],
|
|
8
|
-
displayName: '客服FAQ',
|
|
9
|
-
description: '常见问题答案(退换货/积分/停车政策)',
|
|
10
|
-
sampleData: {
|
|
11
|
-
query: '如何退换货',
|
|
12
|
-
faqs: [{ question: '如何退换货', answer: '凭小票 7 天内可退换。', relevanceScore: 0.9 }],
|
|
13
|
-
},
|
|
14
|
-
priority: 100,
|
|
15
|
-
schemaVersion: 1,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default meta;
|