Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fa0d928980 | |||
| c8ea5a3119 | |||
| 6f427cb553 | |||
| 89fd333702 | |||
| ab10431001 | |||
| e93e4b8f84 | |||
| d90847bad0 | |||
| ffa753707b | |||
| ac2f9f4793 | |||
| 3ba7b179e8 | |||
| 4e7079c221 | |||
| 3c19b7dd97 |
@@ -32,6 +32,7 @@
|
|||||||
| REQ-U-024 | 推广码 | 扫码归因;现场提货有码归码 |
|
| REQ-U-024 | 推广码 | 扫码归因;现场提货有码归码 |
|
||||||
| REQ-U-025 | 分享 | 微信商品分享+渠道参数 |
|
| REQ-U-025 | 分享 | 微信商品分享+渠道参数 |
|
||||||
| REQ-U-026 | 门店规则 | 附件一完整展示 |
|
| REQ-U-026 | 门店规则 | 附件一完整展示 |
|
||||||
|
| REQ-U-027 | 门店套餐 **3.4.10** | 门店详情展示生效套餐;套餐异议申诉入口 |
|
||||||
|
|
||||||
## 门店端 REQ-S
|
## 门店端 REQ-S
|
||||||
|
|
||||||
@@ -58,6 +59,7 @@
|
|||||||
| REQ-S-018 | 权限 | §4.6 矩阵 |
|
| REQ-S-018 | 权限 | §4.6 矩阵 |
|
||||||
| REQ-S-019 | 多店选店 | 记住上次所选 |
|
| REQ-S-019 | 多店选店 | 记住上次所选 |
|
||||||
| REQ-S-020 | 待处理核销 | Wave 3 弱网单 |
|
| REQ-S-020 | 待处理核销 | Wave 3 弱网单 |
|
||||||
|
| REQ-S-021 | 门店套餐 **3.4.10** | 套餐列表/编辑/提审 |
|
||||||
|
|
||||||
## 合伙人端 REQ-P
|
## 合伙人端 REQ-P
|
||||||
|
|
||||||
@@ -89,6 +91,7 @@
|
|||||||
| REQ-P-024 | 负责人复核 | 待复核→待总部审 |
|
| REQ-P-024 | 负责人复核 | 待复核→待总部审 |
|
||||||
| REQ-P-025 | 合同同日 | 同日提交校验 |
|
| REQ-P-025 | 合同同日 | 同日提交校验 |
|
||||||
| REQ-P-026 | 我的仓库 | Wave 3 管仓只读 |
|
| REQ-P-026 | 我的仓库 | Wave 3 管仓只读 |
|
||||||
|
| REQ-P-027 | 门店套餐 **3.4.10** | 拓店套餐页;门店套餐列表/编辑/提审 |
|
||||||
|
|
||||||
## 总部端 REQ-H
|
## 总部端 REQ-H
|
||||||
|
|
||||||
@@ -122,3 +125,4 @@
|
|||||||
| REQ-H-022 | 签约主体 | 山西领势酒业 |
|
| REQ-H-022 | 签约主体 | 山西领势酒业 |
|
||||||
| REQ-H-023 | 热力图 | 腾讯位置服务 |
|
| REQ-H-023 | 热力图 | 腾讯位置服务 |
|
||||||
| REQ-H-024 | 结算异议 | 门店 3 日异议处理 |
|
| REQ-H-024 | 结算异议 | 门店 3 日异议处理 |
|
||||||
|
| REQ-H-025 | 门店套餐 **3.4.10** | 门店详情套餐 Tab 直存;套餐变更审核通过/驳回 |
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ node scripts/smoke-prev1.mjs
|
|||||||
pnpm lint && pnpm test
|
pnpm lint && pnpm test
|
||||||
```
|
```
|
||||||
|
|
||||||
Mock 验证码:`123456`。测试账号见 [`README.md`](./README.md)。
|
Mock 验证码:`999888`。测试账号见 [`README.md`](./README.md)。
|
||||||
|
|
||||||
> **端口冲突**:`h5-partner` 与 `admin-web` 同为 5175,勿同时 `dev:partner` + `dev:admin`。
|
> **端口冲突**:`h5-partner` 与 `admin-web` 同为 5175,勿同时 `dev:partner` + `dev:admin`。
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import LoginPage from './pages/LoginPage';
|
|||||||
import DashboardPage from './pages/DashboardPage';
|
import DashboardPage from './pages/DashboardPage';
|
||||||
import UsersPage from './pages/UsersPage';
|
import UsersPage from './pages/UsersPage';
|
||||||
import OrdersPage from './pages/OrdersPage';
|
import OrdersPage from './pages/OrdersPage';
|
||||||
|
import StorePackageAuditsPage from './pages/StorePackageAuditsPage';
|
||||||
import StoresPage from './pages/StoresPage';
|
import StoresPage from './pages/StoresPage';
|
||||||
import StoreRatingsPage from './pages/StoreRatingsPage';
|
import StoreRatingsPage from './pages/StoreRatingsPage';
|
||||||
import StoreAccountsPage from './pages/StoreAccountsPage';
|
import StoreAccountsPage from './pages/StoreAccountsPage';
|
||||||
@@ -37,6 +38,7 @@ import TicketsPage from './pages/TicketsPage';
|
|||||||
import SupportTicketsPage from './pages/SupportTicketsPage';
|
import SupportTicketsPage from './pages/SupportTicketsPage';
|
||||||
import InvoicesPage from './pages/InvoicesPage';
|
import InvoicesPage from './pages/InvoicesPage';
|
||||||
import UserLogsPage from './pages/UserLogsPage';
|
import UserLogsPage from './pages/UserLogsPage';
|
||||||
|
import DomainEventsPage from './pages/DomainEventsPage';
|
||||||
import HqLogsPage from './pages/HqLogsPage';
|
import HqLogsPage from './pages/HqLogsPage';
|
||||||
import ThirdPartyLogsPage from './pages/ThirdPartyLogsPage';
|
import ThirdPartyLogsPage from './pages/ThirdPartyLogsPage';
|
||||||
import StoreLogsPage from './pages/StoreLogsPage';
|
import StoreLogsPage from './pages/StoreLogsPage';
|
||||||
@@ -79,6 +81,7 @@ export default function App() {
|
|||||||
<Route path="/products" element={<ProductsPage />} />
|
<Route path="/products" element={<ProductsPage />} />
|
||||||
<Route path="/product-detail-templates" element={<ProductDetailTemplatesPage />} />
|
<Route path="/product-detail-templates" element={<ProductDetailTemplatesPage />} />
|
||||||
<Route path="/stores" element={<StoresPage />} />
|
<Route path="/stores" element={<StoresPage />} />
|
||||||
|
<Route path="/store-package-audits" element={<StorePackageAuditsPage />} />
|
||||||
<Route path="/store-ratings" element={<StoreRatingsPage />} />
|
<Route path="/store-ratings" element={<StoreRatingsPage />} />
|
||||||
<Route path="/store-categories" element={<StoreCategoriesPage />} />
|
<Route path="/store-categories" element={<StoreCategoriesPage />} />
|
||||||
<Route path="/store-accounts" element={<StoreAccountsPage />} />
|
<Route path="/store-accounts" element={<StoreAccountsPage />} />
|
||||||
@@ -118,6 +121,7 @@ export default function App() {
|
|||||||
<Route path="/logs/partners" element={<PartnerLogsPage />} />
|
<Route path="/logs/partners" element={<PartnerLogsPage />} />
|
||||||
<Route path="/logs/hq" element={<HqLogsPage />} />
|
<Route path="/logs/hq" element={<HqLogsPage />} />
|
||||||
<Route path="/logs/third-party" element={<ThirdPartyLogsPage />} />
|
<Route path="/logs/third-party" element={<ThirdPartyLogsPage />} />
|
||||||
|
<Route path="/logs/domain-events" element={<DomainEventsPage />} />
|
||||||
<Route path="/deliveries" element={<DeliveriesPage />} />
|
<Route path="/deliveries" element={<DeliveriesPage />} />
|
||||||
<Route path="/deliveries/xiaofeixia" element={<XiaofeixiaTestPage />} />
|
<Route path="/deliveries/xiaofeixia" element={<XiaofeixiaTestPage />} />
|
||||||
<Route path="/hq-permissions" element={<HqPermissionsPage />} />
|
<Route path="/hq-permissions" element={<HqPermissionsPage />} />
|
||||||
|
|||||||
@@ -0,0 +1,217 @@
|
|||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { Alert, Button, Form, Input, InputNumber, Space, Typography, message } from 'antd';
|
||||||
|
import { DownOutlined, UpOutlined } from '@ant-design/icons';
|
||||||
|
import type { StorePackageItemDto } from '@dukang/shared-types';
|
||||||
|
import { STORE_PACKAGE_MAX_COUNT } from '@dukang/shared-types';
|
||||||
|
import { request } from '../lib/api';
|
||||||
|
|
||||||
|
type PackageRow = StorePackageItemDto;
|
||||||
|
|
||||||
|
function emptyRow(index = 0): PackageRow {
|
||||||
|
return { name: '', price: '0', dishes: '', usableTime: '', otherNotes: '', sortOrder: index };
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function AdminStorePackagesSection({ storeId }: { storeId: string }) {
|
||||||
|
const [items, setItems] = useState<PackageRow[]>([emptyRow()]);
|
||||||
|
const [collapsed, setCollapsed] = useState<Record<number, boolean>>({});
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [saving, setSaving] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setLoading(true);
|
||||||
|
request<{ live: PackageRow[] }>(`/admin/stores/${storeId}/packages`)
|
||||||
|
.then((data) => {
|
||||||
|
setItems(
|
||||||
|
data.live?.length
|
||||||
|
? data.live.map((p, i) => ({ ...p, price: String(p.price), sortOrder: i }))
|
||||||
|
: [emptyRow()],
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.catch((e) => message.error(e instanceof Error ? e.message : '加载套餐失败'))
|
||||||
|
.finally(() => setLoading(false));
|
||||||
|
}, [storeId]);
|
||||||
|
|
||||||
|
function updateAt(index: number, patch: Partial<PackageRow>) {
|
||||||
|
setItems((prev) => prev.map((item, i) => (i === index ? { ...item, ...patch } : item)));
|
||||||
|
}
|
||||||
|
|
||||||
|
function addRow() {
|
||||||
|
if (items.length >= STORE_PACKAGE_MAX_COUNT) return;
|
||||||
|
setItems((prev) => [...prev, emptyRow(prev.length)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeAt(index: number) {
|
||||||
|
setItems((prev) => prev.filter((_, i) => i !== index).map((item, i) => ({ ...item, sortOrder: i })));
|
||||||
|
setCollapsed((prev) => {
|
||||||
|
const next: Record<number, boolean> = {};
|
||||||
|
Object.entries(prev).forEach(([k, v]) => {
|
||||||
|
const i = Number(k);
|
||||||
|
if (i < index) next[i] = v;
|
||||||
|
else if (i > index) next[i - 1] = v;
|
||||||
|
});
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleCollapse(index: number) {
|
||||||
|
setCollapsed((prev) => ({ ...prev, [index]: !prev[index] }));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
const filled = items
|
||||||
|
.map((item, index) => ({
|
||||||
|
name: item.name.trim(),
|
||||||
|
price: item.price.trim(),
|
||||||
|
dishes: item.dishes.trim(),
|
||||||
|
usableTime: item.usableTime?.trim() || null,
|
||||||
|
otherNotes: item.otherNotes?.trim() || null,
|
||||||
|
sortOrder: index,
|
||||||
|
}))
|
||||||
|
.filter((item) => item.name || item.dishes || item.price);
|
||||||
|
|
||||||
|
for (let i = 0; i < filled.length; i++) {
|
||||||
|
const item = filled[i];
|
||||||
|
if (!item.name) {
|
||||||
|
message.warning(`第 ${i + 1} 条套餐名称不能为空`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!item.dishes) {
|
||||||
|
message.warning(`第 ${i + 1} 条套餐菜品不能为空`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const price = Number(item.price);
|
||||||
|
if (!Number.isFinite(price) || price < 0) {
|
||||||
|
message.warning(`第 ${i + 1} 条套餐价格须为非负数字`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setSaving(true);
|
||||||
|
try {
|
||||||
|
await request(`/admin/stores/${storeId}/packages`, {
|
||||||
|
method: 'PUT',
|
||||||
|
body: JSON.stringify({
|
||||||
|
packages: filled.map((p) => ({ ...p, price: Number(p.price).toFixed(2) })),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
message.success('套餐已保存并生效');
|
||||||
|
} catch (e) {
|
||||||
|
message.error(e instanceof Error ? e.message : '保存失败');
|
||||||
|
} finally {
|
||||||
|
setSaving(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <Typography.Text type="secondary">加载套餐中…</Typography.Text>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Form layout="vertical" requiredMark={false}>
|
||||||
|
<Alert
|
||||||
|
type="info"
|
||||||
|
showIcon
|
||||||
|
style={{ marginBottom: 16 }}
|
||||||
|
message={`总部直存立即生效,无需审核。同一门店最多 ${STORE_PACKAGE_MAX_COUNT} 条套餐。`}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{items.map((item, index) => {
|
||||||
|
const isCollapsed = !!collapsed[index];
|
||||||
|
const displayName = item.name.trim() || `套餐 ${index + 1}`;
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={index}
|
||||||
|
style={{
|
||||||
|
marginBottom: 16,
|
||||||
|
padding: 16,
|
||||||
|
border: '1px solid #f0f0f0',
|
||||||
|
borderRadius: 8,
|
||||||
|
background: '#fafafa',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Space style={{ width: '100%', justifyContent: 'space-between', marginBottom: isCollapsed ? 0 : 12 }}>
|
||||||
|
<Button
|
||||||
|
type="text"
|
||||||
|
icon={isCollapsed ? <DownOutlined /> : <UpOutlined />}
|
||||||
|
onClick={() => toggleCollapse(index)}
|
||||||
|
style={{ paddingLeft: 0, height: 'auto' }}
|
||||||
|
>
|
||||||
|
<Typography.Title level={5} style={{ margin: 0 }}>
|
||||||
|
{displayName}
|
||||||
|
</Typography.Title>
|
||||||
|
</Button>
|
||||||
|
{items.length > 1 ? (
|
||||||
|
<Button type="link" danger onClick={() => removeAt(index)}>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
|
</Space>
|
||||||
|
|
||||||
|
{!isCollapsed ? (
|
||||||
|
<>
|
||||||
|
<Form.Item label="套餐名称" required style={{ marginBottom: 12 }}>
|
||||||
|
<Input
|
||||||
|
placeholder="如:套餐A"
|
||||||
|
value={item.name}
|
||||||
|
onChange={(e) => updateAt(index, { name: e.target.value })}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item label="价格(元)" required style={{ marginBottom: 12 }}>
|
||||||
|
<InputNumber
|
||||||
|
min={0}
|
||||||
|
precision={2}
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
addonAfter="元"
|
||||||
|
placeholder="198"
|
||||||
|
value={item.price === '' ? undefined : Number(item.price)}
|
||||||
|
onChange={(v) => updateAt(index, { price: v != null ? String(v) : '' })}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item label="菜品" required style={{ marginBottom: 12 }}>
|
||||||
|
<Input.TextArea
|
||||||
|
rows={2}
|
||||||
|
placeholder="红烧肉、红烧鱼、油焖茄子"
|
||||||
|
value={item.dishes}
|
||||||
|
onChange={(e) => updateAt(index, { dishes: e.target.value })}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item label="使用时间" style={{ marginBottom: 12 }}>
|
||||||
|
<Input
|
||||||
|
placeholder="节假日除外"
|
||||||
|
value={item.usableTime || ''}
|
||||||
|
onChange={(e) => updateAt(index, { usableTime: e.target.value })}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item label="其他说明" style={{ marginBottom: 0 }}>
|
||||||
|
<Input
|
||||||
|
placeholder="不可叠加"
|
||||||
|
value={item.otherNotes || ''}
|
||||||
|
onChange={(e) => updateAt(index, { otherNotes: e.target.value })}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
|
||||||
|
{items.length < STORE_PACKAGE_MAX_COUNT ? (
|
||||||
|
<Button onClick={addRow} style={{ marginBottom: 16 }}>
|
||||||
|
添加套餐
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<Typography.Paragraph type="secondary" style={{ marginBottom: 12 }}>
|
||||||
|
修改后点击下方按钮保存,C 端将立即展示生效套餐。
|
||||||
|
</Typography.Paragraph>
|
||||||
|
|
||||||
|
<Button type="primary" loading={saving} onClick={() => void save()}>
|
||||||
|
保存套餐
|
||||||
|
</Button>
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -51,6 +51,7 @@ const MENU_ITEMS: MenuProps['items'] = [
|
|||||||
label: '门店',
|
label: '门店',
|
||||||
children: [
|
children: [
|
||||||
{ key: '/stores', label: '门店列表' },
|
{ key: '/stores', label: '门店列表' },
|
||||||
|
{ key: '/store-package-audits', label: '套餐审核' },
|
||||||
{ key: '/store-ratings', label: '门店评价' },
|
{ key: '/store-ratings', label: '门店评价' },
|
||||||
{ key: '/store-categories', label: '门店分类' },
|
{ key: '/store-categories', label: '门店分类' },
|
||||||
{ key: '/store-accounts', label: '门店账户' },
|
{ key: '/store-accounts', label: '门店账户' },
|
||||||
@@ -121,6 +122,7 @@ const MENU_ITEMS: MenuProps['items'] = [
|
|||||||
{ key: '/logs/partners', label: '合伙人日志' },
|
{ key: '/logs/partners', label: '合伙人日志' },
|
||||||
{ key: '/logs/hq', label: 'HQ 操作日志' },
|
{ key: '/logs/hq', label: 'HQ 操作日志' },
|
||||||
{ key: '/logs/third-party', label: '第三方日志' },
|
{ key: '/logs/third-party', label: '第三方日志' },
|
||||||
|
{ key: '/logs/domain-events', label: '领域事件' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ key: '/hq-permissions', icon: <LockOutlined />, label: '权限分配' },
|
{ key: '/hq-permissions', icon: <LockOutlined />, label: '权限分配' },
|
||||||
@@ -146,6 +148,7 @@ function menuAllowed(key: string, permissionKeys: string[]): boolean {
|
|||||||
'/knowledge-bases': 'knowledge_bases',
|
'/knowledge-bases': 'knowledge_bases',
|
||||||
'stores-group': 'stores',
|
'stores-group': 'stores',
|
||||||
'/stores': 'stores',
|
'/stores': 'stores',
|
||||||
|
'/store-package-audits': 'stores',
|
||||||
'/store-ratings': 'stores',
|
'/store-ratings': 'stores',
|
||||||
'/store-categories': 'stores',
|
'/store-categories': 'stores',
|
||||||
'/store-accounts': 'stores',
|
'/store-accounts': 'stores',
|
||||||
@@ -180,6 +183,7 @@ function menuAllowed(key: string, permissionKeys: string[]): boolean {
|
|||||||
'/logs/partners': 'logs',
|
'/logs/partners': 'logs',
|
||||||
'/logs/hq': 'logs',
|
'/logs/hq': 'logs',
|
||||||
'/logs/third-party': 'logs',
|
'/logs/third-party': 'logs',
|
||||||
|
'/logs/domain-events': 'logs',
|
||||||
'/hq-permissions': 'hq_permissions',
|
'/hq-permissions': 'hq_permissions',
|
||||||
'/system-settings': 'system_settings_any',
|
'/system-settings': 'system_settings_any',
|
||||||
'/hq-accounts': 'hq_accounts',
|
'/hq-accounts': 'hq_accounts',
|
||||||
|
|||||||
@@ -1,45 +1,12 @@
|
|||||||
export type UserLogCategory =
|
export {
|
||||||
| 'login'
|
USER_LOG_CATEGORY_OPTIONS,
|
||||||
| 'browse_product'
|
resolveUserLogCategory,
|
||||||
| 'order'
|
eventNamesForUserLogCategory,
|
||||||
| 'pay'
|
type UserLogCategory,
|
||||||
| 'wechat_auth'
|
} from '@dukang/shared-types';
|
||||||
| 'browse_store'
|
|
||||||
| 'redeem'
|
|
||||||
| 'profile';
|
|
||||||
|
|
||||||
const USER_LOG_EVENT_CATEGORIES: Record<UserLogCategory, readonly string[]> = {
|
import { USER_LOG_CATEGORY_OPTIONS } from '@dukang/shared-types';
|
||||||
login: ['login_success', 'sms_login', 'sms_send', 'sms_verify_fail'],
|
|
||||||
browse_product: ['home_view', 'product_click', 'product_detail_view'],
|
|
||||||
order: ['order_confirm_view', 'order_submit'],
|
|
||||||
pay: ['pay_success', 'pay_fail'],
|
|
||||||
wechat_auth: ['wechat_login', 'wechat_phone', 'wechat_location', 'wechat_album'],
|
|
||||||
browse_store: ['store_list_view', 'store_detail_view'],
|
|
||||||
redeem: ['benefit_redeem_start', 'benefit_redeem_success'],
|
|
||||||
profile: ['profile_update', 'bind_phone'],
|
|
||||||
};
|
|
||||||
|
|
||||||
export const USER_LOG_CATEGORY_OPTIONS: Array<{ value: UserLogCategory | ''; label: string }> = [
|
export const USER_LOG_CATEGORY_LABELS: Record<string, string> = Object.fromEntries(
|
||||||
{ value: '', label: '全部' },
|
|
||||||
{ value: 'login', label: '登录' },
|
|
||||||
{ value: 'browse_product', label: '浏览商品' },
|
|
||||||
{ value: 'order', label: '下单' },
|
|
||||||
{ value: 'pay', label: '支付' },
|
|
||||||
{ value: 'wechat_auth', label: '微信授权' },
|
|
||||||
{ value: 'browse_store', label: '浏览门店' },
|
|
||||||
{ value: 'redeem', label: '核销' },
|
|
||||||
{ value: 'profile', label: '信息修改' },
|
|
||||||
];
|
|
||||||
|
|
||||||
export function resolveUserLogCategory(eventName: string): UserLogCategory | null {
|
|
||||||
for (const [category, events] of Object.entries(USER_LOG_EVENT_CATEGORIES) as Array<
|
|
||||||
[UserLogCategory, readonly string[]]
|
|
||||||
>) {
|
|
||||||
if (events.includes(eventName)) return category;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const USER_LOG_CATEGORY_LABELS = Object.fromEntries(
|
|
||||||
USER_LOG_CATEGORY_OPTIONS.filter((o) => o.value).map((o) => [o.value, o.label]),
|
USER_LOG_CATEGORY_OPTIONS.filter((o) => o.value).map((o) => [o.value, o.label]),
|
||||||
) as Record<string, string>;
|
);
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
|
import { useSearchParams } from 'react-router-dom';
|
||||||
|
import { Card, Descriptions, Drawer, Select, Space, Table, Tag } from 'antd';
|
||||||
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
|
import { request } from '../lib/api';
|
||||||
|
import { fmtTime } from '../lib/constants';
|
||||||
|
|
||||||
|
type Row = {
|
||||||
|
id: string;
|
||||||
|
eventType: string;
|
||||||
|
refType: string;
|
||||||
|
refId: string;
|
||||||
|
status?: string | null;
|
||||||
|
param1?: string | null;
|
||||||
|
param2?: string | null;
|
||||||
|
param3?: string | null;
|
||||||
|
remark?: string | null;
|
||||||
|
createdAt: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const EVENT_OPTIONS = [
|
||||||
|
{ value: '', label: '全部领域事件' },
|
||||||
|
{ value: 'ORDER_STATUS', label: '订单状态' },
|
||||||
|
{ value: 'BENEFIT_LEDGER', label: '权益流水' },
|
||||||
|
{ value: 'STORE_AUDIT', label: '门店审核' },
|
||||||
|
{ value: 'TICKET_COLLAB', label: '工单协作' },
|
||||||
|
{ value: 'PROMO_TOUCH', label: '推广触达' },
|
||||||
|
];
|
||||||
|
|
||||||
|
export default function DomainEventsPage() {
|
||||||
|
const [params, setParams] = useSearchParams();
|
||||||
|
const eventType = params.get('eventType') ?? '';
|
||||||
|
const refType = params.get('refType') ?? '';
|
||||||
|
const refId = params.get('refId') ?? '';
|
||||||
|
const [data, setData] = useState<{ items: Row[]; total: number; page: number; pageSize: number } | null>(null);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [detail, setDetail] = useState<Row | null>(null);
|
||||||
|
|
||||||
|
const load = useCallback(() => {
|
||||||
|
setLoading(true);
|
||||||
|
const q = new URLSearchParams();
|
||||||
|
if (eventType) q.set('eventType', eventType);
|
||||||
|
if (refType) q.set('refType', refType);
|
||||||
|
if (refId) q.set('refId', refId);
|
||||||
|
q.set('page', params.get('page') ?? '1');
|
||||||
|
q.set('pageSize', '20');
|
||||||
|
request<{ items: Row[]; total: number; page: number; pageSize: number }>(
|
||||||
|
`/admin/logs/domain-events?${q.toString()}`,
|
||||||
|
)
|
||||||
|
.then(setData)
|
||||||
|
.finally(() => setLoading(false));
|
||||||
|
}, [eventType, refType, refId, params]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
load();
|
||||||
|
}, [load]);
|
||||||
|
|
||||||
|
const columns: ColumnsType<Row> = [
|
||||||
|
{ title: '时间', dataIndex: 'createdAt', width: 170, render: (v) => fmtTime(v) },
|
||||||
|
{ title: '类型', dataIndex: 'eventType', width: 130, render: (v) => <Tag>{v}</Tag> },
|
||||||
|
{ title: '关联', render: (_, r) => `${r.refType} #${r.refId}` },
|
||||||
|
{ title: '状态', dataIndex: 'status', width: 100 },
|
||||||
|
{ title: '摘要', render: (_, r) => r.param1 || r.remark || '—' },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: 80,
|
||||||
|
render: (_, r) => (
|
||||||
|
<a
|
||||||
|
onClick={async () => {
|
||||||
|
setDetail(await request<Row>(`/admin/logs/domain-events/${r.id}`));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
详情
|
||||||
|
</a>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card title="领域事件">
|
||||||
|
<Space wrap style={{ marginBottom: 16 }}>
|
||||||
|
<Select
|
||||||
|
style={{ width: 180 }}
|
||||||
|
value={eventType}
|
||||||
|
options={EVENT_OPTIONS}
|
||||||
|
onChange={(v) => {
|
||||||
|
const next = new URLSearchParams(params);
|
||||||
|
if (v) next.set('eventType', v);
|
||||||
|
else next.delete('eventType');
|
||||||
|
next.set('page', '1');
|
||||||
|
setParams(next);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
<Table
|
||||||
|
rowKey="id"
|
||||||
|
loading={loading}
|
||||||
|
columns={columns}
|
||||||
|
dataSource={data?.items ?? []}
|
||||||
|
pagination={{
|
||||||
|
current: data?.page ?? 1,
|
||||||
|
pageSize: data?.pageSize ?? 20,
|
||||||
|
total: data?.total ?? 0,
|
||||||
|
onChange: (p) => {
|
||||||
|
const next = new URLSearchParams(params);
|
||||||
|
next.set('page', String(p));
|
||||||
|
setParams(next);
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Drawer open={!!detail} title="事件详情" width={520} onClose={() => setDetail(null)}>
|
||||||
|
{detail && (
|
||||||
|
<Descriptions column={1} size="small">
|
||||||
|
<Descriptions.Item label="ID">{detail.id}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="类型">{detail.eventType}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="关联">{`${detail.refType} #${detail.refId}`}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="param1">{detail.param1}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="param2">{detail.param2}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="param3">{detail.param3}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="备注">{detail.remark}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="时间">{fmtTime(detail.createdAt)}</Descriptions.Item>
|
||||||
|
</Descriptions>
|
||||||
|
)}
|
||||||
|
</Drawer>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { Button, Card, Form, Input, Tabs, message, Typography } from 'antd';
|
import { Button, Card, Form, Input, Tabs, message, Typography } from 'antd';
|
||||||
|
import { MOCK_SMS_FIXED_CODE } from '@dukang/shared-types';
|
||||||
import { saveAuth, request } from '../lib/api';
|
import { saveAuth, request } from '../lib/api';
|
||||||
|
|
||||||
type LoginResult = { accessToken: string; refreshToken: string };
|
type LoginResult = { accessToken: string; refreshToken: string };
|
||||||
@@ -117,14 +118,14 @@ export default function LoginPage() {
|
|||||||
form={smsForm}
|
form={smsForm}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
onFinish={onSmsFinish}
|
onFinish={onSmsFinish}
|
||||||
initialValues={{ phone: '13600000001', code: '123456' }}
|
initialValues={{ phone: '13600000001', code: MOCK_SMS_FIXED_CODE }}
|
||||||
>
|
>
|
||||||
<Form.Item name="phone" label="手机号" rules={[{ required: true, message: '请输入手机号' }]}>
|
<Form.Item name="phone" label="手机号" rules={[{ required: true, message: '请输入手机号' }]}>
|
||||||
<Input placeholder="13600000001" maxLength={11} />
|
<Input placeholder="13600000001" maxLength={11} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="code" label="验证码" rules={[{ required: true, message: '请输入验证码' }]}>
|
<Form.Item name="code" label="验证码" rules={[{ required: true, message: '请输入验证码' }]}>
|
||||||
<Input
|
<Input
|
||||||
placeholder="123456"
|
placeholder={MOCK_SMS_FIXED_CODE}
|
||||||
addonAfter={
|
addonAfter={
|
||||||
<Button type="link" size="small" disabled={codeCooldown > 0} onClick={() => void sendCode()}>
|
<Button type="link" size="small" disabled={codeCooldown > 0} onClick={() => void sendCode()}>
|
||||||
{codeCooldown > 0 ? `${codeCooldown}s` : '获取验证码'}
|
{codeCooldown > 0 ? `${codeCooldown}s` : '获取验证码'}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useState } from 'react';
|
|||||||
import {
|
import {
|
||||||
Button, Card, Col, Form, Input, InputNumber, Row, Space, Tabs, Typography, message,
|
Button, Card, Col, Form, Input, InputNumber, Row, Space, Tabs, Typography, message,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
|
import { MOCK_SMS_FIXED_CODE } from '@dukang/shared-types';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
|
|
||||||
type ApiResult = Record<string, unknown>;
|
type ApiResult = Record<string, unknown>;
|
||||||
@@ -255,7 +256,7 @@ export default function RedeemDebugPage() {
|
|||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="code" label="验证码" rules={[{ required: true }]}>
|
<Form.Item name="code" label="验证码" rules={[{ required: true }]}>
|
||||||
<Input placeholder="Mock 默认 123456" />
|
<Input placeholder={`Mock 默认 ${MOCK_SMS_FIXED_CODE}`} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button
|
<Button
|
||||||
loading={loading}
|
loading={loading}
|
||||||
@@ -335,7 +336,7 @@ export default function RedeemDebugPage() {
|
|||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="code" label="核销确认验证码" rules={[{ required: true }]}>
|
<Form.Item name="code" label="核销确认验证码" rules={[{ required: true }]}>
|
||||||
<Input placeholder="Mock 默认 123456" />
|
<Input placeholder={`Mock 默认 ${MOCK_SMS_FIXED_CODE}`} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|||||||
@@ -0,0 +1,331 @@
|
|||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Drawer,
|
||||||
|
Input,
|
||||||
|
Modal,
|
||||||
|
Space,
|
||||||
|
Table,
|
||||||
|
Tag,
|
||||||
|
Typography,
|
||||||
|
message,
|
||||||
|
} from 'antd';
|
||||||
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
|
import type {
|
||||||
|
StorePackageAuditDetailDto,
|
||||||
|
StorePackageChangeRequestDto,
|
||||||
|
StorePackageItemDto,
|
||||||
|
StorePackageViewDto,
|
||||||
|
} from '@dukang/shared-types';
|
||||||
|
import { STORE_PACKAGE_CHANGE_STATUS_LABELS } from '@dukang/shared-types';
|
||||||
|
import { request, type Paginated } from '../lib/api';
|
||||||
|
import { fmtTime } from '../lib/constants';
|
||||||
|
|
||||||
|
function packageKey(pkg: StorePackageItemDto | StorePackageViewDto, index: number) {
|
||||||
|
const name = String(pkg.name ?? '').trim();
|
||||||
|
return name ? `name:${name}` : `idx:${index}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function diffPackages(live: StorePackageViewDto[], proposed: StorePackageItemDto[]) {
|
||||||
|
const liveMap = new Map(live.map((p, i) => [packageKey(p, i), p]));
|
||||||
|
const proposedMap = new Map(proposed.map((p, i) => [packageKey(p, i), p]));
|
||||||
|
const keys = new Set([...liveMap.keys(), ...proposedMap.keys()]);
|
||||||
|
const rows: Array<{
|
||||||
|
key: string;
|
||||||
|
change: 'added' | 'removed' | 'changed' | 'unchanged';
|
||||||
|
live?: StorePackageViewDto;
|
||||||
|
proposed?: StorePackageItemDto;
|
||||||
|
}> = [];
|
||||||
|
|
||||||
|
for (const key of keys) {
|
||||||
|
const l = liveMap.get(key);
|
||||||
|
const p = proposedMap.get(key);
|
||||||
|
if (l && !p) {
|
||||||
|
rows.push({ key, change: 'removed', live: l });
|
||||||
|
} else if (!l && p) {
|
||||||
|
rows.push({ key, change: 'added', proposed: p });
|
||||||
|
} else if (l && p) {
|
||||||
|
const changed =
|
||||||
|
l.price !== p.price ||
|
||||||
|
l.dishes !== p.dishes ||
|
||||||
|
(l.usableTime ?? '') !== (p.usableTime ?? '') ||
|
||||||
|
(l.otherNotes ?? '') !== (p.otherNotes ?? '');
|
||||||
|
rows.push({ key, change: changed ? 'changed' : 'unchanged', live: l, proposed: p });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CHANGE_LABELS = {
|
||||||
|
added: { text: '新增', color: 'green' },
|
||||||
|
removed: { text: '删除', color: 'red' },
|
||||||
|
changed: { text: '变更', color: 'orange' },
|
||||||
|
unchanged: { text: '未变', color: 'default' },
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export default function StorePackageAuditsPage() {
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [items, setItems] = useState<StorePackageChangeRequestDto[]>([]);
|
||||||
|
const [total, setTotal] = useState(0);
|
||||||
|
const [page, setPage] = useState(1);
|
||||||
|
const [status, setStatus] = useState<string>('PENDING');
|
||||||
|
const [rejectOpen, setRejectOpen] = useState(false);
|
||||||
|
const [rejectReason, setRejectReason] = useState('');
|
||||||
|
const [activeId, setActiveId] = useState<string | null>(null);
|
||||||
|
const [detailOpen, setDetailOpen] = useState(false);
|
||||||
|
const [detailLoading, setDetailLoading] = useState(false);
|
||||||
|
const [detail, setDetail] = useState<StorePackageAuditDetailDto | null>(null);
|
||||||
|
|
||||||
|
async function reload(nextPage = page, nextStatus = status) {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
const qs = new URLSearchParams({
|
||||||
|
page: String(nextPage),
|
||||||
|
pageSize: '20',
|
||||||
|
});
|
||||||
|
if (nextStatus) qs.set('status', nextStatus);
|
||||||
|
const data = await request<Paginated<StorePackageChangeRequestDto>>(
|
||||||
|
`/admin/store-package-audits?${qs}`,
|
||||||
|
);
|
||||||
|
setItems(data.items);
|
||||||
|
setTotal(data.total);
|
||||||
|
setPage(data.page);
|
||||||
|
} catch (e) {
|
||||||
|
message.error(e instanceof Error ? e.message : '加载失败');
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
void reload(1, status);
|
||||||
|
}, [status]);
|
||||||
|
|
||||||
|
async function openDetail(id: string) {
|
||||||
|
setDetailOpen(true);
|
||||||
|
setDetailLoading(true);
|
||||||
|
setDetail(null);
|
||||||
|
try {
|
||||||
|
const data = await request<StorePackageAuditDetailDto>(`/admin/store-package-audits/${id}`);
|
||||||
|
setDetail(data);
|
||||||
|
} catch (e) {
|
||||||
|
message.error(e instanceof Error ? e.message : '加载详情失败');
|
||||||
|
setDetailOpen(false);
|
||||||
|
} finally {
|
||||||
|
setDetailLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function audit(id: string, action: 'APPROVE' | 'REJECT', reason?: string) {
|
||||||
|
try {
|
||||||
|
await request(`/admin/store-package-audits/${id}/audit`, {
|
||||||
|
method: 'PUT',
|
||||||
|
body: JSON.stringify(
|
||||||
|
action === 'REJECT' ? { action, rejectReason: reason } : { action },
|
||||||
|
),
|
||||||
|
});
|
||||||
|
message.success(action === 'APPROVE' ? '已通过' : '已驳回');
|
||||||
|
setDetailOpen(false);
|
||||||
|
void reload(page, status);
|
||||||
|
} catch (e) {
|
||||||
|
message.error(e instanceof Error ? e.message : '操作失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const diffRows = detail ? diffPackages(detail.livePackages ?? [], detail.packages ?? []) : [];
|
||||||
|
|
||||||
|
const diffColumns: ColumnsType<(typeof diffRows)[number]> = [
|
||||||
|
{
|
||||||
|
title: '变更',
|
||||||
|
dataIndex: 'change',
|
||||||
|
width: 72,
|
||||||
|
render: (v: keyof typeof CHANGE_LABELS) => {
|
||||||
|
const meta = CHANGE_LABELS[v];
|
||||||
|
return <Tag color={meta.color}>{meta.text}</Tag>;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '当前线上',
|
||||||
|
render: (_, row) =>
|
||||||
|
row.live ? (
|
||||||
|
<div>
|
||||||
|
<div><strong>{row.live.name}</strong> · ¥{row.live.price}</div>
|
||||||
|
<Typography.Text type="secondary">{row.live.dishes}</Typography.Text>
|
||||||
|
{row.live.usableTime ? (
|
||||||
|
<div><Typography.Text type="secondary">可用:{row.live.usableTime}</Typography.Text></div>
|
||||||
|
) : null}
|
||||||
|
{row.live.otherNotes ? (
|
||||||
|
<div><Typography.Text type="secondary">备注:{row.live.otherNotes}</Typography.Text></div>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
'—'
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '申请变更',
|
||||||
|
render: (_, row) =>
|
||||||
|
row.proposed ? (
|
||||||
|
<div>
|
||||||
|
<div><strong>{row.proposed.name}</strong> · ¥{row.proposed.price}</div>
|
||||||
|
<Typography.Text type="secondary">{row.proposed.dishes}</Typography.Text>
|
||||||
|
{row.proposed.usableTime ? (
|
||||||
|
<div><Typography.Text type="secondary">可用:{row.proposed.usableTime}</Typography.Text></div>
|
||||||
|
) : null}
|
||||||
|
{row.proposed.otherNotes ? (
|
||||||
|
<div><Typography.Text type="secondary">备注:{row.proposed.otherNotes}</Typography.Text></div>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
'—'
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const columns: ColumnsType<StorePackageChangeRequestDto> = [
|
||||||
|
{ title: '门店', dataIndex: 'storeName', render: (_, row) => row.storeName || row.storeId },
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'status',
|
||||||
|
render: (v: StorePackageChangeRequestDto['status']) => (
|
||||||
|
<Tag>{STORE_PACKAGE_CHANGE_STATUS_LABELS[v] ?? v}</Tag>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '套餐数',
|
||||||
|
render: (_, row) => row.packages?.length ?? 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '提交方',
|
||||||
|
render: (_, row) => (row.submitterType === 'PARTNER' ? '合伙人' : '门店'),
|
||||||
|
},
|
||||||
|
{ title: '提交时间', dataIndex: 'createdAt', render: (v) => fmtTime(String(v)) },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
render: (_, row) => (
|
||||||
|
<Space>
|
||||||
|
<Button type="link" onClick={() => void openDetail(row.id)}>
|
||||||
|
查看变更
|
||||||
|
</Button>
|
||||||
|
{row.status === 'PENDING' ? (
|
||||||
|
<>
|
||||||
|
<Button type="link" onClick={() => void audit(row.id, 'APPROVE')}>
|
||||||
|
通过
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
danger
|
||||||
|
onClick={() => {
|
||||||
|
setActiveId(row.id);
|
||||||
|
setRejectReason('');
|
||||||
|
setRejectOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
驳回
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
row.rejectReason || null
|
||||||
|
)}
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Typography.Title level={4}>套餐变更审核</Typography.Title>
|
||||||
|
<Space style={{ marginBottom: 16 }}>
|
||||||
|
{(['PENDING', 'APPROVED', 'REJECTED', ''] as const).map((s) => (
|
||||||
|
<Button key={s || 'all'} type={status === s ? 'primary' : 'default'} onClick={() => setStatus(s)}>
|
||||||
|
{s ? STORE_PACKAGE_CHANGE_STATUS_LABELS[s as keyof typeof STORE_PACKAGE_CHANGE_STATUS_LABELS] : '全部'}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</Space>
|
||||||
|
<Table
|
||||||
|
rowKey="id"
|
||||||
|
loading={loading}
|
||||||
|
columns={columns}
|
||||||
|
dataSource={items}
|
||||||
|
pagination={{
|
||||||
|
current: page,
|
||||||
|
total,
|
||||||
|
pageSize: 20,
|
||||||
|
onChange: (p) => void reload(p, status),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Drawer
|
||||||
|
title={detail ? `${detail.storeName || detail.storeId} · 套餐变更` : '套餐变更详情'}
|
||||||
|
width={720}
|
||||||
|
open={detailOpen}
|
||||||
|
onClose={() => setDetailOpen(false)}
|
||||||
|
extra={
|
||||||
|
detail?.status === 'PENDING' ? (
|
||||||
|
<Space>
|
||||||
|
<Button onClick={() => void audit(detail.id, 'APPROVE')}>通过</Button>
|
||||||
|
<Button
|
||||||
|
danger
|
||||||
|
onClick={() => {
|
||||||
|
setActiveId(detail.id);
|
||||||
|
setRejectReason('');
|
||||||
|
setRejectOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
驳回
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{detailLoading ? (
|
||||||
|
<Typography.Text type="secondary">加载中…</Typography.Text>
|
||||||
|
) : detail ? (
|
||||||
|
<>
|
||||||
|
<Space style={{ marginBottom: 16 }}>
|
||||||
|
<Tag>{STORE_PACKAGE_CHANGE_STATUS_LABELS[detail.status]}</Tag>
|
||||||
|
<Typography.Text type="secondary">
|
||||||
|
提交方:{detail.submitterType === 'PARTNER' ? '合伙人' : '门店'} · {fmtTime(detail.createdAt)}
|
||||||
|
</Typography.Text>
|
||||||
|
</Space>
|
||||||
|
{detail.rejectReason ? (
|
||||||
|
<Typography.Paragraph type="danger">驳回原因:{detail.rejectReason}</Typography.Paragraph>
|
||||||
|
) : null}
|
||||||
|
<Typography.Paragraph type="secondary">
|
||||||
|
线上 {detail.livePackages?.length ?? 0} 条 → 申请 {detail.packages?.length ?? 0} 条
|
||||||
|
</Typography.Paragraph>
|
||||||
|
<Table
|
||||||
|
size="small"
|
||||||
|
rowKey="key"
|
||||||
|
columns={diffColumns}
|
||||||
|
dataSource={diffRows}
|
||||||
|
pagination={false}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</Drawer>
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
title="驳回套餐变更"
|
||||||
|
open={rejectOpen}
|
||||||
|
onCancel={() => setRejectOpen(false)}
|
||||||
|
onOk={() => {
|
||||||
|
if (!activeId) return;
|
||||||
|
if (!rejectReason.trim()) {
|
||||||
|
message.warning('请填写驳回原因');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void audit(activeId, 'REJECT', rejectReason.trim());
|
||||||
|
setRejectOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Input.TextArea
|
||||||
|
rows={3}
|
||||||
|
value={rejectReason}
|
||||||
|
placeholder="驳回原因"
|
||||||
|
onChange={(e) => setRejectReason(e.target.value)}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -41,6 +41,7 @@ import { resolveRegionBinding } from '../lib/china-region';
|
|||||||
import ChinaRegionCascader from '../components/ChinaRegionCascader';
|
import ChinaRegionCascader from '../components/ChinaRegionCascader';
|
||||||
import OssUpload from '../components/OssUpload';
|
import OssUpload from '../components/OssUpload';
|
||||||
import TencentLocPickerModal from '../components/TencentLocPickerModal';
|
import TencentLocPickerModal from '../components/TencentLocPickerModal';
|
||||||
|
import AdminStorePackagesSection from '../components/AdminStorePackagesSection';
|
||||||
|
|
||||||
const CREATE_STEPS = [
|
const CREATE_STEPS = [
|
||||||
{ title: '基本信息' },
|
{ title: '基本信息' },
|
||||||
@@ -1214,6 +1215,11 @@ export default function StoresPage() {
|
|||||||
label: '审核材料',
|
label: '审核材料',
|
||||||
children: <StoreAuditMediaSection detail={detail} />,
|
children: <StoreAuditMediaSection detail={detail} />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'packages',
|
||||||
|
label: '套餐',
|
||||||
|
children: <AdminStorePackagesSection storeId={String(detail.id)} />,
|
||||||
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Form>
|
</Form>
|
||||||
@@ -1398,14 +1404,20 @@ export default function StoresPage() {
|
|||||||
<OssUpload bizType="STORE_TITLE" mediaType="IMAGE" />
|
<OssUpload bizType="STORE_TITLE" mediaType="IMAGE" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Typography.Text strong>环境照片</Typography.Text>
|
<Typography.Text strong>环境照片</Typography.Text>
|
||||||
|
<Typography.Paragraph type="secondary" style={{ marginTop: 4 }}>
|
||||||
|
至少 3 张,可继续添加
|
||||||
|
</Typography.Paragraph>
|
||||||
<Form.List name="envPhotoUrls">
|
<Form.List name="envPhotoUrls">
|
||||||
{(fields) => (
|
{(fields, { add }) => (
|
||||||
<div style={{ marginTop: 8 }}>
|
<div style={{ marginTop: 8 }}>
|
||||||
{fields.map((field, index) => (
|
{fields.map((field, index) => (
|
||||||
<Form.Item key={field.key} name={field.name} label={`环境图 ${index + 1}`}>
|
<Form.Item key={field.key} name={field.name} label={`环境图 ${index + 1}`}>
|
||||||
<OssUpload bizType="STORE_ENV" mediaType="IMAGE" />
|
<OssUpload bizType="STORE_ENV" mediaType="IMAGE" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
))}
|
))}
|
||||||
|
<Button type="dashed" onClick={() => add('')} block>
|
||||||
|
添加环境照片
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Form.List>
|
</Form.List>
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ export default function TicketsPage() {
|
|||||||
{ value: 'RESHIPMENT', label: '破损补发' },
|
{ value: 'RESHIPMENT', label: '破损补发' },
|
||||||
{ value: 'DAMAGE_RETURN', label: '破损退货' },
|
{ value: 'DAMAGE_RETURN', label: '破损退货' },
|
||||||
{ value: 'RETURN_REFUND', label: '退货退款' },
|
{ value: 'RETURN_REFUND', label: '退货退款' },
|
||||||
|
{ value: 'PACKAGE_DISPUTE', label: '套餐异议' },
|
||||||
{ value: 'ALERT', label: '异常' },
|
{ value: 'ALERT', label: '异常' },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
message,
|
message,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
import { USER_SOURCE_TYPE_LABELS, type UserSourceType } from '@dukang/shared-types';
|
import { USER_SOURCE_TYPE_LABELS, resolveUserLogCategory, type UserSourceType } from '@dukang/shared-types';
|
||||||
import { request, type AdminUserRow, type HqProfile, type Paginated } from '../lib/api';
|
import { request, type AdminUserRow, type HqProfile, type Paginated } from '../lib/api';
|
||||||
import { ORDER_STATUS_LABELS, fmtTime, maskPhone } from '../lib/constants';
|
import { ORDER_STATUS_LABELS, fmtTime, maskPhone } from '../lib/constants';
|
||||||
|
|
||||||
@@ -30,6 +30,14 @@ type UserOrderRow = {
|
|||||||
createdAt: string;
|
createdAt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type UserBehaviorLog = {
|
||||||
|
id: string;
|
||||||
|
eventName: string;
|
||||||
|
clientApp?: string | null;
|
||||||
|
createdAt: string;
|
||||||
|
extraJson?: Record<string, unknown> | null;
|
||||||
|
};
|
||||||
|
|
||||||
type UserDetail = AdminUserRow & {
|
type UserDetail = AdminUserRow & {
|
||||||
wxUnionId?: string | null;
|
wxUnionId?: string | null;
|
||||||
cityPref?: Record<string, unknown> | null;
|
cityPref?: Record<string, unknown> | null;
|
||||||
@@ -72,6 +80,7 @@ export default function UsersPage() {
|
|||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [pageSize, setPageSize] = useState(20);
|
const [pageSize, setPageSize] = useState(20);
|
||||||
const [detail, setDetail] = useState<UserDetail | null>(null);
|
const [detail, setDetail] = useState<UserDetail | null>(null);
|
||||||
|
const [behaviorLogs, setBehaviorLogs] = useState<UserBehaviorLog[]>([]);
|
||||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||||
const [deleteOpen, setDeleteOpen] = useState(false);
|
const [deleteOpen, setDeleteOpen] = useState(false);
|
||||||
const [deleteConfirm, setDeleteConfirm] = useState('');
|
const [deleteConfirm, setDeleteConfirm] = useState('');
|
||||||
@@ -123,8 +132,14 @@ export default function UsersPage() {
|
|||||||
}, [location.state, location.pathname, navigate]);
|
}, [location.state, location.pathname, navigate]);
|
||||||
|
|
||||||
async function openDetail(id: string) {
|
async function openDetail(id: string) {
|
||||||
const res = await request<UserDetail>(`/admin/users/${id}`);
|
const [res, logs] = await Promise.all([
|
||||||
|
request<UserDetail>(`/admin/users/${id}`),
|
||||||
|
request<{ items: UserBehaviorLog[] }>(`/admin/logs/users?userId=${id}&pageSize=50`).catch(
|
||||||
|
() => ({ items: [] as UserBehaviorLog[] }),
|
||||||
|
),
|
||||||
|
]);
|
||||||
setDetail(res);
|
setDetail(res);
|
||||||
|
setBehaviorLogs(logs.items ?? []);
|
||||||
setDrawerOpen(true);
|
setDrawerOpen(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,6 +452,28 @@ export default function UsersPage() {
|
|||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
|
|
||||||
|
<Typography.Title level={5} style={{ marginTop: 16 }}>
|
||||||
|
行为时间线(最近 {behaviorLogs.length} 条)
|
||||||
|
</Typography.Title>
|
||||||
|
<Table
|
||||||
|
size="small"
|
||||||
|
rowKey="id"
|
||||||
|
pagination={false}
|
||||||
|
scroll={{ y: 200 }}
|
||||||
|
dataSource={behaviorLogs}
|
||||||
|
locale={{ emptyText: '暂无行为日志' }}
|
||||||
|
columns={[
|
||||||
|
{ title: '时间', dataIndex: 'createdAt', width: 160, render: (v) => fmtTime(v) },
|
||||||
|
{
|
||||||
|
title: '分类',
|
||||||
|
width: 100,
|
||||||
|
render: (_, r) => resolveUserLogCategory(r.eventName) ?? '—',
|
||||||
|
},
|
||||||
|
{ title: '事件', dataIndex: 'eventName' },
|
||||||
|
{ title: '端', dataIndex: 'clientApp', width: 90 },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
|
||||||
<Typography.Title level={5} style={{ marginTop: 16 }}>
|
<Typography.Title level={5} style={{ marginTop: 16 }}>
|
||||||
全部订单({detail.orders?.length ?? 0})
|
全部订单({detail.orders?.length ?? 0})
|
||||||
</Typography.Title>
|
</Typography.Title>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"lint": "echo ok"
|
"lint": "echo ok"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@dukang/client-logging": "workspace:*",
|
||||||
"@dukang/shared-types": "workspace:*",
|
"@dukang/shared-types": "workspace:*",
|
||||||
"@dukang/shared-ui": "workspace:*",
|
"@dukang/shared-ui": "workspace:*",
|
||||||
"@dukang/weixin-sdk": "workspace:*",
|
"@dukang/weixin-sdk": "workspace:*",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import SubAccountLayout from './layouts/SubAccountLayout';
|
|||||||
import HomePage from './pages/HomePage';
|
import HomePage from './pages/HomePage';
|
||||||
import StoreListPage from './pages/StoreListPage';
|
import StoreListPage from './pages/StoreListPage';
|
||||||
import StoreDetailPage from './pages/StoreDetailPage';
|
import StoreDetailPage from './pages/StoreDetailPage';
|
||||||
|
import StorePackagesPage from './pages/StorePackagesPage';
|
||||||
import StoreCreatePage from './pages/StoreCreatePage';
|
import StoreCreatePage from './pages/StoreCreatePage';
|
||||||
import OrderListPage from './pages/OrderListPage';
|
import OrderListPage from './pages/OrderListPage';
|
||||||
import OrderDetailPage from './pages/OrderDetailPage';
|
import OrderDetailPage from './pages/OrderDetailPage';
|
||||||
@@ -31,6 +32,7 @@ function PrimaryRoutes() {
|
|||||||
<Route path="/center" element={<CenterPage />} />
|
<Route path="/center" element={<CenterPage />} />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/stores/new" element={<StoreCreatePage />} />
|
<Route path="/stores/new" element={<StoreCreatePage />} />
|
||||||
|
<Route path="/stores/:id/packages" element={<StorePackagesPage />} />
|
||||||
<Route path="/center/bills" element={<BillsPage />} />
|
<Route path="/center/bills" element={<BillsPage />} />
|
||||||
<Route path="/center/settlement" element={<SettlementPage />} />
|
<Route path="/center/settlement" element={<SettlementPage />} />
|
||||||
<Route path="/center/staff" element={<StaffListPage />} />
|
<Route path="/center/staff" element={<StaffListPage />} />
|
||||||
@@ -68,6 +70,7 @@ function SubAccountRoutes() {
|
|||||||
{!isWarehouse && (
|
{!isWarehouse && (
|
||||||
<>
|
<>
|
||||||
<Route path="/stores/new" element={<StoreCreatePage />} />
|
<Route path="/stores/new" element={<StoreCreatePage />} />
|
||||||
|
<Route path="/stores/:id/packages" element={<StorePackagesPage />} />
|
||||||
<Route path="/stores/:id" element={<StoreDetailPage />} />
|
<Route path="/stores/:id" element={<StoreDetailPage />} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -0,0 +1,158 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import type { PackageFormItem } from '../lib/storePackages';
|
||||||
|
import { STORE_PACKAGE_MAX_COUNT } from '@dukang/shared-types';
|
||||||
|
import { emptyPackage } from '../lib/storePackages';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
items: PackageFormItem[];
|
||||||
|
onChange: (items: PackageFormItem[]) => void;
|
||||||
|
disabled?: boolean;
|
||||||
|
/** 嵌入拓店流程时不重复外层卡片边距 */
|
||||||
|
embedded?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function StorePackagesForm({ items, onChange, disabled, embedded }: Props) {
|
||||||
|
const [collapsed, setCollapsed] = useState<Record<number, boolean>>({});
|
||||||
|
|
||||||
|
function updateAt(index: number, patch: Partial<PackageFormItem>) {
|
||||||
|
const next = items.map((item, i) => (i === index ? { ...item, ...patch } : item));
|
||||||
|
onChange(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addItem() {
|
||||||
|
if (items.length >= STORE_PACKAGE_MAX_COUNT) return;
|
||||||
|
onChange([...items, emptyPackage(items.length)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeAt(index: number) {
|
||||||
|
onChange(items.filter((_, i) => i !== index).map((item, i) => ({ ...item, sortOrder: i })));
|
||||||
|
setCollapsed((prev) => {
|
||||||
|
const next: Record<number, boolean> = {};
|
||||||
|
Object.entries(prev).forEach(([k, v]) => {
|
||||||
|
const i = Number(k);
|
||||||
|
if (i < index) next[i] = v;
|
||||||
|
else if (i > index) next[i - 1] = v;
|
||||||
|
});
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleCollapse(index: number) {
|
||||||
|
setCollapsed((prev) => ({ ...prev, [index]: !prev[index] }));
|
||||||
|
}
|
||||||
|
|
||||||
|
const list = items.length ? items : [emptyPackage(0)];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`partner-packages-form${embedded ? ' partner-packages-form--embedded' : ''}`}>
|
||||||
|
{list.map((item, index) => {
|
||||||
|
const isCollapsed = !!collapsed[index];
|
||||||
|
const displayName = item.name.trim() || `套餐 ${index + 1}`;
|
||||||
|
return (
|
||||||
|
<section
|
||||||
|
key={index}
|
||||||
|
className={`partner-form-card partner-packages-item${isCollapsed ? ' partner-packages-item--collapsed' : ''}`}
|
||||||
|
style={embedded ? { marginLeft: 0, marginRight: 0 } : undefined}
|
||||||
|
>
|
||||||
|
<div className="partner-packages-item-head">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="partner-packages-toggle"
|
||||||
|
onClick={() => toggleCollapse(index)}
|
||||||
|
aria-expanded={!isCollapsed}
|
||||||
|
aria-label={isCollapsed ? '展开套餐' : '收起套餐'}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-outlined">
|
||||||
|
{isCollapsed ? 'expand_more' : 'expand_less'}
|
||||||
|
</span>
|
||||||
|
<span className="headline-md">{displayName}</span>
|
||||||
|
</button>
|
||||||
|
{!disabled && list.length > 1 ? (
|
||||||
|
<button type="button" className="partner-packages-remove" onClick={() => removeAt(index)}>
|
||||||
|
删除
|
||||||
|
</button>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{!isCollapsed ? (
|
||||||
|
<>
|
||||||
|
<div className="partner-field">
|
||||||
|
<label>套餐名称 <span className="text-primary">*</span></label>
|
||||||
|
<div className="partner-field-input">
|
||||||
|
<span className="material-symbols-outlined">restaurant</span>
|
||||||
|
<input
|
||||||
|
placeholder="如:套餐A"
|
||||||
|
value={item.name}
|
||||||
|
disabled={disabled}
|
||||||
|
onChange={(e) => updateAt(index, { name: e.target.value })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="partner-field">
|
||||||
|
<label>价格(元) <span className="text-primary">*</span></label>
|
||||||
|
<div className="partner-field-input">
|
||||||
|
<span className="material-symbols-outlined">payments</span>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
min={0}
|
||||||
|
step={0.01}
|
||||||
|
placeholder="198"
|
||||||
|
value={item.price}
|
||||||
|
disabled={disabled}
|
||||||
|
onChange={(e) => updateAt(index, { price: e.target.value })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="partner-field">
|
||||||
|
<label>菜品 <span className="text-primary">*</span></label>
|
||||||
|
<textarea
|
||||||
|
rows={3}
|
||||||
|
placeholder="红烧肉、红烧鱼、油焖茄子"
|
||||||
|
value={item.dishes}
|
||||||
|
disabled={disabled}
|
||||||
|
onChange={(e) => updateAt(index, { dishes: e.target.value })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="partner-field">
|
||||||
|
<label>使用时间</label>
|
||||||
|
<div className="partner-field-input">
|
||||||
|
<span className="material-symbols-outlined">schedule</span>
|
||||||
|
<input
|
||||||
|
placeholder="节假日除外"
|
||||||
|
value={item.usableTime || ''}
|
||||||
|
disabled={disabled}
|
||||||
|
onChange={(e) => updateAt(index, { usableTime: e.target.value })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="partner-field">
|
||||||
|
<label>其他说明</label>
|
||||||
|
<div className="partner-field-input">
|
||||||
|
<span className="material-symbols-outlined">info</span>
|
||||||
|
<input
|
||||||
|
placeholder="不可叠加"
|
||||||
|
value={item.otherNotes || ''}
|
||||||
|
disabled={disabled}
|
||||||
|
onChange={(e) => updateAt(index, { otherNotes: e.target.value })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
|
||||||
|
{!disabled && list.length < STORE_PACKAGE_MAX_COUNT ? (
|
||||||
|
<button type="button" className="partner-packages-add" onClick={addItem}>
|
||||||
|
<span className="material-symbols-outlined">add_circle</span>
|
||||||
|
添加套餐
|
||||||
|
</button>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { createPartnerTracker } from '@dukang/client-logging';
|
||||||
|
import { apiBase } from './api';
|
||||||
|
|
||||||
|
const tracker = createPartnerTracker({
|
||||||
|
apiBase,
|
||||||
|
clientApp: 'PARTNER_H5',
|
||||||
|
getToken: () => localStorage.getItem('partnerAccessToken'),
|
||||||
|
});
|
||||||
|
|
||||||
|
export function trackPartner(eventName: string, params?: Record<string, unknown>) {
|
||||||
|
tracker.track(eventName, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function trackPartnerPageView(eventName: string, params?: Record<string, unknown>) {
|
||||||
|
tracker.trackPageView(eventName, params);
|
||||||
|
}
|
||||||
@@ -29,6 +29,8 @@ export type StoreDraftForm = {
|
|||||||
bankAccountName: string;
|
bankAccountName: string;
|
||||||
bankAccountNo: string;
|
bankAccountNo: string;
|
||||||
bankBranch: string;
|
bankBranch: string;
|
||||||
|
/** 门店套餐(拓店第 4 步,可空) */
|
||||||
|
packages: import('@dukang/shared-types').StorePackageItemDto[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type StoreDraft = {
|
export type StoreDraft = {
|
||||||
@@ -68,6 +70,7 @@ export const defaultStoreForm = (): StoreDraftForm => ({
|
|||||||
bankAccountName: '',
|
bankAccountName: '',
|
||||||
bankAccountNo: '',
|
bankAccountNo: '',
|
||||||
bankBranch: '',
|
bankBranch: '',
|
||||||
|
packages: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const TIME_RE = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
const TIME_RE = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
||||||
@@ -79,12 +82,18 @@ function timeToMinutes(hhmm: string): number {
|
|||||||
return h * 60 + m;
|
return h * 60 + m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const MIN_ENV_PHOTO_COUNT = 3;
|
||||||
|
|
||||||
export function normalizeStringArray(urls: unknown, minLen: number): string[] {
|
export function normalizeStringArray(urls: unknown, minLen: number): string[] {
|
||||||
const arr = Array.isArray(urls) ? urls.map((u) => String(u ?? '')) : [];
|
const arr = Array.isArray(urls) ? urls.map((u) => String(u ?? '')) : [];
|
||||||
while (arr.length < minLen) arr.push('');
|
while (arr.length < minLen) arr.push('');
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function addEnvPhotoSlot(urls: string[]): string[] {
|
||||||
|
return [...urls, ''];
|
||||||
|
}
|
||||||
|
|
||||||
export function normalizeStoreDraftForm(raw: Partial<StoreDraftForm> | null | undefined): StoreDraftForm {
|
export function normalizeStoreDraftForm(raw: Partial<StoreDraftForm> | null | undefined): StoreDraftForm {
|
||||||
const base = defaultStoreForm();
|
const base = defaultStoreForm();
|
||||||
if (!raw) return base;
|
if (!raw) return base;
|
||||||
@@ -101,7 +110,17 @@ export function normalizeStoreDraftForm(raw: Partial<StoreDraftForm> | null | un
|
|||||||
openTime2: String(raw.openTime2 ?? base.openTime2),
|
openTime2: String(raw.openTime2 ?? base.openTime2),
|
||||||
closeTime2: String(raw.closeTime2 ?? base.closeTime2),
|
closeTime2: String(raw.closeTime2 ?? base.closeTime2),
|
||||||
avgPrice: String(raw.avgPrice ?? base.avgPrice),
|
avgPrice: String(raw.avgPrice ?? base.avgPrice),
|
||||||
envPhotoUrls: normalizeStringArray(raw.envPhotoUrls, 3),
|
envPhotoUrls: normalizeStringArray(raw.envPhotoUrls, MIN_ENV_PHOTO_COUNT),
|
||||||
|
packages: Array.isArray(raw.packages)
|
||||||
|
? raw.packages.map((p, i) => ({
|
||||||
|
name: String((p as { name?: string }).name ?? ''),
|
||||||
|
price: String((p as { price?: string | number }).price ?? ''),
|
||||||
|
dishes: String((p as { dishes?: string }).dishes ?? ''),
|
||||||
|
usableTime: (p as { usableTime?: string }).usableTime ?? '',
|
||||||
|
otherNotes: (p as { otherNotes?: string }).otherNotes ?? '',
|
||||||
|
sortOrder: i,
|
||||||
|
}))
|
||||||
|
: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,13 +221,14 @@ export function validateStoreStep2(
|
|||||||
): string | null {
|
): string | null {
|
||||||
if (!form.coverUrl.trim()) return '请上传门头照';
|
if (!form.coverUrl.trim()) return '请上传门头照';
|
||||||
const envCount = form.envPhotoUrls.filter((u) => u.trim()).length;
|
const envCount = form.envPhotoUrls.filter((u) => u.trim()).length;
|
||||||
if (envCount < 3) return '请上传至少 3 张环境照片';
|
if (envCount < MIN_ENV_PHOTO_COUNT) return `请上传至少 ${MIN_ENV_PHOTO_COUNT} 张环境照片`;
|
||||||
if (!form.contractUrl.trim()) return '请上传签约合同';
|
if (!form.contractUrl.trim()) return '请上传签约合同';
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function patchEnvPhotoAt(urls: string[], index: number, url: string): string[] {
|
export function patchEnvPhotoAt(urls: string[], index: number, url: string): string[] {
|
||||||
const envPhotoUrls = normalizeStringArray(urls, 3);
|
const envPhotoUrls = [...urls];
|
||||||
|
while (envPhotoUrls.length <= index) envPhotoUrls.push('');
|
||||||
envPhotoUrls[index] = url;
|
envPhotoUrls[index] = url;
|
||||||
return envPhotoUrls;
|
return envPhotoUrls;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import type { StorePackageItemDto } from '@dukang/shared-types';
|
||||||
|
import { STORE_PACKAGE_MAX_COUNT } from '@dukang/shared-types';
|
||||||
|
|
||||||
|
export type PackageFormItem = StorePackageItemDto;
|
||||||
|
|
||||||
|
export function emptyPackage(index = 0): PackageFormItem {
|
||||||
|
return {
|
||||||
|
name: '',
|
||||||
|
price: '',
|
||||||
|
dishes: '',
|
||||||
|
usableTime: '',
|
||||||
|
otherNotes: '',
|
||||||
|
sortOrder: index,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizePackageFormItems(raw: PackageFormItem[]): PackageFormItem[] {
|
||||||
|
return raw
|
||||||
|
.map((item, index) => ({
|
||||||
|
name: item.name.trim(),
|
||||||
|
price: item.price.trim(),
|
||||||
|
dishes: item.dishes.trim(),
|
||||||
|
usableTime: item.usableTime?.trim() || '',
|
||||||
|
otherNotes: item.otherNotes?.trim() || '',
|
||||||
|
sortOrder: index,
|
||||||
|
}))
|
||||||
|
.filter((item) => item.name || item.price || item.dishes || item.usableTime || item.otherNotes);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function validatePackageFormItems(items: PackageFormItem[]): string | null {
|
||||||
|
const filled = normalizePackageFormItems(items);
|
||||||
|
if (filled.length > STORE_PACKAGE_MAX_COUNT) {
|
||||||
|
return `套餐最多 ${STORE_PACKAGE_MAX_COUNT} 条`;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < filled.length; i++) {
|
||||||
|
const item = filled[i];
|
||||||
|
if (!item.name) return `第 ${i + 1} 条套餐名称不能为空`;
|
||||||
|
const price = Number(item.price);
|
||||||
|
if (!Number.isFinite(price) || price < 0) return `第 ${i + 1} 条套餐价格须为非负数字`;
|
||||||
|
if (!item.dishes) return `第 ${i + 1} 条套餐菜品不能为空`;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatPackagePrice(price: string | number) {
|
||||||
|
const n = typeof price === 'number' ? price : Number(price);
|
||||||
|
if (!Number.isFinite(n)) return String(price);
|
||||||
|
return n % 1 === 0 ? String(n) : n.toFixed(2);
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { useEffect, useRef } from 'react';
|
||||||
|
import { trackPartnerPageView } from './analytics';
|
||||||
|
|
||||||
|
export function usePartnerPageView(eventName: string, params?: Record<string, unknown>) {
|
||||||
|
const fired = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (fired.current) return;
|
||||||
|
fired.current = true;
|
||||||
|
trackPartnerPageView(eventName, params);
|
||||||
|
}, [eventName, params]);
|
||||||
|
}
|
||||||
@@ -5,11 +5,16 @@ import { getRouterBasename } from '@dukang/weixin-sdk';
|
|||||||
import App from './App';
|
import App from './App';
|
||||||
import { PartnerSessionProvider } from './contexts/PartnerSessionContext';
|
import { PartnerSessionProvider } from './contexts/PartnerSessionContext';
|
||||||
import { PartnerToastProvider } from './contexts/PartnerToastContext';
|
import { PartnerToastProvider } from './contexts/PartnerToastContext';
|
||||||
import { installClientErrorReporting } from './lib/client-error';
|
import { installClientErrorReporting } from '@dukang/client-logging';
|
||||||
|
import { apiBase } from './lib/api';
|
||||||
import './styles.css';
|
import './styles.css';
|
||||||
import './styles/legal.css';
|
import './styles/legal.css';
|
||||||
|
|
||||||
installClientErrorReporting();
|
installClientErrorReporting({
|
||||||
|
apiBase,
|
||||||
|
clientApp: 'PARTNER_H5',
|
||||||
|
getToken: () => localStorage.getItem('partnerAccessToken'),
|
||||||
|
});
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
|||||||
import type { PartnerBillDto } from '@dukang/shared-types';
|
import type { PartnerBillDto } from '@dukang/shared-types';
|
||||||
import { isLoggedIn, request } from '../lib/api';
|
import { isLoggedIn, request } from '../lib/api';
|
||||||
import { toastError, toastSuccess } from '../lib/toast';
|
import { toastError, toastSuccess } from '../lib/toast';
|
||||||
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
|
|
||||||
function fmtMoney(n: number) {
|
function fmtMoney(n: number) {
|
||||||
return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||||
@@ -25,6 +26,7 @@ function canConfirm(status: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function BillsPage() {
|
export default function BillsPage() {
|
||||||
|
usePartnerPageView('partner_bills_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const [bills, setBills] = useState<PartnerBillDto[]>([]);
|
const [bills, setBills] = useState<PartnerBillDto[]>([]);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|||||||
import { Link, useNavigate } from 'react-router-dom';
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
import type { PartnerLeaderboardEntry } from '@dukang/shared-types';
|
import type { PartnerLeaderboardEntry } from '@dukang/shared-types';
|
||||||
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
||||||
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
import { isLoggedIn, request } from '../lib/api';
|
import { isLoggedIn, request } from '../lib/api';
|
||||||
import { fetchPartnerLeaderboard } from '../lib/leaderboard';
|
import { fetchPartnerLeaderboard } from '../lib/leaderboard';
|
||||||
import {
|
import {
|
||||||
@@ -137,6 +138,7 @@ function LeaderboardPreview({ entries }: { entries: PartnerLeaderboardEntry[] })
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
|
usePartnerPageView('partner_home_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { account } = usePartnerSession();
|
const { account } = usePartnerSession();
|
||||||
const navKind = getPartnerNavKind(account);
|
const navKind = getPartnerNavKind(account);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
|||||||
import { fetchPartnerLeaderboard } from '../lib/leaderboard';
|
import { fetchPartnerLeaderboard } from '../lib/leaderboard';
|
||||||
import { usePartnerSession } from '../contexts/PartnerSessionContext';
|
import { usePartnerSession } from '../contexts/PartnerSessionContext';
|
||||||
import { isPrimaryAccount } from '../lib/partnerAccess';
|
import { isPrimaryAccount } from '../lib/partnerAccess';
|
||||||
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
|
|
||||||
const PERIOD_TABS: { key: PartnerLeaderboardPeriod; label: string }[] = [
|
const PERIOD_TABS: { key: PartnerLeaderboardPeriod; label: string }[] = [
|
||||||
{ key: 'month', label: '本月' },
|
{ key: 'month', label: '本月' },
|
||||||
@@ -26,6 +27,7 @@ function periodSubLabel(period: PartnerLeaderboardPeriod): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function LeaderboardPage() {
|
export default function LeaderboardPage() {
|
||||||
|
usePartnerPageView('partner_leaderboard_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { account } = usePartnerSession();
|
const { account } = usePartnerSession();
|
||||||
const showStaffFab = isPrimaryAccount(account);
|
const showStaffFab = isPrimaryAccount(account);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useNavigate, useParams } from 'react-router-dom';
|
|||||||
import PageHeader from '@dukang/shared-ui/PageHeader';
|
import PageHeader from '@dukang/shared-ui/PageHeader';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
import { toastError, toastSuccess } from '../lib/toast';
|
import { toastError, toastSuccess } from '../lib/toast';
|
||||||
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
|
|
||||||
const TIMELINE = [
|
const TIMELINE = [
|
||||||
{ key: 'confirm', label: '待确认' },
|
{ key: 'confirm', label: '待确认' },
|
||||||
@@ -36,6 +37,7 @@ function canShip(status: string) {
|
|||||||
|
|
||||||
export default function OrderDetailPage() {
|
export default function OrderDetailPage() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
usePartnerPageView('partner_order_detail_view', id ? { orderId: id } : undefined);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [order, setOrder] = useState<Record<string, unknown> | null>(null);
|
const [order, setOrder] = useState<Record<string, unknown> | null>(null);
|
||||||
const [shipping, setShipping] = useState(false);
|
const [shipping, setShipping] = useState(false);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
|||||||
import { isLoggedIn, request } from '../lib/api';
|
import { isLoggedIn, request } from '../lib/api';
|
||||||
import { usePartnerSession } from '../contexts/PartnerSessionContext';
|
import { usePartnerSession } from '../contexts/PartnerSessionContext';
|
||||||
import { hasWarehouseAccess } from '../lib/partnerAccess';
|
import { hasWarehouseAccess } from '../lib/partnerAccess';
|
||||||
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
|
|
||||||
type DateFilter = 'today' | '7d' | '30d';
|
type DateFilter = 'today' | '7d' | '30d';
|
||||||
type StatusFilter = 'ALL' | 'PENDING_SHIP' | 'SHIPPING' | 'COMPLETED' | 'ABNORMAL';
|
type StatusFilter = 'ALL' | 'PENDING_SHIP' | 'SHIPPING' | 'COMPLETED' | 'ABNORMAL';
|
||||||
@@ -44,6 +45,7 @@ type OrdersResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function OrderListPage({ tabRoot = false }: OrderListPageProps) {
|
export default function OrderListPage({ tabRoot = false }: OrderListPageProps) {
|
||||||
|
usePartnerPageView('partner_order_list_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { account } = usePartnerSession();
|
const { account } = usePartnerSession();
|
||||||
const warehouseOk = hasWarehouseAccess(account);
|
const warehouseOk = hasWarehouseAccess(account);
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ export default function ProxyOrderDetailPage() {
|
|||||||
const [payMethod, setPayMethod] = useState<ProxyPayMethod>('NATIVE');
|
const [payMethod, setPayMethod] = useState<ProxyPayMethod>('NATIVE');
|
||||||
const [codeUrl, setCodeUrl] = useState<string | null>(null);
|
const [codeUrl, setCodeUrl] = useState<string | null>(null);
|
||||||
const [qrDataUrl, setQrDataUrl] = useState<string | null>(null);
|
const [qrDataUrl, setQrDataUrl] = useState<string | null>(null);
|
||||||
|
const [cancelling, setCancelling] = useState(false);
|
||||||
const pollRef = useRef<number | null>(null);
|
const pollRef = useRef<number | null>(null);
|
||||||
|
|
||||||
function stopPoll() {
|
function stopPoll() {
|
||||||
@@ -77,7 +78,12 @@ export default function ProxyOrderDetailPage() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
void request<PartnerProxyOrderListItem>('PARTNER_H5', `/partner/proxy-orders/${id}`)
|
void request<PartnerProxyOrderListItem>('PARTNER_H5', `/partner/proxy-orders/${id}`)
|
||||||
.then(setOrder)
|
.then((data) => {
|
||||||
|
setOrder(data);
|
||||||
|
if (data.proxyPayMethod) {
|
||||||
|
setPayMethod(data.proxyPayMethod);
|
||||||
|
}
|
||||||
|
})
|
||||||
.catch((e) => setError(e instanceof Error ? e.message : '加载失败'));
|
.catch((e) => setError(e instanceof Error ? e.message : '加载失败'));
|
||||||
}, [id]);
|
}, [id]);
|
||||||
|
|
||||||
@@ -129,6 +135,15 @@ export default function ProxyOrderDetailPage() {
|
|||||||
|
|
||||||
async function startPay(method: ProxyPayMethod) {
|
async function startPay(method: ProxyPayMethod) {
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
|
const locked = order?.proxyPayMethod;
|
||||||
|
if (locked && locked !== method) {
|
||||||
|
setPayMsg(
|
||||||
|
locked === 'JSAPI'
|
||||||
|
? '该订单已发起微信代付,请先取消支付后重新下单'
|
||||||
|
: '该订单已生成收款码,请先取消支付后重新下单',
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
setPaying(true);
|
setPaying(true);
|
||||||
setPayMsg('');
|
setPayMsg('');
|
||||||
setPayMethod(method);
|
setPayMethod(method);
|
||||||
@@ -166,12 +181,14 @@ export default function ProxyOrderDetailPage() {
|
|||||||
|
|
||||||
if (pay.mode === 'native' && pay.codeUrl) {
|
if (pay.mode === 'native' && pay.codeUrl) {
|
||||||
setCodeUrl(pay.codeUrl);
|
setCodeUrl(pay.codeUrl);
|
||||||
|
setOrder((prev) => (prev ? { ...prev, proxyPayMethod: method } : prev));
|
||||||
startPoll(id);
|
startPoll(id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pay.mode === 'jsapi' && pay.prepay) {
|
if (pay.mode === 'jsapi' && pay.prepay) {
|
||||||
setCodeUrl(null);
|
setCodeUrl(null);
|
||||||
|
setOrder((prev) => (prev ? { ...prev, proxyPayMethod: method } : prev));
|
||||||
await invokeWechatPay(pay.prepay, {
|
await invokeWechatPay(pay.prepay, {
|
||||||
apiBase: '/api/v1',
|
apiBase: '/api/v1',
|
||||||
clientApp: 'PARTNER_H5',
|
clientApp: 'PARTNER_H5',
|
||||||
@@ -191,14 +208,27 @@ export default function ProxyOrderDetailPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const autoPayStartedRef = useRef(false);
|
async function cancelPay() {
|
||||||
useEffect(() => {
|
if (!id) return;
|
||||||
if (!id || !unpaid || autoPayStartedRef.current) return;
|
setCancelling(true);
|
||||||
autoPayStartedRef.current = true;
|
setPayMsg('');
|
||||||
void startPay('NATIVE');
|
stopPoll();
|
||||||
// 仅首次进入未支付详情时自动拉收款码
|
try {
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
await request('PARTNER_H5', `/partner/proxy-orders/${id}/cancel-pay`, {
|
||||||
}, [id, unpaid]);
|
method: 'POST',
|
||||||
|
body: '{}',
|
||||||
|
});
|
||||||
|
toastSuccess('已取消支付,可重新下单并选择其他支付方式');
|
||||||
|
navigate('/center/proxy-orders');
|
||||||
|
} catch (e) {
|
||||||
|
setPayMsg(e instanceof Error ? e.message : '取消失败');
|
||||||
|
toastError(e instanceof Error ? e.message : '取消失败');
|
||||||
|
} finally {
|
||||||
|
setCancelling(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const lockedPayMethod = order?.proxyPayMethod ?? null;
|
||||||
|
|
||||||
const img = order?.imageResource?.url || '';
|
const img = order?.imageResource?.url || '';
|
||||||
const isOnSite = String(order?.deliveryType || '').toUpperCase() === 'ON_SITE_PICKUP';
|
const isOnSite = String(order?.deliveryType || '').toUpperCase() === 'ON_SITE_PICKUP';
|
||||||
@@ -285,6 +315,7 @@ export default function ProxyOrderDetailPage() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`partner-proxy-mode-tab${payMethod === 'NATIVE' ? ' is-active' : ''}`}
|
className={`partner-proxy-mode-tab${payMethod === 'NATIVE' ? ' is-active' : ''}`}
|
||||||
|
disabled={!!lockedPayMethod && lockedPayMethod !== 'NATIVE'}
|
||||||
onClick={() => void startPay('NATIVE')}
|
onClick={() => void startPay('NATIVE')}
|
||||||
>
|
>
|
||||||
收款码
|
收款码
|
||||||
@@ -292,11 +323,21 @@ export default function ProxyOrderDetailPage() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`partner-proxy-mode-tab${payMethod === 'JSAPI' ? ' is-active' : ''}`}
|
className={`partner-proxy-mode-tab${payMethod === 'JSAPI' ? ' is-active' : ''}`}
|
||||||
|
disabled={!!lockedPayMethod && lockedPayMethod !== 'JSAPI'}
|
||||||
onClick={() => void startPay('JSAPI')}
|
onClick={() => void startPay('JSAPI')}
|
||||||
>
|
>
|
||||||
微信代付
|
微信代付
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
{lockedPayMethod ? (
|
||||||
|
<p className="label-md text-muted" style={{ marginTop: 8 }}>
|
||||||
|
已选择{lockedPayMethod === 'NATIVE' ? '收款码' : '微信代付'},切换方式请先取消支付
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
<p className="label-md text-muted" style={{ marginTop: 8 }}>
|
||||||
|
请选择支付方式并点击下方按钮发起支付
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
|
||||||
{payMethod === 'NATIVE' ? (
|
{payMethod === 'NATIVE' ? (
|
||||||
<div style={{ textAlign: 'center', marginTop: 16 }}>
|
<div style={{ textAlign: 'center', marginTop: 16 }}>
|
||||||
@@ -338,6 +379,16 @@ export default function ProxyOrderDetailPage() {
|
|||||||
{payMsg}
|
{payMsg}
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-block"
|
||||||
|
style={{ marginTop: 16 }}
|
||||||
|
disabled={cancelling || paying}
|
||||||
|
onClick={() => void cancelPay()}
|
||||||
|
>
|
||||||
|
{cancelling ? '取消中…' : '取消支付'}
|
||||||
|
</button>
|
||||||
</section>
|
</section>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import type {
|
|||||||
ProxyOrderPayResponse,
|
ProxyOrderPayResponse,
|
||||||
ProxyPayMethod,
|
ProxyPayMethod,
|
||||||
} from '@dukang/shared-types';
|
} from '@dukang/shared-types';
|
||||||
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
|
|
||||||
function fmtMoney(n: number) {
|
function fmtMoney(n: number) {
|
||||||
return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||||
@@ -46,6 +47,7 @@ function initialDraft(): ProxyOrderDraft {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ProxyOrderPage() {
|
export default function ProxyOrderPage() {
|
||||||
|
usePartnerPageView('partner_proxy_order_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const draft0 = useMemo(() => initialDraft(), []);
|
const draft0 = useMemo(() => initialDraft(), []);
|
||||||
@@ -70,6 +72,8 @@ export default function ProxyOrderPage() {
|
|||||||
const [codeUrl, setCodeUrl] = useState<string | null>(null);
|
const [codeUrl, setCodeUrl] = useState<string | null>(null);
|
||||||
const [qrDataUrl, setQrDataUrl] = useState<string | null>(null);
|
const [qrDataUrl, setQrDataUrl] = useState<string | null>(null);
|
||||||
const [paying, setPaying] = useState(false);
|
const [paying, setPaying] = useState(false);
|
||||||
|
const [cancelling, setCancelling] = useState(false);
|
||||||
|
const [lockedPayMethod, setLockedPayMethod] = useState<ProxyPayMethod | null>(null);
|
||||||
const pollRef = useRef<number | null>(null);
|
const pollRef = useRef<number | null>(null);
|
||||||
|
|
||||||
const region = useMemo(() => parseRegionCodes(regionCodes), [regionCodes]);
|
const region = useMemo(() => parseRegionCodes(regionCodes), [regionCodes]);
|
||||||
@@ -234,8 +238,17 @@ export default function ProxyOrderPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function startPay(orderId: string, method: ProxyPayMethod) {
|
async function startPay(orderId: string, method: ProxyPayMethod) {
|
||||||
|
if (lockedPayMethod && lockedPayMethod !== method) {
|
||||||
|
setMsg(
|
||||||
|
lockedPayMethod === 'JSAPI'
|
||||||
|
? '该订单已发起微信代付,请先取消支付后重新下单'
|
||||||
|
: '该订单已生成收款码,请先取消支付后重新下单',
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
setPaying(true);
|
setPaying(true);
|
||||||
setMsg('');
|
setMsg('');
|
||||||
|
setPayMethod(method);
|
||||||
try {
|
try {
|
||||||
if (method === 'JSAPI') {
|
if (method === 'JSAPI') {
|
||||||
if (!isWechatEnv()) {
|
if (!isWechatEnv()) {
|
||||||
@@ -266,11 +279,14 @@ export default function ProxyOrderPage() {
|
|||||||
|
|
||||||
if (pay.mode === 'native' && pay.codeUrl) {
|
if (pay.mode === 'native' && pay.codeUrl) {
|
||||||
setCodeUrl(pay.codeUrl);
|
setCodeUrl(pay.codeUrl);
|
||||||
|
setLockedPayMethod(method);
|
||||||
startPoll(orderId);
|
startPoll(orderId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pay.mode === 'jsapi' && pay.prepay) {
|
if (pay.mode === 'jsapi' && pay.prepay) {
|
||||||
|
setCodeUrl(null);
|
||||||
|
setLockedPayMethod(method);
|
||||||
await invokeWechatPay(pay.prepay, {
|
await invokeWechatPay(pay.prepay, {
|
||||||
apiBase: '/api/v1',
|
apiBase: '/api/v1',
|
||||||
clientApp: 'PARTNER_H5',
|
clientApp: 'PARTNER_H5',
|
||||||
@@ -289,6 +305,40 @@ export default function ProxyOrderPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function cancelPay(orderId: string) {
|
||||||
|
setCancelling(true);
|
||||||
|
setMsg('');
|
||||||
|
stopPoll();
|
||||||
|
try {
|
||||||
|
await request('PARTNER_H5', `/partner/proxy-orders/${orderId}/cancel-pay`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: '{}',
|
||||||
|
});
|
||||||
|
toastSuccess('已取消支付,可重新下单并选择其他支付方式');
|
||||||
|
setStep('form');
|
||||||
|
setCreated(null);
|
||||||
|
setCodeUrl(null);
|
||||||
|
setLockedPayMethod(null);
|
||||||
|
} catch (e) {
|
||||||
|
setMsg(e instanceof Error ? e.message : '取消失败');
|
||||||
|
} finally {
|
||||||
|
setCancelling(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function switchPayMethod(method: ProxyPayMethod) {
|
||||||
|
if (lockedPayMethod && lockedPayMethod !== method) {
|
||||||
|
setMsg(
|
||||||
|
lockedPayMethod === 'JSAPI'
|
||||||
|
? '该订单已发起微信代付,请先取消支付后重新下单'
|
||||||
|
: '该订单已生成收款码,请先取消支付后重新下单',
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setPayMethod(method);
|
||||||
|
setMsg('');
|
||||||
|
}
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
setMsg('');
|
setMsg('');
|
||||||
const err = validateForm();
|
const err = validateForm();
|
||||||
@@ -322,6 +372,7 @@ export default function ProxyOrderPage() {
|
|||||||
setCreated(order);
|
setCreated(order);
|
||||||
setStep('pay');
|
setStep('pay');
|
||||||
setCodeUrl(null);
|
setCodeUrl(null);
|
||||||
|
setLockedPayMethod(null);
|
||||||
await startPay(order.id, payMethod);
|
await startPay(order.id, payMethod);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setMsg(e instanceof Error ? e.message : '下单失败');
|
setMsg(e instanceof Error ? e.message : '下单失败');
|
||||||
@@ -359,24 +410,25 @@ export default function ProxyOrderPage() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`partner-proxy-mode-tab${payMethod === 'NATIVE' ? ' is-active' : ''}`}
|
className={`partner-proxy-mode-tab${payMethod === 'NATIVE' ? ' is-active' : ''}`}
|
||||||
onClick={() => {
|
disabled={!!lockedPayMethod && lockedPayMethod !== 'NATIVE'}
|
||||||
setPayMethod('NATIVE');
|
onClick={() => switchPayMethod('NATIVE')}
|
||||||
void startPay(created.id, 'NATIVE');
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
收款码
|
收款码
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`partner-proxy-mode-tab${payMethod === 'JSAPI' ? ' is-active' : ''}`}
|
className={`partner-proxy-mode-tab${payMethod === 'JSAPI' ? ' is-active' : ''}`}
|
||||||
onClick={() => {
|
disabled={!!lockedPayMethod && lockedPayMethod !== 'JSAPI'}
|
||||||
setPayMethod('JSAPI');
|
onClick={() => switchPayMethod('JSAPI')}
|
||||||
void startPay(created.id, 'JSAPI');
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
微信代付
|
微信代付
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
{lockedPayMethod ? (
|
||||||
|
<p className="label-md text-muted" style={{ marginTop: 8 }}>
|
||||||
|
已选择{lockedPayMethod === 'NATIVE' ? '收款码' : '微信代付'},切换方式请先取消支付
|
||||||
|
</p>
|
||||||
|
) : null}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{payMethod === 'NATIVE' ? (
|
{payMethod === 'NATIVE' ? (
|
||||||
@@ -419,6 +471,16 @@ export default function ProxyOrderPage() {
|
|||||||
{msg}
|
{msg}
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-block"
|
||||||
|
style={{ marginTop: 16 }}
|
||||||
|
disabled={cancelling || paying}
|
||||||
|
onClick={() => void cancelPay(created.id)}
|
||||||
|
>
|
||||||
|
{cancelling ? '取消中…' : '取消支付'}
|
||||||
|
</button>
|
||||||
</>
|
</>
|
||||||
) : loadingOptions ? (
|
) : loadingOptions ? (
|
||||||
<p className="label-md text-muted">加载商品…</p>
|
<p className="label-md text-muted">加载商品…</p>
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ import {
|
|||||||
type PartnerStaffItem,
|
type PartnerStaffItem,
|
||||||
} from '@dukang/shared-types';
|
} from '@dukang/shared-types';
|
||||||
import { deletePartnerStaff, listPartnerStaff, updatePartnerStaff } from '../lib/staff';
|
import { deletePartnerStaff, listPartnerStaff, updatePartnerStaff } from '../lib/staff';
|
||||||
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
|
|
||||||
export default function StaffListPage() {
|
export default function StaffListPage() {
|
||||||
|
usePartnerPageView('partner_staff_list_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [staff, setStaff] = useState<PartnerStaffItem[]>([]);
|
const [staff, setStaff] = useState<PartnerStaffItem[]>([]);
|
||||||
const [q, setQ] = useState('');
|
const [q, setQ] = useState('');
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import { isWechatEnv, weixinSdk } from '../lib/weixin';
|
|||||||
import { usePartnerSession } from '../contexts/PartnerSessionContext';
|
import { usePartnerSession } from '../contexts/PartnerSessionContext';
|
||||||
|
|
||||||
import TencentLocPickerOverlay from '../components/TencentLocPickerOverlay';
|
import TencentLocPickerOverlay from '../components/TencentLocPickerOverlay';
|
||||||
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
||||||
@@ -40,12 +41,13 @@ import {
|
|||||||
validateStoreStep3,
|
validateStoreStep3,
|
||||||
|
|
||||||
patchEnvPhotoAt,
|
patchEnvPhotoAt,
|
||||||
|
addEnvPhotoSlot,
|
||||||
|
MIN_ENV_PHOTO_COUNT,
|
||||||
} from '../lib/storeDraft';
|
} from '../lib/storeDraft';
|
||||||
|
import StorePackagesForm from '../components/StorePackagesForm';
|
||||||
|
import { normalizePackageFormItems, validatePackageFormItems } from '../lib/storePackages';
|
||||||
|
|
||||||
|
const STEPS = ['基本信息', '照片上传', '结算资质', '门店套餐'] as const;
|
||||||
|
|
||||||
const STEPS = ['基本信息', '照片上传', '结算资质'] as const;
|
|
||||||
|
|
||||||
type StoreCategoryNode = {
|
type StoreCategoryNode = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -77,6 +79,8 @@ function isPhoneValidationMessage(message: string) {
|
|||||||
|
|
||||||
export default function StoreCreatePage() {
|
export default function StoreCreatePage() {
|
||||||
|
|
||||||
|
usePartnerPageView('partner_store_create_view');
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const { account } = usePartnerSession();
|
const { account } = usePartnerSession();
|
||||||
@@ -102,6 +106,7 @@ export default function StoreCreatePage() {
|
|||||||
const [categoryTree, setCategoryTree] = useState<StoreCategoryNode[]>([]);
|
const [categoryTree, setCategoryTree] = useState<StoreCategoryNode[]>([]);
|
||||||
|
|
||||||
const [mapPickerOpen, setMapPickerOpen] = useState(false);
|
const [mapPickerOpen, setMapPickerOpen] = useState(false);
|
||||||
|
const [stepErrorModal, setStepErrorModal] = useState<string | null>(null);
|
||||||
|
|
||||||
const draftSaveDisabledRef = useRef(false);
|
const draftSaveDisabledRef = useRef(false);
|
||||||
|
|
||||||
@@ -109,9 +114,14 @@ export default function StoreCreatePage() {
|
|||||||
setSubmitError(message);
|
setSubmitError(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reportStepError(message: string) {
|
||||||
|
setSubmitError(message);
|
||||||
|
setStepErrorModal(message);
|
||||||
|
}
|
||||||
|
|
||||||
const stepFromUrl = Number(params.get('step') || 0);
|
const stepFromUrl = Number(params.get('step') || 0);
|
||||||
|
|
||||||
const step = stepFromUrl >= 1 && stepFromUrl <= 3 ? stepFromUrl : (saved?.step ?? 1);
|
const step = stepFromUrl >= 1 && stepFromUrl <= 4 ? stepFromUrl : (saved?.step ?? 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -301,7 +311,7 @@ export default function StoreCreatePage() {
|
|||||||
const msg = validateStoreStep1(form);
|
const msg = validateStoreStep1(form);
|
||||||
|
|
||||||
if (msg) {
|
if (msg) {
|
||||||
reportFormError(msg);
|
reportStepError(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,19 +322,32 @@ export default function StoreCreatePage() {
|
|||||||
const msg = validateStoreStep2(form);
|
const msg = validateStoreStep2(form);
|
||||||
|
|
||||||
if (msg) {
|
if (msg) {
|
||||||
reportFormError(msg);
|
reportStepError(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (step === 3) {
|
||||||
|
const msg = validateStoreStep3(form);
|
||||||
|
if (msg) {
|
||||||
|
if (isPhoneValidationMessage(msg)) {
|
||||||
|
setFieldErrors({ phone: msg });
|
||||||
|
reportStepError(msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reportStepError(msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
goStep(step + 1);
|
goStep(step + 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function submit() {
|
async function submit(skipPackages = false) {
|
||||||
|
|
||||||
const msg = validateStoreStep3(form);
|
const msg = validateStoreStep3(form);
|
||||||
|
|
||||||
@@ -337,6 +360,15 @@ export default function StoreCreatePage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const packagesToSubmit = skipPackages ? [] : form.packages || [];
|
||||||
|
if (!skipPackages) {
|
||||||
|
const pkgMsg = validatePackageFormItems(packagesToSubmit);
|
||||||
|
if (pkgMsg) {
|
||||||
|
reportFormError(pkgMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const step1Msg = validateStoreStep1(form);
|
const step1Msg = validateStoreStep1(form);
|
||||||
|
|
||||||
if (step1Msg) {
|
if (step1Msg) {
|
||||||
@@ -472,6 +504,15 @@ export default function StoreCreatePage() {
|
|||||||
|
|
||||||
draftSaveDisabledRef.current = true;
|
draftSaveDisabledRef.current = true;
|
||||||
clearAllStoreDrafts(accountId);
|
clearAllStoreDrafts(accountId);
|
||||||
|
const packages = normalizePackageFormItems(packagesToSubmit);
|
||||||
|
if (packages.length) {
|
||||||
|
await request('PARTNER_H5', `/partner/stores/${result.store.id}/packages`, {
|
||||||
|
method: 'PUT',
|
||||||
|
body: JSON.stringify({
|
||||||
|
packages: packages.map((p) => ({ ...p, price: Number(p.price).toFixed(2) })),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
setForm(defaultStoreForm());
|
setForm(defaultStoreForm());
|
||||||
setFieldErrors({});
|
setFieldErrors({});
|
||||||
setSubmitError('');
|
setSubmitError('');
|
||||||
@@ -496,7 +537,7 @@ export default function StoreCreatePage() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const progress = step === 1 ? 0 : step === 2 ? 50 : 100;
|
const progress = step === 1 ? 0 : step === 2 ? 33 : step === 3 ? 66 : 100;
|
||||||
|
|
||||||
const nextDisabled = submitting;
|
const nextDisabled = submitting;
|
||||||
|
|
||||||
@@ -919,7 +960,7 @@ export default function StoreCreatePage() {
|
|||||||
|
|
||||||
<h3 className="headline-md">环境照片 <span className="text-primary">*</span></h3>
|
<h3 className="headline-md">环境照片 <span className="text-primary">*</span></h3>
|
||||||
|
|
||||||
<p className="label-md text-muted" style={{ margin: '4px 0 12px' }}>至少 3 张,展示店内整洁环境</p>
|
<p className="label-md text-muted" style={{ margin: '4px 0 12px' }}>至少 {MIN_ENV_PHOTO_COUNT} 张,展示店内整洁环境</p>
|
||||||
|
|
||||||
<div className="partner-upload-grid">
|
<div className="partner-upload-grid">
|
||||||
|
|
||||||
@@ -945,6 +986,17 @@ export default function StoreCreatePage() {
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="partner-btn-outline"
|
||||||
|
style={{ width: '100%', marginTop: 12 }}
|
||||||
|
onClick={() =>
|
||||||
|
setForm((prev) => ({ ...prev, envPhotoUrls: addEnvPhotoSlot(prev.envPhotoUrls) }))
|
||||||
|
}
|
||||||
|
>
|
||||||
|
添加环境照片
|
||||||
|
</button>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
@@ -1096,6 +1148,26 @@ export default function StoreCreatePage() {
|
|||||||
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{step === 4 && (
|
||||||
|
<>
|
||||||
|
<section className="partner-form-card">
|
||||||
|
<div className="partner-section-title">
|
||||||
|
<div className="partner-section-bar" />
|
||||||
|
<h2 className="headline-md">门店套餐</h2>
|
||||||
|
</div>
|
||||||
|
<p className="label-md text-muted" style={{ marginBottom: 16 }}>
|
||||||
|
可选填写;提交后将进入总部审核。也可在最后一页点击「跳过」。
|
||||||
|
</p>
|
||||||
|
<StorePackagesForm
|
||||||
|
items={form.packages?.length ? form.packages : [{ name: '', price: '', dishes: '', usableTime: '', otherNotes: '', sortOrder: 0 }]}
|
||||||
|
onChange={(packages) => setForm((prev) => ({ ...prev, packages }))}
|
||||||
|
disabled={submitting}
|
||||||
|
embedded
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<footer className="partner-sticky-footer">
|
<footer className="partner-sticky-footer">
|
||||||
@@ -1110,7 +1182,7 @@ export default function StoreCreatePage() {
|
|||||||
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{step < 3 ? (
|
{step < 4 ? (
|
||||||
|
|
||||||
<button type="button" className="partner-btn-primary" onClick={() => void handleNext()} disabled={nextDisabled}>
|
<button type="button" className="partner-btn-primary" onClick={() => void handleNext()} disabled={nextDisabled}>
|
||||||
|
|
||||||
@@ -1122,16 +1194,37 @@ export default function StoreCreatePage() {
|
|||||||
|
|
||||||
) : (
|
) : (
|
||||||
|
|
||||||
<button type="button" className="partner-btn-primary" onClick={() => void submit()} disabled={submitting}>
|
<>
|
||||||
|
<button type="button" className="partner-btn-outline" onClick={() => void submit(true)} disabled={submitting}>
|
||||||
|
跳过
|
||||||
|
</button>
|
||||||
|
<button type="button" className="partner-btn-primary" onClick={() => void submit(false)} disabled={submitting}>
|
||||||
|
|
||||||
{submitting ? '提交中…' : '提交'}
|
{submitting ? '提交中…' : '提交'}
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
|
</>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
{stepErrorModal ? (
|
||||||
|
<div className="partner-ship-modal-backdrop" role="presentation" onClick={() => setStepErrorModal(null)}>
|
||||||
|
<div className="partner-ship-modal" role="dialog" aria-modal="true" onClick={(e) => e.stopPropagation()}>
|
||||||
|
<h3 className="headline-md" style={{ marginBottom: 8 }}>请完善信息</h3>
|
||||||
|
<p className="body-md text-muted" style={{ lineHeight: 1.6, whiteSpace: 'pre-wrap' }}>
|
||||||
|
{stepErrorModal}
|
||||||
|
</p>
|
||||||
|
<div className="partner-ship-actions">
|
||||||
|
<button type="button" className="partner-btn-primary" onClick={() => setStepErrorModal(null)}>
|
||||||
|
我知道了
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
<TencentLocPickerOverlay
|
<TencentLocPickerOverlay
|
||||||
open={mapPickerOpen}
|
open={mapPickerOpen}
|
||||||
onClose={() => setMapPickerOpen(false)}
|
onClose={() => setMapPickerOpen(false)}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { request } from '../lib/api';
|
|||||||
import { toastError, toastSuccess } from '../lib/toast';
|
import { toastError, toastSuccess } from '../lib/toast';
|
||||||
import { usePartnerSession } from '../contexts/PartnerSessionContext';
|
import { usePartnerSession } from '../contexts/PartnerSessionContext';
|
||||||
import { canManagePartnerStore } from '../lib/partnerAccess';
|
import { canManagePartnerStore } from '../lib/partnerAccess';
|
||||||
import { normalizeStringArray, patchEnvPhotoAt } from '../lib/storeDraft';
|
import { MIN_ENV_PHOTO_COUNT, normalizeStringArray, patchEnvPhotoAt, addEnvPhotoSlot } from '../lib/storeDraft';
|
||||||
import OssUploadField from '../components/OssUploadField';
|
import OssUploadField from '../components/OssUploadField';
|
||||||
import TencentLocPickerOverlay from '../components/TencentLocPickerOverlay';
|
import TencentLocPickerOverlay from '../components/TencentLocPickerOverlay';
|
||||||
import {
|
import {
|
||||||
@@ -16,9 +16,9 @@ import {
|
|||||||
storeStatusPillClass,
|
storeStatusPillClass,
|
||||||
type StoreStatusValue,
|
type StoreStatusValue,
|
||||||
} from '../lib/storeStatus';
|
} from '../lib/storeStatus';
|
||||||
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
|
|
||||||
const STATUS_OPTIONS: StoreStatusValue[] = ['OPEN', 'PAUSED', 'CLOSED'];
|
const STATUS_OPTIONS: StoreStatusValue[] = ['OPEN', 'PAUSED', 'CLOSED'];
|
||||||
const ENV_SLOT_COUNT = 3;
|
|
||||||
|
|
||||||
function uniqueEnvUrls(urls: string[]): string[] {
|
function uniqueEnvUrls(urls: string[]): string[] {
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
@@ -34,6 +34,7 @@ function uniqueEnvUrls(urls: string[]): string[] {
|
|||||||
|
|
||||||
export default function StoreDetailPage() {
|
export default function StoreDetailPage() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
usePartnerPageView('partner_store_detail_view', id ? { storeId: id } : undefined);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { account } = usePartnerSession();
|
const { account } = usePartnerSession();
|
||||||
const canMutate = canManagePartnerStore(account);
|
const canMutate = canManagePartnerStore(account);
|
||||||
@@ -81,7 +82,7 @@ export default function StoreDetailPage() {
|
|||||||
.map((m) => String(m.url || '')),
|
.map((m) => String(m.url || '')),
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
setEnvPhotoUrls(normalizeStringArray(envFromMedia, ENV_SLOT_COUNT));
|
setEnvPhotoUrls(normalizeStringArray(envFromMedia, MIN_ENV_PHOTO_COUNT));
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -196,8 +197,8 @@ export default function StoreDetailPage() {
|
|||||||
setActionError('请上传门头照');
|
setActionError('请上传门头照');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (nextEnv.length < ENV_SLOT_COUNT) {
|
if (nextEnv.length < MIN_ENV_PHOTO_COUNT) {
|
||||||
setActionError(`请上传至少 ${ENV_SLOT_COUNT} 张环境照片`);
|
setActionError(`请上传至少 ${MIN_ENV_PHOTO_COUNT} 张环境照片`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setMediaSaving(true);
|
setMediaSaving(true);
|
||||||
@@ -277,6 +278,18 @@ export default function StoreDetailPage() {
|
|||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
{canMutate && !auditPending && status !== 'CLOSED' && (
|
||||||
|
<section className="partner-form-card" style={{ margin: '0 0 16px' }}>
|
||||||
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||||
|
<h3 className="label-md text-muted" style={{ textTransform: 'uppercase', letterSpacing: '0.1em' }}>门店套餐</h3>
|
||||||
|
<button type="button" className="partner-btn-outline" onClick={() => navigate(`/stores/${id}/packages`)}>
|
||||||
|
编辑套餐
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<p className="label-md text-muted" style={{ marginTop: 8 }}>维护可核销套餐信息,提交后由总部审核。</p>
|
||||||
|
</section>
|
||||||
|
)}
|
||||||
|
|
||||||
{canMutate && (
|
{canMutate && (
|
||||||
<section className="partner-form-card" style={{ margin: '0 0 16px' }}>
|
<section className="partner-form-card" style={{ margin: '0 0 16px' }}>
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
|
||||||
@@ -388,7 +401,7 @@ export default function StoreDetailPage() {
|
|||||||
<h3 className="headline-md" style={{ borderLeft: '4px solid var(--color-heritage-red)', paddingLeft: 12 }}>店内环境</h3>
|
<h3 className="headline-md" style={{ borderLeft: '4px solid var(--color-heritage-red)', paddingLeft: 12 }}>店内环境</h3>
|
||||||
<span className="label-md text-muted">
|
<span className="label-md text-muted">
|
||||||
{canMutate && !readOnly
|
{canMutate && !readOnly
|
||||||
? `需 ${ENV_SLOT_COUNT} 张 · 已选 ${uniqueEnvUrls(envPhotoUrls).length} 张`
|
? `至少 ${MIN_ENV_PHOTO_COUNT} 张 · 已选 ${uniqueEnvUrls(envPhotoUrls).length} 张`
|
||||||
: envPhotos.length
|
: envPhotos.length
|
||||||
? `已上传 ${envPhotos.length} 张`
|
? `已上传 ${envPhotos.length} 张`
|
||||||
: '暂无照片'}
|
: '暂无照片'}
|
||||||
@@ -408,6 +421,14 @@ export default function StoreDetailPage() {
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="partner-btn-outline"
|
||||||
|
style={{ width: '100%', marginTop: 12 }}
|
||||||
|
onClick={() => setEnvPhotoUrls((prev) => addEnvPhotoSlot(prev))}
|
||||||
|
>
|
||||||
|
添加环境照片
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="partner-btn-outline"
|
className="partner-btn-outline"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
storeStatusPillClass,
|
storeStatusPillClass,
|
||||||
type StoreStatusValue,
|
type StoreStatusValue,
|
||||||
} from '../lib/storeStatus';
|
} from '../lib/storeStatus';
|
||||||
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
|
|
||||||
type StatusFilter = 'ALL' | StoreStatusValue | 'PENDING_AUDIT' | 'REJECTED';
|
type StatusFilter = 'ALL' | StoreStatusValue | 'PENDING_AUDIT' | 'REJECTED';
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ const FILTERS: { key: StatusFilter; label: string }[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export default function StoreListPage() {
|
export default function StoreListPage() {
|
||||||
|
usePartnerPageView('partner_store_list_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const { account } = usePartnerSession();
|
const { account } = usePartnerSession();
|
||||||
|
|||||||
@@ -0,0 +1,143 @@
|
|||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
|
import type { StorePackagesResponse } from '@dukang/shared-types';
|
||||||
|
import StorePackagesForm from '../components/StorePackagesForm';
|
||||||
|
import { request } from '../lib/api';
|
||||||
|
import { toastError, toastSuccess } from '../lib/toast';
|
||||||
|
import {
|
||||||
|
emptyPackage,
|
||||||
|
normalizePackageFormItems,
|
||||||
|
validatePackageFormItems,
|
||||||
|
type PackageFormItem,
|
||||||
|
} from '../lib/storePackages';
|
||||||
|
|
||||||
|
export default function StorePackagesPage() {
|
||||||
|
const { id } = useParams();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [items, setItems] = useState<PackageFormItem[]>([emptyPackage()]);
|
||||||
|
const [pending, setPending] = useState<StorePackagesResponse['pendingRequest']>(null);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [submitting, setSubmitting] = useState(false);
|
||||||
|
const [error, setError] = useState('');
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!id) return;
|
||||||
|
setLoading(true);
|
||||||
|
request<StorePackagesResponse>('PARTNER_H5', `/partner/stores/${id}/packages`)
|
||||||
|
.then((data) => {
|
||||||
|
const base = data.pendingRequest?.packages?.length
|
||||||
|
? data.pendingRequest.packages
|
||||||
|
: data.live?.length
|
||||||
|
? data.live
|
||||||
|
: [emptyPackage()];
|
||||||
|
setItems(base.map((p, i) => ({ ...p, price: String(p.price), sortOrder: i })));
|
||||||
|
setPending(data.pendingRequest ?? null);
|
||||||
|
})
|
||||||
|
.catch((e) => setError(e instanceof Error ? e.message : '加载失败'))
|
||||||
|
.finally(() => setLoading(false));
|
||||||
|
}, [id]);
|
||||||
|
|
||||||
|
async function submitAudit() {
|
||||||
|
if (!id) return;
|
||||||
|
const msg = validatePackageFormItems(items);
|
||||||
|
if (msg) {
|
||||||
|
toastError(msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pending?.status === 'PENDING') {
|
||||||
|
toastError('已有套餐变更审核中,请等待总部处理');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setSubmitting(true);
|
||||||
|
try {
|
||||||
|
const packages = normalizePackageFormItems(items).map((p) => ({
|
||||||
|
...p,
|
||||||
|
price: Number(p.price).toFixed(2),
|
||||||
|
}));
|
||||||
|
await request('PARTNER_H5', `/partner/stores/${id}/packages`, {
|
||||||
|
method: 'PUT',
|
||||||
|
body: JSON.stringify({ packages }),
|
||||||
|
});
|
||||||
|
toastSuccess('已提交审核');
|
||||||
|
navigate(`/stores/${id}`);
|
||||||
|
} catch (e) {
|
||||||
|
toastError(e instanceof Error ? e.message : '提交失败');
|
||||||
|
} finally {
|
||||||
|
setSubmitting(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className="partner-detail-page partner-home--flush-top">
|
||||||
|
<main style={{ padding: '24px 20px' }}>
|
||||||
|
<p className="label-md text-muted">加载中…</p>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="partner-page-sticky partner-home--flush-top">
|
||||||
|
<header className="partner-packages-page-header">
|
||||||
|
<button type="button" className="partner-packages-back" onClick={() => navigate(`/stores/${id}`)}>
|
||||||
|
<span className="material-symbols-outlined">arrow_back</span>
|
||||||
|
</button>
|
||||||
|
<h1 className="headline-md">门店套餐</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main className="partner-packages-page-main">
|
||||||
|
{error ? <p className="partner-form-error" role="alert">{error}</p> : null}
|
||||||
|
|
||||||
|
{pending?.status === 'PENDING' ? (
|
||||||
|
<div className="partner-info-banner">
|
||||||
|
<span className="material-symbols-outlined" style={{ color: 'var(--color-heritage-red)' }}>hourglass_top</span>
|
||||||
|
<p className="body-md">套餐变更审核中,C 端仍展示上一版生效套餐。</p>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{pending?.status === 'REJECTED' && pending.rejectReason ? (
|
||||||
|
<div className="partner-info-banner" style={{ background: 'rgba(180,35,24,0.06)', borderColor: 'rgba(180,35,24,0.15)' }}>
|
||||||
|
<span className="material-symbols-outlined" style={{ color: 'var(--color-heritage-red)' }}>error</span>
|
||||||
|
<p className="body-md">上次驳回:{pending.rejectReason}</p>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<section className="partner-form-card">
|
||||||
|
<div className="partner-section-title">
|
||||||
|
<div className="partner-section-bar" />
|
||||||
|
<h2 className="headline-md">套餐信息</h2>
|
||||||
|
</div>
|
||||||
|
<p className="label-md text-muted" style={{ marginBottom: 16 }}>
|
||||||
|
提交后将由总部审核,通过后 C 端展示生效套餐。
|
||||||
|
</p>
|
||||||
|
<StorePackagesForm
|
||||||
|
items={items}
|
||||||
|
onChange={setItems}
|
||||||
|
disabled={pending?.status === 'PENDING' || submitting}
|
||||||
|
embedded
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer className="partner-sticky-footer">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="partner-btn-outline"
|
||||||
|
onClick={() => navigate(`/stores/${id}`)}
|
||||||
|
disabled={submitting}
|
||||||
|
>
|
||||||
|
返回
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="partner-btn-primary"
|
||||||
|
disabled={submitting || pending?.status === 'PENDING'}
|
||||||
|
onClick={() => void submitAudit()}
|
||||||
|
>
|
||||||
|
{submitting ? '提交中…' : '提交审核'}
|
||||||
|
</button>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import type { PartnerWeeklyReportResponse } from '@dukang/shared-types';
|
|||||||
import PageHeader from '@dukang/shared-ui/PageHeader';
|
import PageHeader from '@dukang/shared-ui/PageHeader';
|
||||||
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
||||||
import { fetchPartnerWeeklyReport } from '../lib/weeklyReport';
|
import { fetchPartnerWeeklyReport } from '../lib/weeklyReport';
|
||||||
|
import { usePartnerPageView } from '../lib/usePageView';
|
||||||
|
|
||||||
function fmtMoney(n: number) {
|
function fmtMoney(n: number) {
|
||||||
return n.toLocaleString('zh-CN', { minimumFractionDigits: 0, maximumFractionDigits: 0 });
|
return n.toLocaleString('zh-CN', { minimumFractionDigits: 0, maximumFractionDigits: 0 });
|
||||||
@@ -15,6 +16,7 @@ function fmtGrowth(n: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function WeeklyReportPage() {
|
export default function WeeklyReportPage() {
|
||||||
|
usePartnerPageView('partner_weekly_report_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [selectedStart, setSelectedStart] = useState<string | undefined>();
|
const [selectedStart, setSelectedStart] = useState<string | undefined>();
|
||||||
const [data, setData] = useState<PartnerWeeklyReportResponse | null>(null);
|
const [data, setData] = useState<PartnerWeeklyReportResponse | null>(null);
|
||||||
|
|||||||
@@ -3634,3 +3634,107 @@ header:has(> .app-page-title:only-child),
|
|||||||
border: none !important;
|
border: none !important;
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ─── 门店套餐 ─── */
|
||||||
|
.partner-packages-page-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 12px var(--space-page) 8px;
|
||||||
|
background: var(--color-surface);
|
||||||
|
border-bottom: 1px solid rgba(226, 190, 188, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-back {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--color-on-surface);
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-page-main {
|
||||||
|
padding-bottom: 88px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-form--embedded .partner-packages-item {
|
||||||
|
margin-bottom: var(--space-md);
|
||||||
|
box-shadow: none;
|
||||||
|
border: 1px solid rgba(226, 190, 188, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-form--embedded .partner-packages-item:last-of-type {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-item-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: var(--space-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-item--collapsed .partner-packages-item-head {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-toggle {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
padding: 0;
|
||||||
|
color: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: left;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-toggle .material-symbols-outlined {
|
||||||
|
font-size: 20px;
|
||||||
|
color: var(--color-on-surface-variant, #666);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-toggle .headline-md {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-remove {
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--color-heritage-red);
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 4px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-add {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 6px;
|
||||||
|
width: calc(100% - var(--space-page) * 2);
|
||||||
|
margin: 0 var(--space-page) var(--space-md);
|
||||||
|
min-height: 48px;
|
||||||
|
border: 1px dashed rgba(166, 29, 36, 0.35);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
background: rgba(166, 29, 36, 0.04);
|
||||||
|
color: var(--color-heritage-red);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-add .material-symbols-outlined {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partner-packages-form:not(.partner-packages-form--embedded) .partner-packages-item {
|
||||||
|
margin-left: var(--space-page);
|
||||||
|
margin-right: var(--space-page);
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"lint": "echo ok"
|
"lint": "echo ok"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@dukang/client-logging": "workspace:*",
|
||||||
"@dukang/shared-ui": "workspace:*",
|
"@dukang/shared-ui": "workspace:*",
|
||||||
"@dukang/shared-types": "workspace:*",
|
"@dukang/shared-types": "workspace:*",
|
||||||
"@dukang/weixin-sdk": "workspace:*",
|
"@dukang/weixin-sdk": "workspace:*",
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import StatusPage from './pages/StatusPage';
|
|||||||
import MinePage from './pages/MinePage';
|
import MinePage from './pages/MinePage';
|
||||||
import StaffPage from './pages/StaffPage';
|
import StaffPage from './pages/StaffPage';
|
||||||
import WithdrawPage from './pages/WithdrawPage';
|
import WithdrawPage from './pages/WithdrawPage';
|
||||||
|
import PackagesPage from './pages/PackagesPage';
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return (
|
return (
|
||||||
@@ -24,6 +25,7 @@ export default function App() {
|
|||||||
<Route path="/select-store" element={<SelectStorePage />} />
|
<Route path="/select-store" element={<SelectStorePage />} />
|
||||||
<Route path="/staff" element={<StaffPage />} />
|
<Route path="/staff" element={<StaffPage />} />
|
||||||
<Route path="/withdraw" element={<WithdrawPage />} />
|
<Route path="/withdraw" element={<WithdrawPage />} />
|
||||||
|
<Route path="/packages" element={<PackagesPage />} />
|
||||||
<Route path="/redeem" element={<RedeemConfirmPage />} />
|
<Route path="/redeem" element={<RedeemConfirmPage />} />
|
||||||
<Route path="/redeem/phone" element={<PhoneRedeemPage />} />
|
<Route path="/redeem/phone" element={<PhoneRedeemPage />} />
|
||||||
<Route path="/redeem/success" element={<RedeemSuccessPage />} />
|
<Route path="/redeem/success" element={<RedeemSuccessPage />} />
|
||||||
|
|||||||
@@ -0,0 +1,143 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import { STORE_PACKAGE_MAX_COUNT } from '@dukang/shared-types';
|
||||||
|
import { emptyPackage, type PackageFormItem } from '../lib/storePackages';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
items: PackageFormItem[];
|
||||||
|
onChange: (items: PackageFormItem[]) => void;
|
||||||
|
disabled?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function ShopPackagesForm({ items, onChange, disabled }: Props) {
|
||||||
|
const [collapsed, setCollapsed] = useState<Record<number, boolean>>({});
|
||||||
|
|
||||||
|
function updateAt(index: number, patch: Partial<PackageFormItem>) {
|
||||||
|
onChange(items.map((item, i) => (i === index ? { ...item, ...patch } : item)));
|
||||||
|
}
|
||||||
|
|
||||||
|
function addItem() {
|
||||||
|
if (items.length >= STORE_PACKAGE_MAX_COUNT) return;
|
||||||
|
onChange([...items, emptyPackage(items.length)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeAt(index: number) {
|
||||||
|
onChange(items.filter((_, i) => i !== index).map((item, i) => ({ ...item, sortOrder: i })));
|
||||||
|
setCollapsed((prev) => {
|
||||||
|
const next: Record<number, boolean> = {};
|
||||||
|
Object.entries(prev).forEach(([k, v]) => {
|
||||||
|
const i = Number(k);
|
||||||
|
if (i < index) next[i] = v;
|
||||||
|
else if (i > index) next[i - 1] = v;
|
||||||
|
});
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleCollapse(index: number) {
|
||||||
|
setCollapsed((prev) => ({ ...prev, [index]: !prev[index] }));
|
||||||
|
}
|
||||||
|
|
||||||
|
const list = items.length ? items : [emptyPackage(0)];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="shop-packages-form">
|
||||||
|
{list.map((item, index) => {
|
||||||
|
const isCollapsed = !!collapsed[index];
|
||||||
|
const displayName = item.name.trim() || `套餐 ${index + 1}`;
|
||||||
|
return (
|
||||||
|
<section key={index} className={`shop-packages-card${isCollapsed ? ' shop-packages-card--collapsed' : ''}`}>
|
||||||
|
<div className="shop-packages-card-head">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="shop-packages-toggle"
|
||||||
|
onClick={() => toggleCollapse(index)}
|
||||||
|
aria-expanded={!isCollapsed}
|
||||||
|
aria-label={isCollapsed ? '展开套餐' : '收起套餐'}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-outlined">
|
||||||
|
{isCollapsed ? 'expand_more' : 'expand_less'}
|
||||||
|
</span>
|
||||||
|
<span className="shop-packages-card-title">{displayName}</span>
|
||||||
|
</button>
|
||||||
|
{!disabled && list.length > 1 ? (
|
||||||
|
<button type="button" className="shop-packages-remove" onClick={() => removeAt(index)}>
|
||||||
|
删除
|
||||||
|
</button>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{!isCollapsed ? (
|
||||||
|
<>
|
||||||
|
<label className="shop-packages-field">
|
||||||
|
<span className="shop-packages-label">套餐名称 *</span>
|
||||||
|
<input
|
||||||
|
className="shop-packages-input"
|
||||||
|
placeholder="如:套餐A"
|
||||||
|
value={item.name}
|
||||||
|
disabled={disabled}
|
||||||
|
onChange={(e) => updateAt(index, { name: e.target.value })}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label className="shop-packages-field">
|
||||||
|
<span className="shop-packages-label">价格(元) *</span>
|
||||||
|
<input
|
||||||
|
className="shop-packages-input"
|
||||||
|
type="number"
|
||||||
|
min={0}
|
||||||
|
step={0.01}
|
||||||
|
placeholder="198"
|
||||||
|
value={item.price}
|
||||||
|
disabled={disabled}
|
||||||
|
onChange={(e) => updateAt(index, { price: e.target.value })}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label className="shop-packages-field">
|
||||||
|
<span className="shop-packages-label">菜品 *</span>
|
||||||
|
<textarea
|
||||||
|
className="shop-packages-textarea"
|
||||||
|
rows={3}
|
||||||
|
placeholder="红烧肉、红烧鱼、油焖茄子"
|
||||||
|
value={item.dishes}
|
||||||
|
disabled={disabled}
|
||||||
|
onChange={(e) => updateAt(index, { dishes: e.target.value })}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label className="shop-packages-field">
|
||||||
|
<span className="shop-packages-label">使用时间</span>
|
||||||
|
<input
|
||||||
|
className="shop-packages-input"
|
||||||
|
placeholder="节假日除外"
|
||||||
|
value={item.usableTime || ''}
|
||||||
|
disabled={disabled}
|
||||||
|
onChange={(e) => updateAt(index, { usableTime: e.target.value })}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label className="shop-packages-field">
|
||||||
|
<span className="shop-packages-label">其他说明</span>
|
||||||
|
<input
|
||||||
|
className="shop-packages-input"
|
||||||
|
placeholder="不可叠加"
|
||||||
|
value={item.otherNotes || ''}
|
||||||
|
disabled={disabled}
|
||||||
|
onChange={(e) => updateAt(index, { otherNotes: e.target.value })}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
|
||||||
|
{!disabled && list.length < STORE_PACKAGE_MAX_COUNT ? (
|
||||||
|
<button type="button" className="shop-packages-add" onClick={addItem}>
|
||||||
|
<span className="material-symbols-outlined">add_circle</span>
|
||||||
|
添加套餐
|
||||||
|
</button>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { createStoreTracker } from '@dukang/client-logging';
|
||||||
|
import { apiBase } from './api';
|
||||||
|
|
||||||
|
const tracker = createStoreTracker({
|
||||||
|
apiBase,
|
||||||
|
clientApp: 'SHOP_H5',
|
||||||
|
getToken: () => localStorage.getItem('shopAccessToken'),
|
||||||
|
getStoreId: () => {
|
||||||
|
try {
|
||||||
|
const raw = localStorage.getItem('shopSession');
|
||||||
|
if (!raw) return null;
|
||||||
|
const parsed = JSON.parse(raw) as { storeId?: string };
|
||||||
|
return parsed.storeId ?? null;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export function trackStore(eventName: string, params?: Record<string, unknown>) {
|
||||||
|
tracker.track(eventName, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function trackStorePageView(eventName: string, params?: Record<string, unknown>) {
|
||||||
|
tracker.trackPageView(eventName, params);
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import type { StorePackageItemDto } from '@dukang/shared-types';
|
||||||
|
import { STORE_PACKAGE_MAX_COUNT } from '@dukang/shared-types';
|
||||||
|
|
||||||
|
export type PackageFormItem = StorePackageItemDto;
|
||||||
|
|
||||||
|
export function emptyPackage(index = 0): PackageFormItem {
|
||||||
|
return {
|
||||||
|
name: '',
|
||||||
|
price: '',
|
||||||
|
dishes: '',
|
||||||
|
usableTime: '',
|
||||||
|
otherNotes: '',
|
||||||
|
sortOrder: index,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizePackageFormItems(raw: PackageFormItem[]): PackageFormItem[] {
|
||||||
|
return raw
|
||||||
|
.map((item, index) => ({
|
||||||
|
name: item.name.trim(),
|
||||||
|
price: item.price.trim(),
|
||||||
|
dishes: item.dishes.trim(),
|
||||||
|
usableTime: item.usableTime?.trim() || '',
|
||||||
|
otherNotes: item.otherNotes?.trim() || '',
|
||||||
|
sortOrder: index,
|
||||||
|
}))
|
||||||
|
.filter((item) => item.name || item.price || item.dishes || item.usableTime || item.otherNotes);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function validatePackageFormItems(items: PackageFormItem[]): string | null {
|
||||||
|
const filled = normalizePackageFormItems(items);
|
||||||
|
if (filled.length > STORE_PACKAGE_MAX_COUNT) {
|
||||||
|
return `套餐最多 ${STORE_PACKAGE_MAX_COUNT} 条`;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < filled.length; i++) {
|
||||||
|
const item = filled[i];
|
||||||
|
if (!item.name) return `第 ${i + 1} 条套餐名称不能为空`;
|
||||||
|
const price = Number(item.price);
|
||||||
|
if (!Number.isFinite(price) || price < 0) return `第 ${i + 1} 条套餐价格须为非负数字`;
|
||||||
|
if (!item.dishes) return `第 ${i + 1} 条套餐菜品不能为空`;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { useEffect, useRef } from 'react';
|
||||||
|
import { trackStorePageView } from './analytics';
|
||||||
|
|
||||||
|
export function useStorePageView(eventName: string, params?: Record<string, unknown>) {
|
||||||
|
const fired = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (fired.current) return;
|
||||||
|
fired.current = true;
|
||||||
|
trackStorePageView(eventName, params);
|
||||||
|
}, [eventName, params]);
|
||||||
|
}
|
||||||
@@ -3,12 +3,17 @@ import ReactDOM from 'react-dom/client';
|
|||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
import { getRouterBasename } from '@dukang/weixin-sdk';
|
import { getRouterBasename } from '@dukang/weixin-sdk';
|
||||||
import { StoreSessionProvider } from './contexts/StoreSessionContext';
|
import { StoreSessionProvider } from './contexts/StoreSessionContext';
|
||||||
import { installClientErrorReporting } from './lib/client-error';
|
import { installClientErrorReporting } from '@dukang/client-logging';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
|
import { apiBase } from './lib/api';
|
||||||
import './styles.css';
|
import './styles.css';
|
||||||
import './styles/legal.css';
|
import './styles/legal.css';
|
||||||
|
|
||||||
installClientErrorReporting();
|
installClientErrorReporting({
|
||||||
|
apiBase,
|
||||||
|
clientApp: 'SHOP_H5',
|
||||||
|
getToken: () => localStorage.getItem('shopAccessToken'),
|
||||||
|
});
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import {
|
|||||||
import { isWechatEnv, weixinSdk } from '../lib/weixin';
|
import { isWechatEnv, weixinSdk } from '../lib/weixin';
|
||||||
import { stripOAuthParamsFromLocation } from '@dukang/weixin-sdk';
|
import { stripOAuthParamsFromLocation } from '@dukang/weixin-sdk';
|
||||||
import WechatScanAuthModal from '../components/WechatScanAuthModal';
|
import WechatScanAuthModal from '../components/WechatScanAuthModal';
|
||||||
|
import { useStorePageView } from '../lib/usePageView';
|
||||||
|
import { trackStore } from '../lib/analytics';
|
||||||
|
|
||||||
const PENDING_SCAN_KEY = 'shop_pending_scan';
|
const PENDING_SCAN_KEY = 'shop_pending_scan';
|
||||||
|
|
||||||
@@ -33,6 +35,7 @@ function formatScanError(e: unknown): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
|
useStorePageView('store_home_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { applySession } = useStoreSession();
|
const { applySession } = useStoreSession();
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
@@ -74,6 +77,7 @@ export default function HomePage() {
|
|||||||
}, [loadDashboard]);
|
}, [loadDashboard]);
|
||||||
|
|
||||||
async function runScan(opts?: { postAuthWarmup?: boolean }) {
|
async function runScan(opts?: { postAuthWarmup?: boolean }) {
|
||||||
|
trackStore('store_redeem_scan_start');
|
||||||
if (!isWechatEnv()) {
|
if (!isWechatEnv()) {
|
||||||
setScanMsg('请在微信内打开门店端进行扫码核销');
|
setScanMsg('请在微信内打开门店端进行扫码核销');
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -13,8 +13,10 @@ import {
|
|||||||
handleShopWechatLoginResult,
|
handleShopWechatLoginResult,
|
||||||
} from '../lib/wechat-auth';
|
} from '../lib/wechat-auth';
|
||||||
import { isWechatEnv } from '../lib/weixin';
|
import { isWechatEnv } from '../lib/weixin';
|
||||||
|
import { useStorePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
export default function MinePage() {
|
export default function MinePage() {
|
||||||
|
useStorePageView('store_mine_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const { resetSession, store: sessionStore, applySession } = useStoreSession();
|
const { resetSession, store: sessionStore, applySession } = useStoreSession();
|
||||||
@@ -145,6 +147,12 @@ export default function MinePage() {
|
|||||||
<span className="material-symbols-outlined" style={{ fontSize: 20 }}>account_balance_wallet</span>
|
<span className="material-symbols-outlined" style={{ fontSize: 20 }}>account_balance_wallet</span>
|
||||||
结算提现
|
结算提现
|
||||||
</button>
|
</button>
|
||||||
|
{profile?.isPrimary ? (
|
||||||
|
<button type="button" className="shop-mine-action" onClick={() => navigate('/packages')}>
|
||||||
|
<span className="material-symbols-outlined" style={{ fontSize: 20 }}>restaurant_menu</span>
|
||||||
|
门店套餐
|
||||||
|
</button>
|
||||||
|
) : null}
|
||||||
{profile?.isPrimary ? (
|
{profile?.isPrimary ? (
|
||||||
<button type="button" className="shop-mine-action" onClick={() => navigate('/staff')}>
|
<button type="button" className="shop-mine-action" onClick={() => navigate('/staff')}>
|
||||||
<span className="material-symbols-outlined" style={{ fontSize: 20 }}>group</span>
|
<span className="material-symbols-outlined" style={{ fontSize: 20 }}>group</span>
|
||||||
|
|||||||
@@ -0,0 +1,143 @@
|
|||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import type { StorePackagesResponse } from '@dukang/shared-types';
|
||||||
|
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
||||||
|
import ShopPackagesForm from '../components/ShopPackagesForm';
|
||||||
|
import { request } from '../lib/api';
|
||||||
|
import { useStorePageView } from '../lib/usePageView';
|
||||||
|
import {
|
||||||
|
emptyPackage,
|
||||||
|
normalizePackageFormItems,
|
||||||
|
validatePackageFormItems,
|
||||||
|
type PackageFormItem,
|
||||||
|
} from '../lib/storePackages';
|
||||||
|
|
||||||
|
export default function PackagesPage() {
|
||||||
|
useStorePageView('store_packages_view');
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [items, setItems] = useState<PackageFormItem[]>([emptyPackage()]);
|
||||||
|
const [pending, setPending] = useState<StorePackagesResponse['pendingRequest']>(null);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [submitting, setSubmitting] = useState(false);
|
||||||
|
const [msg, setMsg] = useState('');
|
||||||
|
|
||||||
|
async function load() {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
const data = await request<StorePackagesResponse>('SHOP_H5', '/shop/store/packages');
|
||||||
|
const base = data.pendingRequest?.packages?.length
|
||||||
|
? data.pendingRequest.packages
|
||||||
|
: data.live?.length
|
||||||
|
? data.live
|
||||||
|
: [emptyPackage()];
|
||||||
|
setItems(base.map((p, i) => ({ ...p, price: String(p.price), sortOrder: i })));
|
||||||
|
setPending(data.pendingRequest ?? null);
|
||||||
|
setMsg('');
|
||||||
|
} catch (e) {
|
||||||
|
setMsg(e instanceof Error ? e.message : '加载失败');
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
void load();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
async function submitAudit() {
|
||||||
|
const validationMsg = validatePackageFormItems(items);
|
||||||
|
if (validationMsg) {
|
||||||
|
setMsg(validationMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pending?.status === 'PENDING') {
|
||||||
|
setMsg('已有套餐变更审核中,请等待总部处理');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setSubmitting(true);
|
||||||
|
setMsg('');
|
||||||
|
try {
|
||||||
|
const packages = normalizePackageFormItems(items).map((p) => ({
|
||||||
|
...p,
|
||||||
|
price: Number(p.price).toFixed(2),
|
||||||
|
}));
|
||||||
|
await request('SHOP_H5', '/shop/store/packages', {
|
||||||
|
method: 'PUT',
|
||||||
|
body: JSON.stringify({ packages }),
|
||||||
|
});
|
||||||
|
setMsg('已提交审核,请等待总部处理');
|
||||||
|
await load();
|
||||||
|
} catch (e) {
|
||||||
|
setMsg(e instanceof Error ? e.message : '提交失败');
|
||||||
|
} finally {
|
||||||
|
setSubmitting(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const disabled = pending?.status === 'PENDING' || submitting;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PullToRefresh onRefresh={load} className="shop-records-page shop-packages-page">
|
||||||
|
<header className="shop-records-header" style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="shop-withdraw-back"
|
||||||
|
onClick={() => navigate('/mine')}
|
||||||
|
aria-label="返回"
|
||||||
|
>
|
||||||
|
<span className="material-symbols-outlined" style={{ fontSize: 22 }}>
|
||||||
|
arrow_back
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<h1 className="app-page-title" style={{ margin: 0 }}>
|
||||||
|
门店套餐
|
||||||
|
</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div className="shop-records-main">
|
||||||
|
{loading ? <p className="shop-records-empty">加载中…</p> : null}
|
||||||
|
|
||||||
|
{!loading && pending?.status === 'PENDING' ? (
|
||||||
|
<section className="shop-packages-notice">
|
||||||
|
<span className="material-symbols-outlined shop-fill-icon" style={{ fontSize: 18 }}>
|
||||||
|
hourglass_top
|
||||||
|
</span>
|
||||||
|
<p>套餐变更审核中,用户端仍展示上一版生效套餐。</p>
|
||||||
|
</section>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{!loading && pending?.status === 'REJECTED' && pending.rejectReason ? (
|
||||||
|
<section className="shop-packages-notice shop-packages-notice--warn">
|
||||||
|
<span className="material-symbols-outlined shop-fill-icon" style={{ fontSize: 18 }}>
|
||||||
|
error
|
||||||
|
</span>
|
||||||
|
<p>上次驳回:{pending.rejectReason}</p>
|
||||||
|
</section>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{!loading ? (
|
||||||
|
<>
|
||||||
|
<p className="shop-packages-intro">
|
||||||
|
维护门店可核销套餐信息,提交后由总部审核通过后在用户端展示。
|
||||||
|
</p>
|
||||||
|
<ShopPackagesForm items={items} onChange={setItems} disabled={disabled} />
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{msg ? <p className="shop-withdraw-msg">{msg}</p> : null}
|
||||||
|
|
||||||
|
{!loading ? (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="shop-withdraw-btn"
|
||||||
|
style={{ marginTop: 16 }}
|
||||||
|
disabled={disabled}
|
||||||
|
onClick={() => void submitAudit()}
|
||||||
|
>
|
||||||
|
{submitting ? '提交中…' : '提交审核'}
|
||||||
|
</button>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</PullToRefresh>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -2,12 +2,14 @@ import { useEffect, useState } from 'react';
|
|||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import type { RedeemPhoneDirectPrepareResult } from '@dukang/shared-types';
|
import type { RedeemPhoneDirectPrepareResult } from '@dukang/shared-types';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
|
import { useStorePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
function formatAmount(n: number) {
|
function formatAmount(n: number) {
|
||||||
return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function PhoneRedeemPage() {
|
export default function PhoneRedeemPage() {
|
||||||
|
useStorePageView('store_phone_redeem_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [phone, setPhone] = useState('');
|
const [phone, setPhone] = useState('');
|
||||||
const [amount, setAmount] = useState('');
|
const [amount, setAmount] = useState('');
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|||||||
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
||||||
import { REDEEM_CHANNEL_LABELS, type RedeemChannel, type RedeemStatsDto } from '@dukang/shared-types';
|
import { REDEEM_CHANNEL_LABELS, type RedeemChannel, type RedeemStatsDto } from '@dukang/shared-types';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
|
import { useStorePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
type RangeKey = 'today' | '7d' | '30d';
|
type RangeKey = 'today' | '7d' | '30d';
|
||||||
type StatusFilter = 'all' | 'pending' | 'paid';
|
type StatusFilter = 'all' | 'pending' | 'paid';
|
||||||
@@ -30,6 +31,7 @@ function channelLabel(channel: unknown): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function RecordsPage() {
|
export default function RecordsPage() {
|
||||||
|
useStorePageView('store_records_view');
|
||||||
const [records, setRecords] = useState<Array<Record<string, unknown>>>([]);
|
const [records, setRecords] = useState<Array<Record<string, unknown>>>([]);
|
||||||
const [range, setRange] = useState<RangeKey>('today');
|
const [range, setRange] = useState<RangeKey>('today');
|
||||||
const [statusFilter, setStatusFilter] = useState<StatusFilter>('all');
|
const [statusFilter, setStatusFilter] = useState<StatusFilter>('all');
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useNavigate, useSearchParams } from 'react-router-dom';
|
|||||||
import WeakNetFallbackPanel from '../components/WeakNetFallbackPanel';
|
import WeakNetFallbackPanel from '../components/WeakNetFallbackPanel';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
import { reportRedeemFailure } from '../lib/redeem-failure';
|
import { reportRedeemFailure } from '../lib/redeem-failure';
|
||||||
|
import { useStorePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
function formatAmount(n: number) {
|
function formatAmount(n: number) {
|
||||||
return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||||
@@ -17,6 +18,7 @@ type Preview = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function RedeemConfirmPage() {
|
export default function RedeemConfirmPage() {
|
||||||
|
useStorePageView('store_redeem_confirm_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const [token, setToken] = useState('');
|
const [token, setToken] = useState('');
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { STORE_STAFF_ROLE_LABELS, type StoreStaffRole } from '@dukang/shared-typ
|
|||||||
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
||||||
import { useStoreSession } from '../contexts/StoreSessionContext';
|
import { useStoreSession } from '../contexts/StoreSessionContext';
|
||||||
import { getStoreProfile, request } from '../lib/api';
|
import { getStoreProfile, request } from '../lib/api';
|
||||||
|
import { useStorePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
type StaffItem = {
|
type StaffItem = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -23,6 +24,7 @@ function maskPhone(phone: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function StaffPage() {
|
export default function StaffPage() {
|
||||||
|
useStorePageView('store_staff_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { store } = useStoreSession();
|
const { store } = useStoreSession();
|
||||||
const profile = store ?? getStoreProfile();
|
const profile = store ?? getStoreProfile();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
} from '@dukang/shared-types';
|
} from '@dukang/shared-types';
|
||||||
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
import PullToRefresh from '@dukang/shared-ui/PullToRefresh';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
|
import { useStorePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
type StatusFilter = 'all' | StoreWithdrawStatus;
|
type StatusFilter = 'all' | StoreWithdrawStatus;
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ function formatMoney(n: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function WithdrawPage() {
|
export default function WithdrawPage() {
|
||||||
|
useStorePageView('store_withdraw_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [summary, setSummary] = useState<StoreWithdrawSummaryDto | null>(null);
|
const [summary, setSummary] = useState<StoreWithdrawSummaryDto | null>(null);
|
||||||
const [items, setItems] = useState<StoreWithdrawRequestDto[]>([]);
|
const [items, setItems] = useState<StoreWithdrawRequestDto[]>([]);
|
||||||
|
|||||||
@@ -1920,6 +1920,165 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ─── 门店套餐 ─── */
|
||||||
|
.shop-packages-page .shop-records-main {
|
||||||
|
padding-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-intro {
|
||||||
|
margin: 0 0 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: var(--color-subtle-gray);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-notice {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
padding: 12px 14px;
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
background: rgba(46, 125, 50, 0.08);
|
||||||
|
border: 1px solid rgba(46, 125, 50, 0.15);
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: var(--color-on-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-notice--warn {
|
||||||
|
background: rgba(180, 35, 24, 0.06);
|
||||||
|
border-color: rgba(180, 35, 24, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-notice p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-card {
|
||||||
|
background: var(--color-card);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: 16px;
|
||||||
|
box-shadow: var(--shadow-card);
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-card-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-card--collapsed .shop-packages-card-head {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-toggle {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
padding: 0;
|
||||||
|
color: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: left;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-toggle .material-symbols-outlined {
|
||||||
|
font-size: 20px;
|
||||||
|
color: var(--color-on-surface-variant, #666);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-card-title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--color-on-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-remove {
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--color-heritage-red);
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-field {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-field:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--color-subtle-gray);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-input,
|
||||||
|
.shop-packages-textarea {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.08);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
background: var(--color-surface-container-low, #fafafa);
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--color-on-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-textarea {
|
||||||
|
resize: vertical;
|
||||||
|
min-height: 72px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-input:focus,
|
||||||
|
.shop-packages-textarea:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: var(--color-heritage-red);
|
||||||
|
box-shadow: 0 0 0 1px rgba(166, 29, 36, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-input:disabled,
|
||||||
|
.shop-packages-textarea:disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-add {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 6px;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 48px;
|
||||||
|
border: 1px dashed rgba(166, 29, 36, 0.35);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
background: rgba(166, 29, 36, 0.04);
|
||||||
|
color: var(--color-heritage-red);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shop-packages-add .material-symbols-outlined {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.shop-record-amounts {
|
.shop-record-amounts {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"lint": "echo ok"
|
"lint": "echo ok"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@dukang/client-logging": "workspace:*",
|
||||||
"@dukang/shared-types": "workspace:*",
|
"@dukang/shared-types": "workspace:*",
|
||||||
"@dukang/shared-ui": "workspace:*",
|
"@dukang/shared-ui": "workspace:*",
|
||||||
"@dukang/weixin-sdk": "workspace:*",
|
"@dukang/weixin-sdk": "workspace:*",
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
|
import { createUserTracker, getSessionId } from '@dukang/client-logging';
|
||||||
import { apiBase } from './api';
|
import { apiBase } from './api';
|
||||||
|
|
||||||
export function track(eventName: string, params?: Record<string, unknown>) {
|
const tracker = createUserTracker({
|
||||||
const token = localStorage.getItem('accessToken');
|
apiBase,
|
||||||
if (!token) return;
|
clientApp: 'USER_H5',
|
||||||
|
});
|
||||||
|
|
||||||
void fetch(`${apiBase}/analytics/events`, {
|
export { getSessionId };
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
export function track(eventName: string, params?: Record<string, unknown>) {
|
||||||
'Content-Type': 'application/json',
|
tracker.track(eventName, params);
|
||||||
Authorization: `Bearer ${token}`,
|
}
|
||||||
'X-Client-App': 'USER_H5',
|
|
||||||
},
|
export function trackPageView(eventName: string, params?: Record<string, unknown>) {
|
||||||
body: JSON.stringify({ events: [{ eventName, params }] }),
|
tracker.trackPageView(eventName, params);
|
||||||
}).catch(() => {});
|
}
|
||||||
|
|
||||||
|
export function initUserAnalytics() {
|
||||||
|
tracker.trackSessionStart();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { useEffect, useRef } from 'react';
|
||||||
|
import { trackPageView } from './analytics';
|
||||||
|
|
||||||
|
export function usePageView(eventName: string, params?: Record<string, unknown>) {
|
||||||
|
const fired = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (fired.current) return;
|
||||||
|
fired.current = true;
|
||||||
|
trackPageView(eventName, params);
|
||||||
|
}, [eventName, params]);
|
||||||
|
}
|
||||||
@@ -2,10 +2,16 @@ import React from 'react';
|
|||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
import { getRouterBasename } from '@dukang/weixin-sdk';
|
import { getRouterBasename } from '@dukang/weixin-sdk';
|
||||||
|
import { installClientErrorReporting } from '@dukang/client-logging';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
|
import { initUserAnalytics } from './lib/analytics';
|
||||||
|
import { apiBase } from './lib/api';
|
||||||
import './styles.css';
|
import './styles.css';
|
||||||
import './styles/legal.css';
|
import './styles/legal.css';
|
||||||
|
|
||||||
|
installClientErrorReporting({ apiBase, clientApp: 'USER_H5' });
|
||||||
|
initUserAnalytics();
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<BrowserRouter basename={getRouterBasename()}>
|
<BrowserRouter basename={getRouterBasename()}>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { request } from '../lib/api';
|
|||||||
import { buildAddressListUrl, readCheckoutContext } from '../lib/navigation';
|
import { buildAddressListUrl, readCheckoutContext } from '../lib/navigation';
|
||||||
import { DEFAULT_REGION, formatRegion } from '../lib/region-data';
|
import { DEFAULT_REGION, formatRegion } from '../lib/region-data';
|
||||||
import { normalizePhoneInput, validateMobilePhone } from '../lib/phone';
|
import { normalizePhoneInput, validateMobilePhone } from '../lib/phone';
|
||||||
|
import { usePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
type AddressForm = {
|
type AddressForm = {
|
||||||
receiverName: string;
|
receiverName: string;
|
||||||
@@ -21,6 +22,7 @@ export default function AddressEditPage() {
|
|||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const [params] = useSearchParams();
|
const [params] = useSearchParams();
|
||||||
const isEdit = Boolean(id);
|
const isEdit = Boolean(id);
|
||||||
|
usePageView('address_edit', { mode: isEdit ? 'edit' : 'create' });
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [pickerOpen, setPickerOpen] = useState(false);
|
const [pickerOpen, setPickerOpen] = useState(false);
|
||||||
const [saving, setSaving] = useState(false);
|
const [saving, setSaving] = useState(false);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import SubPageHeader from '../components/SubPageHeader';
|
|||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
import { useUserSession } from '../contexts/UserSessionContext';
|
import { useUserSession } from '../contexts/UserSessionContext';
|
||||||
import { buildAddressEditUrl, buildAddressListUrl, buildOrderConfirmUrl, hasCheckoutContext, readCheckoutContext } from '../lib/navigation';
|
import { buildAddressEditUrl, buildAddressListUrl, buildOrderConfirmUrl, hasCheckoutContext, readCheckoutContext } from '../lib/navigation';
|
||||||
|
import { usePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
type Address = {
|
type Address = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -25,6 +26,7 @@ function formatAddress(a: Address) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AddressListPage() {
|
export default function AddressListPage() {
|
||||||
|
usePageView('address_list_view');
|
||||||
const { profile } = useUserSession();
|
const { profile } = useUserSession();
|
||||||
const [list, setList] = useState<Address[]>([]);
|
const [list, setList] = useState<Address[]>([]);
|
||||||
const [pendingAddress, setPendingAddress] = useState<Address | null>(null);
|
const [pendingAddress, setPendingAddress] = useState<Address | null>(null);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
import { TICKET_TYPE_LABELS, type TicketTypeDto } from '@dukang/shared-types';
|
import { TICKET_TYPE_LABELS, type TicketTypeDto } from '@dukang/shared-types';
|
||||||
import SubPageHeader from '../components/SubPageHeader';
|
import SubPageHeader from '../components/SubPageHeader';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
|
import { usePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
type TicketRow = {
|
type TicketRow = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -23,6 +24,7 @@ const STATUS_LABEL: Record<string, string> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function AfterSaleListPage() {
|
export default function AfterSaleListPage() {
|
||||||
|
usePageView('after_sale_list_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [items, setItems] = useState<TicketRow[]>([]);
|
const [items, setItems] = useState<TicketRow[]>([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import {
|
|||||||
import SubPageHeader from '../components/SubPageHeader';
|
import SubPageHeader from '../components/SubPageHeader';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
import { uploadFileToOss } from '../lib/upload';
|
import { uploadFileToOss } from '../lib/upload';
|
||||||
|
import { usePageView } from '../lib/usePageView';
|
||||||
|
import { track } from '../lib/analytics';
|
||||||
|
|
||||||
type OrderRow = {
|
type OrderRow = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -21,6 +23,7 @@ type OrderRow = {
|
|||||||
const STEPS = ['类型', '订单', '凭证', '完成'] as const;
|
const STEPS = ['类型', '订单', '凭证', '完成'] as const;
|
||||||
|
|
||||||
export default function AfterSalePage() {
|
export default function AfterSalePage() {
|
||||||
|
usePageView('after_sale_apply');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [params] = useSearchParams();
|
const [params] = useSearchParams();
|
||||||
const presetOrderId = params.get('orderId') || '';
|
const presetOrderId = params.get('orderId') || '';
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ import { useEffect, useState } from 'react';
|
|||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
import PageHeader from '@dukang/shared-ui/PageHeader';
|
import PageHeader from '@dukang/shared-ui/PageHeader';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
|
import { usePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
export default function BenefitDetailPage() {
|
export default function BenefitDetailPage() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
usePageView('benefit_detail_view', { couponId: id });
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [data, setData] = useState<{ coupon: Record<string, unknown>; ledgers: Array<Record<string, unknown>> } | null>(null);
|
const [data, setData] = useState<{ coupon: Record<string, unknown>; ledgers: Array<Record<string, unknown>> } | null>(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from 'react';
|
|||||||
import { Link, useNavigate } from 'react-router-dom';
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
import BrandLogo from '@dukang/shared-ui/BrandLogo';
|
import BrandLogo from '@dukang/shared-ui/BrandLogo';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
|
import { usePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
type BenefitSummary = {
|
type BenefitSummary = {
|
||||||
totalBalance: number;
|
totalBalance: number;
|
||||||
@@ -44,6 +45,7 @@ function buildRedeemUrl(coupon?: CouponItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function BenefitPage() {
|
export default function BenefitPage() {
|
||||||
|
usePageView('benefit_page_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const listRef = useRef<HTMLElement>(null);
|
const listRef = useRef<HTMLElement>(null);
|
||||||
const [summary, setSummary] = useState<BenefitSummary | null>(null);
|
const [summary, setSummary] = useState<BenefitSummary | null>(null);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { buildOrderAddressSelectUrl } from '../lib/navigation';
|
|||||||
import { STITCH_ORDER_PRODUCT_IMAGE } from '../lib/order-images';
|
import { STITCH_ORDER_PRODUCT_IMAGE } from '../lib/order-images';
|
||||||
import { handleShareButtonClick } from '../lib/wechat-share';
|
import { handleShareButtonClick } from '../lib/wechat-share';
|
||||||
import ContactCustomerSheet from '../components/ContactCustomerSheet';
|
import ContactCustomerSheet from '../components/ContactCustomerSheet';
|
||||||
|
import { usePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
type OrderItem = {
|
type OrderItem = {
|
||||||
productName: string;
|
productName: string;
|
||||||
@@ -131,6 +132,7 @@ function fullReceiverAddress(order: Order) {
|
|||||||
|
|
||||||
export default function OrderDetailPage() {
|
export default function OrderDetailPage() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
usePageView('order_detail_view', { orderId: id });
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [order, setOrder] = useState<Order | null>(null);
|
const [order, setOrder] = useState<Order | null>(null);
|
||||||
const [showCs, setShowCs] = useState(false);
|
const [showCs, setShowCs] = useState(false);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import PageHeader from '@dukang/shared-ui/PageHeader';
|
|||||||
import AppImage from '@dukang/shared-ui/AppImage';
|
import AppImage from '@dukang/shared-ui/AppImage';
|
||||||
import OrderStatusTabs from '@dukang/shared-ui/OrderStatusTabs';
|
import OrderStatusTabs from '@dukang/shared-ui/OrderStatusTabs';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
|
import { usePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
const TABS = [
|
const TABS = [
|
||||||
{ key: 'all', label: '全部' },
|
{ key: 'all', label: '全部' },
|
||||||
@@ -36,6 +37,7 @@ function orderStatusLabel(order: Record<string, unknown>) {
|
|||||||
export default function OrderListPage() {
|
export default function OrderListPage() {
|
||||||
const [params, setParams] = useSearchParams();
|
const [params, setParams] = useSearchParams();
|
||||||
const tab = params.get('tab') || 'all';
|
const tab = params.get('tab') || 'all';
|
||||||
|
usePageView('order_list_view', { tab });
|
||||||
const [data, setData] = useState<{ list: Array<Record<string, unknown>> }>({ list: [] });
|
const [data, setData] = useState<{ list: Array<Record<string, unknown>> }>({ list: [] });
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import {
|
|||||||
} from '../lib/pay-wechat';
|
} from '../lib/pay-wechat';
|
||||||
import { applyWechatLoginResult, handleWechatAuthCallback } from '../lib/wechat-auth';
|
import { applyWechatLoginResult, handleWechatAuthCallback } from '../lib/wechat-auth';
|
||||||
import { isWechatEnv } from '../lib/weixin';
|
import { isWechatEnv } from '../lib/weixin';
|
||||||
|
import { usePageView } from '../lib/usePageView';
|
||||||
|
import { track } from '../lib/analytics';
|
||||||
|
|
||||||
function sleep(ms: number) {
|
function sleep(ms: number) {
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
@@ -32,6 +34,7 @@ async function waitOrderPaid(orderId: string, maxAttempts = 15) {
|
|||||||
export default function PayPage() {
|
export default function PayPage() {
|
||||||
const [params] = useSearchParams();
|
const [params] = useSearchParams();
|
||||||
const orderId = params.get('orderId') || '';
|
const orderId = params.get('orderId') || '';
|
||||||
|
usePageView('pay_page_view', { orderId });
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [authLoading, setAuthLoading] = useState(false);
|
const [authLoading, setAuthLoading] = useState(false);
|
||||||
@@ -161,6 +164,11 @@ export default function PayPage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setMsg(e instanceof Error ? e.message : '支付失败');
|
setMsg(e instanceof Error ? e.message : '支付失败');
|
||||||
|
track('pay_fail', {
|
||||||
|
orderId,
|
||||||
|
failReason: e instanceof Error ? e.message : '支付失败',
|
||||||
|
pagePath: '/pay',
|
||||||
|
});
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,7 +155,10 @@ export default function ProductDetailPage() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="product-detail-buy-btn"
|
className="product-detail-buy-btn"
|
||||||
onClick={() => navigate(`/order/confirm?productId=${id}&qty=2`)}
|
onClick={() => {
|
||||||
|
track('product_click', { refType: 'PRODUCT', refId: id, productId: id });
|
||||||
|
navigate(`/order/confirm?productId=${id}&qty=2`);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
立即购买
|
立即购买
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ import { useEffect, useState } from 'react';
|
|||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { REDEEM_TOKEN_TTL_SECONDS } from '@dukang/shared-types';
|
import { REDEEM_TOKEN_TTL_SECONDS } from '@dukang/shared-types';
|
||||||
import PageHeader from '@dukang/shared-ui/PageHeader';
|
import PageHeader from '@dukang/shared-ui/PageHeader';
|
||||||
|
import { usePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
export default function RedeemCodePage() {
|
export default function RedeemCodePage() {
|
||||||
|
usePageView('redeem_code_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const token = sessionStorage.getItem('redeemToken') || '';
|
const token = sessionStorage.getItem('redeemToken') || '';
|
||||||
const amount = sessionStorage.getItem('redeemAmount') || '0';
|
const amount = sessionStorage.getItem('redeemAmount') || '0';
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|||||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||||
import { REDEEM_TOKEN_TTL_SECONDS } from '@dukang/shared-types';
|
import { REDEEM_TOKEN_TTL_SECONDS } from '@dukang/shared-types';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
|
import { usePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
const POLL_INTERVAL_MS = 2500;
|
const POLL_INTERVAL_MS = 2500;
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ function formatTimer(seconds: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function RedeemPage() {
|
export default function RedeemPage() {
|
||||||
|
usePageView('benefit_redeem_start');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const couponId = searchParams.get('couponId') ?? undefined;
|
const couponId = searchParams.get('couponId') ?? undefined;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMemo, useState } from 'react';
|
|||||||
import { useLocation, useNavigate } from 'react-router-dom';
|
import { useLocation, useNavigate } from 'react-router-dom';
|
||||||
import PageHeader from '@dukang/shared-ui/PageHeader';
|
import PageHeader from '@dukang/shared-ui/PageHeader';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
|
import { usePageView } from '../lib/usePageView';
|
||||||
|
|
||||||
type RedeemRecord = {
|
type RedeemRecord = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -46,6 +47,7 @@ function StarRating({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function RedeemSuccessPage() {
|
export default function RedeemSuccessPage() {
|
||||||
|
usePageView('redeem_success_view');
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const [serviceScore, setServiceScore] = useState(5);
|
const [serviceScore, setServiceScore] = useState(5);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
loginHqWithWechat,
|
loginHqWithWechat,
|
||||||
} from '../../lib/wechat';
|
} from '../../lib/wechat';
|
||||||
import { isWechatEnv } from '../../lib/weixin';
|
import { isWechatEnv } from '../../lib/weixin';
|
||||||
|
import { MOCK_SMS_FIXED_CODE } from '@dukang/shared-types';
|
||||||
import { WECHAT_INAPP_REQUIRED_MSG } from '@dukang/weixin-sdk';
|
import { WECHAT_INAPP_REQUIRED_MSG } from '@dukang/weixin-sdk';
|
||||||
import { clearHqAccountCache } from '../../lib/session';
|
import { clearHqAccountCache } from '../../lib/session';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
@@ -41,7 +42,7 @@ function WechatIcon() {
|
|||||||
export default function LoginPage() {
|
export default function LoginPage() {
|
||||||
const remembered = loadRememberedPhone();
|
const remembered = loadRememberedPhone();
|
||||||
const [phone, setPhone] = useState(remembered.phone || DEMO_PHONE);
|
const [phone, setPhone] = useState(remembered.phone || DEMO_PHONE);
|
||||||
const [code, setCode] = useState('123456');
|
const [code, setCode] = useState(MOCK_SMS_FIXED_CODE);
|
||||||
const [rememberAccount, setRememberAccount] = useState(remembered.remember);
|
const [rememberAccount, setRememberAccount] = useState(remembered.remember);
|
||||||
const [agreed, setAgreed] = useState(false);
|
const [agreed, setAgreed] = useState(false);
|
||||||
const [cooldown, setCooldown] = useState(0);
|
const [cooldown, setCooldown] = useState(0);
|
||||||
@@ -103,7 +104,7 @@ export default function LoginPage() {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { phone, scene: 'HQ_LOGIN' },
|
data: { phone, scene: 'HQ_LOGIN' },
|
||||||
});
|
});
|
||||||
toast('验证码已发送(Mock:123456)', 'success');
|
toast(`验证码已发送(Mock:${MOCK_SMS_FIXED_CODE})`, 'success');
|
||||||
setCooldown(60);
|
setCooldown(60);
|
||||||
const t = setInterval(() => {
|
const t = setInterval(() => {
|
||||||
setCooldown((s) => {
|
setCooldown((s) => {
|
||||||
|
|||||||
@@ -104,8 +104,7 @@ export default defineConfig(async () => ({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
h5: {
|
h5: {
|
||||||
// 生产发版由 remote-release 注入 TARO_H5_PUBLIC_PATH=/user/、TARO_H5_ROUTER_BASENAME=/user
|
// staging:user-test.dukanghaoke.com 根路径;生产:remote-release 注入 /user/
|
||||||
// 本地预览勿强制 basename,否则静态托管下易白屏
|
|
||||||
publicPath: process.env.TARO_H5_PUBLIC_PATH || '/',
|
publicPath: process.env.TARO_H5_PUBLIC_PATH || '/',
|
||||||
...(process.env.TARO_H5_ROUTER_BASENAME
|
...(process.env.TARO_H5_ROUTER_BASENAME
|
||||||
? {
|
? {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.24.4",
|
"@babel/runtime": "^7.24.4",
|
||||||
|
"@dukang/client-logging": "workspace:*",
|
||||||
"@dukang/shared-types": "workspace:*",
|
"@dukang/shared-types": "workspace:*",
|
||||||
"@dukang/shared-ui": "workspace:*",
|
"@dukang/shared-ui": "workspace:*",
|
||||||
"@dukang/weixin-sdk": "workspace:*",
|
"@dukang/weixin-sdk": "workspace:*",
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import { createUserTracker, getSessionId } from '@dukang/client-logging';
|
||||||
|
import { API_BASE, CLIENT_APP, getToken } from './api';
|
||||||
|
|
||||||
|
function currentPagePath(): string | undefined {
|
||||||
|
try {
|
||||||
|
const pages = Taro.getCurrentPages();
|
||||||
|
const cur = pages[pages.length - 1] as { route?: string; $taroPath?: string } | undefined;
|
||||||
|
return cur?.$taroPath || cur?.route || undefined;
|
||||||
|
} catch {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const tracker = createUserTracker({
|
||||||
|
apiBase: API_BASE,
|
||||||
|
clientApp: CLIENT_APP,
|
||||||
|
getToken,
|
||||||
|
getPagePath: currentPagePath,
|
||||||
|
postJson: ({ url, headers, body }) => {
|
||||||
|
void Taro.request({ url, method: 'POST', header: headers, data: body }).catch(() => {});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export { getSessionId };
|
||||||
|
|
||||||
|
export function track(eventName: string, params?: Record<string, unknown>) {
|
||||||
|
tracker.track(eventName, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function trackPageView(eventName: string, params?: Record<string, unknown>) {
|
||||||
|
tracker.trackPageView(eventName, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function initUserAnalytics() {
|
||||||
|
tracker.trackSessionStart();
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { useEffect, useRef } from 'react';
|
||||||
|
import { trackPageView } from './analytics';
|
||||||
|
|
||||||
|
export function usePageView(eventName: string, params?: Record<string, unknown>) {
|
||||||
|
const fired = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (fired.current) return;
|
||||||
|
fired.current = true;
|
||||||
|
trackPageView(eventName, params);
|
||||||
|
}, [eventName, params]);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useCallback, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { View, Text, Image, Swiper, SwiperItem } from '@tarojs/components';
|
import { View, Text, Image, Swiper, SwiperItem } from '@tarojs/components';
|
||||||
import Taro, {
|
import Taro, {
|
||||||
useDidShow,
|
useDidShow,
|
||||||
@@ -24,7 +24,6 @@ import { capturePromoSceneAndTouchScan } from '../../lib/promo';
|
|||||||
import { getProductMainImage } from '../../lib/product-images';
|
import { getProductMainImage } from '../../lib/product-images';
|
||||||
import {
|
import {
|
||||||
canBuyOnline,
|
canBuyOnline,
|
||||||
canCrossCity,
|
|
||||||
canPickupOnSite,
|
canPickupOnSite,
|
||||||
normalizeFulfillmentFlags,
|
normalizeFulfillmentFlags,
|
||||||
} from '../../lib/product-fulfillment';
|
} from '../../lib/product-fulfillment';
|
||||||
@@ -34,6 +33,7 @@ import {
|
|||||||
DEFAULT_SHARE_TITLE,
|
DEFAULT_SHARE_TITLE,
|
||||||
toWeappShareMessage,
|
toWeappShareMessage,
|
||||||
} from '../../lib/wechat-share';
|
} from '../../lib/wechat-share';
|
||||||
|
import { trackPageView } from '../../lib/analytics';
|
||||||
type Product = {
|
type Product = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -49,22 +49,6 @@ type Product = {
|
|||||||
allowCrossCityDelivery?: boolean;
|
allowCrossCityDelivery?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type FulfillmentFilter = 'ALL' | 'ONLINE' | 'CROSS_CITY' | 'ON_SITE';
|
|
||||||
|
|
||||||
const FULFILLMENT_FILTERS: Array<{ key: FulfillmentFilter; label: string }> = [
|
|
||||||
{ key: 'ALL', label: '全部' },
|
|
||||||
{ key: 'ONLINE', label: '线上' },
|
|
||||||
{ key: 'CROSS_CITY', label: '跨城' },
|
|
||||||
{ key: 'ON_SITE', label: '现场' },
|
|
||||||
];
|
|
||||||
|
|
||||||
function matchFulfillmentFilter(p: Product, filter: FulfillmentFilter): boolean {
|
|
||||||
if (filter === 'ALL') return true;
|
|
||||||
if (filter === 'ONLINE') return canBuyOnline(p);
|
|
||||||
if (filter === 'CROSS_CITY') return canCrossCity(p);
|
|
||||||
return canPickupOnSite(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
type MiniHomeConfig = {
|
type MiniHomeConfig = {
|
||||||
banners: string[];
|
banners: string[];
|
||||||
footerUrl: string | null;
|
footerUrl: string | null;
|
||||||
@@ -87,7 +71,6 @@ function aromaSectionId(key: AromaKey) {
|
|||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
const [activeAroma, setActiveAroma] = useState<AromaKey>('QINGXIANG');
|
const [activeAroma, setActiveAroma] = useState<AromaKey>('QINGXIANG');
|
||||||
const [fulfillmentFilter, setFulfillmentFilter] = useState<FulfillmentFilter>('ALL');
|
|
||||||
const [products, setProducts] = useState<Product[]>([]);
|
const [products, setProducts] = useState<Product[]>([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [displayCity, setDisplayCity] = useState('郑州市');
|
const [displayCity, setDisplayCity] = useState('郑州市');
|
||||||
@@ -97,6 +80,10 @@ export default function HomePage() {
|
|||||||
const scrollLockTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
const scrollLockTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||||
const lastScrollSyncAtRef = useRef(0);
|
const lastScrollSyncAtRef = useRef(0);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
trackPageView('home_view', { pagePath: '/pages/home/index', cityCode });
|
||||||
|
}, [cityCode]);
|
||||||
|
|
||||||
const loadMiniHome = useCallback(() => {
|
const loadMiniHome = useCallback(() => {
|
||||||
return request<{ miniHome?: MiniHomeConfig }>('/common/client-config')
|
return request<{ miniHome?: MiniHomeConfig }>('/common/client-config')
|
||||||
.then((cfg) => {
|
.then((cfg) => {
|
||||||
@@ -205,23 +192,30 @@ export default function HomePage() {
|
|||||||
Taro.navigateTo({ url: returnPath });
|
Taro.navigateTo({ url: returnPath });
|
||||||
}
|
}
|
||||||
|
|
||||||
const filteredProducts = useMemo(
|
|
||||||
() => products.filter((p) => matchFulfillmentFilter(p, fulfillmentFilter)),
|
|
||||||
[products, fulfillmentFilter],
|
|
||||||
);
|
|
||||||
|
|
||||||
const productsByAroma = useMemo(() => {
|
const productsByAroma = useMemo(() => {
|
||||||
const map: Record<AromaKey, Product[]> = {
|
const map: Record<AromaKey, Product[]> = {
|
||||||
QINGXIANG: [],
|
QINGXIANG: [],
|
||||||
JIANGXIANG: [],
|
JIANGXIANG: [],
|
||||||
NONGXIANG: [],
|
NONGXIANG: [],
|
||||||
};
|
};
|
||||||
for (const p of filteredProducts) {
|
for (const p of products) {
|
||||||
const key = p.aromaType as AromaKey;
|
const key = p.aromaType as AromaKey;
|
||||||
if (key in map) map[key].push(p);
|
if (key in map) map[key].push(p);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}, [filteredProducts]);
|
}, [products]);
|
||||||
|
|
||||||
|
const visibleAromaTabs = useMemo(
|
||||||
|
() => AROMA_TABS.filter((t) => productsByAroma[t.key].length > 0),
|
||||||
|
[productsByAroma],
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (loading || visibleAromaTabs.length === 0) return;
|
||||||
|
if (!visibleAromaTabs.some((t) => t.key === activeAroma)) {
|
||||||
|
setActiveAroma(visibleAromaTabs[0].key);
|
||||||
|
}
|
||||||
|
}, [loading, visibleAromaTabs, activeAroma]);
|
||||||
|
|
||||||
const banners = miniHome.banners;
|
const banners = miniHome.banners;
|
||||||
const footerUrl = miniHome.footerUrl;
|
const footerUrl = miniHome.footerUrl;
|
||||||
@@ -269,18 +263,18 @@ export default function HomePage() {
|
|||||||
if (now - lastScrollSyncAtRef.current < 80) return;
|
if (now - lastScrollSyncAtRef.current < 80) return;
|
||||||
lastScrollSyncAtRef.current = now;
|
lastScrollSyncAtRef.current = now;
|
||||||
const query = Taro.createSelectorQuery();
|
const query = Taro.createSelectorQuery();
|
||||||
AROMA_TABS.forEach((t) => {
|
visibleAromaTabs.forEach((t) => {
|
||||||
query.select(`#${aromaSectionId(t.key)}`).boundingClientRect();
|
query.select(`#${aromaSectionId(t.key)}`).boundingClientRect();
|
||||||
});
|
});
|
||||||
query.exec((rects) => {
|
query.exec((rects) => {
|
||||||
if (!Array.isArray(rects) || rects.length === 0) return;
|
if (!Array.isArray(rects) || rects.length === 0) return;
|
||||||
let next: AromaKey = AROMA_TABS[0].key;
|
let next: AromaKey = visibleAromaTabs[0]?.key ?? AROMA_TABS[0].key;
|
||||||
for (let i = 0; i < AROMA_TABS.length; i++) {
|
for (let i = 0; i < visibleAromaTabs.length; i++) {
|
||||||
const rect = rects[i] as { top?: number } | null;
|
const rect = rects[i] as { top?: number } | null;
|
||||||
if (!rect || rect.top == null) continue;
|
if (!rect || rect.top == null) continue;
|
||||||
// 区块顶进入导航下方一带时视为当前香型
|
// 区块顶进入导航下方一带时视为当前香型
|
||||||
if (rect.top <= AROMA_NAV_OFFSET_PX + 24) {
|
if (rect.top <= AROMA_NAV_OFFSET_PX + 24) {
|
||||||
next = AROMA_TABS[i].key;
|
next = visibleAromaTabs[i].key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setActiveAroma((prev) => (prev === next ? prev : next));
|
setActiveAroma((prev) => (prev === next ? prev : next));
|
||||||
@@ -364,7 +358,7 @@ export default function HomePage() {
|
|||||||
|
|
||||||
<View className="home-aroma-nav">
|
<View className="home-aroma-nav">
|
||||||
<View className="home-aroma-tabs">
|
<View className="home-aroma-tabs">
|
||||||
{AROMA_TABS.map((t) => (
|
{visibleAromaTabs.map((t) => (
|
||||||
<Text
|
<Text
|
||||||
key={t.key}
|
key={t.key}
|
||||||
className={`home-aroma-tab${activeAroma === t.key ? ' home-aroma-tab--active' : ''}`}
|
className={`home-aroma-tab${activeAroma === t.key ? ' home-aroma-tab--active' : ''}`}
|
||||||
@@ -377,38 +371,19 @@ export default function HomePage() {
|
|||||||
<Text className="home-aroma-city">{displayCity}</Text>
|
<Text className="home-aroma-city">{displayCity}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className="home-fulfillment-filters">
|
|
||||||
{FULFILLMENT_FILTERS.map((f) => (
|
|
||||||
<Text
|
|
||||||
key={f.key}
|
|
||||||
className={`home-fulfillment-chip${fulfillmentFilter === f.key ? ' home-fulfillment-chip--active' : ''}`}
|
|
||||||
onClick={() => setFulfillmentFilter(f.key)}
|
|
||||||
>
|
|
||||||
{f.label}
|
|
||||||
</Text>
|
|
||||||
))}
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View className="home-product-list">
|
<View className="home-product-list">
|
||||||
{loading ? <View className="home-empty">加载中…</View> : null}
|
{loading ? <View className="home-empty">加载中…</View> : null}
|
||||||
{!loading && products.length === 0 ? (
|
{!loading && products.length === 0 ? (
|
||||||
<View className="home-empty">当前城市暂无在售商品</View>
|
<View className="home-empty">当前城市暂无在售商品</View>
|
||||||
) : null}
|
) : null}
|
||||||
{!loading && products.length > 0 && filteredProducts.length === 0 ? (
|
|
||||||
<View className="home-empty">暂无符合履约方式的商品</View>
|
|
||||||
) : null}
|
|
||||||
{!loading &&
|
{!loading &&
|
||||||
filteredProducts.length > 0 &&
|
products.length > 0 &&
|
||||||
AROMA_TABS.map((t) => {
|
visibleAromaTabs.map((t) => {
|
||||||
const list = productsByAroma[t.key];
|
const list = productsByAroma[t.key];
|
||||||
return (
|
return (
|
||||||
<View key={t.key} id={aromaSectionId(t.key)} className="home-aroma-section">
|
<View key={t.key} id={aromaSectionId(t.key)} className="home-aroma-section">
|
||||||
<Text className="home-aroma-section-title">{t.label}</Text>
|
<Text className="home-aroma-section-title">{t.label}</Text>
|
||||||
{list.length === 0 ? (
|
{list.map((p) => renderProductCard(p))}
|
||||||
<View className="home-empty home-empty--section">该香型暂未上线</View>
|
|
||||||
) : (
|
|
||||||
list.map((p) => renderProductCard(p))
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
DEFAULT_SHARE_TITLE,
|
DEFAULT_SHARE_TITLE,
|
||||||
toWeappShareMessage,
|
toWeappShareMessage,
|
||||||
} from '../../lib/wechat-share';
|
} from '../../lib/wechat-share';
|
||||||
|
import { usePageView } from '../../lib/usePageView';
|
||||||
|
|
||||||
const isWeapp = process.env.TARO_ENV === 'weapp';
|
const isWeapp = process.env.TARO_ENV === 'weapp';
|
||||||
|
|
||||||
@@ -74,6 +75,7 @@ function fullReceiverAddress(order: OrderDetail) {
|
|||||||
export default function OrderDetailPage() {
|
export default function OrderDetailPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const orderId = router.params.id ?? '';
|
const orderId = router.params.id ?? '';
|
||||||
|
usePageView('order_detail_view', orderId ? { orderId } : undefined);
|
||||||
const [order, setOrder] = useState<OrderDetail | null>(null);
|
const [order, setOrder] = useState<OrderDetail | null>(null);
|
||||||
const [confirming, setConfirming] = useState(false);
|
const [confirming, setConfirming] = useState(false);
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import PageShell from '../../components/PageShell';
|
|||||||
import SubPageHeader from '../../components/SubPageHeader';
|
import SubPageHeader from '../../components/SubPageHeader';
|
||||||
import { request, toast } from '../../lib/api';
|
import { request, toast } from '../../lib/api';
|
||||||
import { buildPayUrl } from '../../lib/checkout-nav';
|
import { buildPayUrl } from '../../lib/checkout-nav';
|
||||||
|
import { usePageView } from '../../lib/usePageView';
|
||||||
|
|
||||||
import { ORDER_STATUS_LABELS } from '@dukang/shared-types';
|
import { ORDER_STATUS_LABELS } from '@dukang/shared-types';
|
||||||
|
|
||||||
@@ -54,6 +55,7 @@ type OrderRow = {
|
|||||||
export default function OrdersPage() {
|
export default function OrdersPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [tab, setTab] = useState(() => normalizeOrdersTab(router.params.tab as string));
|
const [tab, setTab] = useState(() => normalizeOrdersTab(router.params.tab as string));
|
||||||
|
usePageView('order_list_view', { tab });
|
||||||
const [orders, setOrders] = useState<OrderRow[]>([]);
|
const [orders, setOrders] = useState<OrderRow[]>([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import {
|
|||||||
toWeappShareMessage,
|
toWeappShareMessage,
|
||||||
} from '../../lib/wechat-share';
|
} from '../../lib/wechat-share';
|
||||||
import iconHome from '../../assets/tabbar/home.png';
|
import iconHome from '../../assets/tabbar/home.png';
|
||||||
|
import { usePageView } from '../../lib/usePageView';
|
||||||
|
|
||||||
type Product = ProductImageSource & {
|
type Product = ProductImageSource & {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -50,6 +51,10 @@ type Product = ProductImageSource & {
|
|||||||
export default function ProductDetailPage() {
|
export default function ProductDetailPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const productId = router.params.id ?? '';
|
const productId = router.params.id ?? '';
|
||||||
|
usePageView(
|
||||||
|
'product_detail_view',
|
||||||
|
productId ? { refType: 'PRODUCT', refId: productId, productId } : undefined,
|
||||||
|
);
|
||||||
const [product, setProduct] = useState<Product | null>(null);
|
const [product, setProduct] = useState<Product | null>(null);
|
||||||
const [headerSolid, setHeaderSolid] = useState(false);
|
const [headerSolid, setHeaderSolid] = useState(false);
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,15 @@ type StoreMedia = {
|
|||||||
mediaType?: string | null;
|
mediaType?: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type StorePackage = {
|
||||||
|
name: string;
|
||||||
|
price: string | number;
|
||||||
|
dishes: string;
|
||||||
|
usableTime?: string | null;
|
||||||
|
otherNotes?: string | null;
|
||||||
|
sortOrder?: number;
|
||||||
|
};
|
||||||
|
|
||||||
type Store = {
|
type Store = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -42,6 +51,7 @@ type Store = {
|
|||||||
coverUrl?: string | null;
|
coverUrl?: string | null;
|
||||||
carouselUrls?: string[] | null;
|
carouselUrls?: string[] | null;
|
||||||
media?: StoreMedia[] | null;
|
media?: StoreMedia[] | null;
|
||||||
|
packages?: StorePackage[] | null;
|
||||||
openTime?: string | null;
|
openTime?: string | null;
|
||||||
closeTime?: string | null;
|
closeTime?: string | null;
|
||||||
openTime2?: string | null;
|
openTime2?: string | null;
|
||||||
@@ -389,6 +399,26 @@ export default function StoreDetailPage() {
|
|||||||
</View>
|
</View>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
{store.packages && store.packages.length > 0 ? (
|
||||||
|
<View className="store-detail-section">
|
||||||
|
<Text className="store-detail-section-title">门店套餐</Text>
|
||||||
|
{store.packages.map((pkg, index) => (
|
||||||
|
<View key={`${pkg.name}-${index}`} className="store-detail-package-card">
|
||||||
|
<Text className="store-detail-package-name">{pkg.name}</Text>
|
||||||
|
<Text className="store-detail-package-body">
|
||||||
|
{formatRedeemAmountYuan(pkg.price)} 元 · {pkg.dishes}
|
||||||
|
</Text>
|
||||||
|
{pkg.usableTime ? (
|
||||||
|
<Text className="store-detail-package-meta">使用时间:{pkg.usableTime}</Text>
|
||||||
|
) : null}
|
||||||
|
{pkg.otherNotes ? (
|
||||||
|
<Text className="store-detail-package-meta">说明:{pkg.otherNotes}</Text>
|
||||||
|
) : null}
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
) : null}
|
||||||
|
|
||||||
{intro ? (
|
{intro ? (
|
||||||
<View className="store-detail-section">
|
<View className="store-detail-section">
|
||||||
<Text className="store-detail-section-title">门店详情</Text>
|
<Text className="store-detail-section-title">门店详情</Text>
|
||||||
|
|||||||
@@ -234,3 +234,85 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.store-detail-package-card {
|
||||||
|
padding: 12px 0;
|
||||||
|
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-detail-package-card:last-of-type {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-detail-package-name {
|
||||||
|
display: block;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--color-text-primary, #1a1a1a);
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-detail-package-body {
|
||||||
|
display: block;
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--color-text-secondary, #666);
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-detail-package-meta {
|
||||||
|
display: block;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--color-text-tertiary, #999);
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-detail-package-dispute {
|
||||||
|
display: block;
|
||||||
|
margin-top: 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--color-heritage-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-detail-dispute-mask {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.45);
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-detail-dispute-panel {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 480px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 16px 16px 0 0;
|
||||||
|
padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-detail-dispute-input {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 96px;
|
||||||
|
margin: 12px 0 16px;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.08);
|
||||||
|
border-radius: 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-detail-dispute-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-detail-dispute-actions .u-btn {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-detail-dispute-actions .u-btn--ghost {
|
||||||
|
background: rgba(166, 29, 36, 0.08);
|
||||||
|
color: var(--color-heritage-red);
|
||||||
|
}
|
||||||
|
|||||||
@@ -69,6 +69,14 @@ server {
|
|||||||
proxy_set_header Connection "";
|
proxy_set_header Connection "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 旧 /user 前缀书签 → 根路径(staging 独立域名,无 /user 子路径)
|
||||||
|
location = /user {
|
||||||
|
return 301 /;
|
||||||
|
}
|
||||||
|
location ^~ /user/ {
|
||||||
|
rewrite ^/user/(.*)$ /$1 permanent;
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://127.0.0.1:8191;
|
proxy_pass http://127.0.0.1:8191;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
|
|||||||
@@ -88,9 +88,14 @@ corepack prepare pnpm@11.2.2 --activate 2>/dev/null || true
|
|||||||
echo "==> 2. 安装依赖"
|
echo "==> 2. 安装依赖"
|
||||||
# mini-user H5(Taro)构建峰值内存较高
|
# mini-user H5(Taro)构建峰值内存较高
|
||||||
export NODE_OPTIONS="${NODE_OPTIONS:---max-old-space-size=8192}"
|
export NODE_OPTIONS="${NODE_OPTIONS:---max-old-space-size=8192}"
|
||||||
# 生产部署 path:nginx 入口为 /user/
|
# C 端 H5 静态资源路径:staging 独立域名根路径;生产 nginx 入口为 /user/
|
||||||
export TARO_H5_PUBLIC_PATH="${TARO_H5_PUBLIC_PATH:-/user/}"
|
if [[ "$DUKANG_DEPLOY_ENV" == "staging" ]]; then
|
||||||
export TARO_H5_ROUTER_BASENAME="${TARO_H5_ROUTER_BASENAME:-/user}"
|
export TARO_H5_PUBLIC_PATH="${TARO_H5_PUBLIC_PATH:-/}"
|
||||||
|
unset TARO_H5_ROUTER_BASENAME
|
||||||
|
else
|
||||||
|
export TARO_H5_PUBLIC_PATH="${TARO_H5_PUBLIC_PATH:-/user/}"
|
||||||
|
export TARO_H5_ROUTER_BASENAME="${TARO_H5_ROUTER_BASENAME:-/user}"
|
||||||
|
fi
|
||||||
# C 端 H5 编译期注入的 API origin(勿落到 localhost)
|
# C 端 H5 编译期注入的 API origin(勿落到 localhost)
|
||||||
export VITE_API_TARGET="${VITE_API_TARGET:-$VITE_API_DEFAULT}"
|
export VITE_API_TARGET="${VITE_API_TARGET:-$VITE_API_DEFAULT}"
|
||||||
export VITE_APP_ENV="$DUKANG_DEPLOY_ENV"
|
export VITE_APP_ENV="$DUKANG_DEPLOY_ENV"
|
||||||
@@ -167,3 +172,12 @@ APP_ROOT="$APP_ROOT" DEPLOY_TRIGGER="${DEPLOY_TRIGGER:-manual}" DUKANG_ENV_FILE=
|
|||||||
|| echo "WARN: system_version 写入失败"
|
|| echo "WARN: system_version 写入失败"
|
||||||
|
|
||||||
echo "==> 发版完成 ($DUKANG_DEPLOY_ENV)"
|
echo "==> 发版完成 ($DUKANG_DEPLOY_ENV)"
|
||||||
|
|
||||||
|
if [[ "$DUKANG_DEPLOY_ENV" == "staging" ]]; then
|
||||||
|
echo "==> 8. 重载 nginx(staging)"
|
||||||
|
if command -v nginx >/dev/null 2>&1 && nginx -t 2>/dev/null; then
|
||||||
|
systemctl reload nginx || echo "WARN: nginx reload failed"
|
||||||
|
else
|
||||||
|
echo "WARN: nginx 未安装或配置校验失败,跳过重载"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "@dukang/client-logging",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"import": "./src/index.ts",
|
||||||
|
"default": "./dist/index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"dev": "tsc --watch",
|
||||||
|
"lint": "eslint src"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.4.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
import { postJson, type PostJson } from './http';
|
||||||
|
import { getSessionId } from './session';
|
||||||
|
|
||||||
|
export type TrackParams = Record<string, unknown>;
|
||||||
|
|
||||||
|
export type UserTrackerOptions = {
|
||||||
|
apiBase: string;
|
||||||
|
clientApp: string;
|
||||||
|
getToken?: () => string | null;
|
||||||
|
postJson?: PostJson;
|
||||||
|
getPagePath?: () => string | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
function resolvePagePath(getPagePath?: () => string | undefined): string | undefined {
|
||||||
|
if (getPagePath) return getPagePath();
|
||||||
|
if (typeof window !== 'undefined') return window.location.pathname;
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createUserTracker(opts: UserTrackerOptions) {
|
||||||
|
const send = opts.postJson ?? postJson;
|
||||||
|
const getToken = opts.getToken ?? (() =>
|
||||||
|
typeof localStorage !== 'undefined' ? localStorage.getItem('accessToken') : null);
|
||||||
|
|
||||||
|
function track(eventName: string, params?: TrackParams) {
|
||||||
|
const sessionId = getSessionId();
|
||||||
|
const token = getToken();
|
||||||
|
const headers: Record<string, string> = {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-Client-App': opts.clientApp,
|
||||||
|
};
|
||||||
|
if (token) headers.Authorization = `Bearer ${token}`;
|
||||||
|
|
||||||
|
send({
|
||||||
|
url: `${opts.apiBase}/analytics/events`,
|
||||||
|
headers,
|
||||||
|
body: {
|
||||||
|
sessionId,
|
||||||
|
clientApp: opts.clientApp,
|
||||||
|
events: [{ eventName, params: { sessionId, ...params } }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function trackPageView(eventName: string, params?: TrackParams) {
|
||||||
|
track(eventName, {
|
||||||
|
pagePath: resolvePagePath(opts.getPagePath),
|
||||||
|
...params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function trackSessionStart() {
|
||||||
|
track('session_start', {
|
||||||
|
pagePath: resolvePagePath(opts.getPagePath),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return { track, trackPageView, trackSessionStart };
|
||||||
|
}
|
||||||
|
|
||||||
|
export type StoreTrackerOptions = {
|
||||||
|
apiBase: string;
|
||||||
|
clientApp: string;
|
||||||
|
getToken: () => string | null;
|
||||||
|
getStoreId: () => string | null;
|
||||||
|
postJson?: PostJson;
|
||||||
|
getPagePath?: () => string | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function createStoreTracker(opts: StoreTrackerOptions) {
|
||||||
|
const send = opts.postJson ?? postJson;
|
||||||
|
|
||||||
|
function track(eventName: string, params?: TrackParams) {
|
||||||
|
const token = opts.getToken();
|
||||||
|
const storeId = opts.getStoreId();
|
||||||
|
if (!token || !storeId) return;
|
||||||
|
|
||||||
|
send({
|
||||||
|
url: `${opts.apiBase}/analytics/store-events`,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
'X-Client-App': opts.clientApp,
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
sessionId: getSessionId(),
|
||||||
|
storeId,
|
||||||
|
events: [{ eventName, params: { sessionId: getSessionId(), storeId, ...params } }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function trackPageView(eventName: string, params?: TrackParams) {
|
||||||
|
track(eventName, {
|
||||||
|
pagePath: resolvePagePath(opts.getPagePath),
|
||||||
|
...params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return { track, trackPageView };
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PartnerTrackerOptions = {
|
||||||
|
apiBase: string;
|
||||||
|
clientApp: string;
|
||||||
|
getToken: () => string | null;
|
||||||
|
postJson?: PostJson;
|
||||||
|
getPagePath?: () => string | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function createPartnerTracker(opts: PartnerTrackerOptions) {
|
||||||
|
const send = opts.postJson ?? postJson;
|
||||||
|
|
||||||
|
function track(eventName: string, params?: TrackParams) {
|
||||||
|
const token = opts.getToken();
|
||||||
|
if (!token) return;
|
||||||
|
|
||||||
|
send({
|
||||||
|
url: `${opts.apiBase}/analytics/partner-events`,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
'X-Client-App': opts.clientApp,
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
sessionId: getSessionId(),
|
||||||
|
events: [{ eventName, params: { sessionId: getSessionId(), ...params } }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function trackPageView(eventName: string, params?: TrackParams) {
|
||||||
|
track(eventName, {
|
||||||
|
pagePath: resolvePagePath(opts.getPagePath),
|
||||||
|
...params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return { track, trackPageView };
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
import { postJson } from './http';
|
||||||
|
|
||||||
|
export type ClientErrorLevel = 'fatal' | 'error' | 'warn' | 'info';
|
||||||
|
export type ClientErrorCategory =
|
||||||
|
| 'js_error'
|
||||||
|
| 'unhandled_rejection'
|
||||||
|
| 'api_error'
|
||||||
|
| 'network'
|
||||||
|
| 'render'
|
||||||
|
| 'bridge'
|
||||||
|
| 'other';
|
||||||
|
|
||||||
|
export type ClientErrorReporterOptions = {
|
||||||
|
apiBase: string;
|
||||||
|
clientApp: string;
|
||||||
|
getToken?: () => string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function installClientErrorReporting(opts: ClientErrorReporterOptions) {
|
||||||
|
if (typeof window === 'undefined') return;
|
||||||
|
|
||||||
|
const report = (payload: {
|
||||||
|
level: ClientErrorLevel;
|
||||||
|
category: ClientErrorCategory;
|
||||||
|
message: string;
|
||||||
|
stack?: string;
|
||||||
|
extra?: Record<string, unknown>;
|
||||||
|
}) => {
|
||||||
|
const token = opts.getToken?.() ?? localStorage.getItem('accessToken');
|
||||||
|
const headers: Record<string, string> = {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-Client-App': opts.clientApp,
|
||||||
|
};
|
||||||
|
if (token) headers.Authorization = `Bearer ${token}`;
|
||||||
|
|
||||||
|
postJson({
|
||||||
|
url: `${opts.apiBase}/common/client-errors`,
|
||||||
|
headers,
|
||||||
|
body: {
|
||||||
|
level: payload.level,
|
||||||
|
category: payload.category,
|
||||||
|
message: payload.message,
|
||||||
|
stack: payload.stack,
|
||||||
|
pagePath: window.location.pathname,
|
||||||
|
clientApp: opts.clientApp,
|
||||||
|
extra: payload.extra,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('error', (ev) => {
|
||||||
|
report({
|
||||||
|
level: 'error',
|
||||||
|
category: 'js_error',
|
||||||
|
message: ev.message || 'Unknown error',
|
||||||
|
stack: ev.error instanceof Error ? ev.error.stack : undefined,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('unhandledrejection', (ev) => {
|
||||||
|
const reason = ev.reason;
|
||||||
|
report({
|
||||||
|
level: 'error',
|
||||||
|
category: 'unhandled_rejection',
|
||||||
|
message: reason instanceof Error ? reason.message : String(reason),
|
||||||
|
stack: reason instanceof Error ? reason.stack : undefined,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function reportApiError(
|
||||||
|
opts: ClientErrorReporterOptions,
|
||||||
|
input: { message: string; status?: number; url?: string; category?: ClientErrorCategory },
|
||||||
|
) {
|
||||||
|
if (typeof window === 'undefined') return;
|
||||||
|
const token = opts.getToken?.() ?? localStorage.getItem('accessToken');
|
||||||
|
const headers: Record<string, string> = {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-Client-App': opts.clientApp,
|
||||||
|
};
|
||||||
|
if (token) headers.Authorization = `Bearer ${token}`;
|
||||||
|
|
||||||
|
postJson({
|
||||||
|
url: `${opts.apiBase}/common/client-errors`,
|
||||||
|
headers,
|
||||||
|
body: {
|
||||||
|
level: 'warn',
|
||||||
|
category: input.category ?? 'api_error',
|
||||||
|
message: input.message.slice(0, 1000),
|
||||||
|
pagePath: window.location.pathname,
|
||||||
|
clientApp: opts.clientApp,
|
||||||
|
extra: { status: input.status, url: input.url },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
export type PostJsonInput = {
|
||||||
|
url: string;
|
||||||
|
headers?: Record<string, string>;
|
||||||
|
body: unknown;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PostJson = (input: PostJsonInput) => void;
|
||||||
|
|
||||||
|
type WxLike = {
|
||||||
|
request?: (opts: {
|
||||||
|
url: string;
|
||||||
|
method?: string;
|
||||||
|
header?: Record<string, string>;
|
||||||
|
data?: unknown;
|
||||||
|
fail?: () => void;
|
||||||
|
}) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
function getWx(): WxLike | undefined {
|
||||||
|
return (globalThis as { wx?: WxLike }).wx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** fire-and-forget POST JSON;优先 fetch,小程序回退 wx.request */
|
||||||
|
export function postJson(input: PostJsonInput): void {
|
||||||
|
const headers = input.headers ?? { 'Content-Type': 'application/json' };
|
||||||
|
|
||||||
|
if (typeof fetch === 'function') {
|
||||||
|
void fetch(input.url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers,
|
||||||
|
body: JSON.stringify(input.body),
|
||||||
|
}).catch(() => {});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxApi = getWx();
|
||||||
|
if (wxApi?.request) {
|
||||||
|
wxApi.request({
|
||||||
|
url: input.url,
|
||||||
|
method: 'POST',
|
||||||
|
header: headers,
|
||||||
|
data: input.body,
|
||||||
|
fail: () => {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
export { getSessionId, touchSession } from './session';
|
||||||
|
export {
|
||||||
|
createUserTracker,
|
||||||
|
createStoreTracker,
|
||||||
|
createPartnerTracker,
|
||||||
|
type TrackParams,
|
||||||
|
type UserTrackerOptions,
|
||||||
|
type StoreTrackerOptions,
|
||||||
|
type PartnerTrackerOptions,
|
||||||
|
} from './analytics';
|
||||||
|
export { postJson, type PostJson, type PostJsonInput } from './http';
|
||||||
|
export {
|
||||||
|
installClientErrorReporting,
|
||||||
|
reportApiError,
|
||||||
|
type ClientErrorLevel,
|
||||||
|
type ClientErrorCategory,
|
||||||
|
type ClientErrorReporterOptions,
|
||||||
|
} from './client-error';
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
const SESSION_KEY = 'dukang_session_id';
|
||||||
|
|
||||||
|
type WxStorage = {
|
||||||
|
getStorageSync?: (key: string) => unknown;
|
||||||
|
setStorageSync?: (key: string, value: unknown) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
function getWxStorage(): WxStorage | undefined {
|
||||||
|
return (globalThis as { wx?: WxStorage }).wx;
|
||||||
|
}
|
||||||
|
|
||||||
|
function readStorage(key: string): string | null {
|
||||||
|
if (typeof localStorage !== 'undefined') {
|
||||||
|
return localStorage.getItem(key);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const v = getWxStorage()?.getStorageSync?.(key);
|
||||||
|
return v != null && v !== '' ? String(v) : null;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeStorage(key: string, value: string): void {
|
||||||
|
if (typeof localStorage !== 'undefined') {
|
||||||
|
localStorage.setItem(key, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
getWxStorage()?.setStorageSync?.(key, value);
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function newSessionId(): string {
|
||||||
|
if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) {
|
||||||
|
return crypto.randomUUID();
|
||||||
|
}
|
||||||
|
return `s_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getSessionId(): string {
|
||||||
|
let id = readStorage(SESSION_KEY);
|
||||||
|
if (!id) {
|
||||||
|
id = newSessionId();
|
||||||
|
writeStorage(SESSION_KEY, id);
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function touchSession(): string {
|
||||||
|
return getSessionId();
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": "../domain/tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"lib": ["ES2020", "DOM"],
|
||||||
|
"declaration": true
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"]
|
||||||
|
}
|
||||||
@@ -141,3 +141,6 @@ export function loadAppConfig(env?: Record<string, string | undefined>): AppConf
|
|||||||
wechatPayEnabled: resolveWechatPayEnabled(base, e),
|
wechatPayEnabled: resolveWechatPayEnabled(base, e),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Mock 短信环境固定验证码 */
|
||||||
|
export const MOCK_SMS_FIXED_CODE = '999888';
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export * from './invoice';
|
|||||||
export * from './user-log';
|
export * from './user-log';
|
||||||
|
|
||||||
export * from './store-log';
|
export * from './store-log';
|
||||||
|
export * from './store-package';
|
||||||
export * from './partner-log';
|
export * from './partner-log';
|
||||||
export * from './promo';
|
export * from './promo';
|
||||||
export * from './hq-permissions';
|
export * from './hq-permissions';
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
export type PartnerLogCategory =
|
export type PartnerLogCategory =
|
||||||
| 'login'
|
| 'login'
|
||||||
| 'wechat_auth'
|
| 'wechat_auth'
|
||||||
|
| 'page_view'
|
||||||
| 'account_ops'
|
| 'account_ops'
|
||||||
| 'store_ops'
|
| 'store_ops'
|
||||||
| 'shipping'
|
| 'shipping'
|
||||||
@@ -10,6 +11,20 @@ export type PartnerLogCategory =
|
|||||||
export const PARTNER_LOG_EVENT_CATEGORIES: Record<PartnerLogCategory, readonly string[]> = {
|
export const PARTNER_LOG_EVENT_CATEGORIES: Record<PartnerLogCategory, readonly string[]> = {
|
||||||
login: ['partner_sms_send', 'partner_sms_login', 'partner_sms_verify_fail', 'partner_login_success'],
|
login: ['partner_sms_send', 'partner_sms_login', 'partner_sms_verify_fail', 'partner_login_success'],
|
||||||
wechat_auth: ['partner_wechat_login', 'partner_wechat_bind'],
|
wechat_auth: ['partner_wechat_login', 'partner_wechat_bind'],
|
||||||
|
page_view: [
|
||||||
|
'partner_home_view',
|
||||||
|
'partner_store_list_view',
|
||||||
|
'partner_store_detail_view',
|
||||||
|
'partner_store_create_view',
|
||||||
|
'partner_order_list_view',
|
||||||
|
'partner_order_detail_view',
|
||||||
|
'partner_proxy_order_view',
|
||||||
|
'partner_bills_view',
|
||||||
|
'partner_bill_detail_view',
|
||||||
|
'partner_staff_list_view',
|
||||||
|
'partner_leaderboard_view',
|
||||||
|
'partner_weekly_report_view',
|
||||||
|
],
|
||||||
account_ops: [
|
account_ops: [
|
||||||
'partner_staff_create',
|
'partner_staff_create',
|
||||||
'partner_staff_sms_send',
|
'partner_staff_sms_send',
|
||||||
@@ -24,7 +39,7 @@ export const PARTNER_LOG_EVENT_CATEGORIES: Record<PartnerLogCategory, readonly s
|
|||||||
'partner_store_audit_approved',
|
'partner_store_audit_approved',
|
||||||
'partner_store_audit_rejected',
|
'partner_store_audit_rejected',
|
||||||
],
|
],
|
||||||
shipping: ['partner_order_ship', 'partner_delivery_advance'],
|
shipping: ['partner_order_ship', 'partner_delivery_advance', 'partner_proxy_order_create'],
|
||||||
settlement: ['partner_bill_view', 'partner_bill_detail_view', 'partner_bill_confirm'],
|
settlement: ['partner_bill_view', 'partner_bill_detail_view', 'partner_bill_confirm'],
|
||||||
warehouse_ops: ['partner_warehouse_view', 'partner_warehouse_update'],
|
warehouse_ops: ['partner_warehouse_view', 'partner_warehouse_update'],
|
||||||
};
|
};
|
||||||
@@ -33,6 +48,7 @@ export const PARTNER_LOG_CATEGORY_OPTIONS: Array<{ value: PartnerLogCategory | '
|
|||||||
{ value: '', label: '全部' },
|
{ value: '', label: '全部' },
|
||||||
{ value: 'login', label: '登录' },
|
{ value: 'login', label: '登录' },
|
||||||
{ value: 'wechat_auth', label: '微信授权' },
|
{ value: 'wechat_auth', label: '微信授权' },
|
||||||
|
{ value: 'page_view', label: '页面浏览' },
|
||||||
{ value: 'account_ops', label: '子账号管理' },
|
{ value: 'account_ops', label: '子账号管理' },
|
||||||
{ value: 'store_ops', label: '门店操作' },
|
{ value: 'store_ops', label: '门店操作' },
|
||||||
{ value: 'shipping', label: '发货/配送' },
|
{ value: 'shipping', label: '发货/配送' },
|
||||||
@@ -44,6 +60,7 @@ export const PARTNER_LOG_CATEGORY_LABELS: Record<PartnerLogCategory | '', string
|
|||||||
'': '全部',
|
'': '全部',
|
||||||
login: '登录',
|
login: '登录',
|
||||||
wechat_auth: '微信授权',
|
wechat_auth: '微信授权',
|
||||||
|
page_view: '页面浏览',
|
||||||
account_ops: '子账号管理',
|
account_ops: '子账号管理',
|
||||||
store_ops: '门店操作',
|
store_ops: '门店操作',
|
||||||
shipping: '发货/配送',
|
shipping: '发货/配送',
|
||||||
@@ -82,3 +99,13 @@ export interface PartnerLogRowDto {
|
|||||||
extraJson: Record<string, unknown> | null;
|
extraJson: Record<string, unknown> | null;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type PartnerAnalyticsExtra = {
|
||||||
|
sessionId?: string;
|
||||||
|
partnerAccountId?: string;
|
||||||
|
storeId?: string;
|
||||||
|
orderId?: string;
|
||||||
|
billId?: string;
|
||||||
|
cityCode?: string;
|
||||||
|
pagePath?: string;
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,13 +1,32 @@
|
|||||||
export type StoreLogCategory =
|
export type StoreLogCategory =
|
||||||
| 'login'
|
| 'login'
|
||||||
| 'wechat_auth'
|
| 'wechat_auth'
|
||||||
|
| 'page_view'
|
||||||
| 'redeem'
|
| 'redeem'
|
||||||
| 'payout'
|
| 'payout'
|
||||||
| 'store_ops';
|
| 'store_ops'
|
||||||
|
| 'package';
|
||||||
|
|
||||||
export const STORE_LOG_EVENT_CATEGORIES: Record<StoreLogCategory, readonly string[]> = {
|
export const STORE_LOG_EVENT_CATEGORIES: Record<StoreLogCategory, readonly string[]> = {
|
||||||
login: ['store_sms_send', 'store_sms_login', 'store_sms_verify_fail', 'store_login_success'],
|
login: [
|
||||||
|
'store_sms_send',
|
||||||
|
'store_sms_login',
|
||||||
|
'store_sms_verify_fail',
|
||||||
|
'store_login_success',
|
||||||
|
'store_select',
|
||||||
|
],
|
||||||
wechat_auth: ['store_wechat_login', 'store_wechat_bind'],
|
wechat_auth: ['store_wechat_login', 'store_wechat_bind'],
|
||||||
|
page_view: [
|
||||||
|
'store_home_view',
|
||||||
|
'store_redeem_entry_view',
|
||||||
|
'store_redeem_confirm_view',
|
||||||
|
'store_phone_redeem_view',
|
||||||
|
'store_records_view',
|
||||||
|
'store_withdraw_view',
|
||||||
|
'store_packages_view',
|
||||||
|
'store_mine_view',
|
||||||
|
'store_staff_view',
|
||||||
|
],
|
||||||
redeem: [
|
redeem: [
|
||||||
'store_redeem_preview',
|
'store_redeem_preview',
|
||||||
'store_redeem_confirm',
|
'store_redeem_confirm',
|
||||||
@@ -19,27 +38,39 @@ export const STORE_LOG_EVENT_CATEGORIES: Record<StoreLogCategory, readonly strin
|
|||||||
'store_redeem_phone_lookup_sms',
|
'store_redeem_phone_lookup_sms',
|
||||||
'store_redeem_phone_balance',
|
'store_redeem_phone_balance',
|
||||||
'store_redeem_phone_prepare',
|
'store_redeem_phone_prepare',
|
||||||
|
'store_redeem_scan_start',
|
||||||
],
|
],
|
||||||
payout: ['store_payout_created', 'store_payout_paid'],
|
payout: ['store_payout_created', 'store_payout_paid', 'store_withdraw_applied', 'store_withdraw_paid'],
|
||||||
store_ops: ['store_status_change'],
|
store_ops: [
|
||||||
|
'store_status_change',
|
||||||
|
'store_staff_create',
|
||||||
|
'store_staff_update',
|
||||||
|
'store_staff_delete',
|
||||||
|
'store_staff_permission_update',
|
||||||
|
],
|
||||||
|
package: ['store_package_apply', 'store_package_audit_view'],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const STORE_LOG_CATEGORY_OPTIONS: Array<{ value: StoreLogCategory | ''; label: string }> = [
|
export const STORE_LOG_CATEGORY_OPTIONS: Array<{ value: StoreLogCategory | ''; label: string }> = [
|
||||||
{ value: '', label: '全部' },
|
{ value: '', label: '全部' },
|
||||||
{ value: 'login', label: '登录' },
|
{ value: 'login', label: '登录' },
|
||||||
{ value: 'wechat_auth', label: '授权' },
|
{ value: 'wechat_auth', label: '授权' },
|
||||||
|
{ value: 'page_view', label: '页面浏览' },
|
||||||
{ value: 'redeem', label: '核销' },
|
{ value: 'redeem', label: '核销' },
|
||||||
{ value: 'payout', label: '提现/打款' },
|
{ value: 'payout', label: '提现/打款' },
|
||||||
{ value: 'store_ops', label: '门店操作' },
|
{ value: 'store_ops', label: '门店操作' },
|
||||||
|
{ value: 'package', label: '套餐' },
|
||||||
];
|
];
|
||||||
|
|
||||||
export const STORE_LOG_CATEGORY_LABELS: Record<StoreLogCategory | '', string> = {
|
export const STORE_LOG_CATEGORY_LABELS: Record<StoreLogCategory | '', string> = {
|
||||||
'': '全部',
|
'': '全部',
|
||||||
login: '登录',
|
login: '登录',
|
||||||
wechat_auth: '授权',
|
wechat_auth: '授权',
|
||||||
|
page_view: '页面浏览',
|
||||||
redeem: '核销',
|
redeem: '核销',
|
||||||
payout: '提现/打款',
|
payout: '提现/打款',
|
||||||
store_ops: '门店操作',
|
store_ops: '门店操作',
|
||||||
|
package: '套餐',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function resolveStoreLogCategory(eventName: string): StoreLogCategory | null {
|
export function resolveStoreLogCategory(eventName: string): StoreLogCategory | null {
|
||||||
@@ -72,3 +103,14 @@ export interface StoreLogRowDto {
|
|||||||
extraJson: Record<string, unknown> | null;
|
extraJson: Record<string, unknown> | null;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type StoreAnalyticsExtra = {
|
||||||
|
sessionId?: string;
|
||||||
|
storeId?: string;
|
||||||
|
storeAccountId?: string;
|
||||||
|
redeemChannel?: 'scan' | 'phone' | 'pending';
|
||||||
|
amount?: number;
|
||||||
|
failReason?: string;
|
||||||
|
durationMs?: number;
|
||||||
|
pagePath?: string;
|
||||||
|
};
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/** 门店套餐(v3.4.10) */
|
||||||
|
export interface StorePackageItemDto {
|
||||||
|
name: string;
|
||||||
|
price: string;
|
||||||
|
dishes: string;
|
||||||
|
usableTime?: string | null;
|
||||||
|
otherNotes?: string | null;
|
||||||
|
sortOrder: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StorePackageViewDto extends StorePackageItemDto {
|
||||||
|
id?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type StorePackageChangeStatus = 'PENDING' | 'APPROVED' | 'REJECTED';
|
||||||
|
|
||||||
|
export type StorePackageSubmitterType = 'PARTNER' | 'SHOP';
|
||||||
|
|
||||||
|
export const STORE_PACKAGE_CHANGE_STATUS_LABELS: Record<StorePackageChangeStatus, string> = {
|
||||||
|
PENDING: '审核中',
|
||||||
|
APPROVED: '已通过',
|
||||||
|
REJECTED: '已驳回',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const STORE_PACKAGE_MAX_COUNT = 10;
|
||||||
|
|
||||||
|
export interface StorePackagesResponse {
|
||||||
|
live: StorePackageViewDto[];
|
||||||
|
pendingRequest?: {
|
||||||
|
id: string;
|
||||||
|
status: StorePackageChangeStatus;
|
||||||
|
packages: StorePackageItemDto[];
|
||||||
|
rejectReason?: string | null;
|
||||||
|
createdAt: string;
|
||||||
|
} | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StorePackageChangeRequestDto {
|
||||||
|
id: string;
|
||||||
|
storeId: string;
|
||||||
|
storeName?: string;
|
||||||
|
status: StorePackageChangeStatus;
|
||||||
|
packages: StorePackageItemDto[];
|
||||||
|
submitterType: StorePackageSubmitterType;
|
||||||
|
submitterId: string;
|
||||||
|
rejectReason?: string | null;
|
||||||
|
reviewedAt?: string | null;
|
||||||
|
createdAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 套餐变更审核详情(含线上现行套餐,供对比) */
|
||||||
|
export interface StorePackageAuditDetailDto extends StorePackageChangeRequestDto {
|
||||||
|
livePackages: StorePackageViewDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StorePackageAuditAction {
|
||||||
|
action: 'APPROVE' | 'REJECT';
|
||||||
|
rejectReason?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreatePackageDisputeRequest {
|
||||||
|
storeId: string;
|
||||||
|
remark?: string;
|
||||||
|
redeemRecordId?: string;
|
||||||
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
/** 售后工单类型(PRD 四类型 + 系统 ALERT) */
|
/** 售后工单类型(PRD 四类型 + 系统 ALERT + 套餐异议) */
|
||||||
export type TicketTypeDto =
|
export type TicketTypeDto =
|
||||||
| 'REFUND'
|
| 'REFUND'
|
||||||
| 'RESHIPMENT'
|
| 'RESHIPMENT'
|
||||||
| 'ALERT'
|
| 'ALERT'
|
||||||
| 'DAMAGE_RETURN'
|
| 'DAMAGE_RETURN'
|
||||||
| 'RETURN_REFUND';
|
| 'RETURN_REFUND'
|
||||||
|
| 'PACKAGE_DISPUTE';
|
||||||
|
|
||||||
/** 用户可发起的售后类型 */
|
/** 用户可发起的售后类型 */
|
||||||
export const AFTER_SALE_TICKET_TYPES = [
|
export const AFTER_SALE_TICKET_TYPES = [
|
||||||
@@ -12,6 +13,7 @@ export const AFTER_SALE_TICKET_TYPES = [
|
|||||||
'RESHIPMENT',
|
'RESHIPMENT',
|
||||||
'DAMAGE_RETURN',
|
'DAMAGE_RETURN',
|
||||||
'RETURN_REFUND',
|
'RETURN_REFUND',
|
||||||
|
'PACKAGE_DISPUTE',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type AfterSaleTicketType = (typeof AFTER_SALE_TICKET_TYPES)[number];
|
export type AfterSaleTicketType = (typeof AFTER_SALE_TICKET_TYPES)[number];
|
||||||
@@ -22,6 +24,7 @@ export const TICKET_TYPE_LABELS: Record<TicketTypeDto, string> = {
|
|||||||
ALERT: '异常',
|
ALERT: '异常',
|
||||||
DAMAGE_RETURN: '破损退货',
|
DAMAGE_RETURN: '破损退货',
|
||||||
RETURN_REFUND: '退货退款',
|
RETURN_REFUND: '退货退款',
|
||||||
|
PACKAGE_DISPUTE: '套餐异议',
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface TicketDto {
|
export interface TicketDto {
|
||||||
|
|||||||
@@ -152,6 +152,8 @@ export type PartnerProxyOrderListItem = OrderDto & {
|
|||||||
deliveryType?: string | null;
|
deliveryType?: string | null;
|
||||||
productSpec?: string | null;
|
productSpec?: string | null;
|
||||||
imageResource?: { url?: string } | null;
|
imageResource?: { url?: string } | null;
|
||||||
|
/** 已锁定的支付方式(首次拉起支付后不可切换,须取消后重新下单) */
|
||||||
|
proxyPayMethod?: ProxyPayMethod | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PartnerProxyOrderListResponse = {
|
export type PartnerProxyOrderListResponse = {
|
||||||
|
|||||||
@@ -6,17 +6,39 @@ export type UserLogCategory =
|
|||||||
| 'wechat_auth'
|
| 'wechat_auth'
|
||||||
| 'browse_store'
|
| 'browse_store'
|
||||||
| 'redeem'
|
| 'redeem'
|
||||||
| 'profile';
|
| 'profile'
|
||||||
|
| 'promo'
|
||||||
|
| 'customer_service'
|
||||||
|
| 'after_sale'
|
||||||
|
| 'error';
|
||||||
|
|
||||||
export const USER_LOG_EVENT_CATEGORIES: Record<UserLogCategory, readonly string[]> = {
|
export const USER_LOG_EVENT_CATEGORIES: Record<UserLogCategory, readonly string[]> = {
|
||||||
login: ['login_success', 'sms_login', 'sms_send', 'sms_verify_fail'],
|
login: ['login_success', 'sms_login', 'sms_send', 'sms_verify_fail', 'session_start'],
|
||||||
browse_product: ['home_view', 'product_click', 'product_detail_view'],
|
browse_product: ['home_view', 'product_list_view', 'product_click', 'product_detail_view'],
|
||||||
order: ['order_confirm_view', 'order_submit'],
|
order: ['order_confirm_view', 'order_submit', 'order_list_view', 'order_detail_view', 'order_cancel'],
|
||||||
pay: ['pay_success', 'pay_fail'],
|
pay: ['pay_page_view', 'pay_success', 'pay_fail'],
|
||||||
wechat_auth: ['wechat_login', 'wechat_phone', 'wechat_location', 'wechat_album'],
|
wechat_auth: [
|
||||||
|
'wechat_login',
|
||||||
|
'wechat_phone',
|
||||||
|
'wechat_phone_login',
|
||||||
|
'wechat_location',
|
||||||
|
'wechat_album',
|
||||||
|
'wechat_bind',
|
||||||
|
],
|
||||||
browse_store: ['store_list_view', 'store_detail_view'],
|
browse_store: ['store_list_view', 'store_detail_view'],
|
||||||
redeem: ['benefit_redeem_start', 'benefit_redeem_success'],
|
redeem: [
|
||||||
profile: ['profile_update', 'bind_phone'],
|
'benefit_page_view',
|
||||||
|
'benefit_detail_view',
|
||||||
|
'benefit_redeem_start',
|
||||||
|
'benefit_redeem_success',
|
||||||
|
'redeem_code_view',
|
||||||
|
'redeem_success_view',
|
||||||
|
],
|
||||||
|
profile: ['profile_update', 'bind_phone', 'address_list_view', 'address_edit'],
|
||||||
|
promo: ['promo_touch', 'promo_share'],
|
||||||
|
customer_service: ['cs_contact'],
|
||||||
|
after_sale: ['after_sale_list_view', 'after_sale_apply'],
|
||||||
|
error: ['client_error'],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const USER_LOG_CATEGORY_OPTIONS: Array<{ value: UserLogCategory | ''; label: string }> = [
|
export const USER_LOG_CATEGORY_OPTIONS: Array<{ value: UserLogCategory | ''; label: string }> = [
|
||||||
@@ -29,6 +51,10 @@ export const USER_LOG_CATEGORY_OPTIONS: Array<{ value: UserLogCategory | ''; lab
|
|||||||
{ value: 'browse_store', label: '浏览门店' },
|
{ value: 'browse_store', label: '浏览门店' },
|
||||||
{ value: 'redeem', label: '核销' },
|
{ value: 'redeem', label: '核销' },
|
||||||
{ value: 'profile', label: '信息修改' },
|
{ value: 'profile', label: '信息修改' },
|
||||||
|
{ value: 'promo', label: '推广' },
|
||||||
|
{ value: 'customer_service', label: '客服' },
|
||||||
|
{ value: 'after_sale', label: '售后' },
|
||||||
|
{ value: 'error', label: '前端异常' },
|
||||||
];
|
];
|
||||||
|
|
||||||
export function resolveUserLogCategory(eventName: string): UserLogCategory | null {
|
export function resolveUserLogCategory(eventName: string): UserLogCategory | null {
|
||||||
@@ -59,3 +85,19 @@ export interface UserLogRowDto {
|
|||||||
extraJson: Record<string, unknown> | null;
|
extraJson: Record<string, unknown> | null;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** C 端埋点 extraJson 推荐字段(画像分析) */
|
||||||
|
export type UserAnalyticsExtra = {
|
||||||
|
sessionId?: string;
|
||||||
|
cityCode?: string;
|
||||||
|
productId?: string;
|
||||||
|
skuId?: string;
|
||||||
|
storeId?: string;
|
||||||
|
orderId?: string;
|
||||||
|
amount?: number;
|
||||||
|
quantity?: number;
|
||||||
|
sourceType?: string;
|
||||||
|
sourceRefId?: string;
|
||||||
|
failReason?: string;
|
||||||
|
pagePath?: string;
|
||||||
|
};
|
||||||
|
|||||||
@@ -21,6 +21,16 @@ export type WechatPayOrderResult =
|
|||||||
| { mode: 'mock'; externalNo: string; order?: Record<string, unknown> }
|
| { mode: 'mock'; externalNo: string; order?: Record<string, unknown> }
|
||||||
| { mode: 'jsapi'; prepay: WechatJsapiPrepayParams; orderId: string };
|
| { mode: 'jsapi'; prepay: WechatJsapiPrepayParams; orderId: string };
|
||||||
|
|
||||||
|
/** 微信退款回调解密结果 */
|
||||||
|
export type WechatRefundNotifyResult = {
|
||||||
|
outRefundNo: string;
|
||||||
|
refundId: string;
|
||||||
|
status: 'SUCCESS' | 'PROCESSING' | 'ABNORMAL' | 'CLOSED';
|
||||||
|
amountFen: number;
|
||||||
|
outTradeNo?: string;
|
||||||
|
transactionId?: string;
|
||||||
|
};
|
||||||
|
|
||||||
/** 业务错误码:微信支付前需完成微信授权 */
|
/** 业务错误码:微信支付前需完成微信授权 */
|
||||||
export const WECHAT_AUTH_REQUIRED = 'WECHAT_AUTH_REQUIRED';
|
export const WECHAT_AUTH_REQUIRED = 'WECHAT_AUTH_REQUIRED';
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ export const WECOM_BOT_PERMISSIONS = [
|
|||||||
'support_ticket.create',
|
'support_ticket.create',
|
||||||
'support_ticket.progress',
|
'support_ticket.progress',
|
||||||
'handbook.query',
|
'handbook.query',
|
||||||
|
'server_log.view',
|
||||||
|
'api.query',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type WecomBotPermission = (typeof WECOM_BOT_PERMISSIONS)[number];
|
export type WecomBotPermission = (typeof WECOM_BOT_PERMISSIONS)[number];
|
||||||
@@ -17,6 +19,8 @@ export const WECOM_BOT_PERMISSION_LABELS: Record<WecomBotPermission, string> = {
|
|||||||
'support_ticket.create': '创建技术支持工单',
|
'support_ticket.create': '创建技术支持工单',
|
||||||
'support_ticket.progress': '查看开发进度',
|
'support_ticket.progress': '查看开发进度',
|
||||||
'handbook.query': '查询使用手册',
|
'handbook.query': '查询使用手册',
|
||||||
|
'server_log.view': '查看服务器日志',
|
||||||
|
'api.query': '查询业务 API(只读)',
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 预置机器人角色(创建时可选;权限可按角色带出默认值后自定义) */
|
/** 预置机器人角色(创建时可选;权限可按角色带出默认值后自定义) */
|
||||||
@@ -38,7 +42,7 @@ export const WECOM_BOT_ROLE_LABELS: Record<WecomBotRole, string> = {
|
|||||||
|
|
||||||
export const WECOM_BOT_ROLE_DEFAULT_PERMISSIONS: Record<WecomBotRole, WecomBotPermission[]> = {
|
export const WECOM_BOT_ROLE_DEFAULT_PERMISSIONS: Record<WecomBotRole, WecomBotPermission[]> = {
|
||||||
CUSTOMER_SERVICE: ['ticket.create', 'user.view_sms', 'delivery.view'],
|
CUSTOMER_SERVICE: ['ticket.create', 'user.view_sms', 'delivery.view'],
|
||||||
TECH_SUPPORT: ['support_ticket.create', 'support_ticket.progress'],
|
TECH_SUPPORT: ['support_ticket.create', 'support_ticket.progress', 'server_log.view', 'api.query'],
|
||||||
TEAM_ASSISTANT: ['handbook.query'],
|
TEAM_ASSISTANT: ['handbook.query'],
|
||||||
CUSTOM: [],
|
CUSTOM: [],
|
||||||
};
|
};
|
||||||
|
|||||||
Generated
+292
@@ -72,6 +72,9 @@ importers:
|
|||||||
|
|
||||||
apps/h5-partner:
|
apps/h5-partner:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@dukang/client-logging':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../../packages/client-logging
|
||||||
'@dukang/shared-types':
|
'@dukang/shared-types':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../packages/shared-types
|
version: link:../../packages/shared-types
|
||||||
@@ -118,6 +121,9 @@ importers:
|
|||||||
|
|
||||||
apps/h5-shop:
|
apps/h5-shop:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@dukang/client-logging':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../../packages/client-logging
|
||||||
'@dukang/shared-types':
|
'@dukang/shared-types':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../packages/shared-types
|
version: link:../../packages/shared-types
|
||||||
@@ -155,6 +161,9 @@ importers:
|
|||||||
|
|
||||||
apps/h5-user:
|
apps/h5-user:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@dukang/client-logging':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../../packages/client-logging
|
||||||
'@dukang/shared-types':
|
'@dukang/shared-types':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../packages/shared-types
|
version: link:../../packages/shared-types
|
||||||
@@ -277,6 +286,9 @@ importers:
|
|||||||
'@babel/runtime':
|
'@babel/runtime':
|
||||||
specifier: ^7.24.4
|
specifier: ^7.24.4
|
||||||
version: 7.29.7
|
version: 7.29.7
|
||||||
|
'@dukang/client-logging':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../../packages/client-logging
|
||||||
'@dukang/shared-types':
|
'@dukang/shared-types':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../packages/shared-types
|
version: link:../../packages/shared-types
|
||||||
@@ -366,6 +378,12 @@ importers:
|
|||||||
specifier: ^5.4.0
|
specifier: ^5.4.0
|
||||||
version: 5.4.21(@types/node@22.20.0)(sass@1.101.0)(terser@5.48.0)
|
version: 5.4.21(@types/node@22.20.0)(sass@1.101.0)(terser@5.48.0)
|
||||||
|
|
||||||
|
packages/client-logging:
|
||||||
|
devDependencies:
|
||||||
|
typescript:
|
||||||
|
specifier: ^5.4.5
|
||||||
|
version: 5.9.3
|
||||||
|
|
||||||
packages/domain:
|
packages/domain:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
typescript:
|
typescript:
|
||||||
@@ -441,6 +459,9 @@ importers:
|
|||||||
'@prisma/client':
|
'@prisma/client':
|
||||||
specifier: ^5.18.0
|
specifier: ^5.18.0
|
||||||
version: 5.22.0(prisma@5.22.0)
|
version: 5.22.0(prisma@5.22.0)
|
||||||
|
'@sentry/node':
|
||||||
|
specifier: ^10.69.0
|
||||||
|
version: 10.69.0(@opentelemetry/core@2.10.0(@opentelemetry/api@1.9.1))
|
||||||
'@wecom/aibot-node-sdk':
|
'@wecom/aibot-node-sdk':
|
||||||
specifier: ^1.0.7
|
specifier: ^1.0.7
|
||||||
version: 1.0.7
|
version: 1.0.7
|
||||||
@@ -621,6 +642,17 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: '>=16.9.0'
|
react: '>=16.9.0'
|
||||||
|
|
||||||
|
'@apm-js-collab/code-transformer-bundler-plugins@0.7.3':
|
||||||
|
resolution: {integrity: sha512-qNbPwuMZ8f5ZuGj/ttPeB7a6C/S1bB6tNYaEL5vNiRKydSAxa4AU0gxCWgaP4fVju+AuwhcumSFjrEcGF9Dv7Q==}
|
||||||
|
engines: {node: '>=18.0.0'}
|
||||||
|
|
||||||
|
'@apm-js-collab/code-transformer@0.18.1':
|
||||||
|
resolution: {integrity: sha512-u1Hb6bHjWtkSpiprwVP6YaHC1DTN4RAU3zYkUDUe7WMnJwdyU1pwTL9dFKiSJB9IiLue/EQovmyx6xhU7FFtAQ==}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
|
'@apm-js-collab/tracing-hooks@0.13.0':
|
||||||
|
resolution: {integrity: sha512-mTvWz9rnQwx1U3h0XPTHaX7bgfkpipLLTQyjlC2cdhQpQEuoLT0AGzoydeoq2NxfEVv6fWOOETcSbb2nptleyw==}
|
||||||
|
|
||||||
'@babel/code-frame@7.29.7':
|
'@babel/code-frame@7.29.7':
|
||||||
resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==}
|
resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==}
|
||||||
engines: {node: '>=6.9.0'}
|
engines: {node: '>=6.9.0'}
|
||||||
@@ -1680,6 +1712,48 @@ packages:
|
|||||||
engines: {node: '>=8.0.0', npm: '>=5.0.0'}
|
engines: {node: '>=8.0.0', npm: '>=5.0.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
'@opentelemetry/api-logs@0.220.0':
|
||||||
|
resolution: {integrity: sha512-CmVa4ImJ+ynfrPMNaAXHET6Bhb44SwzmfyVJFq9ni2jgXJR/l7C6gfVFddNmHP+ZOkP9cf4f9DBe68qVLTHc9w==}
|
||||||
|
engines: {node: '>=8.0.0'}
|
||||||
|
|
||||||
|
'@opentelemetry/api@1.9.1':
|
||||||
|
resolution: {integrity: sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q==}
|
||||||
|
engines: {node: '>=8.0.0'}
|
||||||
|
|
||||||
|
'@opentelemetry/core@2.10.0':
|
||||||
|
resolution: {integrity: sha512-/wNZ8twnEQQA4HoHu22+vcsdru6pWPWxW+7w+FlxT6Id7PE/WIbZmVKkte+PF72e0F2dnImFeHD2syyE1Mw6MQ==}
|
||||||
|
engines: {node: ^18.19.0 || >=20.6.0}
|
||||||
|
peerDependencies:
|
||||||
|
'@opentelemetry/api': '>=1.0.0 <1.10.0'
|
||||||
|
|
||||||
|
'@opentelemetry/instrumentation@0.220.0':
|
||||||
|
resolution: {integrity: sha512-xQx3E2WxP1mDvKzxLxX+CTCtNLa560YJZ3087qYHerl2YmiKpv7AH+dAy7vmx+eVrZ5BwhfWUAVoKOoxCNHcpw==}
|
||||||
|
engines: {node: ^18.19.0 || >=20.6.0}
|
||||||
|
peerDependencies:
|
||||||
|
'@opentelemetry/api': ^1.3.0
|
||||||
|
|
||||||
|
'@opentelemetry/resources@2.10.0':
|
||||||
|
resolution: {integrity: sha512-q6MMm2zhggzsHVNbabYwut+a6nbuQQe3URUoxaojM/8K1IBfwwPzvxIjNi2/lI1TFe+fMHMW9MWhrtDLEXEnkA==}
|
||||||
|
engines: {node: ^18.19.0 || >=20.6.0}
|
||||||
|
peerDependencies:
|
||||||
|
'@opentelemetry/api': '>=1.3.0 <1.10.0'
|
||||||
|
|
||||||
|
'@opentelemetry/sdk-trace-base@2.10.0':
|
||||||
|
resolution: {integrity: sha512-GuYQQT7QD2EeO8lcZLRQzcbOyhqAzL+6WWTKTU9mSUBYBazkEDl+VrQcXQhbB08OWM9anD1aHleVadzulpOaUQ==}
|
||||||
|
engines: {node: ^18.19.0 || >=20.6.0}
|
||||||
|
peerDependencies:
|
||||||
|
'@opentelemetry/api': '>=1.3.0 <1.10.0'
|
||||||
|
|
||||||
|
'@opentelemetry/sdk-trace@2.10.0':
|
||||||
|
resolution: {integrity: sha512-MfQGq3GRmTh5fM/y+OjaO0vj6+luCB1XO2gfXCalKCfgKw0eHL++sm75DNweC6ohlp+aFvACqeE0fYayqdRaoQ==}
|
||||||
|
engines: {node: ^18.19.0 || >=20.6.0}
|
||||||
|
peerDependencies:
|
||||||
|
'@opentelemetry/api': '>=1.3.0 <1.10.0'
|
||||||
|
|
||||||
|
'@opentelemetry/semantic-conventions@1.43.0':
|
||||||
|
resolution: {integrity: sha512-eSYWTm620tTk45EKSedaUL8MFYI8hW164hIXsgIHyxu3VobUB3fFCu5t0hQby6OoWRPsG1KkKUG2M5UadiLiVg==}
|
||||||
|
engines: {node: '>=14'}
|
||||||
|
|
||||||
'@parcel/watcher-android-arm64@2.5.6':
|
'@parcel/watcher-android-arm64@2.5.6':
|
||||||
resolution: {integrity: sha512-YQxSS34tPF/6ZG7r/Ih9xy+kP/WwediEUsqmtf0cuCV5TPPKw/PQHRhueUo6JdeFJaqV3pyjm0GdYjZotbRt/A==}
|
resolution: {integrity: sha512-YQxSS34tPF/6ZG7r/Ih9xy+kP/WwediEUsqmtf0cuCV5TPPKw/PQHRhueUo6JdeFJaqV3pyjm0GdYjZotbRt/A==}
|
||||||
engines: {node: '>= 10.0.0'}
|
engines: {node: '>= 10.0.0'}
|
||||||
@@ -2055,6 +2129,51 @@ packages:
|
|||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
|
'@sentry/conventions@0.16.0':
|
||||||
|
resolution: {integrity: sha512-fO9PLmHdVURcSPUpWCItWAtgKiMwGdJHbovoSEyLplX5sxs2ugvI4CBPTrkkgqhObnZOD0CnWBKDzSVQYBKEyQ==}
|
||||||
|
engines: {node: '>=14'}
|
||||||
|
|
||||||
|
'@sentry/core@10.69.0':
|
||||||
|
resolution: {integrity: sha512-+uuqVEeiDzYuAKjZLqsROKXvRTbl/QeH0gfGRtpYib1cud4rAFWRIkFmcR7Jb7JGFYwmReyQotiTj/hcDszTZg==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
|
'@sentry/node-core@10.69.0':
|
||||||
|
resolution: {integrity: sha512-IgArHczrZJxkgxoffHscj0NxQrG6kCazgmGQnlf3j58J1ec21YaUu8Tu+7G4Lo5tCiW3teQnwlKW1ttMXSqWRw==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
peerDependencies:
|
||||||
|
'@opentelemetry/api': ^1.9.0
|
||||||
|
'@opentelemetry/core': ^1.30.1 || ^2.1.0
|
||||||
|
'@opentelemetry/exporter-trace-otlp-http': '>=0.57.0 <1'
|
||||||
|
'@opentelemetry/instrumentation': '>=0.57.1 <1'
|
||||||
|
'@opentelemetry/sdk-trace-base': ^1.30.1 || ^2.1.0
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@opentelemetry/api':
|
||||||
|
optional: true
|
||||||
|
'@opentelemetry/core':
|
||||||
|
optional: true
|
||||||
|
'@opentelemetry/exporter-trace-otlp-http':
|
||||||
|
optional: true
|
||||||
|
'@opentelemetry/instrumentation':
|
||||||
|
optional: true
|
||||||
|
'@opentelemetry/sdk-trace-base':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@sentry/node@10.69.0':
|
||||||
|
resolution: {integrity: sha512-xEXA1YGIiTZbrW6MWV34uS6JGQuQg2ijTI0zed+FsJb9JZKPYel/GZK8Km26vfTVb+yCXFmWZNBesKegNcVdzg==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
|
'@sentry/opentelemetry@10.69.0':
|
||||||
|
resolution: {integrity: sha512-3FyWV6YcEJuvLrlaKGE1dHXCI+1YO0a62w7PkwlRg8yp6K6YXkmdwu9GjqaYD+Ju4tm7uC7mHIsGFQMm0M7pqQ==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
peerDependencies:
|
||||||
|
'@opentelemetry/api': ^1.9.0
|
||||||
|
'@opentelemetry/core': ^1.30.1 || ^2.1.0
|
||||||
|
'@opentelemetry/sdk-trace-base': ^1.30.1 || ^2.1.0
|
||||||
|
|
||||||
|
'@sentry/server-utils@10.69.0':
|
||||||
|
resolution: {integrity: sha512-0MwHrA8+nNvMIsqf8m3cXwCBlUjr6AS7N6CZvHJtY1DkqEvQqEbD5VIrhzEyHN/KMZIgQ8XeDCQRhjnXFQGRhg==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
'@sideway/address@4.1.5':
|
'@sideway/address@4.1.5':
|
||||||
resolution: {integrity: sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q==}
|
resolution: {integrity: sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q==}
|
||||||
|
|
||||||
@@ -2941,6 +3060,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==}
|
resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
|
astring@1.9.0:
|
||||||
|
resolution: {integrity: sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
asynckit@0.4.0:
|
asynckit@0.4.0:
|
||||||
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
|
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
|
||||||
|
|
||||||
@@ -3208,6 +3331,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==}
|
resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==}
|
||||||
engines: {node: '>=6.0'}
|
engines: {node: '>=6.0'}
|
||||||
|
|
||||||
|
cjs-module-lexer@2.2.0:
|
||||||
|
resolution: {integrity: sha512-4bHTS2YuzUvtoLjdy+98ykbNB5jS0+07EvFNXerqZQJ89F7DI6ET7OQo/HJuW6K0aVsKA9hj9/RVb2kQVOrPDQ==}
|
||||||
|
|
||||||
class-transformer@0.5.1:
|
class-transformer@0.5.1:
|
||||||
resolution: {integrity: sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==}
|
resolution: {integrity: sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==}
|
||||||
|
|
||||||
@@ -3389,6 +3515,7 @@ packages:
|
|||||||
cron-parser@4.9.0:
|
cron-parser@4.9.0:
|
||||||
resolution: {integrity: sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q==}
|
resolution: {integrity: sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q==}
|
||||||
engines: {node: '>=12.0.0'}
|
engines: {node: '>=12.0.0'}
|
||||||
|
deprecated: v4 is no longer maintained, upgrade to v5
|
||||||
|
|
||||||
cron@4.4.0:
|
cron@4.4.0:
|
||||||
resolution: {integrity: sha512-fkdfq+b+AHI4cKdhZlppHveI/mgz2qpiYxcm+t5E5TsxX7QrLS1VE0+7GENEk9z0EeGPcpSciGv6ez24duWhwQ==}
|
resolution: {integrity: sha512-fkdfq+b+AHI4cKdhZlppHveI/mgz2qpiYxcm+t5E5TsxX7QrLS1VE0+7GENEk9z0EeGPcpSciGv6ez24duWhwQ==}
|
||||||
@@ -3653,6 +3780,9 @@ packages:
|
|||||||
es-module-lexer@1.7.0:
|
es-module-lexer@1.7.0:
|
||||||
resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==}
|
resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==}
|
||||||
|
|
||||||
|
es-module-lexer@2.3.1:
|
||||||
|
resolution: {integrity: sha512-shc1dbU90Yl/xq1QrC7QRtfcwURZuVRfPhZbDoldJ1cn1gzDvBaBWlv0eFolj5+0znnPJz5TXLxsN77X/12KTA==}
|
||||||
|
|
||||||
es-object-atoms@1.1.2:
|
es-object-atoms@1.1.2:
|
||||||
resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==}
|
resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
@@ -4264,6 +4394,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==}
|
resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
|
|
||||||
|
import-in-the-middle@3.3.3:
|
||||||
|
resolution: {integrity: sha512-AiohS3H80sXO6owEltjGX+glb7qXaDhBoJb9XcQVH4UI207xu/bDLUcadVKp7Qe576reg9yr/PXZjV5qx8gfbA==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
imurmurhash@0.1.4:
|
imurmurhash@0.1.4:
|
||||||
resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}
|
resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}
|
||||||
engines: {node: '>=0.8.19'}
|
engines: {node: '>=0.8.19'}
|
||||||
@@ -4714,6 +4848,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
|
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
|
||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
|
|
||||||
|
meriyah@6.1.4:
|
||||||
|
resolution: {integrity: sha512-Sz8FzjzI0kN13GK/6MVEsVzMZEPvOhnmmI1lU5+/1cGOiK3QUahntrNNtdVeihrO7t9JpoH75iMNXg6R6uWflQ==}
|
||||||
|
engines: {node: '>=18.0.0'}
|
||||||
|
|
||||||
methods@1.1.2:
|
methods@1.1.2:
|
||||||
resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==}
|
resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==}
|
||||||
engines: {node: '>= 0.6'}
|
engines: {node: '>= 0.6'}
|
||||||
@@ -4784,6 +4922,9 @@ packages:
|
|||||||
mobile-detect@1.4.5:
|
mobile-detect@1.4.5:
|
||||||
resolution: {integrity: sha512-yc0LhH6tItlvfLBugVUEtgawwFU2sIe+cSdmRJJCTMZ5GEJyLxNyC/NIOAOGk67Fa8GNpOttO3Xz/1bHpXFD/g==}
|
resolution: {integrity: sha512-yc0LhH6tItlvfLBugVUEtgawwFU2sIe+cSdmRJJCTMZ5GEJyLxNyC/NIOAOGk67Fa8GNpOttO3Xz/1bHpXFD/g==}
|
||||||
|
|
||||||
|
module-details-from-path@1.0.4:
|
||||||
|
resolution: {integrity: sha512-EGWKgxALGMgzvxYF1UyGTy0HXX/2vHLkw6+NvDKW2jypWbHpjQuj4UMcqQWXHERJhVGKikolT06G3bcKe4fi7w==}
|
||||||
|
|
||||||
moment-timezone@0.5.48:
|
moment-timezone@0.5.48:
|
||||||
resolution: {integrity: sha512-f22b8LV1gbTO2ms2j2z13MuPogNoh5UzxL3nzNAYKGraILnbGc9NEE6dyiiiLv46DGRb8A4kg8UKWLjPthxBHw==}
|
resolution: {integrity: sha512-f22b8LV1gbTO2ms2j2z13MuPogNoh5UzxL3nzNAYKGraILnbGc9NEE6dyiiiLv46DGRb8A4kg8UKWLjPthxBHw==}
|
||||||
|
|
||||||
@@ -5657,6 +5798,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
|
resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
|
|
||||||
|
require-in-the-middle@8.0.1:
|
||||||
|
resolution: {integrity: sha512-QT7FVMXfWOYFbeRBF6nu+I6tr2Tf3u0q8RIEjNob/heKY/nh7drD/k7eeMFmSQgnTtCzLDcCu/XEnpW2wk4xCQ==}
|
||||||
|
engines: {node: '>=9.3.0 || >=8.10.0 <9.0.0'}
|
||||||
|
|
||||||
require-main-filename@2.0.0:
|
require-main-filename@2.0.0:
|
||||||
resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==}
|
resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==}
|
||||||
|
|
||||||
@@ -5771,6 +5916,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==}
|
resolution: {integrity: sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
semifies@1.0.0:
|
||||||
|
resolution: {integrity: sha512-xXR3KGeoxTNWPD4aBvL5NUpMTT7WMANr3EWnaS190QVkY52lqqcVRD7Q05UVbBhiWDGWMlJEUam9m7uFFGVScw==}
|
||||||
|
|
||||||
semver@5.7.2:
|
semver@5.7.2:
|
||||||
resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==}
|
resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@@ -6855,6 +7003,30 @@ snapshots:
|
|||||||
resize-observer-polyfill: 1.5.1
|
resize-observer-polyfill: 1.5.1
|
||||||
throttle-debounce: 5.0.2
|
throttle-debounce: 5.0.2
|
||||||
|
|
||||||
|
'@apm-js-collab/code-transformer-bundler-plugins@0.7.3':
|
||||||
|
dependencies:
|
||||||
|
'@apm-js-collab/code-transformer': 0.18.1
|
||||||
|
es-module-lexer: 2.3.1
|
||||||
|
magic-string: 0.30.21
|
||||||
|
module-details-from-path: 1.0.4
|
||||||
|
|
||||||
|
'@apm-js-collab/code-transformer@0.18.1':
|
||||||
|
dependencies:
|
||||||
|
'@types/estree': 1.0.9
|
||||||
|
astring: 1.9.0
|
||||||
|
esquery: 1.7.0
|
||||||
|
meriyah: 6.1.4
|
||||||
|
semifies: 1.0.0
|
||||||
|
source-map: 0.6.1
|
||||||
|
|
||||||
|
'@apm-js-collab/tracing-hooks@0.13.0':
|
||||||
|
dependencies:
|
||||||
|
'@apm-js-collab/code-transformer': 0.18.1
|
||||||
|
debug: 4.4.3
|
||||||
|
module-details-from-path: 1.0.4
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
'@babel/code-frame@7.29.7':
|
'@babel/code-frame@7.29.7':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/helper-validator-identifier': 7.29.7
|
'@babel/helper-validator-identifier': 7.29.7
|
||||||
@@ -8095,6 +8267,49 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- encoding
|
- encoding
|
||||||
|
|
||||||
|
'@opentelemetry/api-logs@0.220.0':
|
||||||
|
dependencies:
|
||||||
|
'@opentelemetry/api': 1.9.1
|
||||||
|
|
||||||
|
'@opentelemetry/api@1.9.1': {}
|
||||||
|
|
||||||
|
'@opentelemetry/core@2.10.0(@opentelemetry/api@1.9.1)':
|
||||||
|
dependencies:
|
||||||
|
'@opentelemetry/api': 1.9.1
|
||||||
|
'@opentelemetry/semantic-conventions': 1.43.0
|
||||||
|
|
||||||
|
'@opentelemetry/instrumentation@0.220.0(@opentelemetry/api@1.9.1)':
|
||||||
|
dependencies:
|
||||||
|
'@opentelemetry/api': 1.9.1
|
||||||
|
'@opentelemetry/api-logs': 0.220.0
|
||||||
|
import-in-the-middle: 3.3.3
|
||||||
|
require-in-the-middle: 8.0.1
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
|
'@opentelemetry/resources@2.10.0(@opentelemetry/api@1.9.1)':
|
||||||
|
dependencies:
|
||||||
|
'@opentelemetry/api': 1.9.1
|
||||||
|
'@opentelemetry/core': 2.10.0(@opentelemetry/api@1.9.1)
|
||||||
|
'@opentelemetry/semantic-conventions': 1.43.0
|
||||||
|
|
||||||
|
'@opentelemetry/sdk-trace-base@2.10.0(@opentelemetry/api@1.9.1)':
|
||||||
|
dependencies:
|
||||||
|
'@opentelemetry/api': 1.9.1
|
||||||
|
'@opentelemetry/core': 2.10.0(@opentelemetry/api@1.9.1)
|
||||||
|
'@opentelemetry/resources': 2.10.0(@opentelemetry/api@1.9.1)
|
||||||
|
'@opentelemetry/sdk-trace': 2.10.0(@opentelemetry/api@1.9.1)
|
||||||
|
'@opentelemetry/semantic-conventions': 1.43.0
|
||||||
|
|
||||||
|
'@opentelemetry/sdk-trace@2.10.0(@opentelemetry/api@1.9.1)':
|
||||||
|
dependencies:
|
||||||
|
'@opentelemetry/api': 1.9.1
|
||||||
|
'@opentelemetry/core': 2.10.0(@opentelemetry/api@1.9.1)
|
||||||
|
'@opentelemetry/resources': 2.10.0(@opentelemetry/api@1.9.1)
|
||||||
|
'@opentelemetry/semantic-conventions': 1.43.0
|
||||||
|
|
||||||
|
'@opentelemetry/semantic-conventions@1.43.0': {}
|
||||||
|
|
||||||
'@parcel/watcher-android-arm64@2.5.6':
|
'@parcel/watcher-android-arm64@2.5.6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
@@ -8378,6 +8593,58 @@ snapshots:
|
|||||||
'@rollup/rollup-win32-x64-msvc@4.62.2':
|
'@rollup/rollup-win32-x64-msvc@4.62.2':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
'@sentry/conventions@0.16.0': {}
|
||||||
|
|
||||||
|
'@sentry/core@10.69.0':
|
||||||
|
dependencies:
|
||||||
|
'@sentry/conventions': 0.16.0
|
||||||
|
|
||||||
|
'@sentry/node-core@10.69.0(@opentelemetry/api@1.9.1)(@opentelemetry/core@2.10.0(@opentelemetry/api@1.9.1))(@opentelemetry/instrumentation@0.220.0(@opentelemetry/api@1.9.1))(@opentelemetry/sdk-trace-base@2.10.0(@opentelemetry/api@1.9.1))':
|
||||||
|
dependencies:
|
||||||
|
'@sentry/conventions': 0.16.0
|
||||||
|
'@sentry/core': 10.69.0
|
||||||
|
'@sentry/opentelemetry': 10.69.0(@opentelemetry/api@1.9.1)(@opentelemetry/core@2.10.0(@opentelemetry/api@1.9.1))(@opentelemetry/sdk-trace-base@2.10.0(@opentelemetry/api@1.9.1))
|
||||||
|
import-in-the-middle: 3.3.3
|
||||||
|
optionalDependencies:
|
||||||
|
'@opentelemetry/api': 1.9.1
|
||||||
|
'@opentelemetry/core': 2.10.0(@opentelemetry/api@1.9.1)
|
||||||
|
'@opentelemetry/instrumentation': 0.220.0(@opentelemetry/api@1.9.1)
|
||||||
|
'@opentelemetry/sdk-trace-base': 2.10.0(@opentelemetry/api@1.9.1)
|
||||||
|
|
||||||
|
'@sentry/node@10.69.0(@opentelemetry/core@2.10.0(@opentelemetry/api@1.9.1))':
|
||||||
|
dependencies:
|
||||||
|
'@opentelemetry/api': 1.9.1
|
||||||
|
'@opentelemetry/instrumentation': 0.220.0(@opentelemetry/api@1.9.1)
|
||||||
|
'@opentelemetry/sdk-trace-base': 2.10.0(@opentelemetry/api@1.9.1)
|
||||||
|
'@sentry/conventions': 0.16.0
|
||||||
|
'@sentry/core': 10.69.0
|
||||||
|
'@sentry/node-core': 10.69.0(@opentelemetry/api@1.9.1)(@opentelemetry/core@2.10.0(@opentelemetry/api@1.9.1))(@opentelemetry/instrumentation@0.220.0(@opentelemetry/api@1.9.1))(@opentelemetry/sdk-trace-base@2.10.0(@opentelemetry/api@1.9.1))
|
||||||
|
'@sentry/opentelemetry': 10.69.0(@opentelemetry/api@1.9.1)(@opentelemetry/core@2.10.0(@opentelemetry/api@1.9.1))(@opentelemetry/sdk-trace-base@2.10.0(@opentelemetry/api@1.9.1))
|
||||||
|
'@sentry/server-utils': 10.69.0
|
||||||
|
import-in-the-middle: 3.3.3
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- '@opentelemetry/core'
|
||||||
|
- '@opentelemetry/exporter-trace-otlp-http'
|
||||||
|
- supports-color
|
||||||
|
|
||||||
|
'@sentry/opentelemetry@10.69.0(@opentelemetry/api@1.9.1)(@opentelemetry/core@2.10.0(@opentelemetry/api@1.9.1))(@opentelemetry/sdk-trace-base@2.10.0(@opentelemetry/api@1.9.1))':
|
||||||
|
dependencies:
|
||||||
|
'@opentelemetry/api': 1.9.1
|
||||||
|
'@opentelemetry/core': 2.10.0(@opentelemetry/api@1.9.1)
|
||||||
|
'@opentelemetry/sdk-trace-base': 2.10.0(@opentelemetry/api@1.9.1)
|
||||||
|
'@sentry/conventions': 0.16.0
|
||||||
|
'@sentry/core': 10.69.0
|
||||||
|
|
||||||
|
'@sentry/server-utils@10.69.0':
|
||||||
|
dependencies:
|
||||||
|
'@apm-js-collab/code-transformer-bundler-plugins': 0.7.3
|
||||||
|
'@apm-js-collab/tracing-hooks': 0.13.0
|
||||||
|
'@sentry/conventions': 0.16.0
|
||||||
|
'@sentry/core': 10.69.0
|
||||||
|
meriyah: 6.1.4
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
'@sideway/address@4.1.5':
|
'@sideway/address@4.1.5':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@hapi/hoek': 9.3.0
|
'@hapi/hoek': 9.3.0
|
||||||
@@ -9629,6 +9896,8 @@ snapshots:
|
|||||||
|
|
||||||
astral-regex@2.0.0: {}
|
astral-regex@2.0.0: {}
|
||||||
|
|
||||||
|
astring@1.9.0: {}
|
||||||
|
|
||||||
asynckit@0.4.0: {}
|
asynckit@0.4.0: {}
|
||||||
|
|
||||||
autoprefixer@10.5.2(postcss@8.5.15):
|
autoprefixer@10.5.2(postcss@8.5.15):
|
||||||
@@ -9988,6 +10257,8 @@ snapshots:
|
|||||||
|
|
||||||
chrome-trace-event@1.0.4: {}
|
chrome-trace-event@1.0.4: {}
|
||||||
|
|
||||||
|
cjs-module-lexer@2.2.0: {}
|
||||||
|
|
||||||
class-transformer@0.5.1: {}
|
class-transformer@0.5.1: {}
|
||||||
|
|
||||||
class-validator@0.14.4:
|
class-validator@0.14.4:
|
||||||
@@ -10414,6 +10685,8 @@ snapshots:
|
|||||||
|
|
||||||
es-module-lexer@1.7.0: {}
|
es-module-lexer@1.7.0: {}
|
||||||
|
|
||||||
|
es-module-lexer@2.3.1: {}
|
||||||
|
|
||||||
es-object-atoms@1.1.2:
|
es-object-atoms@1.1.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
es-errors: 1.3.0
|
es-errors: 1.3.0
|
||||||
@@ -11183,6 +11456,12 @@ snapshots:
|
|||||||
parent-module: 1.0.1
|
parent-module: 1.0.1
|
||||||
resolve-from: 4.0.0
|
resolve-from: 4.0.0
|
||||||
|
|
||||||
|
import-in-the-middle@3.3.3:
|
||||||
|
dependencies:
|
||||||
|
cjs-module-lexer: 2.2.0
|
||||||
|
es-module-lexer: 2.3.1
|
||||||
|
module-details-from-path: 1.0.4
|
||||||
|
|
||||||
imurmurhash@0.1.4: {}
|
imurmurhash@0.1.4: {}
|
||||||
|
|
||||||
inflight@1.0.6:
|
inflight@1.0.6:
|
||||||
@@ -11609,6 +11888,8 @@ snapshots:
|
|||||||
|
|
||||||
merge2@1.4.1: {}
|
merge2@1.4.1: {}
|
||||||
|
|
||||||
|
meriyah@6.1.4: {}
|
||||||
|
|
||||||
methods@1.1.2: {}
|
methods@1.1.2: {}
|
||||||
|
|
||||||
micromatch@4.0.8:
|
micromatch@4.0.8:
|
||||||
@@ -11663,6 +11944,8 @@ snapshots:
|
|||||||
|
|
||||||
mobile-detect@1.4.5: {}
|
mobile-detect@1.4.5: {}
|
||||||
|
|
||||||
|
module-details-from-path@1.0.4: {}
|
||||||
|
|
||||||
moment-timezone@0.5.48:
|
moment-timezone@0.5.48:
|
||||||
dependencies:
|
dependencies:
|
||||||
moment: 2.30.1
|
moment: 2.30.1
|
||||||
@@ -12589,6 +12872,13 @@ snapshots:
|
|||||||
|
|
||||||
require-from-string@2.0.2: {}
|
require-from-string@2.0.2: {}
|
||||||
|
|
||||||
|
require-in-the-middle@8.0.1:
|
||||||
|
dependencies:
|
||||||
|
debug: 4.4.3
|
||||||
|
module-details-from-path: 1.0.4
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
require-main-filename@2.0.0: {}
|
require-main-filename@2.0.0: {}
|
||||||
|
|
||||||
resize-observer-polyfill@1.5.1: {}
|
resize-observer-polyfill@1.5.1: {}
|
||||||
@@ -12742,6 +13032,8 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
commander: 2.20.3
|
commander: 2.20.3
|
||||||
|
|
||||||
|
semifies@1.0.0: {}
|
||||||
|
|
||||||
semver@5.7.2: {}
|
semver@5.7.2: {}
|
||||||
|
|
||||||
semver@6.3.1: {}
|
semver@6.3.1: {}
|
||||||
|
|||||||
@@ -248,6 +248,12 @@ async function main() {
|
|||||||
token: admin.accessToken,
|
token: admin.accessToken,
|
||||||
body: JSON.stringify({}),
|
body: JSON.stringify({}),
|
||||||
});
|
});
|
||||||
|
const refundedOrder = await req('USER_H5', `/trade/orders/${order2.id}`, { token: userToken });
|
||||||
|
if (refundedOrder.status !== 'REFUNDED' || refundedOrder.payStatus !== 'REFUNDED') {
|
||||||
|
throw new Error(
|
||||||
|
`Refund order status expected REFUNDED/REFUNDED, got ${refundedOrder.status}/${refundedOrder.payStatus}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
console.log('11. Partner phone gate');
|
console.log('11. Partner phone gate');
|
||||||
const unknownPartner = await expectFail('PARTNER_H5', '/partner/auth/phone/check', {
|
const unknownPartner = await expectFail('PARTNER_H5', '/partner/auth/phone/check', {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user